[
https://issues.apache.org/jira/browse/GROOVY-223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15051263#comment-15051263
]
Angelo Schneider commented on GROOVY-223:
-----------------------------------------
What would suggest is importing a class, with an appropriated annotation.
E.g. @QuoteParser(qt='`')
import my.custom.BackticParser // name is arbitrary, the annotation does the
trick
Now if the groovy parser stumbles over a set of quotes we could agree on, it
checks if there is an appropriated 'parser' imported and handles text in
matching quotes to that parse.
Examples could be a DateParser or anything special in DSLs.
I agree special treatment for back tics in shell execution makes no sense, but
if you could just import tic parsers as you wish, perhaps even 'bracket
parsers' that handle stuff surrounded by e.g. '<<' and '>>' that would be cool.
Consider that this:
<< stereotype >>
can not be expressed with operator overloading.
> support `command arguments` notation (backticks) for executing scripts
> ----------------------------------------------------------------------
>
> Key: GROOVY-223
> URL: https://issues.apache.org/jira/browse/GROOVY-223
> Project: Groovy
> Issue Type: Improvement
> Components: parser
> Reporter: james strachan
>
> We should support `cmd` to be syntax sugar for this...
> "cmd".execute()
> which returns an instance of java.lang.Process. In addition if this
> expression is used within a String it should make a GString which extracts
> the output of the command in the middle of the string.
> e.g.
> println "blah `command` blah"
> it should behave like
> println "blah ${`command`.text} blah"
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)