[antlr-interest] Simple problem with tokens string

edA-qa mort-ora-y e.mortoray at ecircle.com
Wed Jul 30 02:33:27 PDT 2008


I'd like to do something like below in a grammar (to handle keywords and
identifiers), but it just doesn't work as expected.

grammar Test;

sample
    :    'sample' VALUE;
   
VALUE
    :    ('a'..'z')+;

This works, so long as the input is not of this form:
    sample sample
In which case I get a MismatchedTokenException.

Why is it that as soon as I use a fixed string in a token it can no
longer be identified as a different token? And how do I do it correctly?

(Using ANTLRWorks 1.1.7)

-- 
edA-qa mort-ora-y
Director Quality Assurance
______________________________________________________
eCircle AG - Inside Digital Marketing
Nymphenburger Str. 86
80636 München

Tel    +49-89-12009-773
Fax    +49-89-12009-750

E-Mail mailto:e.mort-ora-y at ecircle.com
Web    http://www.ecircle.com

______________________________________________________
Aktuelles
"Inside Digital Marketing" - der Newsletter für die
Online-Branche von eCircle. Jeden Monat neu & voll
mit aktuellen Fallstudien und hilfreichen Tipps!
Jetzt kostenlos abonnieren:

http://www.ecircle.com/de/newsletter
______________________________________________________

eCircle AG, HRB 136 334, Handelsregister München
Vorstand:  Lothar Lanz, Volker Wiewer (Vorsitzende), 
Thomas Wilke, Lars Wössner, Alexander Meyer
Vorsitzender des Aufsichtsrates: Dr. Mark Wössner



More information about the antlr-interest mailing list