At 08:11 2/11/2008, Ben Gillis wrote:
 >However, the grammar compiler pukes when I try to define 
keywords
 >with a special sign, such as the dollar sign.
[...]
 >   ...
 >    _keywordDictionary.Add("$SOMETHING", DOLLAR_SOMETHING);
 >   ...
 >}
 >
 >I get the following org.antlr.Tool on the grammar file:
 >
 >error(111): MyGrammar.g:26:1: reference to attribute outside of 
a
 >rule:
 >SOMETHING
[...]
 >That leads me to believe ANTLR is somehow detecting the dollar 
sign
 >and using it as some metasymbol.
 >I thought the code snippets I put in the members block is put 
out
 >"as-is" like the ANTLR book tells me.

Mostly, but it does look for a couple of special characters for 
use with StringTemplate and for ANTLR's own attribute replacement 
(which is why you can refer to $foo.text in a rule action).

You can escape these by using \$ instead.


Also: please remember to use your Reply to All button when 
replying to messages on the ANTLR list, in order to keep responses 
on the list.


List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to