[antlr-interest] lexer: display all rules matched
Edwards, Waverly
Waverly.Edwards at genesys.com
Wed Aug 29 07:04:25 PDT 2007
Ah great! This is great. Now I can really test and be confident that
everything is working as it should.
Thanks,
W.
________________________________
From: Andy Tripp [mailto:antlr at jazillian.com]
Sent: Wednesday, August 29, 2007 9:44 AM
To: Edwards, Waverly
Cc: antlr
Subject: Re: [antlr-interest] lexer: display all rules matched
In Java:
CommonTokenStream tokens = new CommonTokenStream();
tokens.setTokenSource(lexer);
tokens.LT(1); // force load
for (int i=0; i<tokens.size(); i++) {
if (tokens.get(i).getChannel() == 0) {
System.out.println("TOKEN:'" + tokens.get(i).getText() + "'
" + tokens.get(i).getType());
}
>> For the purposes of tests, just create an instance of
the lexer and ask it for all the tokens.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070829/f970f471/attachment-0001.html
More information about the antlr-interest
mailing list