[antlr-interest] Match A with exception of B .....how do I do that?
Johannes Luber
jaluber at gmx.de
Sun Feb 22 22:31:15 PST 2009
Vlastimil Adamovsky schrieb:
> Thanks,
>
> the problem is something like this:
> ......
>
> Identifier : (Letter | '_') (LetterOrDigit | '_')* ;
>
> ReservedIdentifier : PseudoVariableReference | ConstantReference;
> PseudoVariableReference : 'self' | 'super' | 'thisContext';
>
> ConstantReference : 'nil' | 'false' | 'true' ;
>
> ConstantReference
> : 'nil' | 'false' | 'true'
> ;
>
> PseudoVariableReference
> : 'self' | 'super' | 'thisContext'
> ;
>
> ReservedIdentifier
> : PseudoVariableReference | ConstantReference
> ;
>
> *BindableIdentifier : Identifier - ReservedIdentifier ; //this is
> EBNF notation*
>
> How do I set up a *BindableIdentifier *rule so it is valid for ANTLR??
>
> I have to admit, I just started using ANTLR and I like it a lot, but
> still, I think the learning curve is very steep....
>
> Thanks,
> Vlastimil
Well, theoretically you can use
C : (~B)=> A;
but for better error messages it is recommend just to match the superset
and to check in the parser for incorrect characters.
Johannes
>
>
>
> ------------------------------------------------------------------------
>
>
> 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