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

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