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.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to