%{
#include <stdio.h>
#include "parser.h"

int line_number = 1;

#define yywrap() 1
%}
%%

in				{ return IN; }
from				{ return IN; }
out				{ return OUT; }
to				{ return OUT; }
allow				{ return ALLOW; }
permit				{ return ALLOW; }
deny				{ return DENY; }
block				{ return DENY; }
reject				{ return DENY; }
all				{ return ALL; }
any				{ return ALL; }
"*"				{ return ALL; }
hard				{ return HARD; }
soft				{ return SOFT; }
tcp				{ return TCP; }
udp				{ return UDP; }
icmp				{ return ICMP; }
ping				{ return PING; }
traceroute			{ return TRACEROUTE; }
host				{ return HOST; }
net				{ return NET; }
flags				{ return FLAGS; }
	
#[^\n]*				;
\n				{ line_number++; return NEWLINE; }
"/"				{ return SLASH; }
"-"				{ return DASH; }
","				{ return COMMA; }
0x[0-9a-fA-F]+			{ yylval.val = strtol(yytext, 0, 16); return NBR; }
[0-9]+				{ yylval.val = atoi(yytext); return NBR; }
[a-zA-Z][-a-zA-Z0-9_.]+		{ yylval.text = yytext; return WORD; }
\\[-a-zA-Z0-9_.]+		{ yylval.text = 1+yytext; return WORD; }
"."				{ return DOT; }
.				;
