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