[antlr-interest] Getting the Previously Matched Lexer Token in the C Target

Billy O'Neal billy.oneal at gmail.com
Mon Jul 19 17:23:29 PDT 2010


Hello, Everyone :)

Was referred here from my StackOverflow question:
http://stackoverflow.com/questions/3278338/using-the-antlr-c-target-how-can-i-get-the-previously-matched-token-in-the-lexer

I'm quite new to ANTLR; and my Lexer needs to have a gated rule which
makes it valid if and only if it occurs directly after another rule.
If there's a way to get the previously emitted token type, that would
make that gating easy. Otherwise I have to fail over to a nasty hack
of turning the boolean flag off after every lexer rule.

Is it simple/easy to get that information in a lexer rule predicate?

Billy3
--------------------------------------------------------------
Intern - PreEmptive Solutions, LLC
Malware Response Instructor - BleepingComputer.com
Analyst, Security Team - TechSupportForum.com


More information about the antlr-interest mailing list