[ragel-users] Possible bug in scanner

Adrian Thurston thurs... at cs.queensu.ca
Sun Apr 20 23:44:34 UTC 2008


I just checked in a fix for this.

This bug affects -T0 and -T1 for all target languages. The problem
occurs when the last token of a scanner requires some backtracking to match.

-Adrian

David Balmain wrote:
> Hey folks,
> 
> I think I may have found a bug in the scanner. Not sure if this is the
> best place to post bug reports but I couldn't find anywhere else on
> the website.
> 
> Here's my machine definition. I've simplified it as much as possible;
> 
> %%{
>     machine Word;
> 
>     main := |*
>         'a' {PUTS("a: ");};
>         [ab]+ . 'c' {PUTS("abc: ");};
>         any;
>     *|;
> }%%
> 
> To run it, get the full code here;
>     http://pastie.caboo.se/183409
> 
> Basically I'm running this with the string "ba a". What I'd expect to
> happen is that the "[ab]+ . 'c'" expression would match 'ba' then fail
> and then the "any" rule would consume the 'b' then 'a' would match
> twice. Unfortunately, only the second 'a' matches.
> 
> If I run this with the string "ba" I get a segfault which also seems
> to indicate a bug. Perhaps I'm just doing something wrong?
> 
> Cheers,
> Dave
> > 
> 



More information about the ragel-users mailing list