fexec bug in v5.15?

Carlos Antunes cmantu... at gmail.com
Mon Nov 6 05:16:33 UTC 2006


Adrian,

I have the following defined:

consume_sp_optional := |*

            ( ( '\r'? '\n' )? [ \t] )* { printf("===== sp_optional
(%s)\n", p); };

            '\r'? '\n' { printf("===== crlf (%s)\n", p); fexec
tokstart; fret; };

            any { printf("<---- sp_optional (%s)\n", p); fexec
tokstart; fret; };

        *|;

This machine basically eats up optional spaces and tabs including
folding and returns when CRLF is encountered. This worked fine with
v5.14. With version 5.15, however, I think there might be a bug in the
way fexec is working. Looking at the generated C code, I see
(corresponding to the \r'? '\n' line ):

tr6811:
#line 26 "test.rl"
        {tokend = p;{ printf("===== crlf (%s)\n", p); {p =
((tokstart))-1;} {p--;{cs = stack[--top]; goto _again;}} }p--;}
        goto st6170;


Now, there is this p = ((tokstart))-1 followed by a p-- (and another
p-- that is never reached). Shouldn't the first expression be just p =
tokstart? The purpose of the fexec in my code is to backtrack and make
the CRLF available for further matching.

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



More information about the ragel-users mailing list