| 1 |
%top{ |
| 2 |
#include "nl-default.h" |
| 3 |
} |
| 4 |
%{ |
| 5 |
#include <linux/tc_ematch/tc_em_cmp.h> |
| 6 |
|
| 7 |
#include <netlink/netlink.h> |
| 8 |
#include <netlink/utils.h> |
| 9 |
#include <netlink/route/pktloc.h> |
| 10 |
|
| 11 |
#include "pktloc_syntax.h" |
| 12 |
|
| 13 |
int pktloc_get_column(yyscan_t); |
| 14 |
void pktloc_set_column(int, yyscan_t); |
| 15 |
%} |
| 16 |
|
| 17 |
%option 8bit |
| 18 |
%option reentrant |
| 19 |
%option warn |
| 20 |
%option noyywrap |
| 21 |
%option noinput |
| 22 |
%option nounput |
| 23 |
%option bison-bridge |
| 24 |
%option bison-locations |
| 25 |
%option prefix="pktloc_" |
| 26 |
|
| 27 |
%% |
| 28 |
|
| 29 |
[ \t\r\n]+ |
| 30 |
|
| 31 |
"#".* |
| 32 |
|
| 33 |
[[:digit:]]+ | |
| 34 |
0[xX][[:xdigit:]]+ { |
| 35 |
yylval->i = strtoul(yytext, NULL, 0); |
| 36 |
return NUMBER; |
| 37 |
} |
| 38 |
|
| 39 |
"+" { return yylval->i = yytext[0]; } |
| 40 |
|
| 41 |
[uU]8 { yylval->i = TCF_EM_ALIGN_U8; return ALIGN; } |
| 42 |
[uU]16 { yylval->i = TCF_EM_ALIGN_U16; return ALIGN; } |
| 43 |
[uU]32 { yylval->i = TCF_EM_ALIGN_U32; return ALIGN; } |
| 44 |
|
| 45 |
[lL][iI][nN][kK] | |
| 46 |
[eE][tT][hH] { yylval->i = TCF_LAYER_LINK; return LAYER; } |
| 47 |
[nN][eE][tT] | |
| 48 |
[iI][pP] { yylval->i = TCF_LAYER_NETWORK; return LAYER; } |
| 49 |
[tT][rR][aA][nN][sS][pP][oO][rR][tT] | |
| 50 |
[tT][cC][pP] { yylval->i = TCF_LAYER_TRANSPORT; return LAYER; } |
| 51 |
|
| 52 |
|
| 53 |
[^ \t\r\n+]+ { |
| 54 |
yylval->s = strdup(yytext); |
| 55 |
if (yylval->s == NULL) |
| 56 |
return ERROR; |
| 57 |
return NAME; |
| 58 |
} |