fcall legal in scanner?

Adrian Thurston thurs... at cs.queensu.ca
Sun Oct 29 18:40:29 UTC 2006


Hi Carlos,

I found the bug. The problem was with fret in scanner actions. The 
adjustment to p that is needed in some cases was not happening. The 
attached patch will fix the problem.

Cheers,
  Adrian

Carlos Antunes wrote:
> On 10/27/06, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
>> It sounds like a bug. fcall is supposed to work in actions associated with
>> entire patterns (the lex style actions) but they are illegal in the the
>> transition/state based embeddings and Ragel is supposed to emit an error.
>> Could you post or send me some code which exhibits the problem?
>>
> 
> Adrian,
> 
> Please, see test2.rl file attached. It's a messy file because it's
> where I do, testing.
> 
> Basically, I'm using a scanner (main) to match 'Organization',
> 'Authorization' and a general purpose header called extension_header.
> If there is a header like 'an-extension-header', the scanner should
> match on the extension_header rule.
> 
> Here's a string to match:
> 
>             "Authorization: Digest username=\"Alice\",realm=\"atlanta.com\"\n"
>             "    , response=\"7587245234b3434cc3412213e5f113a5432\" , \r\n"
>             "    nonce=\"84a4cc6f3082121f32b42a2187831a9e\" \r\n"
>             "Organization: Boxes by\r\n Bob  \r\n      \n"
>             "An-Extension-Header: 10 \n"
>             "\r\n";
> 
> The scanner performs well with the previous string. Let's try a new string:
> 
>             "An-Extension-Header: 10 \n"
>             "Authorization: Digest username=\"Alice\",realm=\"atlanta.com\"\n"
>             "    , response=\"7587245234b3434cc3412213e5f113a5432\" , \r\n"
>             "    nonce=\"84a4cc6f3082121f32b42a2187831a9e\" \r\n"
>             "Organization: Boxes by\r\n Bob  \r\n      \n"
>             "\r\n";
> 
> In this case, the scanner, once it matches the extension header, will
> continue to match 'Authorization' and 'Organization' as extension
> headers as well, which didn't happen before.
> 
> Note that, if instead of using fcall from the main scanner, I use
> fgoto (and them fgoto back to main instead of fret), both input
> strings produce the same, and correct, behavior.
> 
> Thanks!
> 
> Carlos
> 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ragel-5.14.diff
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20061029/312bc914/attachment-0001.ksh>


More information about the ragel-users mailing list