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