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