[antlr-interest] Test the lexer

Benjamin Niemann pink at odahoda.de
Sat Feb 17 05:04:12 PST 2007


Hello,

Richard Hu wrote:

> Is it possible to test the lexer without testing the parser? I would like
> to send some stream into the lexer and see tokens being generate. But all
> the test samples I've seen include parser.

Just create the Lexer and call its nextToken() method to get one Token after
the other and test if the tokens match your expectations.
If you need a explicit example, you'd have to tell us which ANTLR version
(2.x or 3) and which target language you are using.

HTH

-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/



More information about the antlr-interest mailing list