[antlr-interest] Confused about backtracking in lexer rules

Jim Idle jimi at temporal-wave.com
Sun Nov 16 11:51:34 PST 2008


On Mon, 2008-11-17 at 07:44 +1300, Gavin Lambert wrote:

> At 01:39 17/11/2008, William Rose wrote:
>  >What I'm finding is that the lexer starts matching the URL,
>  >gets to a point where it can't match the character, then



>               ;
> TEXT : (URL) => URL { $type = URL; }
>       | ~(COLON | SLASH | HYPHEN | ASTERISK | SPACE | TAB | CR | 
> LF)*
>       ;


Remember that lexer rules that can effectively match a zero length
string are meaningless. That * would have to be + :-)

To be honest I think that wiki syntax is so bad (I don't even find it
that helpful to marking things up), that a grammar to parser such a
thing is going to be so full of exceptions and hacks that it probably
isn't worth it. 

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081116/90740623/attachment.html 


More information about the antlr-interest mailing list