[antlr-interest] Excluding words as tokens
schlpbch at gmx.ch
schlpbch at gmx.ch
Fri May 22 02:07:55 PDT 2009
Dear all
I'm trying to write a grammar to check the correctness of package names in respect to our meta modell. Thereby I ran into to following problems:
ABSTRACTOBJECT:
SERVICEOBJECT | QUERYOBJECT
SERVICEOBJECT: UPPERCASE (LOWERCASE|UPPERCASE)+ DIGIT*
QUERYOBJECT: UPPERCASE (LOWERCASE|UPPERCASE)+ DIGIT* "Query"
Of course this production is ambiguous, i.e.
DateQuery
can be SERVICEOBJECT token as well as a QUERYOBJECT token.
What I would like to express is that a QUERYOBJECT has to end with "Query" otherwise it is a SERVICEOBJECT which would resolve the ambiguity. How can this be expressed in ANTLR?
A related problem I have is that I would like to express that COMPONENTNAME can consists of LOWERCASE+ DIGIT* except 'model' or 'impl'.
I tried expressing these constraints as a regular expression, playing around with '~' but somehow didn't get it working.
Does anybody have an example how this can be expressed?
Thank you very much for your input.
Andreas
--
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a
More information about the antlr-interest
mailing list