[antlr-interest] lexer: display all rules matched
Gavin Lambert
antlr at mirality.co.nz
Tue Aug 28 14:28:28 PDT 2007
At 08:52 29/08/2007, Edwards, Waverly wrote:
> >>For the purposes of tests, just create an instance of the
> lexer and ask it for all the tokens.
>
>I'll have to more homework as I haven't seen an example of how
>this is done. The only way I've seen this done
>is by chaining together parser or lexical rules and setting an
>action to it. I have two problems with this.
>1. The starting rule appears to be the type that gets returned
>when you chain rules.
>2. There isn't a way to determine which lexical rule is being
>used to match the text.
No, no parser at all. You know the code snippet you put in your
main routine to create a lexer and parser, then call the
entrypoint of your parser? Leave out the bit that creates the
parser and calls its entrypoint, and replace it with some code
that reads from the lexer (or lexer's token stream) directly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070829/e3e55c2d/attachment.html
More information about the antlr-interest
mailing list