I've been spending half an hour to find a build error in my code because of this bug so here comes an useful testcase ;)
When including statemachines from multiple files, the #line directive emitted in the .c file, which is used to report errors by gcc, is _always_ referencing the converted .rl file. In the case of the testcase I'm attaching (which is a reduced version of what I hit), gcc is going to report an error in a line that is a comment: fl...@yamato testcase-bug-ragel % ragel test.rl fl...@yamato testcase-bug-ragel % gcc test.c -c test.rl: In function ‘test’: test.rl:9: error: ‘line’ undeclared (first use in this function) test.rl:9: error: (Each undeclared identifier is reported only once test.rl:9: error: for each function it appears in.) fl...@yamato testcase-bug-ragel % sed -n -e 9p test.rl * -- Diego Elio Pettenò — “Flameeyes” http://blog.flameeyes.eu/ If you found a .asc file in this mail and know not what it is, it's a GnuPG digital signature: http://www.gnupg.org/
%%{
machine common;
action mark {mark = fpc;}
BIT = "0" | "1";
CHAR = 0x01..0x7f;
CR = "\r";
LF = "\n" %{line++;};
CRLF = CR* LF;
CTL = 0x00..0x1f | 0x7f;
DQUOTE = "\"";
HTAB = "\t";
SP = " ";
WSP = SP | HTAB;
LWSP = ( WSP | ( CRLF WSP ) )*;
OCTET = 0x00..0xff;
VCHAR = 0x21..0x7e;
scheme = alpha ( alpha | digit | "+" | "-" | "." )*;
unreserved = alpha | digit | "-" | "." | "_" | "~";
pct_encoded = "%" xdigit xdigit;
sub_delims = "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=";
userinfo = ( unreserved | pct_encoded | sub_delims | ":" )*;
h16 = xdigit{1,4};
dec_octet = digit | ( 0x31..0x39 digit ) | ( "1" digit{2} ) | ( "2" 0x30..0x34 digit ) | ( "25" 0x30..0x35 );
IPv4address = dec_octet "." dec_octet "." dec_octet "." dec_octet;
ls32 = ( h16 ":" h16 ) | IPv4address;
IPv6address = ( ( h16 ":" ){6} ls32 ) | ( "::" ( h16 ":" ){5} ls32 ) | ( h16? "::" ( h16 ":" ){4} ls32 ) | ( ( ( h16 ":" )? h16 )? "::" ( h16 ":" ){3} ls32 ) | ( ( ( h16 ":" ){,2} h16 )? "::" ( h16 ":" ){2} ls32 ) | ( ( ( h16 ":" ){,3} h16 )? "::" h16 ":" ls32 ) | ( ( ( h16 ":" ){,4} h16 )? "::" ls32 ) | ( ( ( h16 ":" ){,5} h16 )? "::" h16 ) | ( ( ( h16 ":" ){,6} h16 )? "::" );
IPvFuture = "v"i xdigit+ "." ( unreserved | sub_delims | ":" )+;
IP_literal = "[" ( IPv6address | IPvFuture ) "]";
}%%
/*
* This header is here just to make sure that the line 9 is not code!
*
*
*
*
*
*
*
*/
void test() {
int cs;
const char *p = "FOO\n", *pe = p + 4, *eof;
%%{
machine test;
include common "common.rl";
main := "FOO" . LF;
write data;
write init;
write exec;
}%%
}
signature.asc
Description: Questa è una parte del messaggio firmata digitalmente
_______________________________________________ ragel-users mailing list [email protected] http://www.complang.org/mailman/listinfo/ragel-users
