'exclusive' or 'inclusive' lexer states?

13 views
Skip to first unread message

markmc....@gmail.com

unread,
Jul 25, 2016, 12:22:36 PM7/25/16
to antlr-discussion
I had to add a new state to a lexer.G4 module, but there didn't seem to be any way that I could see to mark it 'inclusive' (i.e. using the rules from the other mode if none are matched in the new mode.) I wound up having to duplicate everything like this:


(original mode)

KEYWORD : 'KEYWORD'
                  ;

(new mode)

XKEYWORD: 'KEYWORD' -> type(KEYWORD);


This did work, but is there an easier way?
Reply all
Reply to author
Forward
0 new messages