[antlr-interest] probably simple question

jbb at acm.org jbb at acm.org
Mon Aug 9 15:30:07 PDT 2004


Mr. Ashford :-

Try:

-----------------------------------
tokens {
   RESULT="result";
}

protected
DIGIT  : ('0'..'9');

protected
ALPHA  : ('a'..'z' | 'A'..'Z');

ID
options {
  paraphrase   = "an identifier";
  testLiterals = true;
}
       : ALPHA (ALPHA | DIGIT)*;
-----------------------------------

That is, place your keywords into a tokens{} block and not in a lexer rule.
(I think the tokens{} block has to appear before any rules, but can't
remember for sure right now...)

Hope this helps...
	John B. Brodie


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list