[antlr-interest] Difference between negative literal and negative fragment ?
Pururav Thoutireddy
pururav at gmail.com
Fri Jan 20 13:43:12 PST 2012
Hi,
Is there a way of generating c/c++ code corresponding to the formula
written in the given grammar I.e code generation from sat tree.
Thanks
Puru
On Jan 20, 2012 12:33 PM, "Peter Boughton" <boughtonp at gmail.com> wrote:
> See this example lexer grammar:
>
> fragment START_TAG : '<';
> fragment WORDCHAR : 'a'..'z' | 'A'..'Z' | '0'..'9' | '_';
>
> TAG_START : START_TAG WORDCHAR+ { pushMode(IN_TAG); };
>
> ANY_GENERAL : ~START_TAG+;
> // ANY_GENERAL : ~'<'+;
>
> Using the first ANY_GENERAL rule, it consumes everything.
>
> Swapping for the second ANY_GENERAL rule, it works as intended.
>
> I don't understand why they are not doing the same thing?
>
> Are there any other situations where using a literal over a fragment
> will have different behaviour?
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
More information about the antlr-interest
mailing list