0

I want to match a list of well known identifiers and if there's no well known identifier I want it to become something like a default token. It would be something like:

TOKEN1: 'Token1' ;

TOKEN2: 'Token2' ;

DEFAULT: NONE OF THE ABOVE AND MUST FOLLOW LETTER (LETTER|NUMBER)*;

Anyone know if it's possible to accomplish that?

Regards,

Rui

rpvilao
  • 1,116
  • 2
  • 14
  • 31
  • 1
    this is a candidate for rule, not for token, so you can define `DEFAULT` as `LETTER (LETTER|NUMBER)*` and then define rule `tokensOrDefault` that is something like `(TOKEN1 | TOKEN2 | DEFAULT)` – hoaz Nov 29 '12 at 22:08
  • Asked here too: http://antlr.markmail.org/message/wc5mzjjbi3mobea5 – Bart Kiers Nov 29 '12 at 22:48

0 Answers0