libnl: /data/src/libnl3/lib/route/pktloc_syntax.c Source File

libnl 3.7.0

pktloc_syntax.c
1 /* A Bison parser, made by GNU Bison 3.8.2. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 <https://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 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
40
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
47
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30802
50
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
53
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers. */
58 #define YYPURE 1
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66
67 /* Substitute the variable and function names. */
68 #define yyparse pktloc_parse
69 #define yylex pktloc_lex
70 #define yyerror pktloc_error
71 #define yydebug pktloc_debug
72 #define yynerrs pktloc_nerrs
73
74 /* First part of user prologue. */
75 #line 1 "lib/route/pktloc_syntax.y"
76
77 #include <netlink-private/netlink.h>
78 #include <netlink-private/tc.h>
79 #include <netlink/netlink.h>
80 #include <netlink/utils.h>
81 #include <netlink/route/pktloc.h>
82
83 #line 84 "lib/route/pktloc_syntax.c"
84
85 # ifndef YY_CAST
86 # ifdef __cplusplus
87 # define YY_CAST(Type, Val) static_cast<Type> (Val)
88 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
89 # else
90 # define YY_CAST(Type, Val) ((Type) (Val))
91 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
92 # endif
93 # endif
94 # ifndef YY_NULLPTR
95 # if defined __cplusplus
96 # if 201103L <= __cplusplus
97 # define YY_NULLPTR nullptr
98 # else
99 # define YY_NULLPTR 0
100 # endif
101 # else
102 # define YY_NULLPTR ((void*)0)
103 # endif
104 # endif
105
106 #include "pktloc_syntax.h"
107 /* Symbol kind. */
108 enum yysymbol_kind_t
109 {
110 YYSYMBOL_YYEMPTY = -2,
111 YYSYMBOL_YYEOF = 0, /* "end of file" */
112 YYSYMBOL_YYerror = 1, /* error */
113 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
114 YYSYMBOL_ERROR = 3, /* ERROR */
115 YYSYMBOL_NUMBER = 4, /* NUMBER */
116 YYSYMBOL_LAYER = 5, /* LAYER */
117 YYSYMBOL_ALIGN = 6, /* ALIGN */
118 YYSYMBOL_NAME = 7, /* NAME */
119 YYSYMBOL_8_ = 8, /* '+' */
120 YYSYMBOL_YYACCEPT = 9, /* $accept */
121 YYSYMBOL_input = 10, /* input */
122 YYSYMBOL_location = 11, /* location */
123 YYSYMBOL_align = 12, /* align */
124 YYSYMBOL_layer = 13, /* layer */
125 YYSYMBOL_mask = 14, /* mask */
126 YYSYMBOL_shift = 15 /* shift */
127 };
128 typedef enum yysymbol_kind_t yysymbol_kind_t;
129
130
131 /* Second part of user prologue. */
132 #line 24 "lib/route/pktloc_syntax.y"
133
134 extern int pktloc_lex(YYSTYPE *, YYLTYPE *, void *);
135
136 #define pktloc_error yyerror
137 static void yyerror(YYLTYPE *locp, void *scanner, const char *msg)
138 {
139 NL_DBG(1, "Error while parsing packet location file: %s\n", msg);
140 }
141
142 #line 143 "lib/route/pktloc_syntax.c"
143
144
145 #ifdef short
146 # undef short
147 #endif
148
149 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
150 <limits.h> and (if available) <stdint.h> are included
151 so that the code can choose integer types of a good width. */
152
153 #ifndef __PTRDIFF_MAX__
154 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
155 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
156 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
157 # define YY_STDINT_H
158 # endif
159 #endif
160
161 /* Narrow types that promote to a signed type and that can represent a
162 signed or unsigned integer of at least N bits. In tables they can
163 save space and decrease cache pressure. Promoting to a signed type
164 helps avoid bugs in integer arithmetic. */
165
166 #ifdef __INT_LEAST8_MAX__
167 typedef __INT_LEAST8_TYPE__ yytype_int8;
168 #elif defined YY_STDINT_H
169 typedef int_least8_t yytype_int8;
170 #else
171 typedef signed char yytype_int8;
172 #endif
173
174 #ifdef __INT_LEAST16_MAX__
175 typedef __INT_LEAST16_TYPE__ yytype_int16;
176 #elif defined YY_STDINT_H
177 typedef int_least16_t yytype_int16;
178 #else
179 typedef short yytype_int16;
180 #endif
181
182 /* Work around bug in HP-UX 11.23, which defines these macros
183 incorrectly for preprocessor constants. This workaround can likely
184 be removed in 2023, as HPE has promised support for HP-UX 11.23
185 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
186 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
187 #ifdef __hpux
188 # undef UINT_LEAST8_MAX
189 # undef UINT_LEAST16_MAX
190 # define UINT_LEAST8_MAX 255
191 # define UINT_LEAST16_MAX 65535
192 #endif
193
194 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
195 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
196 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
197 && UINT_LEAST8_MAX <= INT_MAX)
198 typedef uint_least8_t yytype_uint8;
199 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
200 typedef unsigned char yytype_uint8;
201 #else
202 typedef short yytype_uint8;
203 #endif
204
205 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
206 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
207 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
208 && UINT_LEAST16_MAX <= INT_MAX)
209 typedef uint_least16_t yytype_uint16;
210 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
211 typedef unsigned short yytype_uint16;
212 #else
213 typedef int yytype_uint16;
214 #endif
215
216 #ifndef YYPTRDIFF_T
217 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
218 # define YYPTRDIFF_T __PTRDIFF_TYPE__
219 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
220 # elif defined PTRDIFF_MAX
221 # ifndef ptrdiff_t
222 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
223 # endif
224 # define YYPTRDIFF_T ptrdiff_t
225 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
226 # else
227 # define YYPTRDIFF_T long
228 # define YYPTRDIFF_MAXIMUM LONG_MAX
229 # endif
230 #endif
231
232 #ifndef YYSIZE_T
233 # ifdef __SIZE_TYPE__
234 # define YYSIZE_T __SIZE_TYPE__
235 # elif defined size_t
236 # define YYSIZE_T size_t
237 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
238 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
239 # define YYSIZE_T size_t
240 # else
241 # define YYSIZE_T unsigned
242 # endif
243 #endif
244
245 #define YYSIZE_MAXIMUM \
246 YY_CAST (YYPTRDIFF_T, \
247 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
248 ? YYPTRDIFF_MAXIMUM \
249 : YY_CAST (YYSIZE_T, -1)))
250
251 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
252
253
254 /* Stored state numbers (used for stacks). */
255 typedef yytype_int8 yy_state_t;
256
257 /* State numbers in computations. */
258 typedef int yy_state_fast_t;
259
260 #ifndef YY_
261 # if defined YYENABLE_NLS && YYENABLE_NLS
262 # if ENABLE_NLS
263 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
264 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
265 # endif
266 # endif
267 # ifndef YY_
268 # define YY_(Msgid) Msgid
269 # endif
270 #endif
271
272
273 #ifndef YY_ATTRIBUTE_PURE
274 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
275 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
276 # else
277 # define YY_ATTRIBUTE_PURE
278 # endif
279 #endif
280
281 #ifndef YY_ATTRIBUTE_UNUSED
282 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
283 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
284 # else
285 # define YY_ATTRIBUTE_UNUSED
286 # endif
287 #endif
288
289 /* Suppress unused-variable warnings by "using" E. */
290 #if ! defined lint || defined __GNUC__
291 # define YY_USE(E) ((void) (E))
292 #else
293 # define YY_USE(E) /* empty */
294 #endif
295
296 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
297 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
298 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
299 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
300 _Pragma ("GCC diagnostic push") \
301 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
302 # else
303 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
304 _Pragma ("GCC diagnostic push") \
305 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
306 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
307 # endif
308 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
309 _Pragma ("GCC diagnostic pop")
310 #else
311 # define YY_INITIAL_VALUE(Value) Value
312 #endif
313 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
314 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
315 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
316 #endif
317 #ifndef YY_INITIAL_VALUE
318 # define YY_INITIAL_VALUE(Value) /* Nothing. */
319 #endif
320
321 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
322 # define YY_IGNORE_USELESS_CAST_BEGIN \
323 _Pragma ("GCC diagnostic push") \
324 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
325 # define YY_IGNORE_USELESS_CAST_END \
326 _Pragma ("GCC diagnostic pop")
327 #endif
328 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
329 # define YY_IGNORE_USELESS_CAST_BEGIN
330 # define YY_IGNORE_USELESS_CAST_END
331 #endif
332
333
334 #define YY_ASSERT(E) ((void) (0 && (E)))
335
336 #if 1
337
338 /* The parser invokes alloca or malloc; define the necessary symbols. */
339
340 # ifdef YYSTACK_USE_ALLOCA
341 # if YYSTACK_USE_ALLOCA
342 # ifdef __GNUC__
343 # define YYSTACK_ALLOC __builtin_alloca
344 # elif defined __BUILTIN_VA_ARG_INCR
345 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
346 # elif defined _AIX
347 # define YYSTACK_ALLOC __alloca
348 # elif defined _MSC_VER
349 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
350 # define alloca _alloca
351 # else
352 # define YYSTACK_ALLOC alloca
353 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
354 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
355 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
356 # ifndef EXIT_SUCCESS
357 # define EXIT_SUCCESS 0
358 # endif
359 # endif
360 # endif
361 # endif
362 # endif
363
364 # ifdef YYSTACK_ALLOC
365 /* Pacify GCC's 'empty if-body' warning. */
366 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
367 # ifndef YYSTACK_ALLOC_MAXIMUM
368 /* The OS might guarantee only one guard page at the bottom of the stack,
369 and a page size can be as small as 4096 bytes. So we cannot safely
370 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
371 to allow for a few compiler-allocated temporary stack slots. */
372 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
373 # endif
374 # else
375 # define YYSTACK_ALLOC YYMALLOC
376 # define YYSTACK_FREE YYFREE
377 # ifndef YYSTACK_ALLOC_MAXIMUM
378 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
379 # endif
380 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
381 && ! ((defined YYMALLOC || defined malloc) \
382 && (defined YYFREE || defined free)))
383 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
384 # ifndef EXIT_SUCCESS
385 # define EXIT_SUCCESS 0
386 # endif
387 # endif
388 # ifndef YYMALLOC
389 # define YYMALLOC malloc
390 # if ! defined malloc && ! defined EXIT_SUCCESS
391 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
392 # endif
393 # endif
394 # ifndef YYFREE
395 # define YYFREE free
396 # if ! defined free && ! defined EXIT_SUCCESS
397 void free (void *); /* INFRINGES ON USER NAME SPACE */
398 # endif
399 # endif
400 # endif
401 #endif /* 1 */
402
403 #if (! defined yyoverflow \
404 && (! defined __cplusplus \
405 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
406 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
407
408 /* A type that is properly aligned for any stack member. */
409 union yyalloc
410 {
411 yy_state_t yyss_alloc;
412 YYSTYPE yyvs_alloc;
413 YYLTYPE yyls_alloc;
414 };
415
416 /* The size of the maximum gap between one aligned stack and the next. */
417 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
418
419 /* The size of an array large to enough to hold all stacks, each with
420 N elements. */
421 # define YYSTACK_BYTES(N) \
422 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
423 + YYSIZEOF (YYLTYPE)) \
424 + 2 * YYSTACK_GAP_MAXIMUM)
425
426 # define YYCOPY_NEEDED 1
427
428 /* Relocate STACK from its old location to the new one. The
429 local variables YYSIZE and YYSTACKSIZE give the old and new number of
430 elements in the stack, and YYPTR gives the new location of the
431 stack. Advance YYPTR to a properly aligned location for the next
432 stack. */
433 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
434 do \
435 { \
436 YYPTRDIFF_T yynewbytes; \
437 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
438 Stack = &yyptr->Stack_alloc; \
439 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
440 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
441 } \
442 while (0)
443
444 #endif
445
446 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
447 /* Copy COUNT objects from SRC to DST. The source and destination do
448 not overlap. */
449 # ifndef YYCOPY
450 # if defined __GNUC__ && 1 < __GNUC__
451 # define YYCOPY(Dst, Src, Count) \
452 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
453 # else
454 # define YYCOPY(Dst, Src, Count) \
455 do \
456 { \
457 YYPTRDIFF_T yyi; \
458 for (yyi = 0; yyi < (Count); yyi++) \
459 (Dst)[yyi] = (Src)[yyi]; \
460 } \
461 while (0)
462 # endif
463 # endif
464 #endif /* !YYCOPY_NEEDED */
465
466 /* YYFINAL -- State number of the termination state. */
467 #define YYFINAL 7
468 /* YYLAST -- Last index in YYTABLE. */
469 #define YYLAST 10
470
471 /* YYNTOKENS -- Number of terminals. */
472 #define YYNTOKENS 9
473 /* YYNNTS -- Number of nonterminals. */
474 #define YYNNTS 7
475 /* YYNRULES -- Number of rules. */
476 #define YYNRULES 12
477 /* YYNSTATES -- Number of states. */
478 #define YYNSTATES 17
479
480 /* YYMAXUTOK -- Last valid token kind. */
481 #define YYMAXUTOK 262
482
483
484 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
485 as returned by yylex, with out-of-bounds checking. */
486 #define YYTRANSLATE(YYX) \
487 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
488 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
489 : YYSYMBOL_YYUNDEF)
490
491 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
492 as returned by yylex. */
493 static const yytype_int8 yytranslate[] =
494 {
495 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 8, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
521 5, 6, 7
522 };
523
524 #if YYDEBUG
525 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
526 static const yytype_int8 yyrline[] =
527 {
528 0, 46, 46, 48, 52, 79, 81, 87, 88, 94,
529 95, 101, 102
530 };
531 #endif
532
533 /** Accessing symbol of state STATE. */
534 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
535
536 #if 1
537 /* The user-facing name of the symbol whose (internal) number is
538 YYSYMBOL. No bounds checking. */
539 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
540
541 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
542 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
543 static const char *const yytname[] =
544 {
545 "\"end of file\"", "error", "\"invalid token\"", "ERROR", "NUMBER",
546 "LAYER", "ALIGN", "NAME", "'+'", "$accept", "input", "location", "align",
547 "layer", "mask", "shift", YY_NULLPTR
548 };
549
550 static const char *
551 yysymbol_name (yysymbol_kind_t yysymbol)
552 {
553 return yytname[yysymbol];
554 }
555 #endif
556
557 #define YYPACT_NINF (-7)
558
559 #define yypact_value_is_default(Yyn) \
560 ((Yyn) == YYPACT_NINF)
561
562 #define YYTABLE_NINF (-1)
563
564 #define yytable_value_is_error(Yyn) \
565 0
566
567 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
568 STATE-NUM. */
569 static const yytype_int8 yypact[] =
570 {
571 -6, -4, 3, -6, -7, -7, -1, -7, -7, -3,
572 2, -7, 4, -7, 5, -7, -7
573 };
574
575 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
576 Performed when YYTABLE does not specify something else to do. Zero
577 means the default is an error. */
578 static const yytype_int8 yydefact[] =
579 {
580 2, 0, 0, 2, 6, 5, 7, 1, 3, 0,
581 0, 8, 9, 10, 11, 12, 4
582 };
583
584 /* YYPGOTO[NTERM-NUM]. */
585 static const yytype_int8 yypgoto[] =
586 {
587 -7, 7, -7, -7, -7, -7, -7
588 };
589
590 /* YYDEFGOTO[NTERM-NUM]. */
591 static const yytype_int8 yydefgoto[] =
592 {
593 0, 2, 3, 6, 10, 14, 16
594 };
595
596 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
597 positive, shift that token. If negative, reduce the rule whose
598 number is the opposite. If YYTABLE_NINF, syntax error. */
599 static const yytype_int8 yytable[] =
600 {
601 4, 1, 5, 7, 9, 11, 12, 0, 13, 15,
602 8
603 };
604
605 static const yytype_int8 yycheck[] =
606 {
607 4, 7, 6, 0, 5, 8, 4, -1, 4, 4,
608 3
609 };
610
611 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
612 state STATE-NUM. */
613 static const yytype_int8 yystos[] =
614 {
615 0, 7, 10, 11, 4, 6, 12, 0, 10, 5,
616 13, 8, 4, 4, 14, 4, 15
617 };
618
619 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
620 static const yytype_int8 yyr1[] =
621 {
622 0, 9, 10, 10, 11, 12, 12, 13, 13, 14,
623 14, 15, 15
624 };
625
626 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
627 static const yytype_int8 yyr2[] =
628 {
629 0, 2, 0, 2, 6, 1, 1, 0, 2, 0,
630 1, 0, 1
631 };
632
633
634 enum { YYENOMEM = -2 };
635
636 #define yyerrok (yyerrstatus = 0)
637 #define yyclearin (yychar = YYEMPTY)
638
639 #define YYACCEPT goto yyacceptlab
640 #define YYABORT goto yyabortlab
641 #define YYERROR goto yyerrorlab
642 #define YYNOMEM goto yyexhaustedlab
643
644
645 #define YYRECOVERING() (!!yyerrstatus)
646
647 #define YYBACKUP(Token, Value) \
648 do \
649 if (yychar == YYEMPTY) \
650 { \
651 yychar = (Token); \
652 yylval = (Value); \
653 YYPOPSTACK (yylen); \
654 yystate = *yyssp; \
655 goto yybackup; \
656 } \
657 else \
658 { \
659 yyerror (&yylloc, scanner, YY_("syntax error: cannot back up")); \
660 YYERROR; \
661 } \
662 while (0)
663
664 /* Backward compatibility with an undocumented macro.
665 Use YYerror or YYUNDEF. */
666 #define YYERRCODE YYUNDEF
667
668 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
669 If N is 0, then set CURRENT to the empty location which ends
670 the previous symbol: RHS[0] (always defined). */
671
672 #ifndef YYLLOC_DEFAULT
673 # define YYLLOC_DEFAULT(Current, Rhs, N) \
674 do \
675 if (N) \
676 { \
677 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
678 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
679 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
680 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
681 } \
682 else \
683 { \
684 (Current).first_line = (Current).last_line = \
685 YYRHSLOC (Rhs, 0).last_line; \
686 (Current).first_column = (Current).last_column = \
687 YYRHSLOC (Rhs, 0).last_column; \
688 } \
689 while (0)
690 #endif
691
692 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
693
694
695 /* Enable debugging if requested. */
696 #if YYDEBUG
697
698 # ifndef YYFPRINTF
699 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
700 # define YYFPRINTF fprintf
701 # endif
702
703 # define YYDPRINTF(Args) \
704 do { \
705 if (yydebug) \
706 YYFPRINTF Args; \
707 } while (0)
708
709
710 /* YYLOCATION_PRINT -- Print the location on the stream.
711 This macro was not mandated originally: define only if we know
712 we won't break user code: when these are the locations we know. */
713
714 # ifndef YYLOCATION_PRINT
715
716 # if defined YY_LOCATION_PRINT
717
718 /* Temporary convenience wrapper in case some people defined the
719 undocumented and private YY_LOCATION_PRINT macros. */
720 # define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc))
721
722 # elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
723
724 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
725
726 YY_ATTRIBUTE_UNUSED
727 static int
728 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
729 {
730 int res = 0;
731 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
732 if (0 <= yylocp->first_line)
733 {
734 res += YYFPRINTF (yyo, "%d", yylocp->first_line);
735 if (0 <= yylocp->first_column)
736 res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
737 }
738 if (0 <= yylocp->last_line)
739 {
740 if (yylocp->first_line < yylocp->last_line)
741 {
742 res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
743 if (0 <= end_col)
744 res += YYFPRINTF (yyo, ".%d", end_col);
745 }
746 else if (0 <= end_col && yylocp->first_column < end_col)
747 res += YYFPRINTF (yyo, "-%d", end_col);
748 }
749 return res;
750 }
751
752 # define YYLOCATION_PRINT yy_location_print_
753
754 /* Temporary convenience wrapper in case some people defined the
755 undocumented and private YY_LOCATION_PRINT macros. */
756 # define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc))
757
758 # else
759
760 # define YYLOCATION_PRINT(File, Loc) ((void) 0)
761 /* Temporary convenience wrapper in case some people defined the
762 undocumented and private YY_LOCATION_PRINT macros. */
763 # define YY_LOCATION_PRINT YYLOCATION_PRINT
764
765 # endif
766 # endif /* !defined YYLOCATION_PRINT */
767
768
769 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
770 do { \
771 if (yydebug) \
772 { \
773 YYFPRINTF (stderr, "%s ", Title); \
774 yy_symbol_print (stderr, \
775 Kind, Value, Location, scanner); \
776 YYFPRINTF (stderr, "\n"); \
777 } \
778 } while (0)
779
780
781 /*-----------------------------------.
782 | Print this symbol's value on YYO. |
783 `-----------------------------------*/
784
785 static void
786 yy_symbol_value_print (FILE *yyo,
787 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, void *scanner)
788 {
789 FILE *yyoutput = yyo;
790 YY_USE (yyoutput);
791 YY_USE (yylocationp);
792 YY_USE (scanner);
793 if (!yyvaluep)
794 return;
795 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
796 YY_USE (yykind);
797 YY_IGNORE_MAYBE_UNINITIALIZED_END
798 }
799
800
801 /*---------------------------.
802 | Print this symbol on YYO. |
803 `---------------------------*/
804
805 static void
806 yy_symbol_print (FILE *yyo,
807 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, void *scanner)
808 {
809 YYFPRINTF (yyo, "%s %s (",
810 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
811
812 YYLOCATION_PRINT (yyo, yylocationp);
813 YYFPRINTF (yyo, ": ");
814 yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, scanner);
815 YYFPRINTF (yyo, ")");
816 }
817
818 /*------------------------------------------------------------------.
819 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
820 | TOP (included). |
821 `------------------------------------------------------------------*/
822
823 static void
824 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
825 {
826 YYFPRINTF (stderr, "Stack now");
827 for (; yybottom <= yytop; yybottom++)
828 {
829 int yybot = *yybottom;
830 YYFPRINTF (stderr, " %d", yybot);
831 }
832 YYFPRINTF (stderr, "\n");
833 }
834
835 # define YY_STACK_PRINT(Bottom, Top) \
836 do { \
837 if (yydebug) \
838 yy_stack_print ((Bottom), (Top)); \
839 } while (0)
840
841
842 /*------------------------------------------------.
843 | Report that the YYRULE is going to be reduced. |
844 `------------------------------------------------*/
845
846 static void
847 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
848 int yyrule, void *scanner)
849 {
850 int yylno = yyrline[yyrule];
851 int yynrhs = yyr2[yyrule];
852 int yyi;
853 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
854 yyrule - 1, yylno);
855 /* The symbols being reduced. */
856 for (yyi = 0; yyi < yynrhs; yyi++)
857 {
858 YYFPRINTF (stderr, " $%d = ", yyi + 1);
859 yy_symbol_print (stderr,
860 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
861 &yyvsp[(yyi + 1) - (yynrhs)],
862 &(yylsp[(yyi + 1) - (yynrhs)]), scanner);
863 YYFPRINTF (stderr, "\n");
864 }
865 }
866
867 # define YY_REDUCE_PRINT(Rule) \
868 do { \
869 if (yydebug) \
870 yy_reduce_print (yyssp, yyvsp, yylsp, Rule, scanner); \
871 } while (0)
872
873 /* Nonzero means print parse trace. It is left uninitialized so that
874 multiple parsers can coexist. */
875 int yydebug;
876 #else /* !YYDEBUG */
877 # define YYDPRINTF(Args) ((void) 0)
878 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
879 # define YY_STACK_PRINT(Bottom, Top)
880 # define YY_REDUCE_PRINT(Rule)
881 #endif /* !YYDEBUG */
882
883
884 /* YYINITDEPTH -- initial size of the parser's stacks. */
885 #ifndef YYINITDEPTH
886 # define YYINITDEPTH 200
887 #endif
888
889 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
890 if the built-in stack extension method is used).
891
892 Do not make this value too large; the results are undefined if
893 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
894 evaluated with infinite-precision integer arithmetic. */
895
896 #ifndef YYMAXDEPTH
897 # define YYMAXDEPTH 10000
898 #endif
899
900
901 /* Context of a parse error. */
902 typedef struct
903 {
904 yy_state_t *yyssp;
905 yysymbol_kind_t yytoken;
906 YYLTYPE *yylloc;
907 } yypcontext_t;
908
909 /* Put in YYARG at most YYARGN of the expected tokens given the
910 current YYCTX, and return the number of tokens stored in YYARG. If
911 YYARG is null, return the number of expected tokens (guaranteed to
912 be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
913 Return 0 if there are more than YYARGN expected tokens, yet fill
914 YYARG up to YYARGN. */
915 static int
916 yypcontext_expected_tokens (const yypcontext_t *yyctx,
917 yysymbol_kind_t yyarg[], int yyargn)
918 {
919 /* Actual size of YYARG. */
920 int yycount = 0;
921 int yyn = yypact[+*yyctx->yyssp];
922 if (!yypact_value_is_default (yyn))
923 {
924 /* Start YYX at -YYN if negative to avoid negative indexes in
925 YYCHECK. In other words, skip the first -YYN actions for
926 this state because they are default actions. */
927 int yyxbegin = yyn < 0 ? -yyn : 0;
928 /* Stay within bounds of both yycheck and yytname. */
929 int yychecklim = YYLAST - yyn + 1;
930 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
931 int yyx;
932 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
933 if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
934 && !yytable_value_is_error (yytable[yyx + yyn]))
935 {
936 if (!yyarg)
937 ++yycount;
938 else if (yycount == yyargn)
939 return 0;
940 else
941 yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
942 }
943 }
944 if (yyarg && yycount == 0 && 0 < yyargn)
945 yyarg[0] = YYSYMBOL_YYEMPTY;
946 return yycount;
947 }
948
949
950
951
952 #ifndef yystrlen
953 # if defined __GLIBC__ && defined _STRING_H
954 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
955 # else
956 /* Return the length of YYSTR. */
957 static YYPTRDIFF_T
958 yystrlen (const char *yystr)
959 {
960 YYPTRDIFF_T yylen;
961 for (yylen = 0; yystr[yylen]; yylen++)
962 continue;
963 return yylen;
964 }
965 # endif
966 #endif
967
968 #ifndef yystpcpy
969 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
970 # define yystpcpy stpcpy
971 # else
972 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
973 YYDEST. */
974 static char *
975 yystpcpy (char *yydest, const char *yysrc)
976 {
977 char *yyd = yydest;
978 const char *yys = yysrc;
979
980 while ((*yyd++ = *yys++) != '\0')
981 continue;
982
983 return yyd - 1;
984 }
985 # endif
986 #endif
987
988 #ifndef yytnamerr
989 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
990 quotes and backslashes, so that it's suitable for yyerror. The
991 heuristic is that double-quoting is unnecessary unless the string
992 contains an apostrophe, a comma, or backslash (other than
993 backslash-backslash). YYSTR is taken from yytname. If YYRES is
994 null, do not copy; instead, return the length of what the result
995 would have been. */
996 static YYPTRDIFF_T
997 yytnamerr (char *yyres, const char *yystr)
998 {
999 if (*yystr == '"')
1000 {
1001 YYPTRDIFF_T yyn = 0;
1002 char const *yyp = yystr;
1003 for (;;)
1004 switch (*++yyp)
1005 {
1006 case '\'':
1007 case ',':
1008 goto do_not_strip_quotes;
1009
1010 case '\\':
1011 if (*++yyp != '\\')
1012 goto do_not_strip_quotes;
1013 else
1014 goto append;
1015
1016 append:
1017 default:
1018 if (yyres)
1019 yyres[yyn] = *yyp;
1020 yyn++;
1021 break;
1022
1023 case '"':
1024 if (yyres)
1025 yyres[yyn] = '\0';
1026 return yyn;
1027 }
1028 do_not_strip_quotes: ;
1029 }
1030
1031 if (yyres)
1032 return yystpcpy (yyres, yystr) - yyres;
1033 else
1034 return yystrlen (yystr);
1035 }
1036 #endif
1037
1038
1039 static int
1040 yy_syntax_error_arguments (const yypcontext_t *yyctx,
1041 yysymbol_kind_t yyarg[], int yyargn)
1042 {
1043 /* Actual size of YYARG. */
1044 int yycount = 0;
1045 /* There are many possibilities here to consider:
1046 - If this state is a consistent state with a default action, then
1047 the only way this function was invoked is if the default action
1048 is an error action. In that case, don't check for expected
1049 tokens because there are none.
1050 - The only way there can be no lookahead present (in yychar) is if
1051 this state is a consistent state with a default action. Thus,
1052 detecting the absence of a lookahead is sufficient to determine
1053 that there is no unexpected or expected token to report. In that
1054 case, just report a simple "syntax error".
1055 - Don't assume there isn't a lookahead just because this state is a
1056 consistent state with a default action. There might have been a
1057 previous inconsistent state, consistent state with a non-default
1058 action, or user semantic action that manipulated yychar.
1059 - Of course, the expected token list depends on states to have
1060 correct lookahead information, and it depends on the parser not
1061 to perform extra reductions after fetching a lookahead from the
1062 scanner and before detecting a syntax error. Thus, state merging
1063 (from LALR or IELR) and default reductions corrupt the expected
1064 token list. However, the list is correct for canonical LR with
1065 one exception: it will still contain any token that will not be
1066 accepted due to an error action in a later state.
1067 */
1068 if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1069 {
1070 int yyn;
1071 if (yyarg)
1072 yyarg[yycount] = yyctx->yytoken;
1073 ++yycount;
1074 yyn = yypcontext_expected_tokens (yyctx,
1075 yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1076 if (yyn == YYENOMEM)
1077 return YYENOMEM;
1078 else
1079 yycount += yyn;
1080 }
1081 return yycount;
1082 }
1083
1084 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1085 about the unexpected token YYTOKEN for the state stack whose top is
1086 YYSSP.
1087
1088 Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
1089 not large enough to hold the message. In that case, also set
1090 *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
1091 required number of bytes is too large to store. */
1092 static int
1093 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1094 const yypcontext_t *yyctx)
1095 {
1096 enum { YYARGS_MAX = 5 };
1097 /* Internationalized format string. */
1098 const char *yyformat = YY_NULLPTR;
1099 /* Arguments of yyformat: reported tokens (one for the "unexpected",
1100 one per "expected"). */
1101 yysymbol_kind_t yyarg[YYARGS_MAX];
1102 /* Cumulated lengths of YYARG. */
1103 YYPTRDIFF_T yysize = 0;
1104
1105 /* Actual size of YYARG. */
1106 int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1107 if (yycount == YYENOMEM)
1108 return YYENOMEM;
1109
1110 switch (yycount)
1111 {
1112 #define YYCASE_(N, S) \
1113 case N: \
1114 yyformat = S; \
1115 break
1116 default: /* Avoid compiler warnings. */
1117 YYCASE_(0, YY_("syntax error"));
1118 YYCASE_(1, YY_("syntax error, unexpected %s"));
1119 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1120 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1121 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1122 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1123 #undef YYCASE_
1124 }
1125
1126 /* Compute error message size. Don't count the "%s"s, but reserve
1127 room for the terminator. */
1128 yysize = yystrlen (yyformat) - 2 * yycount + 1;
1129 {
1130 int yyi;
1131 for (yyi = 0; yyi < yycount; ++yyi)
1132 {
1133 YYPTRDIFF_T yysize1
1134 = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1135 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1136 yysize = yysize1;
1137 else
1138 return YYENOMEM;
1139 }
1140 }
1141
1142 if (*yymsg_alloc < yysize)
1143 {
1144 *yymsg_alloc = 2 * yysize;
1145 if (! (yysize <= *yymsg_alloc
1146 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1147 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1148 return -1;
1149 }
1150
1151 /* Avoid sprintf, as that infringes on the user's name space.
1152 Don't have undefined behavior even if the translation
1153 produced a string with the wrong number of "%s"s. */
1154 {
1155 char *yyp = *yymsg;
1156 int yyi = 0;
1157 while ((*yyp = *yyformat) != '\0')
1158 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1159 {
1160 yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1161 yyformat += 2;
1162 }
1163 else
1164 {
1165 ++yyp;
1166 ++yyformat;
1167 }
1168 }
1169 return 0;
1170 }
1171
1172
1173 /*-----------------------------------------------.
1174 | Release the memory associated to this symbol. |
1175 `-----------------------------------------------*/
1176
1177 static void
1178 yydestruct (const char *yymsg,
1179 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, void *scanner)
1180 {
1181 YY_USE (yyvaluep);
1182 YY_USE (yylocationp);
1183 YY_USE (scanner);
1184 if (!yymsg)
1185 yymsg = "Deleting";
1186 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1187
1188 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1189 switch (yykind)
1190 {
1191 case YYSYMBOL_NAME: /* NAME */
1192 #line 40 "lib/route/pktloc_syntax.y"
1193 { free(((*yyvaluep).s)); }
1194 #line 1195 "lib/route/pktloc_syntax.c"
1195 break;
1196
1197 default:
1198 break;
1199 }
1200 YY_IGNORE_MAYBE_UNINITIALIZED_END
1201 }
1202
1203
1204
1205
1206
1207
1208 /*----------.
1209 | yyparse. |
1210 `----------*/
1211
1212 int
1213 yyparse (void *scanner)
1214 {
1215 /* Lookahead token kind. */
1216 int yychar;
1217
1218
1219 /* The semantic value of the lookahead symbol. */
1220 /* Default value used for initialization, for pacifying older GCCs
1221 or non-GCC compilers. */
1222 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1223 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1224
1225 /* Location data for the lookahead symbol. */
1226 static YYLTYPE yyloc_default
1227 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1228 = { 1, 1, 1, 1 }
1229 # endif
1230 ;
1231 YYLTYPE yylloc = yyloc_default;
1232
1233 /* Number of syntax errors so far. */
1234 int yynerrs = 0;
1235
1236 yy_state_fast_t yystate = 0;
1237 /* Number of tokens to shift before error messages enabled. */
1238 int yyerrstatus = 0;
1239
1240 /* Refer to the stacks through separate pointers, to allow yyoverflow
1241 to reallocate them elsewhere. */
1242
1243 /* Their size. */
1244 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1245
1246 /* The state stack: array, bottom, top. */
1247 yy_state_t yyssa[YYINITDEPTH];
1248 yy_state_t *yyss = yyssa;
1249 yy_state_t *yyssp = yyss;
1250
1251 /* The semantic value stack: array, bottom, top. */
1252 YYSTYPE yyvsa[YYINITDEPTH];
1253 YYSTYPE *yyvs = yyvsa;
1254 YYSTYPE *yyvsp = yyvs;
1255
1256 /* The location stack: array, bottom, top. */
1257 YYLTYPE yylsa[YYINITDEPTH];
1258 YYLTYPE *yyls = yylsa;
1259 YYLTYPE *yylsp = yyls;
1260
1261 int yyn;
1262 /* The return value of yyparse. */
1263 int yyresult;
1264 /* Lookahead symbol kind. */
1265 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1266 /* The variables used to return semantic value and location from the
1267 action routines. */
1268 YYSTYPE yyval;
1269 YYLTYPE yyloc;
1270
1271 /* The locations where the error started and ended. */
1272 YYLTYPE yyerror_range[3];
1273
1274 /* Buffer for error messages, and its allocated size. */
1275 char yymsgbuf[128];
1276 char *yymsg = yymsgbuf;
1277 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1278
1279 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1280
1281 /* The number of symbols on the RHS of the reduced rule.
1282 Keep to zero when no symbol should be popped. */
1283 int yylen = 0;
1284
1285 YYDPRINTF ((stderr, "Starting parse\n"));
1286
1287 yychar = YYEMPTY; /* Cause a token to be read. */
1288
1289 yylsp[0] = yylloc;
1290 goto yysetstate;
1291
1292
1293 /*------------------------------------------------------------.
1294 | yynewstate -- push a new state, which is found in yystate. |
1295 `------------------------------------------------------------*/
1296 yynewstate:
1297 /* In all cases, when you get here, the value and location stacks
1298 have just been pushed. So pushing a state here evens the stacks. */
1299 yyssp++;
1300
1301
1302 /*--------------------------------------------------------------------.
1303 | yysetstate -- set current state (the top of the stack) to yystate. |
1304 `--------------------------------------------------------------------*/
1305 yysetstate:
1306 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1307 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1308 YY_IGNORE_USELESS_CAST_BEGIN
1309 *yyssp = YY_CAST (yy_state_t, yystate);
1310 YY_IGNORE_USELESS_CAST_END
1311 YY_STACK_PRINT (yyss, yyssp);
1312
1313 if (yyss + yystacksize - 1 <= yyssp)
1314 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1315 YYNOMEM;
1316 #else
1317 {
1318 /* Get the current used size of the three stacks, in elements. */
1319 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1320
1321 # if defined yyoverflow
1322 {
1323 /* Give user a chance to reallocate the stack. Use copies of
1324 these so that the &'s don't force the real ones into
1325 memory. */
1326 yy_state_t *yyss1 = yyss;
1327 YYSTYPE *yyvs1 = yyvs;
1328 YYLTYPE *yyls1 = yyls;
1329
1330 /* Each stack pointer address is followed by the size of the
1331 data in use in that stack, in bytes. This used to be a
1332 conditional around just the two extra args, but that might
1333 be undefined if yyoverflow is a macro. */
1334 yyoverflow (YY_("memory exhausted"),
1335 &yyss1, yysize * YYSIZEOF (*yyssp),
1336 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1337 &yyls1, yysize * YYSIZEOF (*yylsp),
1338 &yystacksize);
1339 yyss = yyss1;
1340 yyvs = yyvs1;
1341 yyls = yyls1;
1342 }
1343 # else /* defined YYSTACK_RELOCATE */
1344 /* Extend the stack our own way. */
1345 if (YYMAXDEPTH <= yystacksize)
1346 YYNOMEM;
1347 yystacksize *= 2;
1348 if (YYMAXDEPTH < yystacksize)
1349 yystacksize = YYMAXDEPTH;
1350
1351 {
1352 yy_state_t *yyss1 = yyss;
1353 union yyalloc *yyptr =
1354 YY_CAST (union yyalloc *,
1355 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1356 if (! yyptr)
1357 YYNOMEM;
1358 YYSTACK_RELOCATE (yyss_alloc, yyss);
1359 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1360 YYSTACK_RELOCATE (yyls_alloc, yyls);
1361 # undef YYSTACK_RELOCATE
1362 if (yyss1 != yyssa)
1363 YYSTACK_FREE (yyss1);
1364 }
1365 # endif
1366
1367 yyssp = yyss + yysize - 1;
1368 yyvsp = yyvs + yysize - 1;
1369 yylsp = yyls + yysize - 1;
1370
1371 YY_IGNORE_USELESS_CAST_BEGIN
1372 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1373 YY_CAST (long, yystacksize)));
1374 YY_IGNORE_USELESS_CAST_END
1375
1376 if (yyss + yystacksize - 1 <= yyssp)
1377 YYABORT;
1378 }
1379 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1380
1381
1382 if (yystate == YYFINAL)
1383 YYACCEPT;
1384
1385 goto yybackup;
1386
1387
1388 /*-----------.
1389 | yybackup. |
1390 `-----------*/
1391 yybackup:
1392 /* Do appropriate processing given the current state. Read a
1393 lookahead token if we need one and don't already have one. */
1394
1395 /* First try to decide what to do without reference to lookahead token. */
1396 yyn = yypact[yystate];
1397 if (yypact_value_is_default (yyn))
1398 goto yydefault;
1399
1400 /* Not known => get a lookahead token if don't already have one. */
1401
1402 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1403 if (yychar == YYEMPTY)
1404 {
1405 YYDPRINTF ((stderr, "Reading a token\n"));
1406 yychar = yylex (&yylval, &yylloc, scanner);
1407 }
1408
1409 if (yychar <= YYEOF)
1410 {
1411 yychar = YYEOF;
1412 yytoken = YYSYMBOL_YYEOF;
1413 YYDPRINTF ((stderr, "Now at end of input.\n"));
1414 }
1415 else if (yychar == YYerror)
1416 {
1417 /* The scanner already issued an error message, process directly
1418 to error recovery. But do not keep the error token as
1419 lookahead, it is too special and may lead us to an endless
1420 loop in error recovery. */
1421 yychar = YYUNDEF;
1422 yytoken = YYSYMBOL_YYerror;
1423 yyerror_range[1] = yylloc;
1424 goto yyerrlab1;
1425 }
1426 else
1427 {
1428 yytoken = YYTRANSLATE (yychar);
1429 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1430 }
1431
1432 /* If the proper action on seeing token YYTOKEN is to reduce or to
1433 detect an error, take that action. */
1434 yyn += yytoken;
1435 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1436 goto yydefault;
1437 yyn = yytable[yyn];
1438 if (yyn <= 0)
1439 {
1440 if (yytable_value_is_error (yyn))
1441 goto yyerrlab;
1442 yyn = -yyn;
1443 goto yyreduce;
1444 }
1445
1446 /* Count tokens shifted since error; after three, turn off error
1447 status. */
1448 if (yyerrstatus)
1449 yyerrstatus--;
1450
1451 /* Shift the lookahead token. */
1452 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1453 yystate = yyn;
1454 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1455 *++yyvsp = yylval;
1456 YY_IGNORE_MAYBE_UNINITIALIZED_END
1457 *++yylsp = yylloc;
1458
1459 /* Discard the shifted token. */
1460 yychar = YYEMPTY;
1461 goto yynewstate;
1462
1463
1464 /*-----------------------------------------------------------.
1465 | yydefault -- do the default action for the current state. |
1466 `-----------------------------------------------------------*/
1467 yydefault:
1468 yyn = yydefact[yystate];
1469 if (yyn == 0)
1470 goto yyerrlab;
1471 goto yyreduce;
1472
1473
1474 /*-----------------------------.
1475 | yyreduce -- do a reduction. |
1476 `-----------------------------*/
1477 yyreduce:
1478 /* yyn is the number of a rule to reduce with. */
1479 yylen = yyr2[yyn];
1480
1481 /* If YYLEN is nonzero, implement the default value of the action:
1482 '$$ = $1'.
1483
1484 Otherwise, the following line sets YYVAL to garbage.
1485 This behavior is undocumented and Bison
1486 users should not rely upon it. Assigning to YYVAL
1487 unconditionally makes the parser a bit smaller, and it avoids a
1488 GCC warning that YYVAL may be used uninitialized. */
1489 yyval = yyvsp[1-yylen];
1490
1491 /* Default location. */
1492 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1493 yyerror_range[1] = yyloc;
1494 YY_REDUCE_PRINT (yyn);
1495 switch (yyn)
1496 {
1497 case 4: /* location: NAME align layer NUMBER mask shift */
1498 #line 53 "lib/route/pktloc_syntax.y"
1499 {
1500 struct rtnl_pktloc *loc;
1501
1502 if (!(loc = rtnl_pktloc_alloc())) {
1503 NL_DBG(1, "Allocating a packet location "
1504 "object failed.\n");
1505 YYABORT;
1506 }
1507
1508 loc->name = (yyvsp[-5].s);
1509 loc->align = (yyvsp[-4].i);
1510 loc->layer = (yyvsp[-3].i);
1511 loc->offset = (yyvsp[-2].i);
1512 loc->mask = (yyvsp[-1].i);
1513 loc->shift = (yyvsp[0].i);
1514
1515 if (rtnl_pktloc_add(loc) < 0) {
1516 NL_DBG(1, "Duplicate packet location entry "
1517 "\"%s\"\n", (yyvsp[-5].s));
1518 }
1519
1520 (yyval.l) = loc;
1521 }
1522 #line 1523 "lib/route/pktloc_syntax.c"
1523 break;
1524
1525 case 5: /* align: ALIGN */
1526 #line 80 "lib/route/pktloc_syntax.y"
1527 { (yyval.i) = (yyvsp[0].i); }
1528 #line 1529 "lib/route/pktloc_syntax.c"
1529 break;
1530
1531 case 6: /* align: NUMBER */
1532 #line 82 "lib/route/pktloc_syntax.y"
1533 { (yyval.i) = (yyvsp[0].i); }
1534 #line 1535 "lib/route/pktloc_syntax.c"
1535 break;
1536
1537 case 7: /* layer: %empty */
1538 #line 87 "lib/route/pktloc_syntax.y"
1539 { (yyval.i) = TCF_LAYER_NETWORK; }
1540 #line 1541 "lib/route/pktloc_syntax.c"
1541 break;
1542
1543 case 8: /* layer: LAYER '+' */
1544 #line 89 "lib/route/pktloc_syntax.y"
1545 { (yyval.i) = (yyvsp[-1].i); }
1546 #line 1547 "lib/route/pktloc_syntax.c"
1547 break;
1548
1549 case 9: /* mask: %empty */
1550 #line 94 "lib/route/pktloc_syntax.y"
1551 { (yyval.i) = 0; }
1552 #line 1553 "lib/route/pktloc_syntax.c"
1553 break;
1554
1555 case 10: /* mask: NUMBER */
1556 #line 96 "lib/route/pktloc_syntax.y"
1557 { (yyval.i) = (yyvsp[0].i); }
1558 #line 1559 "lib/route/pktloc_syntax.c"
1559 break;
1560
1561 case 11: /* shift: %empty */
1562 #line 101 "lib/route/pktloc_syntax.y"
1563 { (yyval.i) = 0; }
1564 #line 1565 "lib/route/pktloc_syntax.c"
1565 break;
1566
1567 case 12: /* shift: NUMBER */
1568 #line 103 "lib/route/pktloc_syntax.y"
1569 { (yyval.i) = (yyvsp[0].i); }
1570 #line 1571 "lib/route/pktloc_syntax.c"
1571 break;
1572
1573
1574 #line 1575 "lib/route/pktloc_syntax.c"
1575
1576 default: break;
1577 }
1578 /* User semantic actions sometimes alter yychar, and that requires
1579 that yytoken be updated with the new translation. We take the
1580 approach of translating immediately before every use of yytoken.
1581 One alternative is translating here after every semantic action,
1582 but that translation would be missed if the semantic action invokes
1583 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1584 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1585 incorrect destructor might then be invoked immediately. In the
1586 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1587 to an incorrect destructor call or verbose syntax error message
1588 before the lookahead is translated. */
1589 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1590
1591 YYPOPSTACK (yylen);
1592 yylen = 0;
1593
1594 *++yyvsp = yyval;
1595 *++yylsp = yyloc;
1596
1597 /* Now 'shift' the result of the reduction. Determine what state
1598 that goes to, based on the state we popped back to and the rule
1599 number reduced by. */
1600 {
1601 const int yylhs = yyr1[yyn] - YYNTOKENS;
1602 const int yyi = yypgoto[yylhs] + *yyssp;
1603 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1604 ? yytable[yyi]
1605 : yydefgoto[yylhs]);
1606 }
1607
1608 goto yynewstate;
1609
1610
1611 /*--------------------------------------.
1612 | yyerrlab -- here on detecting error. |
1613 `--------------------------------------*/
1614 yyerrlab:
1615 /* Make sure we have latest lookahead translation. See comments at
1616 user semantic actions for why this is necessary. */
1617 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1618 /* If not already recovering from an error, report this error. */
1619 if (!yyerrstatus)
1620 {
1621 ++yynerrs;
1622 {
1623 yypcontext_t yyctx
1624 = {yyssp, yytoken, &yylloc};
1625 char const *yymsgp = YY_("syntax error");
1626 int yysyntax_error_status;
1627 yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
1628 if (yysyntax_error_status == 0)
1629 yymsgp = yymsg;
1630 else if (yysyntax_error_status == -1)
1631 {
1632 if (yymsg != yymsgbuf)
1633 YYSTACK_FREE (yymsg);
1634 yymsg = YY_CAST (char *,
1635 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
1636 if (yymsg)
1637 {
1638 yysyntax_error_status
1639 = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
1640 yymsgp = yymsg;
1641 }
1642 else
1643 {
1644 yymsg = yymsgbuf;
1645 yymsg_alloc = sizeof yymsgbuf;
1646 yysyntax_error_status = YYENOMEM;
1647 }
1648 }
1649 yyerror (&yylloc, scanner, yymsgp);
1650 if (yysyntax_error_status == YYENOMEM)
1651 YYNOMEM;
1652 }
1653 }
1654
1655 yyerror_range[1] = yylloc;
1656 if (yyerrstatus == 3)
1657 {
1658 /* If just tried and failed to reuse lookahead token after an
1659 error, discard it. */
1660
1661 if (yychar <= YYEOF)
1662 {
1663 /* Return failure if at end of input. */
1664 if (yychar == YYEOF)
1665 YYABORT;
1666 }
1667 else
1668 {
1669 yydestruct ("Error: discarding",
1670 yytoken, &yylval, &yylloc, scanner);
1671 yychar = YYEMPTY;
1672 }
1673 }
1674
1675 /* Else will try to reuse lookahead token after shifting the error
1676 token. */
1677 goto yyerrlab1;
1678
1679
1680 /*---------------------------------------------------.
1681 | yyerrorlab -- error raised explicitly by YYERROR. |
1682 `---------------------------------------------------*/
1683 yyerrorlab:
1684 /* Pacify compilers when the user code never invokes YYERROR and the
1685 label yyerrorlab therefore never appears in user code. */
1686 if (0)
1687 YYERROR;
1688 ++yynerrs;
1689
1690 /* Do not reclaim the symbols of the rule whose action triggered
1691 this YYERROR. */
1692 YYPOPSTACK (yylen);
1693 yylen = 0;
1694 YY_STACK_PRINT (yyss, yyssp);
1695 yystate = *yyssp;
1696 goto yyerrlab1;
1697
1698
1699 /*-------------------------------------------------------------.
1700 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1701 `-------------------------------------------------------------*/
1702 yyerrlab1:
1703 yyerrstatus = 3; /* Each real token shifted decrements this. */
1704
1705 /* Pop stack until we find a state that shifts the error token. */
1706 for (;;)
1707 {
1708 yyn = yypact[yystate];
1709 if (!yypact_value_is_default (yyn))
1710 {
1711 yyn += YYSYMBOL_YYerror;
1712 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1713 {
1714 yyn = yytable[yyn];
1715 if (0 < yyn)
1716 break;
1717 }
1718 }
1719
1720 /* Pop the current state because it cannot handle the error token. */
1721 if (yyssp == yyss)
1722 YYABORT;
1723
1724 yyerror_range[1] = *yylsp;
1725 yydestruct ("Error: popping",
1726 YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp, scanner);
1727 YYPOPSTACK (1);
1728 yystate = *yyssp;
1729 YY_STACK_PRINT (yyss, yyssp);
1730 }
1731
1732 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1733 *++yyvsp = yylval;
1734 YY_IGNORE_MAYBE_UNINITIALIZED_END
1735
1736 yyerror_range[2] = yylloc;
1737 ++yylsp;
1738 YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
1739
1740 /* Shift the error token. */
1741 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1742
1743 yystate = yyn;
1744 goto yynewstate;
1745
1746
1747 /*-------------------------------------.
1748 | yyacceptlab -- YYACCEPT comes here. |
1749 `-------------------------------------*/
1750 yyacceptlab:
1751 yyresult = 0;
1752 goto yyreturnlab;
1753
1754
1755 /*-----------------------------------.
1756 | yyabortlab -- YYABORT comes here. |
1757 `-----------------------------------*/
1758 yyabortlab:
1759 yyresult = 1;
1760 goto yyreturnlab;
1761
1762
1763 /*-----------------------------------------------------------.
1764 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1765 `-----------------------------------------------------------*/
1766 yyexhaustedlab:
1767 yyerror (&yylloc, scanner, YY_("memory exhausted"));
1768 yyresult = 2;
1769 goto yyreturnlab;
1770
1771
1772 /*----------------------------------------------------------.
1773 | yyreturnlab -- parsing is finished, clean up and return. |
1774 `----------------------------------------------------------*/
1775 yyreturnlab:
1776 if (yychar != YYEMPTY)
1777 {
1778 /* Make sure we have latest lookahead translation. See comments at
1779 user semantic actions for why this is necessary. */
1780 yytoken = YYTRANSLATE (yychar);
1781 yydestruct ("Cleanup: discarding lookahead",
1782 yytoken, &yylval, &yylloc, scanner);
1783 }
1784 /* Do not reclaim the symbols of the rule whose action triggered
1785 this YYABORT or YYACCEPT. */
1786 YYPOPSTACK (yylen);
1787 YY_STACK_PRINT (yyss, yyssp);
1788 while (yyssp != yyss)
1789 {
1790 yydestruct ("Cleanup: popping",
1791 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp, scanner);
1792 YYPOPSTACK (1);
1793 }
1794 #ifndef yyoverflow
1795 if (yyss != yyssa)
1796 YYSTACK_FREE (yyss);
1797 #endif
1798 if (yymsg != yymsgbuf)
1799 YYSTACK_FREE (yymsg);
1800 return yyresult;
1801 }
1802
rtnl_pktloc_add
int rtnl_pktloc_add(struct rtnl_pktloc *loc)
Add a packet location to the hash table.
Definition: pktloc.c:213
rtnl_pktloc_alloc
struct rtnl_pktloc * rtnl_pktloc_alloc(void)
Allocate packet location object.
Definition: pktloc.c:180
YYLTYPE
Definition: pktloc_syntax.h:98
rtnl_pktloc
Definition: pktloc.h:20
yypcontext_t
Definition: ematch_syntax.c:1006
YYSTYPE
Definition: ematch_syntax.h:211
yyalloc
Definition: ematch_syntax.c:500