fcall legal in scanner?

Carlos Antunes cmantu... at gmail.com
Fri Oct 27 17:27:50 UTC 2006


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

-- 
"We hold [...] that all men are created equal; that they are
endowed [...] with certain inalienable rights; that among
these are life, liberty, and the pursuit of happiness"
        -- Thomas Jefferson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test2.rl
Type: application/octet-stream
Size: 12918 bytes
Desc: not available
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20061027/018eec33/attachment-0001.obj>


More information about the ragel-users mailing list