[antlr-interest] Matching braces in grammar
Jukkis
evangelion at luukku.com
Mon May 21 04:05:04 PDT 2007
Hello all ANTLR fans!
I'm developing a small language with ANTLR. One feature is that my language can have BeanShell code written into the language in special BeanShell blocks.
Currently, I have a special kind of statement which takes the BeanShell code (which is essentially Java):
${"print(\"Hey, I'm BeanShell code\");"}
defined in my grammar as:
beanshell_statement
: "$" LCURLY! STRING_LITERAL RCURLY!
;
The problem is that BeanShell code may contain the symbol '}' which I use to terminate the statement. Currently, I use STRING_LITERAL to work around this fact.
Now, what I would want is that there would be no need to write the BeanShell code inside a string. How can I make ANTLR understand that it would consider any curlys found INSIDE the MATCHING '{' ... '}' pair as just ordinary text?
Thank you very much for any advice!
...................................................................
Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku
More information about the antlr-interest
mailing list