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