[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
case-independent character range match bug, flex 2.5.25
From: |
Bruce Lilly |
Subject: |
case-independent character range match bug, flex 2.5.25 |
Date: |
Sun, 15 Dec 2002 09:50:30 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 |
When given the -i option, flex not only treats upper- and
lower-case letters identically as individual characters,
it botches ranges if a specific alphabetic character is
used in specifying a range:
# cat test.l
/* input might be from a socket, and isatty may therefore be unreliable */
%option always-interactive
/* RFC 2822: some control chars, all printing 7-bit chars except ']',
'\\', and '[' */
dtext ([\001-\010\013\014\016-\037!-Z^-\177])
%%
/* domain literals */
{dtext} {
return 2;
}
\] {
return 3;
}
.|\n {
return 1;
}
%%
int main(int argc, char **argv)
{
int c;
do switch((c = yylex())) {
case 1:
/*FALLTHROUGH*/
case 2:
if (yytext[0] == ']') {
(void) fprintf(stderr, "Warning! Warning! Danger, Will Robinson! Flex is
broken! (%d)\n", c);
abort();
}
}
while (c);
return 0;
}
int yywrap(void)
{
return 1;
}
# flex test.l
# cc -o test lex.yy.c
# echo 'abc[123]def' | ./test
# flex -i test.l
test.l:15: warning, rule cannot be matched
# cc -o test lex.yy.c
# echo 'abc[123]def' | ./test
Warning! Warning! Danger, Will Robinson! Flex is broken! (2)
ksh: 29994: Abort(coredump)
- case-independent character range match bug, flex 2.5.25,
Bruce Lilly <=