[antlr-interest] lexer: display all rules matched

Gavin Lambert antlr at mirality.co.nz
Tue Aug 28 13:13:08 PDT 2007


At 01:58 29/08/2007, Edwards, Waverly wrote:
>Is there a way to inspect what lexer rules have been matched or 
>inspect the token buffer?
>What I'm trying to do is to setup test(s) to ensure that every 
>keyword is matched and that no rule conflicts with another.
>I have just short of 550 lexical rules just for keywords alone 
>(originally I thought it was just a couple hundred).

For the purposes of tests, just create an instance of the lexer 
and ask it for all the tokens.  (Exactly how you do this depends 
on your target language.)

There's no need to create a parser if all you want to do is to 
validate the output of the lexer against a "known good" or 
"expected" list. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070829/c8362286/attachment.html 


More information about the antlr-interest mailing list