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