[antlr-interest] Regular Expressions (2)

Ale Strooisma alestrooisma at gmx.net
Wed Jul 4 16:22:44 PDT 2012


I guess this would work:

AT_PROTECTED : AT "protected";
AT_PRIVATE : AT "private";
fragment AT : "@";

Good luck,
Ale

On 07/05/2012 12:20 AM, Daniela da Cruz wrote:
> Sorry. The previous email was sent before I finish it.
>
> Hello all
>
> I am developing an Objective-C 2.0 grammar using the Antlr v2.7.
> The problem I'm facing is that there exist some ambiguous reserved words.
> For instance and using k = 1 in Lexer, there exist
>
> @protected, @private, @public, @interface, in, inout, ...
>
> defining these regular expressions like:
>
> AT_PROTECTED : "@protected" ;
> AT_PRIVATE : "@private" ;
>
> Using this approach, of course, I get a lot of warnings because they are
> ambiguous.
>
> How do you suggest to solve them?
>
> Factorize them and then set the token type accordingly?
>
> Thanks
> daniela
>
> 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