[antlr-interest] antlr 3 woe

fhaupt at informatik.uni-wuerzburg.de fhaupt at informatik.uni-wuerzburg.de
Mon Dec 4 17:02:00 PST 2006


Hi,

> the `fragment` keyword establishes a Token which is a fragment, e.g. a
> portion of, another Token.
> 
thats how I understood it. In most of the cases my keywords could also be matched by STRING.

> fragment Tokens may not be referenced by parser rules, but ANTLRv3
> currently does not check for that mis-use (there is a bug report about
> this).
Ahh, thanks a lot.

> 
> you need to re-work your lexer rules so that Tokens that the parser needs
> to see are not created by fragment rules.
I'm over it....

> 
> as for using % in rules. I believe that % inside an antlr string,
> e.g. '...%...'  works just fine without any special escape. But a %
> anywhere inside an action code fragment, e.g. {...%...} should be escaped
> as \%.  So { System.out.printf("%s%n",x); } should be written as
> { System.out.printf("\%s\%n",x); } // java 1.5.
> 
> Hope this helps...
>    -jbb
> 


Yes it does, 
thanks alot 

fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20061205/cea150eb/attachment.bin 


More information about the antlr-interest mailing list