[antlr-interest] Skipping thru text looking for keywords to parse ...

Gavin Lambert antlr at mirality.co.nz
Wed Jan 7 21:57:29 PST 2009


At 14:07 7/01/2009, Ben Gillis wrote:
>Are there any examples or email archive discussion where the bulk 
>of text being parsed is, implicitly, comments that should be 
>ignored (i.e. there is no metacharacter(s) indicating what is a 
>comment)...and, the parser is only concerned with various 
>keywords?

Look up "filtering lexers" (or the "filter=true" option in a 
lexer-only grammar).  That might be the sort of thing you're 
after.

Alternatively, you could just define a lexer rule that consumes 
(and discards) everything up to (but not including) the next 
interesting keyword.



More information about the antlr-interest mailing list