help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binary scanner not matching character ranges


From: Shaun Jackman
Subject: Binary scanner not matching character ranges
Date: Fri, 17 Dec 2004 12:42:44 -0800

I'm writing a binary scanner for the Telnet protocol, which is deadly
simple. The escape sequence 0xff preceeds a two or three byte command,
and everything else is a normal character. The rule explicit
"\xff\xec" is matching, but all the rules with a '.' in them are not
matching. For example, the input sequence 0xff 0xfd 0x03 is being
matched by the last rule three times, rather than the fourth rule,
"\xff\xfd.". I've tried using character ranges instead, like
[\x00-\xff], but I'm not having any luck.

"\xff\xec" return xEOF;
"\xff\xfb." yylval = yytext[2]; return WILL;
"\xff\xfc." yylval = yytext[2]; return WONT;
"\xff\xfd." yylval = yytext[2]; return DO;
"\xff\xfe." yylval = yytext[2]; return DONT;
"\xff\xff" return 255;
"\xff." yylval = yytext[1]; return IAC;
. return yytext[0];

Please cc me in your reply. Thanks,
Shaun




reply via email to

[Prev in Thread] Current Thread [Next in Thread]