[antlr-interest] Missing characters in partial matches

Matt Palmer mattpalms at gmail.com
Sun Aug 24 05:52:05 PDT 2008


Hi all,

The Comment code you guys provided (with correct punctuation) did in fact
solve my problem, and I also have a better (not perfect!) understanding of
the lexer now.  The token DFA's are indeed illuminating, once you get the
hang of them.

It took me a little while to figure out the Comment code; that the empty
alternative was used to switch the Comment token type to Lsqb, if only the
Lsqb had actually matched.  A very nice hack - although I would have
preferred not to have had to use it :)

Many thanks again,

Matt

On Sat, Aug 23, 2008 at 6:24 PM, Kay Röpke <kroepke at classdump.org> wrote:

>
> On Aug 23, 2008, at 5:50 PM, Matt Palmer wrote:
>
>  Just a quick thank you to everyone who's responded.  I feel like I have a
>> better grasp on what's going on now.  I'm going to have a play, and look
>> at
>> the tokens DFA (or even the code, if that doesn't enlighten me).  I'm keen
>> to understand how the v3 lexer actually works, but also how it might
>> otherwise work too :)
>>
>
>
> The DFA in ANTLRWorks (or by generating it by hand and giving
> org.antlr.Tool the -dfa option) is really what you want to be looking at.
> For big DFAs the codegen will likely be a table-based DFA and that's not
> really readable ;)
>
> Just come up with some simple cases where it doesn't do what you expect,
> then look at the DFAs. You'll pretty much know what happens then :) Together
> with the very helpful summary by the others in this thread, that is!
>
> cheers,
> -k
> --
> Kay Röpke
> http://classdump.org/
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080824/c5ce4171/attachment.html 


More information about the antlr-interest mailing list