%{ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "y.tab.h" %} %option noyywrap %option nounput %option noinput /* common section */ nl \n ws [ \t]+ special [()+\|\?\*,] sstring [a-zA-Z0-9] socket \/{sstring}[^{special}][a-zA-Z0-9\/\.]+ quotedstring \"[^"\n]*\" bracketstring \<[^>]*\> comment ^\#[^\n]* %% "DROP" { yylval.number=0;return (ACTION);} "PASS" { yylval.number=1;return (ACTION);} "IN" { return (IN);} "OUT" { return (OUT);} "ANY" { return (ANY);} {bracketstring} { yylval.string=strndup(yytext+1, yyleng -2);return WORD;} {ws}"FROM"{ws}{socket}$ { yylval.string=strdup(yytext);return SOCKET;} ^"LOG" { return LOG;} "QUICK" { return QUICK;} {ws} { ; } {nl} { ; } {comment} { return COMMENT; } %%