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