libnl  3.2.14
ematch_syntax.c
1 /* A Bison parser, made by GNU Bison 2.5. */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5  Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 
20 /* As a special exception, you may create a larger work that contains
21  part or all of the Bison parser skeleton and distribute that work
22  under terms of your choice, so long as that work isn't itself a
23  parser generator using the skeleton or a modified version thereof
24  as a parser skeleton. Alternatively, if you modify or redistribute
25  the parser skeleton itself, you may (at your option) remove this
26  special exception, which will cause the skeleton and the resulting
27  Bison output files to be licensed under the GNU General Public
28  License without this special exception.
29 
30  This special exception was added by the Free Software Foundation in
31  version 2.2 of Bison. */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34  simplifying the original so-called "semantic" parser. */
35 
36 /* All symbols defined below should begin with yy or YY, to avoid
37  infringing on user name space. This should be done even for local
38  variables, as they might otherwise be expanded by user macros.
39  There are some unavoidable exceptions within include files to
40  define necessary library symbols; they are noted "INFRINGES ON
41  USER NAME SPACE" below. */
42 
43 /* Identify Bison output. */
44 #define YYBISON 1
45 
46 /* Bison version. */
47 #define YYBISON_VERSION "2.5"
48 
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers. */
53 #define YYPURE 1
54 
55 /* Push parsers. */
56 #define YYPUSH 0
57 
58 /* Pull parsers. */
59 #define YYPULL 1
60 
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
63 
64 /* Substitute the variable and function names. */
65 #define yyparse ematch_parse
66 #define yylex ematch_lex
67 #define yyerror ematch_error
68 #define yylval ematch_lval
69 #define yychar ematch_char
70 #define yydebug ematch_debug
71 #define yynerrs ematch_nerrs
72 
73 
74 /* Copy the first part of user declarations. */
75 
76 /* Line 268 of yacc.c */
77 #line 12 "route/cls/ematch_syntax.y"
78 
79 #include <netlink-local.h>
80 #include <netlink-tc.h>
81 #include <netlink/netlink.h>
82 #include <netlink/utils.h>
83 #include <netlink/route/pktloc.h>
84 #include <netlink/route/cls/ematch.h>
85 #include <netlink/route/cls/ematch/cmp.h>
86 #include <netlink/route/cls/ematch/nbyte.h>
87 #include <netlink/route/cls/ematch/text.h>
88 #include <netlink/route/cls/ematch/meta.h>
89 
90 #define META_ALLOC rtnl_meta_value_alloc_id
91 #define META_ID(name) TCF_META_ID_##name
92 #define META_INT TCF_META_TYPE_INT
93 #define META_VAR TCF_META_TYPE_VAR
94 
95 
96 /* Line 268 of yacc.c */
97 #line 98 "route/cls/ematch_syntax.c"
98 
99 /* Enabling traces. */
100 #ifndef YYDEBUG
101 # define YYDEBUG 0
102 #endif
103 
104 /* Enabling verbose error messages. */
105 #ifdef YYERROR_VERBOSE
106 # undef YYERROR_VERBOSE
107 # define YYERROR_VERBOSE 1
108 #else
109 # define YYERROR_VERBOSE 1
110 #endif
111 
112 /* Enabling the token table. */
113 #ifndef YYTOKEN_TABLE
114 # define YYTOKEN_TABLE 0
115 #endif
116 
117 
118 /* Tokens. */
119 #ifndef YYTOKENTYPE
120 # define YYTOKENTYPE
121  /* Put the tokens into the symbol table, so that GDB and other debuggers
122  know about them. */
123  enum yytokentype {
124  ERROR = 258,
125  LOGIC = 259,
126  NOT = 260,
127  OPERAND = 261,
128  NUMBER = 262,
129  ALIGN = 263,
130  LAYER = 264,
131  KW_OPEN = 265,
132  KW_CLOSE = 266,
133  KW_PLUS = 267,
134  KW_MASK = 268,
135  KW_SHIFT = 269,
136  KW_AT = 270,
137  EMATCH_CMP = 271,
138  EMATCH_NBYTE = 272,
139  EMATCH_TEXT = 273,
140  EMATCH_META = 274,
141  KW_EQ = 275,
142  KW_GT = 276,
143  KW_LT = 277,
144  KW_FROM = 278,
145  KW_TO = 279,
146  META_RANDOM = 280,
147  META_LOADAVG_0 = 281,
148  META_LOADAVG_1 = 282,
149  META_LOADAVG_2 = 283,
150  META_DEV = 284,
151  META_PRIO = 285,
152  META_PROTO = 286,
153  META_PKTTYPE = 287,
154  META_PKTLEN = 288,
155  META_DATALEN = 289,
156  META_MACLEN = 290,
157  META_MARK = 291,
158  META_TCINDEX = 292,
159  META_RTCLASSID = 293,
160  META_RTIIF = 294,
161  META_SK_FAMILY = 295,
162  META_SK_STATE = 296,
163  META_SK_REUSE = 297,
164  META_SK_REFCNT = 298,
165  META_SK_RCVBUF = 299,
166  META_SK_SNDBUF = 300,
167  META_SK_SHUTDOWN = 301,
168  META_SK_PROTO = 302,
169  META_SK_TYPE = 303,
170  META_SK_RMEM_ALLOC = 304,
171  META_SK_WMEM_ALLOC = 305,
172  META_SK_WMEM_QUEUED = 306,
173  META_SK_RCV_QLEN = 307,
174  META_SK_SND_QLEN = 308,
175  META_SK_ERR_QLEN = 309,
176  META_SK_FORWARD_ALLOCS = 310,
177  META_SK_ALLOCS = 311,
178  META_SK_ROUTE_CAPS = 312,
179  META_SK_HASH = 313,
180  META_SK_LINGERTIME = 314,
181  META_SK_ACK_BACKLOG = 315,
182  META_SK_MAX_ACK_BACKLOG = 316,
183  META_SK_PRIO = 317,
184  META_SK_RCVLOWAT = 318,
185  META_SK_RCVTIMEO = 319,
186  META_SK_SNDTIMEO = 320,
187  META_SK_SENDMSG_OFF = 321,
188  META_SK_WRITE_PENDING = 322,
189  META_VLAN = 323,
190  META_RXHASH = 324,
191  META_DEVNAME = 325,
192  META_SK_BOUND_IF = 326,
193  STR = 327,
194  QUOTED = 328
195  };
196 #endif
197 /* Tokens. */
198 #define ERROR 258
199 #define LOGIC 259
200 #define NOT 260
201 #define OPERAND 261
202 #define NUMBER 262
203 #define ALIGN 263
204 #define LAYER 264
205 #define KW_OPEN 265
206 #define KW_CLOSE 266
207 #define KW_PLUS 267
208 #define KW_MASK 268
209 #define KW_SHIFT 269
210 #define KW_AT 270
211 #define EMATCH_CMP 271
212 #define EMATCH_NBYTE 272
213 #define EMATCH_TEXT 273
214 #define EMATCH_META 274
215 #define KW_EQ 275
216 #define KW_GT 276
217 #define KW_LT 277
218 #define KW_FROM 278
219 #define KW_TO 279
220 #define META_RANDOM 280
221 #define META_LOADAVG_0 281
222 #define META_LOADAVG_1 282
223 #define META_LOADAVG_2 283
224 #define META_DEV 284
225 #define META_PRIO 285
226 #define META_PROTO 286
227 #define META_PKTTYPE 287
228 #define META_PKTLEN 288
229 #define META_DATALEN 289
230 #define META_MACLEN 290
231 #define META_MARK 291
232 #define META_TCINDEX 292
233 #define META_RTCLASSID 293
234 #define META_RTIIF 294
235 #define META_SK_FAMILY 295
236 #define META_SK_STATE 296
237 #define META_SK_REUSE 297
238 #define META_SK_REFCNT 298
239 #define META_SK_RCVBUF 299
240 #define META_SK_SNDBUF 300
241 #define META_SK_SHUTDOWN 301
242 #define META_SK_PROTO 302
243 #define META_SK_TYPE 303
244 #define META_SK_RMEM_ALLOC 304
245 #define META_SK_WMEM_ALLOC 305
246 #define META_SK_WMEM_QUEUED 306
247 #define META_SK_RCV_QLEN 307
248 #define META_SK_SND_QLEN 308
249 #define META_SK_ERR_QLEN 309
250 #define META_SK_FORWARD_ALLOCS 310
251 #define META_SK_ALLOCS 311
252 #define META_SK_ROUTE_CAPS 312
253 #define META_SK_HASH 313
254 #define META_SK_LINGERTIME 314
255 #define META_SK_ACK_BACKLOG 315
256 #define META_SK_MAX_ACK_BACKLOG 316
257 #define META_SK_PRIO 317
258 #define META_SK_RCVLOWAT 318
259 #define META_SK_RCVTIMEO 319
260 #define META_SK_SNDTIMEO 320
261 #define META_SK_SENDMSG_OFF 321
262 #define META_SK_WRITE_PENDING 322
263 #define META_VLAN 323
264 #define META_RXHASH 324
265 #define META_DEVNAME 325
266 #define META_SK_BOUND_IF 326
267 #define STR 327
268 #define QUOTED 328
269 
270 
271 
272 
273 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
274 typedef union YYSTYPE
275 {
276 
277 /* Line 293 of yacc.c */
278 #line 39 "route/cls/ematch_syntax.y"
279 
280  struct tcf_em_cmp cmp;
281  struct ematch_quoted q;
282  struct rtnl_ematch * e;
283  struct rtnl_pktloc * loc;
284  struct rtnl_meta_value *mv;
285  uint32_t i;
286  uint64_t i64;
287  char * s;
288 
289 
290 
291 /* Line 293 of yacc.c */
292 #line 293 "route/cls/ematch_syntax.c"
293 } YYSTYPE;
294 # define YYSTYPE_IS_TRIVIAL 1
295 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
296 # define YYSTYPE_IS_DECLARED 1
297 #endif
298 
299 
300 /* Copy the second part of user declarations. */
301 
302 /* Line 343 of yacc.c */
303 #line 50 "route/cls/ematch_syntax.y"
304 
305 extern int ematch_lex(YYSTYPE *, void *);
306 
307 static void yyerror(void *scanner, char **errp, struct nl_list_head *root, const char *msg)
308 {
309  if (msg)
310  *errp = strdup(msg);
311  else
312  *errp = NULL;
313 }
314 
315 
316 /* Line 343 of yacc.c */
317 #line 318 "route/cls/ematch_syntax.c"
318 
319 #ifdef short
320 # undef short
321 #endif
322 
323 #ifdef YYTYPE_UINT8
324 typedef YYTYPE_UINT8 yytype_uint8;
325 #else
326 typedef unsigned char yytype_uint8;
327 #endif
328 
329 #ifdef YYTYPE_INT8
330 typedef YYTYPE_INT8 yytype_int8;
331 #elif (defined __STDC__ || defined __C99__FUNC__ \
332  || defined __cplusplus || defined _MSC_VER)
333 typedef signed char yytype_int8;
334 #else
335 typedef short int yytype_int8;
336 #endif
337 
338 #ifdef YYTYPE_UINT16
339 typedef YYTYPE_UINT16 yytype_uint16;
340 #else
341 typedef unsigned short int yytype_uint16;
342 #endif
343 
344 #ifdef YYTYPE_INT16
345 typedef YYTYPE_INT16 yytype_int16;
346 #else
347 typedef short int yytype_int16;
348 #endif
349 
350 #ifndef YYSIZE_T
351 # ifdef __SIZE_TYPE__
352 # define YYSIZE_T __SIZE_TYPE__
353 # elif defined size_t
354 # define YYSIZE_T size_t
355 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
356  || defined __cplusplus || defined _MSC_VER)
357 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
358 # define YYSIZE_T size_t
359 # else
360 # define YYSIZE_T unsigned int
361 # endif
362 #endif
363 
364 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
365 
366 #ifndef YY_
367 # if defined YYENABLE_NLS && YYENABLE_NLS
368 # if ENABLE_NLS
369 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
370 # define YY_(msgid) dgettext ("bison-runtime", msgid)
371 # endif
372 # endif
373 # ifndef YY_
374 # define YY_(msgid) msgid
375 # endif
376 #endif
377 
378 /* Suppress unused-variable warnings by "using" E. */
379 #if ! defined lint || defined __GNUC__
380 # define YYUSE(e) ((void) (e))
381 #else
382 # define YYUSE(e) /* empty */
383 #endif
384 
385 /* Identity function, used to suppress warnings about constant conditions. */
386 #ifndef lint
387 # define YYID(n) (n)
388 #else
389 #if (defined __STDC__ || defined __C99__FUNC__ \
390  || defined __cplusplus || defined _MSC_VER)
391 static int
392 YYID (int yyi)
393 #else
394 static int
395 YYID (yyi)
396  int yyi;
397 #endif
398 {
399  return yyi;
400 }
401 #endif
402 
403 #if ! defined yyoverflow || YYERROR_VERBOSE
404 
405 /* The parser invokes alloca or malloc; define the necessary symbols. */
406 
407 # ifdef YYSTACK_USE_ALLOCA
408 # if YYSTACK_USE_ALLOCA
409 # ifdef __GNUC__
410 # define YYSTACK_ALLOC __builtin_alloca
411 # elif defined __BUILTIN_VA_ARG_INCR
412 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
413 # elif defined _AIX
414 # define YYSTACK_ALLOC __alloca
415 # elif defined _MSC_VER
416 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
417 # define alloca _alloca
418 # else
419 # define YYSTACK_ALLOC alloca
420 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
421  || defined __cplusplus || defined _MSC_VER)
422 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
423 # ifndef EXIT_SUCCESS
424 # define EXIT_SUCCESS 0
425 # endif
426 # endif
427 # endif
428 # endif
429 # endif
430 
431 # ifdef YYSTACK_ALLOC
432  /* Pacify GCC's `empty if-body' warning. */
433 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
434 # ifndef YYSTACK_ALLOC_MAXIMUM
435  /* The OS might guarantee only one guard page at the bottom of the stack,
436  and a page size can be as small as 4096 bytes. So we cannot safely
437  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
438  to allow for a few compiler-allocated temporary stack slots. */
439 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
440 # endif
441 # else
442 # define YYSTACK_ALLOC YYMALLOC
443 # define YYSTACK_FREE YYFREE
444 # ifndef YYSTACK_ALLOC_MAXIMUM
445 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
446 # endif
447 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
448  && ! ((defined YYMALLOC || defined malloc) \
449  && (defined YYFREE || defined free)))
450 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
451 # ifndef EXIT_SUCCESS
452 # define EXIT_SUCCESS 0
453 # endif
454 # endif
455 # ifndef YYMALLOC
456 # define YYMALLOC malloc
457 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
458  || defined __cplusplus || defined _MSC_VER)
459 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
460 # endif
461 # endif
462 # ifndef YYFREE
463 # define YYFREE free
464 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
465  || defined __cplusplus || defined _MSC_VER)
466 void free (void *); /* INFRINGES ON USER NAME SPACE */
467 # endif
468 # endif
469 # endif
470 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
471 
472 
473 #if (! defined yyoverflow \
474  && (! defined __cplusplus \
475  || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
476 
477 /* A type that is properly aligned for any stack member. */
478 union yyalloc
479 {
480  yytype_int16 yyss_alloc;
481  YYSTYPE yyvs_alloc;
482 };
483 
484 /* The size of the maximum gap between one aligned stack and the next. */
485 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
486 
487 /* The size of an array large to enough to hold all stacks, each with
488  N elements. */
489 # define YYSTACK_BYTES(N) \
490  ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
491  + YYSTACK_GAP_MAXIMUM)
492 
493 # define YYCOPY_NEEDED 1
494 
495 /* Relocate STACK from its old location to the new one. The
496  local variables YYSIZE and YYSTACKSIZE give the old and new number of
497  elements in the stack, and YYPTR gives the new location of the
498  stack. Advance YYPTR to a properly aligned location for the next
499  stack. */
500 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
501  do \
502  { \
503  YYSIZE_T yynewbytes; \
504  YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
505  Stack = &yyptr->Stack_alloc; \
506  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
507  yyptr += yynewbytes / sizeof (*yyptr); \
508  } \
509  while (YYID (0))
510 
511 #endif
512 
513 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
514 /* Copy COUNT objects from FROM to TO. The source and destination do
515  not overlap. */
516 # ifndef YYCOPY
517 # if defined __GNUC__ && 1 < __GNUC__
518 # define YYCOPY(To, From, Count) \
519  __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
520 # else
521 # define YYCOPY(To, From, Count) \
522  do \
523  { \
524  YYSIZE_T yyi; \
525  for (yyi = 0; yyi < (Count); yyi++) \
526  (To)[yyi] = (From)[yyi]; \
527  } \
528  while (YYID (0))
529 # endif
530 # endif
531 #endif /* !YYCOPY_NEEDED */
532 
533 /* YYFINAL -- State number of the termination state. */
534 #define YYFINAL 26
535 /* YYLAST -- Last index in YYTABLE. */
536 #define YYLAST 138
537 
538 /* YYNTOKENS -- Number of terminals. */
539 #define YYNTOKENS 74
540 /* YYNNTS -- Number of nonterminals. */
541 #define YYNNTS 18
542 /* YYNRULES -- Number of rules. */
543 #define YYNRULES 84
544 /* YYNRULES -- Number of states. */
545 #define YYNSTATES 118
546 
547 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
548 #define YYUNDEFTOK 2
549 #define YYMAXUTOK 328
550 
551 #define YYTRANSLATE(YYX) \
552  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
553 
554 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
555 static const yytype_uint8 yytranslate[] =
556 {
557  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
583  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
584  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
585  25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
586  35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
587  45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
588  55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
589  65, 66, 67, 68, 69, 70, 71, 72, 73
590 };
591 
592 #if YYDEBUG
593 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
594  YYRHS. */
595 static const yytype_uint8 yyprhs[] =
596 {
597  0, 0, 3, 4, 6, 8, 12, 15, 17, 19,
598  26, 34, 41, 45, 50, 52, 56, 57, 60, 61,
599  64, 66, 68, 72, 75, 77, 79, 81, 83, 85,
600  87, 89, 91, 93, 95, 97, 99, 101, 103, 105,
601  107, 109, 111, 113, 115, 117, 119, 121, 123, 125,
602  127, 129, 131, 133, 135, 137, 139, 141, 143, 145,
603  147, 149, 151, 153, 155, 157, 159, 161, 163, 165,
604  167, 169, 171, 173, 175, 181, 182, 185, 188, 189,
605  192, 193, 196, 198, 200
606 };
607 
608 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
609 static const yytype_int8 yyrhs[] =
610 {
611  75, 0, -1, -1, 76, -1, 77, -1, 77, 4,
612  76, -1, 5, 78, -1, 78, -1, 79, -1, 17,
613  10, 87, 20, 86, 11, -1, 18, 10, 72, 73,
614  81, 82, 11, -1, 19, 10, 83, 91, 83, 11,
615  -1, 10, 76, 11, -1, 16, 10, 80, 11, -1,
616  80, -1, 87, 91, 7, -1, -1, 23, 87, -1,
617  -1, 24, 87, -1, 73, -1, 7, -1, 84, 90,
618  89, -1, 85, 90, -1, 25, -1, 26, -1, 27,
619  -1, 28, -1, 29, -1, 30, -1, 31, -1, 32,
620  -1, 33, -1, 34, -1, 35, -1, 36, -1, 37,
621  -1, 38, -1, 39, -1, 40, -1, 41, -1, 42,
622  -1, 43, -1, 44, -1, 45, -1, 46, -1, 47,
623  -1, 48, -1, 49, -1, 50, -1, 51, -1, 52,
624  -1, 53, -1, 54, -1, 55, -1, 56, -1, 57,
625  -1, 58, -1, 59, -1, 60, -1, 61, -1, 62,
626  -1, 63, -1, 64, -1, 65, -1, 66, -1, 67,
627  -1, 68, -1, 69, -1, 70, -1, 71, -1, 73,
628  -1, 72, -1, 72, -1, 88, 9, 12, 7, 89,
629  -1, -1, 8, 15, -1, 7, 15, -1, -1, 13,
630  7, -1, -1, 14, 7, -1, 20, -1, 21, -1,
631  22, -1
632 };
633 
634 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
635 static const yytype_uint16 yyrline[] =
636 {
637  0, 148, 148, 150, 157, 161, 173, 178, 186, 201,
638  219, 246, 265, 293, 295, 300, 321, 322, 328, 329,
639  334, 336, 338, 340, 345, 346, 347, 348, 349, 350,
640  351, 352, 353, 354, 355, 356, 357, 358, 359, 360,
641  361, 362, 363, 364, 365, 366, 367, 368, 369, 370,
642  371, 372, 373, 374, 375, 376, 377, 378, 379, 380,
643  381, 382, 383, 384, 385, 386, 387, 388, 389, 393,
644  394, 401, 405, 434, 447, 473, 474, 476, 482, 483,
645  489, 490, 495, 497, 499
646 };
647 #endif
648 
649 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
650 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
651  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
652 static const char *const yytname[] =
653 {
654  "$end", "error", "$undefined", "ERROR", "LOGIC", "NOT", "OPERAND",
655  "NUMBER", "ALIGN", "LAYER", "\"(\"", "\")\"", "\"+\"", "\"mask\"",
656  "\">>\"", "\"at\"", "\"cmp\"", "\"pattern\"", "\"text\"", "\"meta\"",
657  "\"=\"", "\">\"", "\"<\"", "\"from\"", "\"to\"", "\"random\"",
658  "\"loadavg_0\"", "\"loadavg_1\"", "\"loadavg_2\"", "\"dev\"", "\"prio\"",
659  "\"proto\"", "\"pkttype\"", "\"pktlen\"", "\"datalen\"", "\"maclen\"",
660  "\"mark\"", "\"tcindex\"", "\"rtclassid\"", "\"rtiif\"", "\"sk_family\"",
661  "\"sk_state\"", "\"sk_reuse\"", "\"sk_refcnt\"", "\"sk_rcvbuf\"",
662  "\"sk_sndbuf\"", "\"sk_shutdown\"", "\"sk_proto\"", "\"sk_type\"",
663  "\"sk_rmem_alloc\"", "\"sk_wmem_alloc\"", "\"sk_wmem_queued\"",
664  "\"sk_rcv_qlen\"", "\"sk_snd_qlen\"", "\"sk_err_qlen\"",
665  "\"sk_forward_allocs\"", "\"sk_allocs\"", "\"sk_route_caps\"",
666  "\"sk_hash\"", "\"sk_lingertime\"", "\"sk_ack_backlog\"",
667  "\"sk_max_ack_backlog\"", "\"sk_prio\"", "\"sk_rcvlowat\"",
668  "\"sk_rcvtimeo\"", "\"sk_sndtimeo\"", "\"sk_sendmsg_off\"",
669  "\"sk_write_pending\"", "\"vlan\"", "\"rxhash\"", "\"devname\"",
670  "\"sk_bound_if\"", "STR", "QUOTED", "$accept", "input", "expr", "match",
671  "ematch", "cmp_match", "cmp_expr", "text_from", "text_to", "meta_value",
672  "meta_int_id", "meta_var_id", "pattern", "pktloc", "align", "mask",
673  "shift", "operand", 0
674 };
675 #endif
676 
677 # ifdef YYPRINT
678 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
679  token YYLEX-NUM. */
680 static const yytype_uint16 yytoknum[] =
681 {
682  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
683  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
684  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
685  285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
686  295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
687  305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
688  315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
689  325, 326, 327, 328
690 };
691 # endif
692 
693 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
694 static const yytype_uint8 yyr1[] =
695 {
696  0, 74, 75, 75, 76, 76, 77, 77, 78, 78,
697  78, 78, 78, 79, 79, 80, 81, 81, 82, 82,
698  83, 83, 83, 83, 84, 84, 84, 84, 84, 84,
699  84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
700  84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
701  84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
702  84, 84, 84, 84, 84, 84, 84, 84, 84, 85,
703  85, 86, 86, 87, 87, 88, 88, 88, 89, 89,
704  90, 90, 91, 91, 91
705 };
706 
707 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
708 static const yytype_uint8 yyr2[] =
709 {
710  0, 2, 0, 1, 1, 3, 2, 1, 1, 6,
711  7, 6, 3, 4, 1, 3, 0, 2, 0, 2,
712  1, 1, 3, 2, 1, 1, 1, 1, 1, 1,
713  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
714  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
715  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
716  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
717  1, 1, 1, 1, 5, 0, 2, 2, 0, 2,
718  0, 2, 1, 1, 1
719 };
720 
721 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
722  Performed when YYTABLE doesn't specify something else to do. Zero
723  means the default is an error. */
724 static const yytype_uint8 yydefact[] =
725 {
726  2, 75, 0, 0, 75, 0, 0, 0, 0, 73,
727  0, 3, 4, 7, 8, 14, 0, 0, 6, 77,
728  76, 0, 75, 75, 0, 0, 1, 75, 82, 83,
729  84, 0, 0, 12, 0, 0, 0, 21, 24, 25,
730  26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
731  36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
732  46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
733  56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
734  66, 67, 68, 69, 70, 20, 0, 80, 80, 5,
735  15, 0, 13, 0, 16, 0, 0, 78, 23, 78,
736  72, 71, 0, 75, 18, 0, 81, 0, 22, 74,
737  9, 17, 75, 0, 11, 79, 19, 10
738 };
739 
740 /* YYDEFGOTO[NTERM-NUM]. */
741 static const yytype_int8 yydefgoto[] =
742 {
743  -1, 10, 11, 12, 13, 14, 15, 104, 113, 86,
744  87, 88, 102, 16, 17, 108, 97, 31
745 };
746 
747 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
748  STATE-NUM. */
749 #define YYPACT_NINF -63
750 static const yytype_int8 yypact[] =
751 {
752  -4, 15, -13, -8, 11, 10, 14, 25, 29, -63,
753  26, -63, 37, -63, -63, -63, 16, 33, -63, -63,
754  -63, 32, 1, 1, -28, 65, -63, 11, -63, -63,
755  -63, 38, 34, -63, 36, 28, -24, -63, -63, -63,
756  -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
757  -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
758  -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
759  -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
760  -63, -63, -63, -63, -63, -63, 16, 39, 39, -63,
761  -63, 43, -63, -62, 31, 65, 44, 42, -63, 42,
762  -63, -63, 41, 1, 35, 45, -63, 50, -63, -63,
763  -63, -63, 1, 47, -63, -63, -63, -63
764 };
765 
766 /* YYPGOTO[NTERM-NUM]. */
767 static const yytype_int8 yypgoto[] =
768 {
769  -63, -63, 13, -63, 59, -63, 40, -63, -63, -34,
770  -63, -63, -63, -23, -63, -36, -22, -21
771 };
772 
773 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
774  positive, shift that token. If negative, reduce the rule which
775  number is the opposite. If YYTABLE_NINF, syntax error. */
776 #define YYTABLE_NINF -76
777 static const yytype_int8 yytable[] =
778 {
779  35, 1, 19, 2, 3, -75, 4, 20, 2, 3,
780  100, 101, 5, 6, 7, 8, 1, 21, 2, 3,
781  22, 4, 2, 3, 23, 4, 26, 5, 6, 7,
782  8, 5, 6, 7, 8, 24, 28, 29, 30, 25,
783  89, 27, 32, 33, 36, 90, 91, 92, 93, 94,
784  99, 106, 110, 96, 103, 107, 114, 115, 117, 112,
785  18, 105, 34, 109, 0, 95, 98, 0, 9, 0,
786  0, 0, 37, 9, 0, 0, 0, 0, 0, 0,
787  111, 0, 0, 9, 0, 0, 0, 9, 0, 116,
788  38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
789  48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
790  58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
791  68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
792  78, 79, 80, 81, 82, 83, 84, 0, 85
793 };
794 
795 #define yypact_value_is_default(yystate) \
796  ((yystate) == (-63))
797 
798 #define yytable_value_is_error(yytable_value) \
799  YYID (0)
800 
801 static const yytype_int8 yycheck[] =
802 {
803  23, 5, 15, 7, 8, 9, 10, 15, 7, 8,
804  72, 73, 16, 17, 18, 19, 5, 4, 7, 8,
805  10, 10, 7, 8, 10, 10, 0, 16, 17, 18,
806  19, 16, 17, 18, 19, 10, 20, 21, 22, 10,
807  27, 4, 9, 11, 72, 7, 12, 11, 20, 73,
808  7, 7, 11, 14, 23, 13, 11, 7, 11, 24,
809  1, 95, 22, 99, -1, 86, 88, -1, 72, -1,
810  -1, -1, 7, 72, -1, -1, -1, -1, -1, -1,
811  103, -1, -1, 72, -1, -1, -1, 72, -1, 112,
812  25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
813  35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
814  45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
815  55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
816  65, 66, 67, 68, 69, 70, 71, -1, 73
817 };
818 
819 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
820  symbol of state STATE-NUM. */
821 static const yytype_uint8 yystos[] =
822 {
823  0, 5, 7, 8, 10, 16, 17, 18, 19, 72,
824  75, 76, 77, 78, 79, 80, 87, 88, 78, 15,
825  15, 76, 10, 10, 10, 10, 0, 4, 20, 21,
826  22, 91, 9, 11, 80, 87, 72, 7, 25, 26,
827  27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
828  37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
829  47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
830  57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
831  67, 68, 69, 70, 71, 73, 83, 84, 85, 76,
832  7, 12, 11, 20, 73, 91, 14, 90, 90, 7,
833  72, 73, 86, 23, 81, 83, 7, 13, 89, 89,
834  11, 87, 24, 82, 11, 7, 87, 11
835 };
836 
837 #define yyerrok (yyerrstatus = 0)
838 #define yyclearin (yychar = YYEMPTY)
839 #define YYEMPTY (-2)
840 #define YYEOF 0
841 
842 #define YYACCEPT goto yyacceptlab
843 #define YYABORT goto yyabortlab
844 #define YYERROR goto yyerrorlab
845 
846 
847 /* Like YYERROR except do call yyerror. This remains here temporarily
848  to ease the transition to the new meaning of YYERROR, for GCC.
849  Once GCC version 2 has supplanted version 1, this can go. However,
850  YYFAIL appears to be in use. Nevertheless, it is formally deprecated
851  in Bison 2.4.2's NEWS entry, where a plan to phase it out is
852  discussed. */
853 
854 #define YYFAIL goto yyerrlab
855 #if defined YYFAIL
856  /* This is here to suppress warnings from the GCC cpp's
857  -Wunused-macros. Normally we don't worry about that warning, but
858  some users do, and we want to make it easy for users to remove
859  YYFAIL uses, which will produce warnings from Bison 2.5. */
860 #endif
861 
862 #define YYRECOVERING() (!!yyerrstatus)
863 
864 #define YYBACKUP(Token, Value) \
865 do \
866  if (yychar == YYEMPTY && yylen == 1) \
867  { \
868  yychar = (Token); \
869  yylval = (Value); \
870  YYPOPSTACK (1); \
871  goto yybackup; \
872  } \
873  else \
874  { \
875  yyerror (scanner, errp, root, YY_("syntax error: cannot back up")); \
876  YYERROR; \
877  } \
878 while (YYID (0))
879 
880 
881 #define YYTERROR 1
882 #define YYERRCODE 256
883 
884 
885 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
886  If N is 0, then set CURRENT to the empty location which ends
887  the previous symbol: RHS[0] (always defined). */
888 
889 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
890 #ifndef YYLLOC_DEFAULT
891 # define YYLLOC_DEFAULT(Current, Rhs, N) \
892  do \
893  if (YYID (N)) \
894  { \
895  (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
896  (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
897  (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
898  (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
899  } \
900  else \
901  { \
902  (Current).first_line = (Current).last_line = \
903  YYRHSLOC (Rhs, 0).last_line; \
904  (Current).first_column = (Current).last_column = \
905  YYRHSLOC (Rhs, 0).last_column; \
906  } \
907  while (YYID (0))
908 #endif
909 
910 
911 /* This macro is provided for backward compatibility. */
912 
913 #ifndef YY_LOCATION_PRINT
914 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
915 #endif
916 
917 
918 /* YYLEX -- calling `yylex' with the right arguments. */
919 
920 #ifdef YYLEX_PARAM
921 # define YYLEX yylex (&yylval, YYLEX_PARAM)
922 #else
923 # define YYLEX yylex (&yylval, scanner)
924 #endif
925 
926 /* Enable debugging if requested. */
927 #if YYDEBUG
928 
929 # ifndef YYFPRINTF
930 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
931 # define YYFPRINTF fprintf
932 # endif
933 
934 # define YYDPRINTF(Args) \
935 do { \
936  if (yydebug) \
937  YYFPRINTF Args; \
938 } while (YYID (0))
939 
940 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
941 do { \
942  if (yydebug) \
943  { \
944  YYFPRINTF (stderr, "%s ", Title); \
945  yy_symbol_print (stderr, \
946  Type, Value, scanner, errp, root); \
947  YYFPRINTF (stderr, "\n"); \
948  } \
949 } while (YYID (0))
950 
951 
952 /*--------------------------------.
953 | Print this symbol on YYOUTPUT. |
954 `--------------------------------*/
955 
956 /*ARGSUSED*/
957 #if (defined __STDC__ || defined __C99__FUNC__ \
958  || defined __cplusplus || defined _MSC_VER)
959 static void
960 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
961 #else
962 static void
963 yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, errp, root)
964  FILE *yyoutput;
965  int yytype;
966  YYSTYPE const * const yyvaluep;
967  void *scanner;
968  char **errp;
969  struct nl_list_head *root;
970 #endif
971 {
972  if (!yyvaluep)
973  return;
974  YYUSE (scanner);
975  YYUSE (errp);
976  YYUSE (root);
977 # ifdef YYPRINT
978  if (yytype < YYNTOKENS)
979  YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
980 # else
981  YYUSE (yyoutput);
982 # endif
983  switch (yytype)
984  {
985  default:
986  break;
987  }
988 }
989 
990 
991 /*--------------------------------.
992 | Print this symbol on YYOUTPUT. |
993 `--------------------------------*/
994 
995 #if (defined __STDC__ || defined __C99__FUNC__ \
996  || defined __cplusplus || defined _MSC_VER)
997 static void
998 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
999 #else
1000 static void
1001 yy_symbol_print (yyoutput, yytype, yyvaluep, scanner, errp, root)
1002  FILE *yyoutput;
1003  int yytype;
1004  YYSTYPE const * const yyvaluep;
1005  void *scanner;
1006  char **errp;
1007  struct nl_list_head *root;
1008 #endif
1009 {
1010  if (yytype < YYNTOKENS)
1011  YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1012  else
1013  YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1014 
1015  yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, errp, root);
1016  YYFPRINTF (yyoutput, ")");
1017 }
1018 
1019 /*------------------------------------------------------------------.
1020 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1021 | TOP (included). |
1022 `------------------------------------------------------------------*/
1023 
1024 #if (defined __STDC__ || defined __C99__FUNC__ \
1025  || defined __cplusplus || defined _MSC_VER)
1026 static void
1027 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1028 #else
1029 static void
1030 yy_stack_print (yybottom, yytop)
1031  yytype_int16 *yybottom;
1032  yytype_int16 *yytop;
1033 #endif
1034 {
1035  YYFPRINTF (stderr, "Stack now");
1036  for (; yybottom <= yytop; yybottom++)
1037  {
1038  int yybot = *yybottom;
1039  YYFPRINTF (stderr, " %d", yybot);
1040  }
1041  YYFPRINTF (stderr, "\n");
1042 }
1043 
1044 # define YY_STACK_PRINT(Bottom, Top) \
1045 do { \
1046  if (yydebug) \
1047  yy_stack_print ((Bottom), (Top)); \
1048 } while (YYID (0))
1049 
1050 
1051 /*------------------------------------------------.
1052 | Report that the YYRULE is going to be reduced. |
1053 `------------------------------------------------*/
1054 
1055 #if (defined __STDC__ || defined __C99__FUNC__ \
1056  || defined __cplusplus || defined _MSC_VER)
1057 static void
1058 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, void *scanner, char **errp, struct nl_list_head *root)
1059 #else
1060 static void
1061 yy_reduce_print (yyvsp, yyrule, scanner, errp, root)
1062  YYSTYPE *yyvsp;
1063  int yyrule;
1064  void *scanner;
1065  char **errp;
1066  struct nl_list_head *root;
1067 #endif
1068 {
1069  int yynrhs = yyr2[yyrule];
1070  int yyi;
1071  unsigned long int yylno = yyrline[yyrule];
1072  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1073  yyrule - 1, yylno);
1074  /* The symbols being reduced. */
1075  for (yyi = 0; yyi < yynrhs; yyi++)
1076  {
1077  YYFPRINTF (stderr, " $%d = ", yyi + 1);
1078  yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1079  &(yyvsp[(yyi + 1) - (yynrhs)])
1080  , scanner, errp, root);
1081  YYFPRINTF (stderr, "\n");
1082  }
1083 }
1084 
1085 # define YY_REDUCE_PRINT(Rule) \
1086 do { \
1087  if (yydebug) \
1088  yy_reduce_print (yyvsp, Rule, scanner, errp, root); \
1089 } while (YYID (0))
1090 
1091 /* Nonzero means print parse trace. It is left uninitialized so that
1092  multiple parsers can coexist. */
1093 int yydebug;
1094 #else /* !YYDEBUG */
1095 # define YYDPRINTF(Args)
1096 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1097 # define YY_STACK_PRINT(Bottom, Top)
1098 # define YY_REDUCE_PRINT(Rule)
1099 #endif /* !YYDEBUG */
1100 
1101 
1102 /* YYINITDEPTH -- initial size of the parser's stacks. */
1103 #ifndef YYINITDEPTH
1104 # define YYINITDEPTH 200
1105 #endif
1106 
1107 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1108  if the built-in stack extension method is used).
1109 
1110  Do not make this value too large; the results are undefined if
1111  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1112  evaluated with infinite-precision integer arithmetic. */
1113 
1114 #ifndef YYMAXDEPTH
1115 # define YYMAXDEPTH 10000
1116 #endif
1117 
1118 
1119 #if YYERROR_VERBOSE
1120 
1121 # ifndef yystrlen
1122 # if defined __GLIBC__ && defined _STRING_H
1123 # define yystrlen strlen
1124 # else
1125 /* Return the length of YYSTR. */
1126 #if (defined __STDC__ || defined __C99__FUNC__ \
1127  || defined __cplusplus || defined _MSC_VER)
1128 static YYSIZE_T
1129 yystrlen (const char *yystr)
1130 #else
1131 static YYSIZE_T
1132 yystrlen (yystr)
1133  const char *yystr;
1134 #endif
1135 {
1136  YYSIZE_T yylen;
1137  for (yylen = 0; yystr[yylen]; yylen++)
1138  continue;
1139  return yylen;
1140 }
1141 # endif
1142 # endif
1143 
1144 # ifndef yystpcpy
1145 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1146 # define yystpcpy stpcpy
1147 # else
1148 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1149  YYDEST. */
1150 #if (defined __STDC__ || defined __C99__FUNC__ \
1151  || defined __cplusplus || defined _MSC_VER)
1152 static char *
1153 yystpcpy (char *yydest, const char *yysrc)
1154 #else
1155 static char *
1156 yystpcpy (yydest, yysrc)
1157  char *yydest;
1158  const char *yysrc;
1159 #endif
1160 {
1161  char *yyd = yydest;
1162  const char *yys = yysrc;
1163 
1164  while ((*yyd++ = *yys++) != '\0')
1165  continue;
1166 
1167  return yyd - 1;
1168 }
1169 # endif
1170 # endif
1171 
1172 # ifndef yytnamerr
1173 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1174  quotes and backslashes, so that it's suitable for yyerror. The
1175  heuristic is that double-quoting is unnecessary unless the string
1176  contains an apostrophe, a comma, or backslash (other than
1177  backslash-backslash). YYSTR is taken from yytname. If YYRES is
1178  null, do not copy; instead, return the length of what the result
1179  would have been. */
1180 static YYSIZE_T
1181 yytnamerr (char *yyres, const char *yystr)
1182 {
1183  if (*yystr == '"')
1184  {
1185  YYSIZE_T yyn = 0;
1186  char const *yyp = yystr;
1187 
1188  for (;;)
1189  switch (*++yyp)
1190  {
1191  case '\'':
1192  case ',':
1193  goto do_not_strip_quotes;
1194 
1195  case '\\':
1196  if (*++yyp != '\\')
1197  goto do_not_strip_quotes;
1198  /* Fall through. */
1199  default:
1200  if (yyres)
1201  yyres[yyn] = *yyp;
1202  yyn++;
1203  break;
1204 
1205  case '"':
1206  if (yyres)
1207  yyres[yyn] = '\0';
1208  return yyn;
1209  }
1210  do_not_strip_quotes: ;
1211  }
1212 
1213  if (! yyres)
1214  return yystrlen (yystr);
1215 
1216  return yystpcpy (yyres, yystr) - yyres;
1217 }
1218 # endif
1219 
1220 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1221  about the unexpected token YYTOKEN for the state stack whose top is
1222  YYSSP.
1223 
1224  Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1225  not large enough to hold the message. In that case, also set
1226  *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1227  required number of bytes is too large to store. */
1228 static int
1229 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1230  yytype_int16 *yyssp, int yytoken)
1231 {
1232  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1233  YYSIZE_T yysize = yysize0;
1234  YYSIZE_T yysize1;
1235  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1236  /* Internationalized format string. */
1237  const char *yyformat = 0;
1238  /* Arguments of yyformat. */
1239  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1240  /* Number of reported tokens (one for the "unexpected", one per
1241  "expected"). */
1242  int yycount = 0;
1243 
1244  /* There are many possibilities here to consider:
1245  - Assume YYFAIL is not used. It's too flawed to consider. See
1246  <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1247  for details. YYERROR is fine as it does not invoke this
1248  function.
1249  - If this state is a consistent state with a default action, then
1250  the only way this function was invoked is if the default action
1251  is an error action. In that case, don't check for expected
1252  tokens because there are none.
1253  - The only way there can be no lookahead present (in yychar) is if
1254  this state is a consistent state with a default action. Thus,
1255  detecting the absence of a lookahead is sufficient to determine
1256  that there is no unexpected or expected token to report. In that
1257  case, just report a simple "syntax error".
1258  - Don't assume there isn't a lookahead just because this state is a
1259  consistent state with a default action. There might have been a
1260  previous inconsistent state, consistent state with a non-default
1261  action, or user semantic action that manipulated yychar.
1262  - Of course, the expected token list depends on states to have
1263  correct lookahead information, and it depends on the parser not
1264  to perform extra reductions after fetching a lookahead from the
1265  scanner and before detecting a syntax error. Thus, state merging
1266  (from LALR or IELR) and default reductions corrupt the expected
1267  token list. However, the list is correct for canonical LR with
1268  one exception: it will still contain any token that will not be
1269  accepted due to an error action in a later state.
1270  */
1271  if (yytoken != YYEMPTY)
1272  {
1273  int yyn = yypact[*yyssp];
1274  yyarg[yycount++] = yytname[yytoken];
1275  if (!yypact_value_is_default (yyn))
1276  {
1277  /* Start YYX at -YYN if negative to avoid negative indexes in
1278  YYCHECK. In other words, skip the first -YYN actions for
1279  this state because they are default actions. */
1280  int yyxbegin = yyn < 0 ? -yyn : 0;
1281  /* Stay within bounds of both yycheck and yytname. */
1282  int yychecklim = YYLAST - yyn + 1;
1283  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1284  int yyx;
1285 
1286  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1287  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1288  && !yytable_value_is_error (yytable[yyx + yyn]))
1289  {
1290  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1291  {
1292  yycount = 1;
1293  yysize = yysize0;
1294  break;
1295  }
1296  yyarg[yycount++] = yytname[yyx];
1297  yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1298  if (! (yysize <= yysize1
1299  && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1300  return 2;
1301  yysize = yysize1;
1302  }
1303  }
1304  }
1305 
1306  switch (yycount)
1307  {
1308 # define YYCASE_(N, S) \
1309  case N: \
1310  yyformat = S; \
1311  break
1312  YYCASE_(0, YY_("syntax error"));
1313  YYCASE_(1, YY_("syntax error, unexpected %s"));
1314  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1315  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1316  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1317  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1318 # undef YYCASE_
1319  }
1320 
1321  yysize1 = yysize + yystrlen (yyformat);
1322  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1323  return 2;
1324  yysize = yysize1;
1325 
1326  if (*yymsg_alloc < yysize)
1327  {
1328  *yymsg_alloc = 2 * yysize;
1329  if (! (yysize <= *yymsg_alloc
1330  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1331  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1332  return 1;
1333  }
1334 
1335  /* Avoid sprintf, as that infringes on the user's name space.
1336  Don't have undefined behavior even if the translation
1337  produced a string with the wrong number of "%s"s. */
1338  {
1339  char *yyp = *yymsg;
1340  int yyi = 0;
1341  while ((*yyp = *yyformat) != '\0')
1342  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1343  {
1344  yyp += yytnamerr (yyp, yyarg[yyi++]);
1345  yyformat += 2;
1346  }
1347  else
1348  {
1349  yyp++;
1350  yyformat++;
1351  }
1352  }
1353  return 0;
1354 }
1355 #endif /* YYERROR_VERBOSE */
1356 
1357 /*-----------------------------------------------.
1358 | Release the memory associated to this symbol. |
1359 `-----------------------------------------------*/
1360 
1361 /*ARGSUSED*/
1362 #if (defined __STDC__ || defined __C99__FUNC__ \
1363  || defined __cplusplus || defined _MSC_VER)
1364 static void
1365 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
1366 #else
1367 static void
1368 yydestruct (yymsg, yytype, yyvaluep, scanner, errp, root)
1369  const char *yymsg;
1370  int yytype;
1371  YYSTYPE *yyvaluep;
1372  void *scanner;
1373  char **errp;
1374  struct nl_list_head *root;
1375 #endif
1376 {
1377  YYUSE (yyvaluep);
1378  YYUSE (scanner);
1379  YYUSE (errp);
1380  YYUSE (root);
1381 
1382  if (!yymsg)
1383  yymsg = "Deleting";
1384  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1385 
1386  switch (yytype)
1387  {
1388  case 72: /* "STR" */
1389 
1390 /* Line 1391 of yacc.c */
1391 #line 139 "route/cls/ematch_syntax.y"
1392  { free((yyvaluep->s)); NL_DBG(2, "string destructor\n"); };
1393 
1394 /* Line 1391 of yacc.c */
1395 #line 1396 "route/cls/ematch_syntax.c"
1396  break;
1397  case 73: /* "QUOTED" */
1398 
1399 /* Line 1391 of yacc.c */
1400 #line 141 "route/cls/ematch_syntax.y"
1401  { free((yyvaluep->q).data); NL_DBG(2, "quoted destructor\n"); };
1402 
1403 /* Line 1391 of yacc.c */
1404 #line 1405 "route/cls/ematch_syntax.c"
1405  break;
1406  case 81: /* "text_from" */
1407 
1408 /* Line 1391 of yacc.c */
1409 #line 140 "route/cls/ematch_syntax.y"
1410  { rtnl_pktloc_put((yyvaluep->loc)); NL_DBG(2, "pktloc destructor\n"); };
1411 
1412 /* Line 1391 of yacc.c */
1413 #line 1414 "route/cls/ematch_syntax.c"
1414  break;
1415  case 82: /* "text_to" */
1416 
1417 /* Line 1391 of yacc.c */
1418 #line 140 "route/cls/ematch_syntax.y"
1419  { rtnl_pktloc_put((yyvaluep->loc)); NL_DBG(2, "pktloc destructor\n"); };
1420 
1421 /* Line 1391 of yacc.c */
1422 #line 1423 "route/cls/ematch_syntax.c"
1423  break;
1424  case 83: /* "meta_value" */
1425 
1426 /* Line 1391 of yacc.c */
1427 #line 142 "route/cls/ematch_syntax.y"
1428  { rtnl_meta_value_put((yyvaluep->mv)); NL_DBG(2, "meta value destructor\n"); };
1429 
1430 /* Line 1391 of yacc.c */
1431 #line 1432 "route/cls/ematch_syntax.c"
1432  break;
1433  case 86: /* "pattern" */
1434 
1435 /* Line 1391 of yacc.c */
1436 #line 141 "route/cls/ematch_syntax.y"
1437  { free((yyvaluep->q).data); NL_DBG(2, "quoted destructor\n"); };
1438 
1439 /* Line 1391 of yacc.c */
1440 #line 1441 "route/cls/ematch_syntax.c"
1441  break;
1442  case 87: /* "pktloc" */
1443 
1444 /* Line 1391 of yacc.c */
1445 #line 140 "route/cls/ematch_syntax.y"
1446  { rtnl_pktloc_put((yyvaluep->loc)); NL_DBG(2, "pktloc destructor\n"); };
1447 
1448 /* Line 1391 of yacc.c */
1449 #line 1450 "route/cls/ematch_syntax.c"
1450  break;
1451 
1452  default:
1453  break;
1454  }
1455 }
1456 
1457 
1458 /* Prevent warnings from -Wmissing-prototypes. */
1459 #ifdef YYPARSE_PARAM
1460 #if defined __STDC__ || defined __cplusplus
1461 int yyparse (void *YYPARSE_PARAM);
1462 #else
1463 int yyparse ();
1464 #endif
1465 #else /* ! YYPARSE_PARAM */
1466 #if defined __STDC__ || defined __cplusplus
1467 int yyparse (void *scanner, char **errp, struct nl_list_head *root);
1468 #else
1469 int yyparse ();
1470 #endif
1471 #endif /* ! YYPARSE_PARAM */
1472 
1473 
1474 /*----------.
1475 | yyparse. |
1476 `----------*/
1477 
1478 #ifdef YYPARSE_PARAM
1479 #if (defined __STDC__ || defined __C99__FUNC__ \
1480  || defined __cplusplus || defined _MSC_VER)
1481 int
1482 yyparse (void *YYPARSE_PARAM)
1483 #else
1484 int
1485 yyparse (YYPARSE_PARAM)
1486  void *YYPARSE_PARAM;
1487 #endif
1488 #else /* ! YYPARSE_PARAM */
1489 #if (defined __STDC__ || defined __C99__FUNC__ \
1490  || defined __cplusplus || defined _MSC_VER)
1491 int
1492 yyparse (void *scanner, char **errp, struct nl_list_head *root)
1493 #else
1494 int
1495 yyparse (scanner, errp, root)
1496  void *scanner;
1497  char **errp;
1498  struct nl_list_head *root;
1499 #endif
1500 #endif
1501 {
1502 /* The lookahead symbol. */
1503 int yychar;
1504 
1505 /* The semantic value of the lookahead symbol. */
1506 YYSTYPE yylval;
1507 
1508  /* Number of syntax errors so far. */
1509  int yynerrs;
1510 
1511  int yystate;
1512  /* Number of tokens to shift before error messages enabled. */
1513  int yyerrstatus;
1514 
1515  /* The stacks and their tools:
1516  `yyss': related to states.
1517  `yyvs': related to semantic values.
1518 
1519  Refer to the stacks thru separate pointers, to allow yyoverflow
1520  to reallocate them elsewhere. */
1521 
1522  /* The state stack. */
1523  yytype_int16 yyssa[YYINITDEPTH];
1524  yytype_int16 *yyss;
1525  yytype_int16 *yyssp;
1526 
1527  /* The semantic value stack. */
1528  YYSTYPE yyvsa[YYINITDEPTH];
1529  YYSTYPE *yyvs;
1530  YYSTYPE *yyvsp;
1531 
1532  YYSIZE_T yystacksize;
1533 
1534  int yyn;
1535  int yyresult;
1536  /* Lookahead token as an internal (translated) token number. */
1537  int yytoken;
1538  /* The variables used to return semantic value and location from the
1539  action routines. */
1540  YYSTYPE yyval;
1541 
1542 #if YYERROR_VERBOSE
1543  /* Buffer for error messages, and its allocated size. */
1544  char yymsgbuf[128];
1545  char *yymsg = yymsgbuf;
1546  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1547 #endif
1548 
1549 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1550 
1551  /* The number of symbols on the RHS of the reduced rule.
1552  Keep to zero when no symbol should be popped. */
1553  int yylen = 0;
1554 
1555  yytoken = 0;
1556  yyss = yyssa;
1557  yyvs = yyvsa;
1558  yystacksize = YYINITDEPTH;
1559 
1560  YYDPRINTF ((stderr, "Starting parse\n"));
1561 
1562  yystate = 0;
1563  yyerrstatus = 0;
1564  yynerrs = 0;
1565  yychar = YYEMPTY; /* Cause a token to be read. */
1566 
1567  /* Initialize stack pointers.
1568  Waste one element of value and location stack
1569  so that they stay on the same level as the state stack.
1570  The wasted elements are never initialized. */
1571  yyssp = yyss;
1572  yyvsp = yyvs;
1573 
1574  goto yysetstate;
1575 
1576 /*------------------------------------------------------------.
1577 | yynewstate -- Push a new state, which is found in yystate. |
1578 `------------------------------------------------------------*/
1579  yynewstate:
1580  /* In all cases, when you get here, the value and location stacks
1581  have just been pushed. So pushing a state here evens the stacks. */
1582  yyssp++;
1583 
1584  yysetstate:
1585  *yyssp = yystate;
1586 
1587  if (yyss + yystacksize - 1 <= yyssp)
1588  {
1589  /* Get the current used size of the three stacks, in elements. */
1590  YYSIZE_T yysize = yyssp - yyss + 1;
1591 
1592 #ifdef yyoverflow
1593  {
1594  /* Give user a chance to reallocate the stack. Use copies of
1595  these so that the &'s don't force the real ones into
1596  memory. */
1597  YYSTYPE *yyvs1 = yyvs;
1598  yytype_int16 *yyss1 = yyss;
1599 
1600  /* Each stack pointer address is followed by the size of the
1601  data in use in that stack, in bytes. This used to be a
1602  conditional around just the two extra args, but that might
1603  be undefined if yyoverflow is a macro. */
1604  yyoverflow (YY_("memory exhausted"),
1605  &yyss1, yysize * sizeof (*yyssp),
1606  &yyvs1, yysize * sizeof (*yyvsp),
1607  &yystacksize);
1608 
1609  yyss = yyss1;
1610  yyvs = yyvs1;
1611  }
1612 #else /* no yyoverflow */
1613 # ifndef YYSTACK_RELOCATE
1614  goto yyexhaustedlab;
1615 # else
1616  /* Extend the stack our own way. */
1617  if (YYMAXDEPTH <= yystacksize)
1618  goto yyexhaustedlab;
1619  yystacksize *= 2;
1620  if (YYMAXDEPTH < yystacksize)
1621  yystacksize = YYMAXDEPTH;
1622 
1623  {
1624  yytype_int16 *yyss1 = yyss;
1625  union yyalloc *yyptr =
1626  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1627  if (! yyptr)
1628  goto yyexhaustedlab;
1629  YYSTACK_RELOCATE (yyss_alloc, yyss);
1630  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1631 # undef YYSTACK_RELOCATE
1632  if (yyss1 != yyssa)
1633  YYSTACK_FREE (yyss1);
1634  }
1635 # endif
1636 #endif /* no yyoverflow */
1637 
1638  yyssp = yyss + yysize - 1;
1639  yyvsp = yyvs + yysize - 1;
1640 
1641  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1642  (unsigned long int) yystacksize));
1643 
1644  if (yyss + yystacksize - 1 <= yyssp)
1645  YYABORT;
1646  }
1647 
1648  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1649 
1650  if (yystate == YYFINAL)
1651  YYACCEPT;
1652 
1653  goto yybackup;
1654 
1655 /*-----------.
1656 | yybackup. |
1657 `-----------*/
1658 yybackup:
1659 
1660  /* Do appropriate processing given the current state. Read a
1661  lookahead token if we need one and don't already have one. */
1662 
1663  /* First try to decide what to do without reference to lookahead token. */
1664  yyn = yypact[yystate];
1665  if (yypact_value_is_default (yyn))
1666  goto yydefault;
1667 
1668  /* Not known => get a lookahead token if don't already have one. */
1669 
1670  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1671  if (yychar == YYEMPTY)
1672  {
1673  YYDPRINTF ((stderr, "Reading a token: "));
1674  yychar = YYLEX;
1675  }
1676 
1677  if (yychar <= YYEOF)
1678  {
1679  yychar = yytoken = YYEOF;
1680  YYDPRINTF ((stderr, "Now at end of input.\n"));
1681  }
1682  else
1683  {
1684  yytoken = YYTRANSLATE (yychar);
1685  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1686  }
1687 
1688  /* If the proper action on seeing token YYTOKEN is to reduce or to
1689  detect an error, take that action. */
1690  yyn += yytoken;
1691  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1692  goto yydefault;
1693  yyn = yytable[yyn];
1694  if (yyn <= 0)
1695  {
1696  if (yytable_value_is_error (yyn))
1697  goto yyerrlab;
1698  yyn = -yyn;
1699  goto yyreduce;
1700  }
1701 
1702  /* Count tokens shifted since error; after three, turn off error
1703  status. */
1704  if (yyerrstatus)
1705  yyerrstatus--;
1706 
1707  /* Shift the lookahead token. */
1708  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1709 
1710  /* Discard the shifted token. */
1711  yychar = YYEMPTY;
1712 
1713  yystate = yyn;
1714  *++yyvsp = yylval;
1715 
1716  goto yynewstate;
1717 
1718 
1719 /*-----------------------------------------------------------.
1720 | yydefault -- do the default action for the current state. |
1721 `-----------------------------------------------------------*/
1722 yydefault:
1723  yyn = yydefact[yystate];
1724  if (yyn == 0)
1725  goto yyerrlab;
1726  goto yyreduce;
1727 
1728 
1729 /*-----------------------------.
1730 | yyreduce -- Do a reduction. |
1731 `-----------------------------*/
1732 yyreduce:
1733  /* yyn is the number of a rule to reduce with. */
1734  yylen = yyr2[yyn];
1735 
1736  /* If YYLEN is nonzero, implement the default value of the action:
1737  `$$ = $1'.
1738 
1739  Otherwise, the following line sets YYVAL to garbage.
1740  This behavior is undocumented and Bison
1741  users should not rely upon it. Assigning to YYVAL
1742  unconditionally makes the parser a bit smaller, and it avoids a
1743  GCC warning that YYVAL may be used uninitialized. */
1744  yyval = yyvsp[1-yylen];
1745 
1746 
1747  YY_REDUCE_PRINT (yyn);
1748  switch (yyn)
1749  {
1750  case 3:
1751 
1752 /* Line 1806 of yacc.c */
1753 #line 151 "route/cls/ematch_syntax.y"
1754  {
1755  nl_list_add_tail(root, &(yyvsp[(1) - (1)].e)->e_list);
1756  }
1757  break;
1758 
1759  case 4:
1760 
1761 /* Line 1806 of yacc.c */
1762 #line 158 "route/cls/ematch_syntax.y"
1763  {
1764  (yyval.e) = (yyvsp[(1) - (1)].e);
1765  }
1766  break;
1767 
1768  case 5:
1769 
1770 /* Line 1806 of yacc.c */
1771 #line 162 "route/cls/ematch_syntax.y"
1772  {
1773  rtnl_ematch_set_flags((yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].i));
1774 
1775  /* make ematch new head */
1776  nl_list_add_tail(&(yyvsp[(1) - (3)].e)->e_list, &(yyvsp[(3) - (3)].e)->e_list);
1777 
1778  (yyval.e) = (yyvsp[(1) - (3)].e);
1779  }
1780  break;
1781 
1782  case 6:
1783 
1784 /* Line 1806 of yacc.c */
1785 #line 174 "route/cls/ematch_syntax.y"
1786  {
1787  rtnl_ematch_set_flags((yyvsp[(2) - (2)].e), TCF_EM_INVERT);
1788  (yyval.e) = (yyvsp[(2) - (2)].e);
1789  }
1790  break;
1791 
1792  case 7:
1793 
1794 /* Line 1806 of yacc.c */
1795 #line 179 "route/cls/ematch_syntax.y"
1796  {
1797  (yyval.e) = (yyvsp[(1) - (1)].e);
1798  }
1799  break;
1800 
1801  case 8:
1802 
1803 /* Line 1806 of yacc.c */
1804 #line 187 "route/cls/ematch_syntax.y"
1805  {
1806  struct rtnl_ematch *e;
1807 
1808  if (!(e = rtnl_ematch_alloc())) {
1809  *errp = strdup("Unable to allocate ematch object");
1810  YYABORT;
1811  }
1812 
1813  if (rtnl_ematch_set_kind(e, TCF_EM_CMP) < 0)
1814  BUG();
1815 
1816  rtnl_ematch_cmp_set(e, &(yyvsp[(1) - (1)].cmp));
1817  (yyval.e) = e;
1818  }
1819  break;
1820 
1821  case 9:
1822 
1823 /* Line 1806 of yacc.c */
1824 #line 202 "route/cls/ematch_syntax.y"
1825  {
1826  struct rtnl_ematch *e;
1827 
1828  if (!(e = rtnl_ematch_alloc())) {
1829  *errp = strdup("Unable to allocate ematch object");
1830  YYABORT;
1831  }
1832 
1833  if (rtnl_ematch_set_kind(e, TCF_EM_NBYTE) < 0)
1834  BUG();
1835 
1836  rtnl_ematch_nbyte_set_offset(e, (yyvsp[(3) - (6)].loc)->layer, (yyvsp[(3) - (6)].loc)->offset);
1837  rtnl_pktloc_put((yyvsp[(3) - (6)].loc));
1838  rtnl_ematch_nbyte_set_pattern(e, (uint8_t *) (yyvsp[(5) - (6)].q).data, (yyvsp[(5) - (6)].q).index);
1839 
1840  (yyval.e) = e;
1841  }
1842  break;
1843 
1844  case 10:
1845 
1846 /* Line 1806 of yacc.c */
1847 #line 220 "route/cls/ematch_syntax.y"
1848  {
1849  struct rtnl_ematch *e;
1850 
1851  if (!(e = rtnl_ematch_alloc())) {
1852  *errp = strdup("Unable to allocate ematch object");
1853  YYABORT;
1854  }
1855 
1856  if (rtnl_ematch_set_kind(e, TCF_EM_TEXT) < 0)
1857  BUG();
1858 
1859  rtnl_ematch_text_set_algo(e, (yyvsp[(3) - (7)].s));
1860  rtnl_ematch_text_set_pattern(e, (yyvsp[(4) - (7)].q).data, (yyvsp[(4) - (7)].q).index);
1861 
1862  if ((yyvsp[(5) - (7)].loc)) {
1863  rtnl_ematch_text_set_from(e, (yyvsp[(5) - (7)].loc)->layer, (yyvsp[(5) - (7)].loc)->offset);
1864  rtnl_pktloc_put((yyvsp[(5) - (7)].loc));
1865  }
1866 
1867  if ((yyvsp[(6) - (7)].loc)) {
1868  rtnl_ematch_text_set_to(e, (yyvsp[(6) - (7)].loc)->layer, (yyvsp[(6) - (7)].loc)->offset);
1869  rtnl_pktloc_put((yyvsp[(6) - (7)].loc));
1870  }
1871 
1872  (yyval.e) = e;
1873  }
1874  break;
1875 
1876  case 11:
1877 
1878 /* Line 1806 of yacc.c */
1879 #line 247 "route/cls/ematch_syntax.y"
1880  {
1881  struct rtnl_ematch *e;
1882 
1883  if (!(e = rtnl_ematch_alloc())) {
1884  *errp = strdup("Unable to allocate ematch object");
1885  YYABORT;
1886  }
1887 
1888  if (rtnl_ematch_set_kind(e, TCF_EM_META) < 0)
1889  BUG();
1890 
1891  rtnl_ematch_meta_set_lvalue(e, (yyvsp[(3) - (6)].mv));
1892  rtnl_ematch_meta_set_rvalue(e, (yyvsp[(5) - (6)].mv));
1893  rtnl_ematch_meta_set_operand(e, (yyvsp[(4) - (6)].i));
1894 
1895  (yyval.e) = e;
1896  }
1897  break;
1898 
1899  case 12:
1900 
1901 /* Line 1806 of yacc.c */
1902 #line 266 "route/cls/ematch_syntax.y"
1903  {
1904  struct rtnl_ematch *e;
1905 
1906  if (!(e = rtnl_ematch_alloc())) {
1907  *errp = strdup("Unable to allocate ematch object");
1908  YYABORT;
1909  }
1910 
1911  if (rtnl_ematch_set_kind(e, TCF_EM_CONTAINER) < 0)
1912  BUG();
1913 
1914  /* Make e->childs the list head of a the ematch sequence */
1915  nl_list_add_tail(&e->e_childs, &(yyvsp[(2) - (3)].e)->e_list);
1916 
1917  (yyval.e) = e;
1918  }
1919  break;
1920 
1921  case 13:
1922 
1923 /* Line 1806 of yacc.c */
1924 #line 294 "route/cls/ematch_syntax.y"
1925  { (yyval.cmp) = (yyvsp[(3) - (4)].cmp); }
1926  break;
1927 
1928  case 14:
1929 
1930 /* Line 1806 of yacc.c */
1931 #line 296 "route/cls/ematch_syntax.y"
1932  { (yyval.cmp) = (yyvsp[(1) - (1)].cmp); }
1933  break;
1934 
1935  case 15:
1936 
1937 /* Line 1806 of yacc.c */
1938 #line 301 "route/cls/ematch_syntax.y"
1939  {
1940  if ((yyvsp[(1) - (3)].loc)->align == TCF_EM_ALIGN_U16 ||
1941  (yyvsp[(1) - (3)].loc)->align == TCF_EM_ALIGN_U32)
1942  (yyval.cmp).flags = TCF_EM_CMP_TRANS;
1943 
1944  memset(&(yyval.cmp), 0, sizeof((yyval.cmp)));
1945 
1946  (yyval.cmp).mask = (yyvsp[(1) - (3)].loc)->mask;
1947  (yyval.cmp).off = (yyvsp[(1) - (3)].loc)->offset;
1948  (yyval.cmp).align = (yyvsp[(1) - (3)].loc)->align;
1949  (yyval.cmp).layer = (yyvsp[(1) - (3)].loc)->layer;
1950  (yyval.cmp).opnd = (yyvsp[(2) - (3)].i);
1951  (yyval.cmp).val = (yyvsp[(3) - (3)].i);
1952 
1953  rtnl_pktloc_put((yyvsp[(1) - (3)].loc));
1954  }
1955  break;
1956 
1957  case 16:
1958 
1959 /* Line 1806 of yacc.c */
1960 #line 321 "route/cls/ematch_syntax.y"
1961  { (yyval.loc) = NULL; }
1962  break;
1963 
1964  case 17:
1965 
1966 /* Line 1806 of yacc.c */
1967 #line 323 "route/cls/ematch_syntax.y"
1968  { (yyval.loc) = (yyvsp[(2) - (2)].loc); }
1969  break;
1970 
1971  case 18:
1972 
1973 /* Line 1806 of yacc.c */
1974 #line 328 "route/cls/ematch_syntax.y"
1975  { (yyval.loc) = NULL; }
1976  break;
1977 
1978  case 19:
1979 
1980 /* Line 1806 of yacc.c */
1981 #line 330 "route/cls/ematch_syntax.y"
1982  { (yyval.loc) = (yyvsp[(2) - (2)].loc); }
1983  break;
1984 
1985  case 20:
1986 
1987 /* Line 1806 of yacc.c */
1988 #line 335 "route/cls/ematch_syntax.y"
1989  { (yyval.mv) = rtnl_meta_value_alloc_var((yyvsp[(1) - (1)].q).data, (yyvsp[(1) - (1)].q).len); }
1990  break;
1991 
1992  case 21:
1993 
1994 /* Line 1806 of yacc.c */
1995 #line 337 "route/cls/ematch_syntax.y"
1996  { (yyval.mv) = rtnl_meta_value_alloc_int((yyvsp[(1) - (1)].i)); }
1997  break;
1998 
1999  case 22:
2000 
2001 /* Line 1806 of yacc.c */
2002 #line 339 "route/cls/ematch_syntax.y"
2003  { (yyval.mv) = META_ALLOC(META_INT, (yyvsp[(1) - (3)].i), (yyvsp[(2) - (3)].i), (yyvsp[(3) - (3)].i64)); }
2004  break;
2005 
2006  case 23:
2007 
2008 /* Line 1806 of yacc.c */
2009 #line 341 "route/cls/ematch_syntax.y"
2010  { (yyval.mv) = META_ALLOC(META_VAR, (yyvsp[(1) - (2)].i), (yyvsp[(2) - (2)].i), 0); }
2011  break;
2012 
2013  case 24:
2014 
2015 /* Line 1806 of yacc.c */
2016 #line 345 "route/cls/ematch_syntax.y"
2017  { (yyval.i) = META_ID(RANDOM); }
2018  break;
2019 
2020  case 25:
2021 
2022 /* Line 1806 of yacc.c */
2023 #line 346 "route/cls/ematch_syntax.y"
2024  { (yyval.i) = META_ID(LOADAVG_0); }
2025  break;
2026 
2027  case 26:
2028 
2029 /* Line 1806 of yacc.c */
2030 #line 347 "route/cls/ematch_syntax.y"
2031  { (yyval.i) = META_ID(LOADAVG_1); }
2032  break;
2033 
2034  case 27:
2035 
2036 /* Line 1806 of yacc.c */
2037 #line 348 "route/cls/ematch_syntax.y"
2038  { (yyval.i) = META_ID(LOADAVG_2); }
2039  break;
2040 
2041  case 28:
2042 
2043 /* Line 1806 of yacc.c */
2044 #line 349 "route/cls/ematch_syntax.y"
2045  { (yyval.i) = META_ID(DEV); }
2046  break;
2047 
2048  case 29:
2049 
2050 /* Line 1806 of yacc.c */
2051 #line 350 "route/cls/ematch_syntax.y"
2052  { (yyval.i) = META_ID(PRIORITY); }
2053  break;
2054 
2055  case 30:
2056 
2057 /* Line 1806 of yacc.c */
2058 #line 351 "route/cls/ematch_syntax.y"
2059  { (yyval.i) = META_ID(PROTOCOL); }
2060  break;
2061 
2062  case 31:
2063 
2064 /* Line 1806 of yacc.c */
2065 #line 352 "route/cls/ematch_syntax.y"
2066  { (yyval.i) = META_ID(PKTTYPE); }
2067  break;
2068 
2069  case 32:
2070 
2071 /* Line 1806 of yacc.c */
2072 #line 353 "route/cls/ematch_syntax.y"
2073  { (yyval.i) = META_ID(PKTLEN); }
2074  break;
2075 
2076  case 33:
2077 
2078 /* Line 1806 of yacc.c */
2079 #line 354 "route/cls/ematch_syntax.y"
2080  { (yyval.i) = META_ID(DATALEN); }
2081  break;
2082 
2083  case 34:
2084 
2085 /* Line 1806 of yacc.c */
2086 #line 355 "route/cls/ematch_syntax.y"
2087  { (yyval.i) = META_ID(MACLEN); }
2088  break;
2089 
2090  case 35:
2091 
2092 /* Line 1806 of yacc.c */
2093 #line 356 "route/cls/ematch_syntax.y"
2094  { (yyval.i) = META_ID(NFMARK); }
2095  break;
2096 
2097  case 36:
2098 
2099 /* Line 1806 of yacc.c */
2100 #line 357 "route/cls/ematch_syntax.y"
2101  { (yyval.i) = META_ID(TCINDEX); }
2102  break;
2103 
2104  case 37:
2105 
2106 /* Line 1806 of yacc.c */
2107 #line 358 "route/cls/ematch_syntax.y"
2108  { (yyval.i) = META_ID(RTCLASSID); }
2109  break;
2110 
2111  case 38:
2112 
2113 /* Line 1806 of yacc.c */
2114 #line 359 "route/cls/ematch_syntax.y"
2115  { (yyval.i) = META_ID(RTIIF); }
2116  break;
2117 
2118  case 39:
2119 
2120 /* Line 1806 of yacc.c */
2121 #line 360 "route/cls/ematch_syntax.y"
2122  { (yyval.i) = META_ID(SK_FAMILY); }
2123  break;
2124 
2125  case 40:
2126 
2127 /* Line 1806 of yacc.c */
2128 #line 361 "route/cls/ematch_syntax.y"
2129  { (yyval.i) = META_ID(SK_STATE); }
2130  break;
2131 
2132  case 41:
2133 
2134 /* Line 1806 of yacc.c */
2135 #line 362 "route/cls/ematch_syntax.y"
2136  { (yyval.i) = META_ID(SK_REUSE); }
2137  break;
2138 
2139  case 42:
2140 
2141 /* Line 1806 of yacc.c */
2142 #line 363 "route/cls/ematch_syntax.y"
2143  { (yyval.i) = META_ID(SK_REFCNT); }
2144  break;
2145 
2146  case 43:
2147 
2148 /* Line 1806 of yacc.c */
2149 #line 364 "route/cls/ematch_syntax.y"
2150  { (yyval.i) = META_ID(SK_RCVBUF); }
2151  break;
2152 
2153  case 44:
2154 
2155 /* Line 1806 of yacc.c */
2156 #line 365 "route/cls/ematch_syntax.y"
2157  { (yyval.i) = META_ID(SK_SNDBUF); }
2158  break;
2159 
2160  case 45:
2161 
2162 /* Line 1806 of yacc.c */
2163 #line 366 "route/cls/ematch_syntax.y"
2164  { (yyval.i) = META_ID(SK_SHUTDOWN); }
2165  break;
2166 
2167  case 46:
2168 
2169 /* Line 1806 of yacc.c */
2170 #line 367 "route/cls/ematch_syntax.y"
2171  { (yyval.i) = META_ID(SK_PROTO); }
2172  break;
2173 
2174  case 47:
2175 
2176 /* Line 1806 of yacc.c */
2177 #line 368 "route/cls/ematch_syntax.y"
2178  { (yyval.i) = META_ID(SK_TYPE); }
2179  break;
2180 
2181  case 48:
2182 
2183 /* Line 1806 of yacc.c */
2184 #line 369 "route/cls/ematch_syntax.y"
2185  { (yyval.i) = META_ID(SK_RMEM_ALLOC); }
2186  break;
2187 
2188  case 49:
2189 
2190 /* Line 1806 of yacc.c */
2191 #line 370 "route/cls/ematch_syntax.y"
2192  { (yyval.i) = META_ID(SK_WMEM_ALLOC); }
2193  break;
2194 
2195  case 50:
2196 
2197 /* Line 1806 of yacc.c */
2198 #line 371 "route/cls/ematch_syntax.y"
2199  { (yyval.i) = META_ID(SK_WMEM_QUEUED); }
2200  break;
2201 
2202  case 51:
2203 
2204 /* Line 1806 of yacc.c */
2205 #line 372 "route/cls/ematch_syntax.y"
2206  { (yyval.i) = META_ID(SK_RCV_QLEN); }
2207  break;
2208 
2209  case 52:
2210 
2211 /* Line 1806 of yacc.c */
2212 #line 373 "route/cls/ematch_syntax.y"
2213  { (yyval.i) = META_ID(SK_SND_QLEN); }
2214  break;
2215 
2216  case 53:
2217 
2218 /* Line 1806 of yacc.c */
2219 #line 374 "route/cls/ematch_syntax.y"
2220  { (yyval.i) = META_ID(SK_ERR_QLEN); }
2221  break;
2222 
2223  case 54:
2224 
2225 /* Line 1806 of yacc.c */
2226 #line 375 "route/cls/ematch_syntax.y"
2227  { (yyval.i) = META_ID(SK_FORWARD_ALLOCS); }
2228  break;
2229 
2230  case 55:
2231 
2232 /* Line 1806 of yacc.c */
2233 #line 376 "route/cls/ematch_syntax.y"
2234  { (yyval.i) = META_ID(SK_ALLOCS); }
2235  break;
2236 
2237  case 56:
2238 
2239 /* Line 1806 of yacc.c */
2240 #line 377 "route/cls/ematch_syntax.y"
2241  { (yyval.i) = META_ID(SK_ROUTE_CAPS); }
2242  break;
2243 
2244  case 57:
2245 
2246 /* Line 1806 of yacc.c */
2247 #line 378 "route/cls/ematch_syntax.y"
2248  { (yyval.i) = META_ID(SK_HASH); }
2249  break;
2250 
2251  case 58:
2252 
2253 /* Line 1806 of yacc.c */
2254 #line 379 "route/cls/ematch_syntax.y"
2255  { (yyval.i) = META_ID(SK_LINGERTIME); }
2256  break;
2257 
2258  case 59:
2259 
2260 /* Line 1806 of yacc.c */
2261 #line 380 "route/cls/ematch_syntax.y"
2262  { (yyval.i) = META_ID(SK_ACK_BACKLOG); }
2263  break;
2264 
2265  case 60:
2266 
2267 /* Line 1806 of yacc.c */
2268 #line 381 "route/cls/ematch_syntax.y"
2269  { (yyval.i) = META_ID(SK_MAX_ACK_BACKLOG); }
2270  break;
2271 
2272  case 61:
2273 
2274 /* Line 1806 of yacc.c */
2275 #line 382 "route/cls/ematch_syntax.y"
2276  { (yyval.i) = META_ID(SK_PRIO); }
2277  break;
2278 
2279  case 62:
2280 
2281 /* Line 1806 of yacc.c */
2282 #line 383 "route/cls/ematch_syntax.y"
2283  { (yyval.i) = META_ID(SK_RCVLOWAT); }
2284  break;
2285 
2286  case 63:
2287 
2288 /* Line 1806 of yacc.c */
2289 #line 384 "route/cls/ematch_syntax.y"
2290  { (yyval.i) = META_ID(SK_RCVTIMEO); }
2291  break;
2292 
2293  case 64:
2294 
2295 /* Line 1806 of yacc.c */
2296 #line 385 "route/cls/ematch_syntax.y"
2297  { (yyval.i) = META_ID(SK_SNDTIMEO); }
2298  break;
2299 
2300  case 65:
2301 
2302 /* Line 1806 of yacc.c */
2303 #line 386 "route/cls/ematch_syntax.y"
2304  { (yyval.i) = META_ID(SK_SENDMSG_OFF); }
2305  break;
2306 
2307  case 66:
2308 
2309 /* Line 1806 of yacc.c */
2310 #line 387 "route/cls/ematch_syntax.y"
2311  { (yyval.i) = META_ID(SK_WRITE_PENDING); }
2312  break;
2313 
2314  case 67:
2315 
2316 /* Line 1806 of yacc.c */
2317 #line 388 "route/cls/ematch_syntax.y"
2318  { (yyval.i) = META_ID(VLAN_TAG); }
2319  break;
2320 
2321  case 68:
2322 
2323 /* Line 1806 of yacc.c */
2324 #line 389 "route/cls/ematch_syntax.y"
2325  { (yyval.i) = META_ID(RXHASH); }
2326  break;
2327 
2328  case 69:
2329 
2330 /* Line 1806 of yacc.c */
2331 #line 393 "route/cls/ematch_syntax.y"
2332  { (yyval.i) = META_ID(DEV); }
2333  break;
2334 
2335  case 70:
2336 
2337 /* Line 1806 of yacc.c */
2338 #line 394 "route/cls/ematch_syntax.y"
2339  { (yyval.i) = META_ID(SK_BOUND_IF); }
2340  break;
2341 
2342  case 71:
2343 
2344 /* Line 1806 of yacc.c */
2345 #line 402 "route/cls/ematch_syntax.y"
2346  {
2347  (yyval.q) = (yyvsp[(1) - (1)].q);
2348  }
2349  break;
2350 
2351  case 72:
2352 
2353 /* Line 1806 of yacc.c */
2354 #line 406 "route/cls/ematch_syntax.y"
2355  {
2356  struct nl_addr *addr;
2357 
2358  if (nl_addr_parse((yyvsp[(1) - (1)].s), AF_UNSPEC, &addr) == 0) {
2359  (yyval.q).len = nl_addr_get_len(addr);
2360 
2361  (yyval.q).index = min_t(int, (yyval.q).len, nl_addr_get_prefixlen(addr)/8);
2362 
2363  if (!((yyval.q).data = calloc(1, (yyval.q).len))) {
2364  nl_addr_put(addr);
2365  YYABORT;
2366  }
2367 
2368  memcpy((yyval.q).data, nl_addr_get_binary_addr(addr), (yyval.q).len);
2369  nl_addr_put(addr);
2370  } else {
2371  if (asprintf(errp, "invalid pattern \"%s\"", (yyvsp[(1) - (1)].s)) == -1)
2372  *errp = NULL;
2373  YYABORT;
2374  }
2375  }
2376  break;
2377 
2378  case 73:
2379 
2380 /* Line 1806 of yacc.c */
2381 #line 435 "route/cls/ematch_syntax.y"
2382  {
2383  struct rtnl_pktloc *loc;
2384 
2385  if (rtnl_pktloc_lookup((yyvsp[(1) - (1)].s), &loc) < 0) {
2386  if (asprintf(errp, "Packet location \"%s\" not found", (yyvsp[(1) - (1)].s)) == -1)
2387  *errp = NULL;
2388  YYABORT;
2389  }
2390 
2391  (yyval.loc) = loc;
2392  }
2393  break;
2394 
2395  case 74:
2396 
2397 /* Line 1806 of yacc.c */
2398 #line 448 "route/cls/ematch_syntax.y"
2399  {
2400  struct rtnl_pktloc *loc;
2401 
2402  if ((yyvsp[(5) - (5)].i64) && (!(yyvsp[(1) - (5)].i) || (yyvsp[(1) - (5)].i) > TCF_EM_ALIGN_U32)) {
2403  *errp = strdup("mask only allowed for alignments u8|u16|u32");
2404  YYABORT;
2405  }
2406 
2407  if (!(loc = rtnl_pktloc_alloc())) {
2408  *errp = strdup("Unable to allocate packet location object");
2409  YYABORT;
2410  }
2411 
2412  loc->name = strdup("<USER-DEFINED>");
2413  loc->align = (yyvsp[(1) - (5)].i);
2414  loc->layer = (yyvsp[(2) - (5)].i);
2415  loc->offset = (yyvsp[(4) - (5)].i);
2416  loc->mask = (yyvsp[(5) - (5)].i64);
2417 
2418  (yyval.loc) = loc;
2419  }
2420  break;
2421 
2422  case 75:
2423 
2424 /* Line 1806 of yacc.c */
2425 #line 473 "route/cls/ematch_syntax.y"
2426  { (yyval.i) = 0; }
2427  break;
2428 
2429  case 76:
2430 
2431 /* Line 1806 of yacc.c */
2432 #line 475 "route/cls/ematch_syntax.y"
2433  { (yyval.i) = (yyvsp[(1) - (2)].i); }
2434  break;
2435 
2436  case 77:
2437 
2438 /* Line 1806 of yacc.c */
2439 #line 477 "route/cls/ematch_syntax.y"
2440  { (yyval.i) = (yyvsp[(1) - (2)].i); }
2441  break;
2442 
2443  case 78:
2444 
2445 /* Line 1806 of yacc.c */
2446 #line 482 "route/cls/ematch_syntax.y"
2447  { (yyval.i64) = 0; }
2448  break;
2449 
2450  case 79:
2451 
2452 /* Line 1806 of yacc.c */
2453 #line 484 "route/cls/ematch_syntax.y"
2454  { (yyval.i64) = (yyvsp[(2) - (2)].i); }
2455  break;
2456 
2457  case 80:
2458 
2459 /* Line 1806 of yacc.c */
2460 #line 489 "route/cls/ematch_syntax.y"
2461  { (yyval.i) = 0; }
2462  break;
2463 
2464  case 81:
2465 
2466 /* Line 1806 of yacc.c */
2467 #line 491 "route/cls/ematch_syntax.y"
2468  { (yyval.i) = (yyvsp[(2) - (2)].i); }
2469  break;
2470 
2471  case 82:
2472 
2473 /* Line 1806 of yacc.c */
2474 #line 496 "route/cls/ematch_syntax.y"
2475  { (yyval.i) = TCF_EM_OPND_EQ; }
2476  break;
2477 
2478  case 83:
2479 
2480 /* Line 1806 of yacc.c */
2481 #line 498 "route/cls/ematch_syntax.y"
2482  { (yyval.i) = TCF_EM_OPND_GT; }
2483  break;
2484 
2485  case 84:
2486 
2487 /* Line 1806 of yacc.c */
2488 #line 500 "route/cls/ematch_syntax.y"
2489  { (yyval.i) = TCF_EM_OPND_LT; }
2490  break;
2491 
2492 
2493 
2494 /* Line 1806 of yacc.c */
2495 #line 2496 "route/cls/ematch_syntax.c"
2496  default: break;
2497  }
2498  /* User semantic actions sometimes alter yychar, and that requires
2499  that yytoken be updated with the new translation. We take the
2500  approach of translating immediately before every use of yytoken.
2501  One alternative is translating here after every semantic action,
2502  but that translation would be missed if the semantic action invokes
2503  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2504  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2505  incorrect destructor might then be invoked immediately. In the
2506  case of YYERROR or YYBACKUP, subsequent parser actions might lead
2507  to an incorrect destructor call or verbose syntax error message
2508  before the lookahead is translated. */
2509  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2510 
2511  YYPOPSTACK (yylen);
2512  yylen = 0;
2513  YY_STACK_PRINT (yyss, yyssp);
2514 
2515  *++yyvsp = yyval;
2516 
2517  /* Now `shift' the result of the reduction. Determine what state
2518  that goes to, based on the state we popped back to and the rule
2519  number reduced by. */
2520 
2521  yyn = yyr1[yyn];
2522 
2523  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2524  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2525  yystate = yytable[yystate];
2526  else
2527  yystate = yydefgoto[yyn - YYNTOKENS];
2528 
2529  goto yynewstate;
2530 
2531 
2532 /*------------------------------------.
2533 | yyerrlab -- here on detecting error |
2534 `------------------------------------*/
2535 yyerrlab:
2536  /* Make sure we have latest lookahead translation. See comments at
2537  user semantic actions for why this is necessary. */
2538  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2539 
2540  /* If not already recovering from an error, report this error. */
2541  if (!yyerrstatus)
2542  {
2543  ++yynerrs;
2544 #if ! YYERROR_VERBOSE
2545  yyerror (scanner, errp, root, YY_("syntax error"));
2546 #else
2547 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2548  yyssp, yytoken)
2549  {
2550  char const *yymsgp = YY_("syntax error");
2551  int yysyntax_error_status;
2552  yysyntax_error_status = YYSYNTAX_ERROR;
2553  if (yysyntax_error_status == 0)
2554  yymsgp = yymsg;
2555  else if (yysyntax_error_status == 1)
2556  {
2557  if (yymsg != yymsgbuf)
2558  YYSTACK_FREE (yymsg);
2559  yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2560  if (!yymsg)
2561  {
2562  yymsg = yymsgbuf;
2563  yymsg_alloc = sizeof yymsgbuf;
2564  yysyntax_error_status = 2;
2565  }
2566  else
2567  {
2568  yysyntax_error_status = YYSYNTAX_ERROR;
2569  yymsgp = yymsg;
2570  }
2571  }
2572  yyerror (scanner, errp, root, yymsgp);
2573  if (yysyntax_error_status == 2)
2574  goto yyexhaustedlab;
2575  }
2576 # undef YYSYNTAX_ERROR
2577 #endif
2578  }
2579 
2580 
2581 
2582  if (yyerrstatus == 3)
2583  {
2584  /* If just tried and failed to reuse lookahead token after an
2585  error, discard it. */
2586 
2587  if (yychar <= YYEOF)
2588  {
2589  /* Return failure if at end of input. */
2590  if (yychar == YYEOF)
2591  YYABORT;
2592  }
2593  else
2594  {
2595  yydestruct ("Error: discarding",
2596  yytoken, &yylval, scanner, errp, root);
2597  yychar = YYEMPTY;
2598  }
2599  }
2600 
2601  /* Else will try to reuse lookahead token after shifting the error
2602  token. */
2603  goto yyerrlab1;
2604 
2605 
2606 /*---------------------------------------------------.
2607 | yyerrorlab -- error raised explicitly by YYERROR. |
2608 `---------------------------------------------------*/
2609 yyerrorlab:
2610 
2611  /* Pacify compilers like GCC when the user code never invokes
2612  YYERROR and the label yyerrorlab therefore never appears in user
2613  code. */
2614  if (/*CONSTCOND*/ 0)
2615  goto yyerrorlab;
2616 
2617  /* Do not reclaim the symbols of the rule which action triggered
2618  this YYERROR. */
2619  YYPOPSTACK (yylen);
2620  yylen = 0;
2621  YY_STACK_PRINT (yyss, yyssp);
2622  yystate = *yyssp;
2623  goto yyerrlab1;
2624 
2625 
2626 /*-------------------------------------------------------------.
2627 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2628 `-------------------------------------------------------------*/
2629 yyerrlab1:
2630  yyerrstatus = 3; /* Each real token shifted decrements this. */
2631 
2632  for (;;)
2633  {
2634  yyn = yypact[yystate];
2635  if (!yypact_value_is_default (yyn))
2636  {
2637  yyn += YYTERROR;
2638  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2639  {
2640  yyn = yytable[yyn];
2641  if (0 < yyn)
2642  break;
2643  }
2644  }
2645 
2646  /* Pop the current state because it cannot handle the error token. */
2647  if (yyssp == yyss)
2648  YYABORT;
2649 
2650 
2651  yydestruct ("Error: popping",
2652  yystos[yystate], yyvsp, scanner, errp, root);
2653  YYPOPSTACK (1);
2654  yystate = *yyssp;
2655  YY_STACK_PRINT (yyss, yyssp);
2656  }
2657 
2658  *++yyvsp = yylval;
2659 
2660 
2661  /* Shift the error token. */
2662  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2663 
2664  yystate = yyn;
2665  goto yynewstate;
2666 
2667 
2668 /*-------------------------------------.
2669 | yyacceptlab -- YYACCEPT comes here. |
2670 `-------------------------------------*/
2671 yyacceptlab:
2672  yyresult = 0;
2673  goto yyreturn;
2674 
2675 /*-----------------------------------.
2676 | yyabortlab -- YYABORT comes here. |
2677 `-----------------------------------*/
2678 yyabortlab:
2679  yyresult = 1;
2680  goto yyreturn;
2681 
2682 #if !defined(yyoverflow) || YYERROR_VERBOSE
2683 /*-------------------------------------------------.
2684 | yyexhaustedlab -- memory exhaustion comes here. |
2685 `-------------------------------------------------*/
2686 yyexhaustedlab:
2687  yyerror (scanner, errp, root, YY_("memory exhausted"));
2688  yyresult = 2;
2689  /* Fall through. */
2690 #endif
2691 
2692 yyreturn:
2693  if (yychar != YYEMPTY)
2694  {
2695  /* Make sure we have latest lookahead translation. See comments at
2696  user semantic actions for why this is necessary. */
2697  yytoken = YYTRANSLATE (yychar);
2698  yydestruct ("Cleanup: discarding lookahead",
2699  yytoken, &yylval, scanner, errp, root);
2700  }
2701  /* Do not reclaim the symbols of the rule which action triggered
2702  this YYABORT or YYACCEPT. */
2703  YYPOPSTACK (yylen);
2704  YY_STACK_PRINT (yyss, yyssp);
2705  while (yyssp != yyss)
2706  {
2707  yydestruct ("Cleanup: popping",
2708  yystos[*yyssp], yyvsp, scanner, errp, root);
2709  YYPOPSTACK (1);
2710  }
2711 #ifndef yyoverflow
2712  if (yyss != yyssa)
2713  YYSTACK_FREE (yyss);
2714 #endif
2715 #if YYERROR_VERBOSE
2716  if (yymsg != yymsgbuf)
2717  YYSTACK_FREE (yymsg);
2718 #endif
2719  /* Make sure YYID is used. */
2720  return YYID (yyresult);
2721 }
2722 
2723 
2724