[antlr-interest] Matching compound keywords in the lexer
franck102
franck102 at yahoo.com
Fri Nov 25 12:47:50 PST 2011
I am trying to match multi-word keywords at the lexer level, I found the
pattern below in previous answers but I can't figure out how to make the
type assigned to $type visible to parser rules... any suggestion
appreciated!
I would rather not modify containOperator to get at the token type, this
would make the grammar much less readable.
containOperator : CONTAINS_TEXT | CONTAINS_MATCH
CONTAINS_TEXT
: 'contains' WS+ ( 'match' { $type=CONTAINS_MATCH }
| 'text' )
;
// CONTAINS_MATCH:; // causes "token definitions can never be matched"
error
--
View this message in context: http://antlr.1301665.n2.nabble.com/Matching-compound-keywords-in-the-lexer-tp7032358p7032358.html
Sent from the ANTLR mailing list archive at Nabble.com.
More information about the antlr-interest
mailing list