Line data Source code
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 0
59 :
60 : /* Push parsers. */
61 : #define YYPUSH 0
62 :
63 : /* Pull parsers. */
64 : #define YYPULL 1
65 :
66 :
67 :
68 :
69 : /* First part of user prologue. */
70 :
71 : /*
72 : * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
73 : * (Royal Institute of Technology, Stockholm, Sweden).
74 : * All rights reserved.
75 : *
76 : * Redistribution and use in source and binary forms, with or without
77 : * modification, are permitted provided that the following conditions
78 : * are met:
79 : *
80 : * 1. Redistributions of source code must retain the above copyright
81 : * notice, this list of conditions and the following disclaimer.
82 : *
83 : * 2. Redistributions in binary form must reproduce the above copyright
84 : * notice, this list of conditions and the following disclaimer in the
85 : * documentation and/or other materials provided with the distribution.
86 : *
87 : * 3. Neither the name of the Institute nor the names of its contributors
88 : * may be used to endorse or promote products derived from this software
89 : * without specific prior written permission.
90 : *
91 : * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
92 : * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
93 : * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
94 : * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
95 : * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
96 : * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
97 : * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
98 : * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
99 : * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
100 : * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
101 : * SUCH DAMAGE.
102 : */
103 :
104 : #include "compile_et.h"
105 : #include "lex.h"
106 :
107 : void yyerror (const char *s);
108 : #define yyerror yyerror
109 : static long name2number(const char *str);
110 :
111 : extern char *yytext;
112 :
113 : /* This is for bison */
114 :
115 : #if !defined(alloca) && !defined(HAVE_ALLOCA)
116 : #define alloca(x) malloc(x)
117 : #endif
118 :
119 : #define YYMALLOC malloc
120 : #define YYFREE free
121 :
122 :
123 :
124 : # ifndef YY_CAST
125 : # ifdef __cplusplus
126 : # define YY_CAST(Type, Val) static_cast<Type> (Val)
127 : # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
128 : # else
129 : # define YY_CAST(Type, Val) ((Type) (Val))
130 : # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
131 : # endif
132 : # endif
133 : # ifndef YY_NULLPTR
134 : # if defined __cplusplus
135 : # if 201103L <= __cplusplus
136 : # define YY_NULLPTR nullptr
137 : # else
138 : # define YY_NULLPTR 0
139 : # endif
140 : # else
141 : # define YY_NULLPTR ((void*)0)
142 : # endif
143 : # endif
144 :
145 : #include "parse.tab.h"
146 : /* Symbol kind. */
147 : enum yysymbol_kind_t
148 : {
149 : YYSYMBOL_YYEMPTY = -2,
150 : YYSYMBOL_YYEOF = 0, /* "end of file" */
151 : YYSYMBOL_YYerror = 1, /* error */
152 : YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
153 : YYSYMBOL_ET = 3, /* ET */
154 : YYSYMBOL_INDEX = 4, /* INDEX */
155 : YYSYMBOL_PREFIX = 5, /* PREFIX */
156 : YYSYMBOL_EC = 6, /* EC */
157 : YYSYMBOL_ID = 7, /* ID */
158 : YYSYMBOL_END = 8, /* END */
159 : YYSYMBOL_STRING = 9, /* STRING */
160 : YYSYMBOL_NUMBER = 10, /* NUMBER */
161 : YYSYMBOL_11_ = 11, /* ',' */
162 : YYSYMBOL_YYACCEPT = 12, /* $accept */
163 : YYSYMBOL_file = 13, /* file */
164 : YYSYMBOL_header = 14, /* header */
165 : YYSYMBOL_id = 15, /* id */
166 : YYSYMBOL_et = 16, /* et */
167 : YYSYMBOL_statements = 17, /* statements */
168 : YYSYMBOL_statement = 18 /* statement */
169 : };
170 : typedef enum yysymbol_kind_t yysymbol_kind_t;
171 :
172 :
173 :
174 :
175 : #ifdef short
176 : # undef short
177 : #endif
178 :
179 : /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
180 : <limits.h> and (if available) <stdint.h> are included
181 : so that the code can choose integer types of a good width. */
182 :
183 : #ifndef __PTRDIFF_MAX__
184 : # include <limits.h> /* INFRINGES ON USER NAME SPACE */
185 : # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
186 : # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
187 : # define YY_STDINT_H
188 : # endif
189 : #endif
190 :
191 : /* Narrow types that promote to a signed type and that can represent a
192 : signed or unsigned integer of at least N bits. In tables they can
193 : save space and decrease cache pressure. Promoting to a signed type
194 : helps avoid bugs in integer arithmetic. */
195 :
196 : #ifdef __INT_LEAST8_MAX__
197 : typedef __INT_LEAST8_TYPE__ yytype_int8;
198 : #elif defined YY_STDINT_H
199 : typedef int_least8_t yytype_int8;
200 : #else
201 : typedef signed char yytype_int8;
202 : #endif
203 :
204 : #ifdef __INT_LEAST16_MAX__
205 : typedef __INT_LEAST16_TYPE__ yytype_int16;
206 : #elif defined YY_STDINT_H
207 : typedef int_least16_t yytype_int16;
208 : #else
209 : typedef short yytype_int16;
210 : #endif
211 :
212 : /* Work around bug in HP-UX 11.23, which defines these macros
213 : incorrectly for preprocessor constants. This workaround can likely
214 : be removed in 2023, as HPE has promised support for HP-UX 11.23
215 : (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
216 : <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
217 : #ifdef __hpux
218 : # undef UINT_LEAST8_MAX
219 : # undef UINT_LEAST16_MAX
220 : # define UINT_LEAST8_MAX 255
221 : # define UINT_LEAST16_MAX 65535
222 : #endif
223 :
224 : #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
225 : typedef __UINT_LEAST8_TYPE__ yytype_uint8;
226 : #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
227 : && UINT_LEAST8_MAX <= INT_MAX)
228 : typedef uint_least8_t yytype_uint8;
229 : #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
230 : typedef unsigned char yytype_uint8;
231 : #else
232 : typedef short yytype_uint8;
233 : #endif
234 :
235 : #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
236 : typedef __UINT_LEAST16_TYPE__ yytype_uint16;
237 : #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
238 : && UINT_LEAST16_MAX <= INT_MAX)
239 : typedef uint_least16_t yytype_uint16;
240 : #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
241 : typedef unsigned short yytype_uint16;
242 : #else
243 : typedef int yytype_uint16;
244 : #endif
245 :
246 : #ifndef YYPTRDIFF_T
247 : # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
248 : # define YYPTRDIFF_T __PTRDIFF_TYPE__
249 : # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
250 : # elif defined PTRDIFF_MAX
251 : # ifndef ptrdiff_t
252 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
253 : # endif
254 : # define YYPTRDIFF_T ptrdiff_t
255 : # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
256 : # else
257 : # define YYPTRDIFF_T long
258 : # define YYPTRDIFF_MAXIMUM LONG_MAX
259 : # endif
260 : #endif
261 :
262 : #ifndef YYSIZE_T
263 : # ifdef __SIZE_TYPE__
264 : # define YYSIZE_T __SIZE_TYPE__
265 : # elif defined size_t
266 : # define YYSIZE_T size_t
267 : # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
268 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
269 : # define YYSIZE_T size_t
270 : # else
271 : # define YYSIZE_T unsigned
272 : # endif
273 : #endif
274 :
275 : #define YYSIZE_MAXIMUM \
276 : YY_CAST (YYPTRDIFF_T, \
277 : (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
278 : ? YYPTRDIFF_MAXIMUM \
279 : : YY_CAST (YYSIZE_T, -1)))
280 :
281 : #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
282 :
283 :
284 : /* Stored state numbers (used for stacks). */
285 : typedef yytype_int8 yy_state_t;
286 :
287 : /* State numbers in computations. */
288 : typedef int yy_state_fast_t;
289 :
290 : #ifndef YY_
291 : # if defined YYENABLE_NLS && YYENABLE_NLS
292 : # if ENABLE_NLS
293 : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
294 : # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
295 : # endif
296 : # endif
297 : # ifndef YY_
298 : # define YY_(Msgid) Msgid
299 : # endif
300 : #endif
301 :
302 :
303 : #ifndef YY_ATTRIBUTE_PURE
304 : # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
305 : # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
306 : # else
307 : # define YY_ATTRIBUTE_PURE
308 : # endif
309 : #endif
310 :
311 : #ifndef YY_ATTRIBUTE_UNUSED
312 : # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
313 : # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
314 : # else
315 : # define YY_ATTRIBUTE_UNUSED
316 : # endif
317 : #endif
318 :
319 : /* Suppress unused-variable warnings by "using" E. */
320 : #if ! defined lint || defined __GNUC__
321 : # define YY_USE(E) ((void) (E))
322 : #else
323 : # define YY_USE(E) /* empty */
324 : #endif
325 :
326 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
327 : #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
328 : # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
329 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
330 : _Pragma ("GCC diagnostic push") \
331 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
332 : # else
333 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
334 : _Pragma ("GCC diagnostic push") \
335 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
336 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
337 : # endif
338 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
339 : _Pragma ("GCC diagnostic pop")
340 : #else
341 : # define YY_INITIAL_VALUE(Value) Value
342 : #endif
343 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
344 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
345 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
346 : #endif
347 : #ifndef YY_INITIAL_VALUE
348 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
349 : #endif
350 :
351 : #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
352 : # define YY_IGNORE_USELESS_CAST_BEGIN \
353 : _Pragma ("GCC diagnostic push") \
354 : _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
355 : # define YY_IGNORE_USELESS_CAST_END \
356 : _Pragma ("GCC diagnostic pop")
357 : #endif
358 : #ifndef YY_IGNORE_USELESS_CAST_BEGIN
359 : # define YY_IGNORE_USELESS_CAST_BEGIN
360 : # define YY_IGNORE_USELESS_CAST_END
361 : #endif
362 :
363 :
364 : #define YY_ASSERT(E) ((void) (0 && (E)))
365 :
366 : #if !defined yyoverflow
367 :
368 : /* The parser invokes alloca or malloc; define the necessary symbols. */
369 :
370 : # ifdef YYSTACK_USE_ALLOCA
371 : # if YYSTACK_USE_ALLOCA
372 : # ifdef __GNUC__
373 : # define YYSTACK_ALLOC __builtin_alloca
374 : # elif defined __BUILTIN_VA_ARG_INCR
375 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
376 : # elif defined _AIX
377 : # define YYSTACK_ALLOC __alloca
378 : # elif defined _MSC_VER
379 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
380 : # define alloca _alloca
381 : # else
382 : # define YYSTACK_ALLOC alloca
383 : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
384 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
385 : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
386 : # ifndef EXIT_SUCCESS
387 : # define EXIT_SUCCESS 0
388 : # endif
389 : # endif
390 : # endif
391 : # endif
392 : # endif
393 :
394 : # ifdef YYSTACK_ALLOC
395 : /* Pacify GCC's 'empty if-body' warning. */
396 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
397 : # ifndef YYSTACK_ALLOC_MAXIMUM
398 : /* The OS might guarantee only one guard page at the bottom of the stack,
399 : and a page size can be as small as 4096 bytes. So we cannot safely
400 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
401 : to allow for a few compiler-allocated temporary stack slots. */
402 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
403 : # endif
404 : # else
405 : # define YYSTACK_ALLOC YYMALLOC
406 : # define YYSTACK_FREE YYFREE
407 : # ifndef YYSTACK_ALLOC_MAXIMUM
408 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
409 : # endif
410 : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
411 : && ! ((defined YYMALLOC || defined malloc) \
412 : && (defined YYFREE || defined free)))
413 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
414 : # ifndef EXIT_SUCCESS
415 : # define EXIT_SUCCESS 0
416 : # endif
417 : # endif
418 : # ifndef YYMALLOC
419 : # define YYMALLOC malloc
420 : # if ! defined malloc && ! defined EXIT_SUCCESS
421 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
422 : # endif
423 : # endif
424 : # ifndef YYFREE
425 : # define YYFREE free
426 : # if ! defined free && ! defined EXIT_SUCCESS
427 : void free (void *); /* INFRINGES ON USER NAME SPACE */
428 : # endif
429 : # endif
430 : # endif
431 : #endif /* !defined yyoverflow */
432 :
433 : #if (! defined yyoverflow \
434 : && (! defined __cplusplus \
435 : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
436 :
437 : /* A type that is properly aligned for any stack member. */
438 : union yyalloc
439 : {
440 : yy_state_t yyss_alloc;
441 : YYSTYPE yyvs_alloc;
442 : };
443 :
444 : /* The size of the maximum gap between one aligned stack and the next. */
445 : # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
446 :
447 : /* The size of an array large to enough to hold all stacks, each with
448 : N elements. */
449 : # define YYSTACK_BYTES(N) \
450 : ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
451 : + YYSTACK_GAP_MAXIMUM)
452 :
453 : # define YYCOPY_NEEDED 1
454 :
455 : /* Relocate STACK from its old location to the new one. The
456 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
457 : elements in the stack, and YYPTR gives the new location of the
458 : stack. Advance YYPTR to a properly aligned location for the next
459 : stack. */
460 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
461 : do \
462 : { \
463 : YYPTRDIFF_T yynewbytes; \
464 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
465 : Stack = &yyptr->Stack_alloc; \
466 : yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
467 : yyptr += yynewbytes / YYSIZEOF (*yyptr); \
468 : } \
469 : while (0)
470 :
471 : #endif
472 :
473 : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
474 : /* Copy COUNT objects from SRC to DST. The source and destination do
475 : not overlap. */
476 : # ifndef YYCOPY
477 : # if defined __GNUC__ && 1 < __GNUC__
478 : # define YYCOPY(Dst, Src, Count) \
479 : __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
480 : # else
481 : # define YYCOPY(Dst, Src, Count) \
482 : do \
483 : { \
484 : YYPTRDIFF_T yyi; \
485 : for (yyi = 0; yyi < (Count); yyi++) \
486 : (Dst)[yyi] = (Src)[yyi]; \
487 : } \
488 : while (0)
489 : # endif
490 : # endif
491 : #endif /* !YYCOPY_NEEDED */
492 :
493 : /* YYFINAL -- State number of the termination state. */
494 : #define YYFINAL 9
495 : /* YYLAST -- Last index in YYTABLE. */
496 : #define YYLAST 23
497 :
498 : /* YYNTOKENS -- Number of terminals. */
499 : #define YYNTOKENS 12
500 : /* YYNNTS -- Number of nonterminals. */
501 : #define YYNNTS 7
502 : /* YYNRULES -- Number of rules. */
503 : #define YYNRULES 15
504 : /* YYNSTATES -- Number of states. */
505 : #define YYNSTATES 24
506 :
507 : /* YYMAXUTOK -- Last valid token kind. */
508 : #define YYMAXUTOK 265
509 :
510 :
511 : /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
512 : as returned by yylex, with out-of-bounds checking. */
513 : #define YYTRANSLATE(YYX) \
514 : (0 <= (YYX) && (YYX) <= YYMAXUTOK \
515 : ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
516 : : YYSYMBOL_YYUNDEF)
517 :
518 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
519 : as returned by yylex. */
520 : static const yytype_int8 yytranslate[] =
521 : {
522 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 : 2, 2, 2, 2, 11, 2, 2, 2, 2, 2,
527 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
548 : 5, 6, 7, 8, 9, 10
549 : };
550 :
551 : #if YYDEBUG
552 : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
553 : static const yytype_uint8 yyrline[] =
554 : {
555 : 0, 66, 66, 67, 70, 71, 74, 80, 86, 95,
556 : 96, 99, 103, 111, 118, 138
557 : };
558 : #endif
559 :
560 : /** Accessing symbol of state STATE. */
561 : #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
562 :
563 : #if YYDEBUG || 0
564 : /* The user-facing name of the symbol whose (internal) number is
565 : YYSYMBOL. No bounds checking. */
566 : static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
567 :
568 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
569 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
570 : static const char *const yytname[] =
571 : {
572 : "\"end of file\"", "error", "\"invalid token\"", "ET", "INDEX",
573 : "PREFIX", "EC", "ID", "END", "STRING", "NUMBER", "','", "$accept",
574 : "file", "header", "id", "et", "statements", "statement", YY_NULLPTR
575 : };
576 :
577 : static const char *
578 : yysymbol_name (yysymbol_kind_t yysymbol)
579 : {
580 : return yytname[yysymbol];
581 : }
582 : #endif
583 :
584 : #define YYPACT_NINF (-5)
585 :
586 : #define yypact_value_is_default(Yyn) \
587 : ((Yyn) == YYPACT_NINF)
588 :
589 : #define YYTABLE_NINF (-1)
590 :
591 : #define yytable_value_is_error(Yyn) \
592 : 0
593 :
594 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
595 : STATE-NUM. */
596 : static const yytype_int8 yypact[] =
597 : {
598 : 0, -3, -1, 5, -4, 6, -5, 1, -5, -5,
599 : 2, 4, 7, -5, -4, -5, -5, -5, -5, -5,
600 : 3, -5, 8, -5
601 : };
602 :
603 : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
604 : Performed when YYTABLE does not specify something else to do. Zero
605 : means the default is an error. */
606 : static const yytype_int8 yydefact[] =
607 : {
608 : 2, 0, 0, 0, 0, 0, 5, 7, 6, 1,
609 : 0, 13, 0, 15, 3, 9, 4, 8, 11, 12,
610 : 0, 10, 0, 14
611 : };
612 :
613 : /* YYPGOTO[NTERM-NUM]. */
614 : static const yytype_int8 yypgoto[] =
615 : {
616 : -5, -5, -5, -5, 10, -5, 9
617 : };
618 :
619 : /* YYDEFGOTO[NTERM-NUM]. */
620 : static const yytype_int8 yydefgoto[] =
621 : {
622 : 0, 3, 4, 5, 6, 14, 15
623 : };
624 :
625 : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
626 : positive, shift that token. If negative, reduce the rule whose
627 : number is the opposite. If YYTABLE_NINF, syntax error. */
628 : static const yytype_int8 yytable[] =
629 : {
630 : 10, 11, 12, 1, 13, 9, 7, 2, 8, 1,
631 : 17, 0, 18, 19, 22, 16, 20, 23, 0, 0,
632 : 0, 0, 0, 21
633 : };
634 :
635 : static const yytype_int8 yycheck[] =
636 : {
637 : 4, 5, 6, 3, 8, 0, 9, 7, 9, 3,
638 : 9, -1, 10, 9, 11, 5, 9, 9, -1, -1,
639 : -1, -1, -1, 14
640 : };
641 :
642 : /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
643 : state STATE-NUM. */
644 : static const yytype_int8 yystos[] =
645 : {
646 : 0, 3, 7, 13, 14, 15, 16, 9, 9, 0,
647 : 4, 5, 6, 8, 17, 18, 16, 9, 10, 9,
648 : 9, 18, 11, 9
649 : };
650 :
651 : /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
652 : static const yytype_int8 yyr1[] =
653 : {
654 : 0, 12, 13, 13, 14, 14, 15, 16, 16, 17,
655 : 17, 18, 18, 18, 18, 18
656 : };
657 :
658 : /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
659 : static const yytype_int8 yyr2[] =
660 : {
661 : 0, 2, 0, 2, 2, 1, 2, 2, 3, 1,
662 : 2, 2, 2, 1, 4, 1
663 : };
664 :
665 :
666 : enum { YYENOMEM = -2 };
667 :
668 : #define yyerrok (yyerrstatus = 0)
669 : #define yyclearin (yychar = YYEMPTY)
670 :
671 : #define YYACCEPT goto yyacceptlab
672 : #define YYABORT goto yyabortlab
673 : #define YYERROR goto yyerrorlab
674 : #define YYNOMEM goto yyexhaustedlab
675 :
676 :
677 : #define YYRECOVERING() (!!yyerrstatus)
678 :
679 : #define YYBACKUP(Token, Value) \
680 : do \
681 : if (yychar == YYEMPTY) \
682 : { \
683 : yychar = (Token); \
684 : yylval = (Value); \
685 : YYPOPSTACK (yylen); \
686 : yystate = *yyssp; \
687 : goto yybackup; \
688 : } \
689 : else \
690 : { \
691 : yyerror (YY_("syntax error: cannot back up")); \
692 : YYERROR; \
693 : } \
694 : while (0)
695 :
696 : /* Backward compatibility with an undocumented macro.
697 : Use YYerror or YYUNDEF. */
698 : #define YYERRCODE YYUNDEF
699 :
700 :
701 : /* Enable debugging if requested. */
702 : #if YYDEBUG
703 :
704 : # ifndef YYFPRINTF
705 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
706 : # define YYFPRINTF fprintf
707 : # endif
708 :
709 : # define YYDPRINTF(Args) \
710 : do { \
711 : if (yydebug) \
712 : YYFPRINTF Args; \
713 : } while (0)
714 :
715 :
716 :
717 :
718 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
719 : do { \
720 : if (yydebug) \
721 : { \
722 : YYFPRINTF (stderr, "%s ", Title); \
723 : yy_symbol_print (stderr, \
724 : Kind, Value); \
725 : YYFPRINTF (stderr, "\n"); \
726 : } \
727 : } while (0)
728 :
729 :
730 : /*-----------------------------------.
731 : | Print this symbol's value on YYO. |
732 : `-----------------------------------*/
733 :
734 : static void
735 : yy_symbol_value_print (FILE *yyo,
736 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
737 : {
738 : FILE *yyoutput = yyo;
739 : YY_USE (yyoutput);
740 : if (!yyvaluep)
741 : return;
742 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
743 : YY_USE (yykind);
744 : YY_IGNORE_MAYBE_UNINITIALIZED_END
745 : }
746 :
747 :
748 : /*---------------------------.
749 : | Print this symbol on YYO. |
750 : `---------------------------*/
751 :
752 : static void
753 : yy_symbol_print (FILE *yyo,
754 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
755 : {
756 : YYFPRINTF (yyo, "%s %s (",
757 : yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
758 :
759 : yy_symbol_value_print (yyo, yykind, yyvaluep);
760 : YYFPRINTF (yyo, ")");
761 : }
762 :
763 : /*------------------------------------------------------------------.
764 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
765 : | TOP (included). |
766 : `------------------------------------------------------------------*/
767 :
768 : static void
769 : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
770 : {
771 : YYFPRINTF (stderr, "Stack now");
772 : for (; yybottom <= yytop; yybottom++)
773 : {
774 : int yybot = *yybottom;
775 : YYFPRINTF (stderr, " %d", yybot);
776 : }
777 : YYFPRINTF (stderr, "\n");
778 : }
779 :
780 : # define YY_STACK_PRINT(Bottom, Top) \
781 : do { \
782 : if (yydebug) \
783 : yy_stack_print ((Bottom), (Top)); \
784 : } while (0)
785 :
786 :
787 : /*------------------------------------------------.
788 : | Report that the YYRULE is going to be reduced. |
789 : `------------------------------------------------*/
790 :
791 : static void
792 : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
793 : int yyrule)
794 : {
795 : int yylno = yyrline[yyrule];
796 : int yynrhs = yyr2[yyrule];
797 : int yyi;
798 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
799 : yyrule - 1, yylno);
800 : /* The symbols being reduced. */
801 : for (yyi = 0; yyi < yynrhs; yyi++)
802 : {
803 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
804 : yy_symbol_print (stderr,
805 : YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
806 : &yyvsp[(yyi + 1) - (yynrhs)]);
807 : YYFPRINTF (stderr, "\n");
808 : }
809 : }
810 :
811 : # define YY_REDUCE_PRINT(Rule) \
812 : do { \
813 : if (yydebug) \
814 : yy_reduce_print (yyssp, yyvsp, Rule); \
815 : } while (0)
816 :
817 : /* Nonzero means print parse trace. It is left uninitialized so that
818 : multiple parsers can coexist. */
819 : int yydebug;
820 : #else /* !YYDEBUG */
821 : # define YYDPRINTF(Args) ((void) 0)
822 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
823 : # define YY_STACK_PRINT(Bottom, Top)
824 : # define YY_REDUCE_PRINT(Rule)
825 : #endif /* !YYDEBUG */
826 :
827 :
828 : /* YYINITDEPTH -- initial size of the parser's stacks. */
829 : #ifndef YYINITDEPTH
830 : # define YYINITDEPTH 200
831 : #endif
832 :
833 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
834 : if the built-in stack extension method is used).
835 :
836 : Do not make this value too large; the results are undefined if
837 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
838 : evaluated with infinite-precision integer arithmetic. */
839 :
840 : #ifndef YYMAXDEPTH
841 : # define YYMAXDEPTH 10000
842 : #endif
843 :
844 :
845 :
846 :
847 :
848 :
849 : /*-----------------------------------------------.
850 : | Release the memory associated to this symbol. |
851 : `-----------------------------------------------*/
852 :
853 : static void
854 468 : yydestruct (const char *yymsg,
855 : yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
856 : {
857 : YY_USE (yyvaluep);
858 468 : if (!yymsg)
859 0 : yymsg = "Deleting";
860 : YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
861 :
862 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
863 : YY_USE (yykind);
864 : YY_IGNORE_MAYBE_UNINITIALIZED_END
865 468 : }
866 :
867 :
868 : /* Lookahead token kind. */
869 : int yychar;
870 :
871 : /* The semantic value of the lookahead symbol. */
872 : YYSTYPE yylval;
873 : /* Number of syntax errors so far. */
874 : int yynerrs;
875 :
876 :
877 :
878 :
879 : /*----------.
880 : | yyparse. |
881 : `----------*/
882 :
883 : int
884 247 : yyparse (void)
885 : {
886 247 : yy_state_fast_t yystate = 0;
887 : /* Number of tokens to shift before error messages enabled. */
888 247 : int yyerrstatus = 0;
889 :
890 : /* Refer to the stacks through separate pointers, to allow yyoverflow
891 : to reallocate them elsewhere. */
892 :
893 : /* Their size. */
894 247 : YYPTRDIFF_T yystacksize = YYINITDEPTH;
895 :
896 : /* The state stack: array, bottom, top. */
897 13 : yy_state_t yyssa[YYINITDEPTH];
898 247 : yy_state_t *yyss = yyssa;
899 247 : yy_state_t *yyssp = yyss;
900 :
901 : /* The semantic value stack: array, bottom, top. */
902 13 : YYSTYPE yyvsa[YYINITDEPTH];
903 247 : YYSTYPE *yyvs = yyvsa;
904 247 : YYSTYPE *yyvsp = yyvs;
905 :
906 13 : int yyn;
907 : /* The return value of yyparse. */
908 13 : int yyresult;
909 : /* Lookahead symbol kind. */
910 247 : yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
911 : /* The variables used to return semantic value and location from the
912 : action routines. */
913 13 : YYSTYPE yyval;
914 :
915 :
916 :
917 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
918 :
919 : /* The number of symbols on the RHS of the reduced rule.
920 : Keep to zero when no symbol should be popped. */
921 247 : int yylen = 0;
922 :
923 13 : YYDPRINTF ((stderr, "Starting parse\n"));
924 :
925 247 : yychar = YYEMPTY; /* Cause a token to be read. */
926 :
927 247 : goto yysetstate;
928 :
929 :
930 : /*------------------------------------------------------------.
931 : | yynewstate -- push a new state, which is found in yystate. |
932 : `------------------------------------------------------------*/
933 62605 : yynewstate:
934 : /* In all cases, when you get here, the value and location stacks
935 : have just been pushed. So pushing a state here evens the stacks. */
936 62605 : yyssp++;
937 :
938 :
939 : /*--------------------------------------------------------------------.
940 : | yysetstate -- set current state (the top of the stack) to yystate. |
941 : `--------------------------------------------------------------------*/
942 62852 : yysetstate:
943 3308 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
944 3308 : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
945 : YY_IGNORE_USELESS_CAST_BEGIN
946 62852 : *yyssp = YY_CAST (yy_state_t, yystate);
947 : YY_IGNORE_USELESS_CAST_END
948 3308 : YY_STACK_PRINT (yyss, yyssp);
949 :
950 62852 : if (yyss + yystacksize - 1 <= yyssp)
951 : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
952 : YYNOMEM;
953 : #else
954 : {
955 : /* Get the current used size of the three stacks, in elements. */
956 0 : YYPTRDIFF_T yysize = yyssp - yyss + 1;
957 :
958 : # if defined yyoverflow
959 : {
960 : /* Give user a chance to reallocate the stack. Use copies of
961 : these so that the &'s don't force the real ones into
962 : memory. */
963 : yy_state_t *yyss1 = yyss;
964 : YYSTYPE *yyvs1 = yyvs;
965 :
966 : /* Each stack pointer address is followed by the size of the
967 : data in use in that stack, in bytes. This used to be a
968 : conditional around just the two extra args, but that might
969 : be undefined if yyoverflow is a macro. */
970 : yyoverflow (YY_("memory exhausted"),
971 : &yyss1, yysize * YYSIZEOF (*yyssp),
972 : &yyvs1, yysize * YYSIZEOF (*yyvsp),
973 : &yystacksize);
974 : yyss = yyss1;
975 : yyvs = yyvs1;
976 : }
977 : # else /* defined YYSTACK_RELOCATE */
978 : /* Extend the stack our own way. */
979 0 : if (YYMAXDEPTH <= yystacksize)
980 0 : YYNOMEM;
981 0 : yystacksize *= 2;
982 0 : if (YYMAXDEPTH < yystacksize)
983 0 : yystacksize = YYMAXDEPTH;
984 :
985 : {
986 0 : yy_state_t *yyss1 = yyss;
987 0 : union yyalloc *yyptr =
988 0 : YY_CAST (union yyalloc *,
989 : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
990 0 : if (! yyptr)
991 0 : YYNOMEM;
992 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
993 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
994 : # undef YYSTACK_RELOCATE
995 0 : if (yyss1 != yyssa)
996 0 : YYSTACK_FREE (yyss1);
997 : }
998 : # endif
999 :
1000 0 : yyssp = yyss + yysize - 1;
1001 0 : yyvsp = yyvs + yysize - 1;
1002 :
1003 : YY_IGNORE_USELESS_CAST_BEGIN
1004 0 : YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1005 : YY_CAST (long, yystacksize)));
1006 : YY_IGNORE_USELESS_CAST_END
1007 :
1008 0 : if (yyss + yystacksize - 1 <= yyssp)
1009 0 : YYABORT;
1010 : }
1011 : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1012 :
1013 :
1014 62852 : if (yystate == YYFINAL)
1015 76 : YYACCEPT;
1016 :
1017 62776 : goto yybackup;
1018 :
1019 :
1020 : /*-----------.
1021 : | yybackup. |
1022 : `-----------*/
1023 62776 : yybackup:
1024 : /* Do appropriate processing given the current state. Read a
1025 : lookahead token if we need one and don't already have one. */
1026 :
1027 : /* First try to decide what to do without reference to lookahead token. */
1028 62776 : yyn = yypact[yystate];
1029 62776 : if (yypact_value_is_default (yyn))
1030 21622 : goto yydefault;
1031 :
1032 : /* Not known => get a lookahead token if don't already have one. */
1033 :
1034 : /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1035 41154 : if (yychar == YYEMPTY)
1036 : {
1037 2148 : YYDPRINTF ((stderr, "Reading a token\n"));
1038 40812 : yychar = yylex ();
1039 : }
1040 :
1041 41154 : if (yychar <= YYEOF)
1042 : {
1043 152 : yychar = YYEOF;
1044 152 : yytoken = YYSYMBOL_YYEOF;
1045 8 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1046 : }
1047 41002 : else if (yychar == YYerror)
1048 : {
1049 : /* The scanner already issued an error message, process directly
1050 : to error recovery. But do not keep the error token as
1051 : lookahead, it is too special and may lead us to an endless
1052 : loop in error recovery. */
1053 0 : yychar = YYUNDEF;
1054 0 : yytoken = YYSYMBOL_YYerror;
1055 0 : goto yyerrlab1;
1056 : }
1057 : else
1058 : {
1059 41002 : yytoken = YYTRANSLATE (yychar);
1060 2166 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1061 : }
1062 :
1063 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1064 : detect an error, take that action. */
1065 41154 : yyn += yytoken;
1066 41154 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1067 342 : goto yydefault;
1068 40812 : yyn = yytable[yyn];
1069 40812 : if (yyn <= 0)
1070 : {
1071 0 : if (yytable_value_is_error (yyn))
1072 : goto yyerrlab;
1073 0 : yyn = -yyn;
1074 0 : goto yyreduce;
1075 : }
1076 :
1077 : /* Count tokens shifted since error; after three, turn off error
1078 : status. */
1079 40812 : if (yyerrstatus)
1080 0 : yyerrstatus--;
1081 :
1082 : /* Shift the lookahead token. */
1083 2148 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1084 40812 : yystate = yyn;
1085 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1086 40812 : *++yyvsp = yylval;
1087 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1088 :
1089 : /* Discard the shifted token. */
1090 40812 : yychar = YYEMPTY;
1091 40812 : goto yynewstate;
1092 :
1093 :
1094 : /*-----------------------------------------------------------.
1095 : | yydefault -- do the default action for the current state. |
1096 : `-----------------------------------------------------------*/
1097 21964 : yydefault:
1098 21964 : yyn = yydefact[yystate];
1099 21964 : if (yyn == 0)
1100 0 : goto yyerrlab;
1101 21964 : goto yyreduce;
1102 :
1103 :
1104 : /*-----------------------------.
1105 : | yyreduce -- do a reduction. |
1106 : `-----------------------------*/
1107 21964 : yyreduce:
1108 : /* yyn is the number of a rule to reduce with. */
1109 21964 : yylen = yyr2[yyn];
1110 :
1111 : /* If YYLEN is nonzero, implement the default value of the action:
1112 : '$$ = $1'.
1113 :
1114 : Otherwise, the following line sets YYVAL to garbage.
1115 : This behavior is undocumented and Bison
1116 : users should not rely upon it. Assigning to YYVAL
1117 : unconditionally makes the parser a bit smaller, and it avoids a
1118 : GCC warning that YYVAL may be used uninitialized. */
1119 21964 : yyval = yyvsp[1-yylen];
1120 :
1121 :
1122 1156 : YY_REDUCE_PRINT (yyn);
1123 21964 : switch (yyn)
1124 : {
1125 209 : case 6: /* id: ID STRING */
1126 : {
1127 209 : id_str = (yyvsp[0].string);
1128 : }
1129 209 : break;
1130 :
1131 247 : case 7: /* et: ET STRING */
1132 : {
1133 247 : base_id = name2number((yyvsp[0].string));
1134 247 : strlcpy(name, (yyvsp[0].string), sizeof(name));
1135 247 : free((yyvsp[0].string));
1136 : }
1137 247 : break;
1138 :
1139 0 : case 8: /* et: ET STRING STRING */
1140 : {
1141 0 : base_id = name2number((yyvsp[-1].string));
1142 0 : strlcpy(name, (yyvsp[0].string), sizeof(name));
1143 0 : free((yyvsp[-1].string));
1144 0 : free((yyvsp[0].string));
1145 : }
1146 0 : break;
1147 :
1148 627 : case 11: /* statement: INDEX NUMBER */
1149 : {
1150 627 : number = (yyvsp[0].number);
1151 : }
1152 627 : break;
1153 :
1154 532 : case 12: /* statement: PREFIX STRING */
1155 : {
1156 532 : free(prefix);
1157 532 : asprintf (&prefix, "%s_", (yyvsp[0].string));
1158 532 : if (prefix == NULL)
1159 0 : errx(1, "malloc");
1160 532 : free((yyvsp[0].string));
1161 : }
1162 532 : break;
1163 :
1164 19 : case 13: /* statement: PREFIX */
1165 : {
1166 19 : prefix = realloc(prefix, 1);
1167 19 : if (prefix == NULL)
1168 0 : errx(1, "malloc");
1169 19 : *prefix = '\0';
1170 : }
1171 19 : break;
1172 :
1173 9329 : case 14: /* statement: EC STRING ',' STRING */
1174 : {
1175 9329 : struct error_code *ec = malloc(sizeof(*ec));
1176 :
1177 9329 : if (ec == NULL)
1178 0 : errx(1, "malloc");
1179 :
1180 9329 : ec->next = NULL;
1181 9329 : ec->number = number;
1182 9329 : if(prefix && *prefix != '\0') {
1183 6916 : asprintf (&ec->name, "%s%s", prefix, (yyvsp[-2].string));
1184 6916 : if (ec->name == NULL)
1185 0 : errx(1, "malloc");
1186 6916 : free((yyvsp[-2].string));
1187 : } else
1188 2413 : ec->name = (yyvsp[-2].string);
1189 9329 : ec->string = (yyvsp[0].string);
1190 9329 : APPEND(codes, ec);
1191 9329 : number++;
1192 : }
1193 9329 : break;
1194 :
1195 171 : case 15: /* statement: END */
1196 : {
1197 171 : YYACCEPT;
1198 : }
1199 : break;
1200 :
1201 :
1202 :
1203 10260 : default: break;
1204 : }
1205 : /* User semantic actions sometimes alter yychar, and that requires
1206 : that yytoken be updated with the new translation. We take the
1207 : approach of translating immediately before every use of yytoken.
1208 : One alternative is translating here after every semantic action,
1209 : but that translation would be missed if the semantic action invokes
1210 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1211 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1212 : incorrect destructor might then be invoked immediately. In the
1213 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
1214 : to an incorrect destructor call or verbose syntax error message
1215 : before the lookahead is translated. */
1216 1147 : YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1217 :
1218 21793 : YYPOPSTACK (yylen);
1219 21793 : yylen = 0;
1220 :
1221 21793 : *++yyvsp = yyval;
1222 :
1223 : /* Now 'shift' the result of the reduction. Determine what state
1224 : that goes to, based on the state we popped back to and the rule
1225 : number reduced by. */
1226 : {
1227 21793 : const int yylhs = yyr1[yyn] - YYNTOKENS;
1228 21793 : const int yyi = yypgoto[yylhs] + *yyssp;
1229 10754 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1230 10469 : ? yytable[yyi]
1231 32547 : : yydefgoto[yylhs]);
1232 : }
1233 :
1234 21793 : goto yynewstate;
1235 :
1236 :
1237 : /*--------------------------------------.
1238 : | yyerrlab -- here on detecting error. |
1239 : `--------------------------------------*/
1240 0 : yyerrlab:
1241 : /* Make sure we have latest lookahead translation. See comments at
1242 : user semantic actions for why this is necessary. */
1243 0 : yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1244 : /* If not already recovering from an error, report this error. */
1245 0 : if (!yyerrstatus)
1246 : {
1247 0 : ++yynerrs;
1248 0 : yyerror (YY_("syntax error"));
1249 : }
1250 :
1251 0 : if (yyerrstatus == 3)
1252 : {
1253 : /* If just tried and failed to reuse lookahead token after an
1254 : error, discard it. */
1255 :
1256 0 : if (yychar <= YYEOF)
1257 : {
1258 : /* Return failure if at end of input. */
1259 0 : if (yychar == YYEOF)
1260 0 : YYABORT;
1261 : }
1262 : else
1263 : {
1264 0 : yydestruct ("Error: discarding",
1265 : yytoken, &yylval);
1266 0 : yychar = YYEMPTY;
1267 : }
1268 : }
1269 :
1270 : /* Else will try to reuse lookahead token after shifting the error
1271 : token. */
1272 0 : goto yyerrlab1;
1273 :
1274 :
1275 : /*---------------------------------------------------.
1276 : | yyerrorlab -- error raised explicitly by YYERROR. |
1277 : `---------------------------------------------------*/
1278 : yyerrorlab:
1279 : /* Pacify compilers when the user code never invokes YYERROR and the
1280 : label yyerrorlab therefore never appears in user code. */
1281 : if (0)
1282 : YYERROR;
1283 : ++yynerrs;
1284 :
1285 : /* Do not reclaim the symbols of the rule whose action triggered
1286 : this YYERROR. */
1287 : YYPOPSTACK (yylen);
1288 : yylen = 0;
1289 : YY_STACK_PRINT (yyss, yyssp);
1290 : yystate = *yyssp;
1291 : goto yyerrlab1;
1292 :
1293 :
1294 : /*-------------------------------------------------------------.
1295 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
1296 : `-------------------------------------------------------------*/
1297 0 : yyerrlab1:
1298 0 : yyerrstatus = 3; /* Each real token shifted decrements this. */
1299 :
1300 : /* Pop stack until we find a state that shifts the error token. */
1301 0 : for (;;)
1302 : {
1303 0 : yyn = yypact[yystate];
1304 0 : if (!yypact_value_is_default (yyn))
1305 : {
1306 0 : yyn += YYSYMBOL_YYerror;
1307 0 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1308 : {
1309 0 : yyn = yytable[yyn];
1310 0 : if (0 < yyn)
1311 0 : break;
1312 : }
1313 : }
1314 :
1315 : /* Pop the current state because it cannot handle the error token. */
1316 0 : if (yyssp == yyss)
1317 0 : YYABORT;
1318 :
1319 :
1320 0 : yydestruct ("Error: popping",
1321 0 : YY_ACCESSING_SYMBOL (yystate), yyvsp);
1322 0 : YYPOPSTACK (1);
1323 0 : yystate = *yyssp;
1324 0 : YY_STACK_PRINT (yyss, yyssp);
1325 : }
1326 :
1327 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1328 0 : *++yyvsp = yylval;
1329 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1330 :
1331 :
1332 : /* Shift the error token. */
1333 0 : YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1334 :
1335 0 : yystate = yyn;
1336 0 : goto yynewstate;
1337 :
1338 :
1339 : /*-------------------------------------.
1340 : | yyacceptlab -- YYACCEPT comes here. |
1341 : `-------------------------------------*/
1342 247 : yyacceptlab:
1343 247 : yyresult = 0;
1344 247 : goto yyreturnlab;
1345 :
1346 :
1347 : /*-----------------------------------.
1348 : | yyabortlab -- YYABORT comes here. |
1349 : `-----------------------------------*/
1350 0 : yyabortlab:
1351 0 : yyresult = 1;
1352 0 : goto yyreturnlab;
1353 :
1354 :
1355 : /*-----------------------------------------------------------.
1356 : | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1357 : `-----------------------------------------------------------*/
1358 0 : yyexhaustedlab:
1359 0 : yyerror (YY_("memory exhausted"));
1360 0 : yyresult = 2;
1361 0 : goto yyreturnlab;
1362 :
1363 :
1364 : /*----------------------------------------------------------.
1365 : | yyreturnlab -- parsing is finished, clean up and return. |
1366 : `----------------------------------------------------------*/
1367 247 : yyreturnlab:
1368 247 : if (yychar != YYEMPTY)
1369 : {
1370 : /* Make sure we have latest lookahead translation. See comments at
1371 : user semantic actions for why this is necessary. */
1372 13 : yytoken = YYTRANSLATE (yychar);
1373 0 : yydestruct ("Cleanup: discarding lookahead",
1374 : yytoken, &yylval);
1375 : }
1376 : /* Do not reclaim the symbols of the rule whose action triggered
1377 : this YYABORT or YYACCEPT. */
1378 247 : YYPOPSTACK (yylen);
1379 13 : YY_STACK_PRINT (yyss, yyssp);
1380 715 : while (yyssp != yyss)
1381 : {
1382 468 : yydestruct ("Cleanup: popping",
1383 468 : YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1384 468 : YYPOPSTACK (1);
1385 : }
1386 : #ifndef yyoverflow
1387 247 : if (yyss != yyssa)
1388 0 : YYSTACK_FREE (yyss);
1389 : #endif
1390 :
1391 247 : return yyresult;
1392 : }
1393 :
1394 :
1395 :
1396 : static long
1397 247 : name2number(const char *str)
1398 : {
1399 13 : const char *p;
1400 247 : long num = 0;
1401 247 : const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1402 : "abcdefghijklmnopqrstuvwxyz0123456789_";
1403 247 : if(strlen(str) > 4) {
1404 0 : yyerror("table name too long");
1405 0 : return 0;
1406 : }
1407 1140 : for(p = str; *p; p++){
1408 893 : char *q = strchr(x, *p);
1409 893 : if(q == NULL) {
1410 0 : yyerror("invalid character in table name");
1411 0 : return 0;
1412 : }
1413 893 : num = (num << 6) + (q - x) + 1;
1414 : }
1415 247 : num <<= 8;
1416 247 : if(num > 0x7fffffff)
1417 152 : num = -(0xffffffff - num + 1);
1418 234 : return num;
1419 : }
1420 :
1421 : void
1422 0 : yyerror (const char *s)
1423 : {
1424 0 : _lex_error_message ("%s\n", s);
1425 0 : }
|