[antlr-interest] Testing literals

Daniela da Cruz danieladacruz at gmail.com
Fri Sep 28 07:14:18 PDT 2012


Hi

I am building a grammar for Objective-C using Antlr 2.7 (other versions are
not an option).

One problem I am having is the following. For example, in Objective-C we
have:

foreach(int c in list)
{
}

But we can also have:

int in;

In the grammar I have a rule for identifiers with the option testLiterals =
true ("in" is currently a Literal).

This result in the expression "int in" be not parsed! Anyone have an idea
how to solve this?

thanks
daniela


More information about the antlr-interest mailing list