xref: /netbsd-src/external/gpl3/binutils.old/dist/gas/config/loongarch-parse.c (revision c42dbd0ed2e61fe6eda8590caa852ccf34719964)
1 /* A Bison parser, made by GNU Bison 3.8.2.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6    Inc.
7 
8    This program is free software: you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation, either version 3 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
20 
21 /* As a special exception, you may create a larger work that contains
22    part or all of the Bison parser skeleton and distribute that work
23    under terms of your choice, so long as that work isn't itself a
24    parser generator using the skeleton or a modified version thereof
25    as a parser skeleton.  Alternatively, if you modify or redistribute
26    the parser skeleton itself, you may (at your option) remove this
27    special exception, which will cause the skeleton and the resulting
28    Bison output files to be licensed under the GNU General Public
29    License without this special exception.
30 
31    This special exception was added by the Free Software Foundation in
32    version 2.2 of Bison.  */
33 
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35    simplifying the original so-called "semantic" parser.  */
36 
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38    especially those whose name start with YY_ or yy_.  They are
39    private implementation details that can be changed or removed.  */
40 
41 /* All symbols defined below should begin with yy or YY, to avoid
42    infringing on user name space.  This should be done even for local
43    variables, as they might otherwise be expanded by user macros.
44    There are some unavoidable exceptions within include files to
45    define necessary library symbols; they are noted "INFRINGES ON
46    USER NAME SPACE" below.  */
47 
48 /* Identify Bison output, and Bison version.  */
49 #define YYBISON 30802
50 
51 /* Bison version string.  */
52 #define YYBISON_VERSION "3.8.2"
53 
54 /* Skeleton name.  */
55 #define YYSKELETON_NAME "yacc.c"
56 
57 /* Pure parsers.  */
58 #define YYPURE 0
59 
60 /* Push parsers.  */
61 #define YYPUSH 0
62 
63 /* Pull parsers.  */
64 #define YYPULL 1
65 
66 
67 
68 
69 /* First part of user prologue.  */
70 #line 19 "./config/loongarch-parse.y"
71 
72 #include "as.h"
73 #include "loongarch-lex.h"
74 #include "loongarch-parse.h"
yyerror(const char * s ATTRIBUTE_UNUSED)75 static void yyerror (const char *s ATTRIBUTE_UNUSED)
76 {
77 };
78 int yylex (void);
79 
80 
81 static struct reloc_info *top, *end;
82 
83 static expressionS const_0 =
84 {
85   .X_op = O_constant,
86   .X_add_number = 0
87 };
88 
89 static int
is_const(struct reloc_info * info)90 is_const (struct reloc_info *info)
91 {
92   return (info->type == BFD_RELOC_LARCH_SOP_PUSH_ABSOLUTE
93 	  && info->value.X_op == O_constant);
94 }
95 
96 int
loongarch_parse_expr(const char * expr,struct reloc_info * reloc_stack_top,size_t max_reloc_num,size_t * reloc_num,offsetT * imm)97 loongarch_parse_expr (const char *expr,
98 		      struct reloc_info *reloc_stack_top,
99 		      size_t max_reloc_num,
100 		      size_t *reloc_num,
101 		      offsetT *imm)
102 {
103   int ret;
104   struct yy_buffer_state *buffstate;
105   top = reloc_stack_top;
106   end = top + max_reloc_num;
107   buffstate = yy_scan_string (expr);
108   ret = yyparse ();
109 
110   if (ret == 0)
111     {
112       if (is_const (top - 1))
113 	*imm = (--top)->value.X_add_number;
114       else
115 	*imm = 0;
116       *reloc_num = top - reloc_stack_top;
117     }
118   yy_delete_buffer (buffstate);
119 
120   return ret;
121 }
122 
123 static void
emit_const(offsetT imm)124 emit_const (offsetT imm)
125 {
126   if (end <= top)
127     as_fatal (_("expr too huge"));
128   top->type = BFD_RELOC_LARCH_SOP_PUSH_ABSOLUTE;
129   top->value.X_op = O_constant;
130   top->value.X_add_number = imm;
131   top++;
132 }
133 
134 static const char *
my_getExpression(expressionS * ep,const char * str)135 my_getExpression (expressionS *ep, const char *str)
136 {
137   char *save_in, *ret;
138   if (*str == ':')
139     {
140       unsigned long j;
141       char *str_1 = (char *) str;
142       str_1++;
143       j = strtol (str_1, &str_1, 10);
144       get_internal_label (ep, j, *str_1 == 'f');
145       return NULL;
146     }
147   save_in = input_line_pointer;
148   input_line_pointer = (char *)str;
149   expression (ep);
150   ret = input_line_pointer;
151   input_line_pointer = save_in;
152   return ret;
153 }
154 
155 static void
reloc(const char * op_c_str,const char * id_c_str,offsetT addend)156 reloc (const char *op_c_str, const char *id_c_str, offsetT addend)
157 {
158   expressionS id_sym_expr;
159 
160   if (end <= top)
161     as_fatal (_("expr too huge"));
162 
163   if (id_c_str)
164     {
165       my_getExpression (&id_sym_expr, id_c_str);
166       id_sym_expr.X_add_number += addend;
167     }
168   else
169     {
170       id_sym_expr.X_op = O_constant;
171       id_sym_expr.X_add_number = addend;
172     }
173 
174   if (strcmp (op_c_str, "abs") == 0)
175     {
176       top->value = id_sym_expr;
177       top->type = BFD_RELOC_LARCH_SOP_PUSH_ABSOLUTE;
178       top++;
179     }
180   else if (strcmp (op_c_str, "pcrel") == 0)
181     {
182       top->value = id_sym_expr;
183       top->type = BFD_RELOC_LARCH_SOP_PUSH_PCREL;
184       top++;
185     }
186   else if (strcmp (op_c_str, "gprel") == 0)
187     {
188       top->value = id_sym_expr;
189       top->type = BFD_RELOC_LARCH_SOP_PUSH_GPREL;
190       top++;
191     }
192   else if (strcmp (op_c_str, "tprel") == 0)
193     {
194       top->value = id_sym_expr;
195       top->type = BFD_RELOC_LARCH_SOP_PUSH_TLS_TPREL;
196       top++;
197     }
198   else if (strcmp (op_c_str, "tlsgot") == 0)
199     {
200       top->value = id_sym_expr;
201       top->type = BFD_RELOC_LARCH_SOP_PUSH_TLS_GOT;
202       top++;
203     }
204   else if (strcmp (op_c_str, "tlsgd") == 0)
205     {
206       top->value = id_sym_expr;
207       top->type = BFD_RELOC_LARCH_SOP_PUSH_TLS_GD;
208       top++;
209     }
210   else if (strcmp (op_c_str, "plt") == 0)
211     {
212       top->value = id_sym_expr;
213       top->type = BFD_RELOC_LARCH_SOP_PUSH_PLT_PCREL;
214       top++;
215     }
216   else
217     as_fatal (_("unknown reloc hint: %s"), op_c_str);
218 }
219 
220 static void
emit_unary(char op)221 emit_unary (char op)
222 {
223   struct reloc_info *s_top = top - 1;
224   if (is_const (s_top))
225     {
226       offsetT opr = s_top->value.X_add_number;
227       switch (op)
228 	{
229 	case '+':
230 	  break;
231 	case '-':
232 	  opr = -opr;
233 	  break;
234 	case '~':
235 	  opr = ~opr;
236 	  break;
237 	case '!':
238 	  opr = !opr;
239 	  break;
240 	default:
241 	  abort ();
242 	}
243       s_top->value.X_add_number = opr;
244     }
245   else
246     {
247       if (end <= top)
248 	as_fatal (_("expr too huge"));
249       switch (op)
250 	{
251 	case '!':
252 	  top->type = BFD_RELOC_LARCH_SOP_NOT;
253 	  break;
254 	default:
255 	  abort ();
256 	}
257       top->value = const_0;
258       top++;
259     }
260 }
261 
262 static void
emit_bin(int op)263 emit_bin (int op)
264 {
265   struct reloc_info *last_1st = top - 1, *last_2nd = top - 2;
266   if (is_const (last_1st) && is_const (last_2nd))
267     {
268       offsetT opr1 = last_2nd->value.X_add_number;
269       offsetT opr2 = last_1st->value.X_add_number;
270       switch (op)
271 	{
272 	case '*':
273 	  opr1 = opr1 * opr2;
274 	  break;
275 	case '/':
276 	  opr1 = opr1 / opr2;
277 	  break;
278 	case '%':
279 	  opr1 = opr1 % opr2;
280 	  break;
281 	case '+':
282 	  opr1 = opr1 + opr2;
283 	  break;
284 	case '-':
285 	  opr1 = opr1 - opr2;
286 	  break;
287 	case LEFT_OP:
288 	  opr1 = opr1 << opr2;
289 	  break;
290 	case RIGHT_OP:
291 	  /* Algorithm right shift.  */
292 	  opr1 = (offsetT)opr1 >> (offsetT)opr2;
293 	  break;
294 	case '<':
295 	  opr1 = opr1 < opr2;
296 	  break;
297 	case '>':
298 	  opr1 = opr1 > opr2;
299 	  break;
300 	case LE_OP:
301 	  opr1 = opr1 <= opr2;
302 	  break;
303 	case GE_OP:
304 	  opr1 = opr1 >= opr2;
305 	  break;
306 	case EQ_OP:
307 	  opr1 = opr1 == opr2;
308 	  break;
309 	case NE_OP:
310 	  opr1 = opr1 != opr2;
311 	  break;
312 	case '&':
313 	  opr1 = opr1 & opr2;
314 	  break;
315 	case '^':
316 	  opr1 = opr1 ^ opr2;
317 	  break;
318 	case '|':
319 	  opr1 = opr1 | opr2;
320 	  break;
321 	case AND_OP:
322 	  opr1 = opr1 && opr2;
323 	  break;
324 	case OR_OP:
325 	  opr1 = opr1 || opr2;
326 	  break;
327 	default:
328 	  abort ();
329 	}
330       last_2nd->value.X_add_number = opr1;
331       last_1st->type = 0;
332       top--;
333     }
334   else
335     {
336       if (end <= top)
337 	as_fatal (_("expr too huge"));
338       switch (op)
339 	{
340 	case '+':
341 	  top->type = BFD_RELOC_LARCH_SOP_ADD;
342 	  break;
343 	case '-':
344 	  top->type = BFD_RELOC_LARCH_SOP_SUB;
345 	  break;
346 	case LEFT_OP:
347 	  top->type = BFD_RELOC_LARCH_SOP_SL;
348 	  break;
349 	case RIGHT_OP:
350 	  top->type = BFD_RELOC_LARCH_SOP_SR;
351 	  break;
352 	case '&':
353 	  top->type = BFD_RELOC_LARCH_SOP_AND;
354 	  break;
355 	default:
356 	  abort ();
357 	}
358       top->value = const_0;
359       top++;
360     }
361 }
362 
363 static void
emit_if_else(void)364 emit_if_else (void)
365 {
366   struct reloc_info *last_1st = top - 1;
367   struct reloc_info *last_2nd = top - 2;
368   struct reloc_info *last_3rd = top - 3;
369   if (is_const (last_1st) && is_const (last_2nd) && is_const (last_3rd))
370     {
371       offsetT opr1 = last_3rd->value.X_add_number;
372       offsetT opr2 = last_2nd->value.X_add_number;
373       offsetT opr3 = last_1st->value.X_add_number;
374       opr1 = opr1 ? opr2 : opr3;
375       last_3rd->value.X_add_number = opr1;
376       last_2nd->type = 0;
377       last_1st->type = 0;
378       top -= 2;
379     }
380   else
381     {
382       if (end <= top)
383 	as_fatal (_("expr too huge"));
384       top->type = BFD_RELOC_LARCH_SOP_IF_ELSE;
385       top->value = const_0;
386       top++;
387     }
388 }
389 
390 
391 #line 392 "config/loongarch-parse.c"
392 
393 # ifndef YY_CAST
394 #  ifdef __cplusplus
395 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
396 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
397 #  else
398 #   define YY_CAST(Type, Val) ((Type) (Val))
399 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
400 #  endif
401 # endif
402 # ifndef YY_NULLPTR
403 #  if defined __cplusplus
404 #   if 201103L <= __cplusplus
405 #    define YY_NULLPTR nullptr
406 #   else
407 #    define YY_NULLPTR 0
408 #   endif
409 #  else
410 #   define YY_NULLPTR ((void*)0)
411 #  endif
412 # endif
413 
414 /* Use api.header.include to #include this header
415    instead of duplicating it here.  */
416 #ifndef YY_YY_CONFIG_LOONGARCH_PARSE_H_INCLUDED
417 # define YY_YY_CONFIG_LOONGARCH_PARSE_H_INCLUDED
418 /* Debug traces.  */
419 #ifndef YYDEBUG
420 # define YYDEBUG 0
421 #endif
422 #if YYDEBUG
423 extern int yydebug;
424 #endif
425 
426 /* Token kinds.  */
427 #ifndef YYTOKENTYPE
428 # define YYTOKENTYPE
429   enum yytokentype
430   {
431     YYEMPTY = -2,
432     YYEOF = 0,                     /* "end of file"  */
433     YYerror = 256,                 /* error  */
434     YYUNDEF = 257,                 /* "invalid token"  */
435     INTEGER = 258,                 /* INTEGER  */
436     IDENTIFIER = 259,              /* IDENTIFIER  */
437     LEFT_OP = 260,                 /* LEFT_OP  */
438     RIGHT_OP = 261,                /* RIGHT_OP  */
439     LE_OP = 262,                   /* LE_OP  */
440     GE_OP = 263,                   /* GE_OP  */
441     EQ_OP = 264,                   /* EQ_OP  */
442     NE_OP = 265,                   /* NE_OP  */
443     AND_OP = 266,                  /* AND_OP  */
444     OR_OP = 267                    /* OR_OP  */
445   };
446   typedef enum yytokentype yytoken_kind_t;
447 #endif
448 /* Token kinds.  */
449 #define YYEMPTY -2
450 #define YYEOF 0
451 #define YYerror 256
452 #define YYUNDEF 257
453 #define INTEGER 258
454 #define IDENTIFIER 259
455 #define LEFT_OP 260
456 #define RIGHT_OP 261
457 #define LE_OP 262
458 #define GE_OP 263
459 #define EQ_OP 264
460 #define NE_OP 265
461 #define AND_OP 266
462 #define OR_OP 267
463 
464 /* Value type.  */
465 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
466 union YYSTYPE
467 {
468 #line 340 "./config/loongarch-parse.y"
469 
470 char *c_str;
471 offsetT imm;
472 
473 #line 474 "config/loongarch-parse.c"
474 
475 };
476 typedef union YYSTYPE YYSTYPE;
477 # define YYSTYPE_IS_TRIVIAL 1
478 # define YYSTYPE_IS_DECLARED 1
479 #endif
480 
481 
482 extern YYSTYPE yylval;
483 
484 
485 int yyparse (void);
486 
487 
488 #endif /* !YY_YY_CONFIG_LOONGARCH_PARSE_H_INCLUDED  */
489 /* Symbol kind.  */
490 enum yysymbol_kind_t
491 {
492   YYSYMBOL_YYEMPTY = -2,
493   YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
494   YYSYMBOL_YYerror = 1,                    /* error  */
495   YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
496   YYSYMBOL_INTEGER = 3,                    /* INTEGER  */
497   YYSYMBOL_IDENTIFIER = 4,                 /* IDENTIFIER  */
498   YYSYMBOL_LEFT_OP = 5,                    /* LEFT_OP  */
499   YYSYMBOL_RIGHT_OP = 6,                   /* RIGHT_OP  */
500   YYSYMBOL_LE_OP = 7,                      /* LE_OP  */
501   YYSYMBOL_GE_OP = 8,                      /* GE_OP  */
502   YYSYMBOL_EQ_OP = 9,                      /* EQ_OP  */
503   YYSYMBOL_NE_OP = 10,                     /* NE_OP  */
504   YYSYMBOL_AND_OP = 11,                    /* AND_OP  */
505   YYSYMBOL_OR_OP = 12,                     /* OR_OP  */
506   YYSYMBOL_13_ = 13,                       /* '('  */
507   YYSYMBOL_14_ = 14,                       /* ')'  */
508   YYSYMBOL_15_ = 15,                       /* '%'  */
509   YYSYMBOL_16_ = 16,                       /* '-'  */
510   YYSYMBOL_17_ = 17,                       /* '+'  */
511   YYSYMBOL_18_ = 18,                       /* '~'  */
512   YYSYMBOL_19_ = 19,                       /* '!'  */
513   YYSYMBOL_20_ = 20,                       /* '*'  */
514   YYSYMBOL_21_ = 21,                       /* '/'  */
515   YYSYMBOL_22_ = 22,                       /* '<'  */
516   YYSYMBOL_23_ = 23,                       /* '>'  */
517   YYSYMBOL_24_ = 24,                       /* '&'  */
518   YYSYMBOL_25_ = 25,                       /* '^'  */
519   YYSYMBOL_26_ = 26,                       /* '|'  */
520   YYSYMBOL_27_ = 27,                       /* '?'  */
521   YYSYMBOL_28_ = 28,                       /* ':'  */
522   YYSYMBOL_YYACCEPT = 29,                  /* $accept  */
523   YYSYMBOL_primary_expression = 30,        /* primary_expression  */
524   YYSYMBOL_addend = 31,                    /* addend  */
525   YYSYMBOL_unary_expression = 32,          /* unary_expression  */
526   YYSYMBOL_multiplicative_expression = 33, /* multiplicative_expression  */
527   YYSYMBOL_additive_expression = 34,       /* additive_expression  */
528   YYSYMBOL_shift_expression = 35,          /* shift_expression  */
529   YYSYMBOL_relational_expression = 36,     /* relational_expression  */
530   YYSYMBOL_equality_expression = 37,       /* equality_expression  */
531   YYSYMBOL_and_expression = 38,            /* and_expression  */
532   YYSYMBOL_exclusive_or_expression = 39,   /* exclusive_or_expression  */
533   YYSYMBOL_inclusive_or_expression = 40,   /* inclusive_or_expression  */
534   YYSYMBOL_logical_and_expression = 41,    /* logical_and_expression  */
535   YYSYMBOL_logical_or_expression = 42,     /* logical_or_expression  */
536   YYSYMBOL_conditional_expression = 43,    /* conditional_expression  */
537   YYSYMBOL_expression = 44                 /* expression  */
538 };
539 typedef enum yysymbol_kind_t yysymbol_kind_t;
540 
541 
542 
543 
544 #ifdef short
545 # undef short
546 #endif
547 
548 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
549    <limits.h> and (if available) <stdint.h> are included
550    so that the code can choose integer types of a good width.  */
551 
552 #ifndef __PTRDIFF_MAX__
553 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
554 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
555 #  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
556 #  define YY_STDINT_H
557 # endif
558 #endif
559 
560 /* Narrow types that promote to a signed type and that can represent a
561    signed or unsigned integer of at least N bits.  In tables they can
562    save space and decrease cache pressure.  Promoting to a signed type
563    helps avoid bugs in integer arithmetic.  */
564 
565 #ifdef __INT_LEAST8_MAX__
566 typedef __INT_LEAST8_TYPE__ yytype_int8;
567 #elif defined YY_STDINT_H
568 typedef int_least8_t yytype_int8;
569 #else
570 typedef signed char yytype_int8;
571 #endif
572 
573 #ifdef __INT_LEAST16_MAX__
574 typedef __INT_LEAST16_TYPE__ yytype_int16;
575 #elif defined YY_STDINT_H
576 typedef int_least16_t yytype_int16;
577 #else
578 typedef short yytype_int16;
579 #endif
580 
581 /* Work around bug in HP-UX 11.23, which defines these macros
582    incorrectly for preprocessor constants.  This workaround can likely
583    be removed in 2023, as HPE has promised support for HP-UX 11.23
584    (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
585    <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
586 #ifdef __hpux
587 # undef UINT_LEAST8_MAX
588 # undef UINT_LEAST16_MAX
589 # define UINT_LEAST8_MAX 255
590 # define UINT_LEAST16_MAX 65535
591 #endif
592 
593 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
594 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
595 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
596        && UINT_LEAST8_MAX <= INT_MAX)
597 typedef uint_least8_t yytype_uint8;
598 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
599 typedef unsigned char yytype_uint8;
600 #else
601 typedef short yytype_uint8;
602 #endif
603 
604 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
605 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
606 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
607        && UINT_LEAST16_MAX <= INT_MAX)
608 typedef uint_least16_t yytype_uint16;
609 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
610 typedef unsigned short yytype_uint16;
611 #else
612 typedef int yytype_uint16;
613 #endif
614 
615 #ifndef YYPTRDIFF_T
616 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
617 #  define YYPTRDIFF_T __PTRDIFF_TYPE__
618 #  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
619 # elif defined PTRDIFF_MAX
620 #  ifndef ptrdiff_t
621 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
622 #  endif
623 #  define YYPTRDIFF_T ptrdiff_t
624 #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
625 # else
626 #  define YYPTRDIFF_T long
627 #  define YYPTRDIFF_MAXIMUM LONG_MAX
628 # endif
629 #endif
630 
631 #ifndef YYSIZE_T
632 # ifdef __SIZE_TYPE__
633 #  define YYSIZE_T __SIZE_TYPE__
634 # elif defined size_t
635 #  define YYSIZE_T size_t
636 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
637 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
638 #  define YYSIZE_T size_t
639 # else
640 #  define YYSIZE_T unsigned
641 # endif
642 #endif
643 
644 #define YYSIZE_MAXIMUM                                  \
645   YY_CAST (YYPTRDIFF_T,                                 \
646            (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
647             ? YYPTRDIFF_MAXIMUM                         \
648             : YY_CAST (YYSIZE_T, -1)))
649 
650 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
651 
652 
653 /* Stored state numbers (used for stacks). */
654 typedef yytype_int8 yy_state_t;
655 
656 /* State numbers in computations.  */
657 typedef int yy_state_fast_t;
658 
659 #ifndef YY_
660 # if defined YYENABLE_NLS && YYENABLE_NLS
661 #  if ENABLE_NLS
662 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
663 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
664 #  endif
665 # endif
666 # ifndef YY_
667 #  define YY_(Msgid) Msgid
668 # endif
669 #endif
670 
671 
672 #ifndef YY_ATTRIBUTE_PURE
673 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
674 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
675 # else
676 #  define YY_ATTRIBUTE_PURE
677 # endif
678 #endif
679 
680 #ifndef YY_ATTRIBUTE_UNUSED
681 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
682 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
683 # else
684 #  define YY_ATTRIBUTE_UNUSED
685 # endif
686 #endif
687 
688 /* Suppress unused-variable warnings by "using" E.  */
689 #if ! defined lint || defined __GNUC__
690 # define YY_USE(E) ((void) (E))
691 #else
692 # define YY_USE(E) /* empty */
693 #endif
694 
695 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
696 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
697 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
698 #  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
699     _Pragma ("GCC diagnostic push")                                     \
700     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
701 # else
702 #  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
703     _Pragma ("GCC diagnostic push")                                     \
704     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
705     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
706 # endif
707 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
708     _Pragma ("GCC diagnostic pop")
709 #else
710 # define YY_INITIAL_VALUE(Value) Value
711 #endif
712 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
713 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
714 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
715 #endif
716 #ifndef YY_INITIAL_VALUE
717 # define YY_INITIAL_VALUE(Value) /* Nothing. */
718 #endif
719 
720 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
721 # define YY_IGNORE_USELESS_CAST_BEGIN                          \
722     _Pragma ("GCC diagnostic push")                            \
723     _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
724 # define YY_IGNORE_USELESS_CAST_END            \
725     _Pragma ("GCC diagnostic pop")
726 #endif
727 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
728 # define YY_IGNORE_USELESS_CAST_BEGIN
729 # define YY_IGNORE_USELESS_CAST_END
730 #endif
731 
732 
733 #define YY_ASSERT(E) ((void) (0 && (E)))
734 
735 #if !defined yyoverflow
736 
737 /* The parser invokes alloca or malloc; define the necessary symbols.  */
738 
739 # ifdef YYSTACK_USE_ALLOCA
740 #  if YYSTACK_USE_ALLOCA
741 #   ifdef __GNUC__
742 #    define YYSTACK_ALLOC __builtin_alloca
743 #   elif defined __BUILTIN_VA_ARG_INCR
744 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
745 #   elif defined _AIX
746 #    define YYSTACK_ALLOC __alloca
747 #   elif defined _MSC_VER
748 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
749 #    define alloca _alloca
750 #   else
751 #    define YYSTACK_ALLOC alloca
752 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
753 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
754       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
755 #     ifndef EXIT_SUCCESS
756 #      define EXIT_SUCCESS 0
757 #     endif
758 #    endif
759 #   endif
760 #  endif
761 # endif
762 
763 # ifdef YYSTACK_ALLOC
764    /* Pacify GCC's 'empty if-body' warning.  */
765 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
766 #  ifndef YYSTACK_ALLOC_MAXIMUM
767     /* The OS might guarantee only one guard page at the bottom of the stack,
768        and a page size can be as small as 4096 bytes.  So we cannot safely
769        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
770        to allow for a few compiler-allocated temporary stack slots.  */
771 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
772 #  endif
773 # else
774 #  define YYSTACK_ALLOC YYMALLOC
775 #  define YYSTACK_FREE YYFREE
776 #  ifndef YYSTACK_ALLOC_MAXIMUM
777 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
778 #  endif
779 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
780        && ! ((defined YYMALLOC || defined malloc) \
781              && (defined YYFREE || defined free)))
782 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
783 #   ifndef EXIT_SUCCESS
784 #    define EXIT_SUCCESS 0
785 #   endif
786 #  endif
787 #  ifndef YYMALLOC
788 #   define YYMALLOC malloc
789 #   if ! defined malloc && ! defined EXIT_SUCCESS
790 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
791 #   endif
792 #  endif
793 #  ifndef YYFREE
794 #   define YYFREE free
795 #   if ! defined free && ! defined EXIT_SUCCESS
796 void free (void *); /* INFRINGES ON USER NAME SPACE */
797 #   endif
798 #  endif
799 # endif
800 #endif /* !defined yyoverflow */
801 
802 #if (! defined yyoverflow \
803      && (! defined __cplusplus \
804          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
805 
806 /* A type that is properly aligned for any stack member.  */
807 union yyalloc
808 {
809   yy_state_t yyss_alloc;
810   YYSTYPE yyvs_alloc;
811 };
812 
813 /* The size of the maximum gap between one aligned stack and the next.  */
814 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
815 
816 /* The size of an array large to enough to hold all stacks, each with
817    N elements.  */
818 # define YYSTACK_BYTES(N) \
819      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
820       + YYSTACK_GAP_MAXIMUM)
821 
822 # define YYCOPY_NEEDED 1
823 
824 /* Relocate STACK from its old location to the new one.  The
825    local variables YYSIZE and YYSTACKSIZE give the old and new number of
826    elements in the stack, and YYPTR gives the new location of the
827    stack.  Advance YYPTR to a properly aligned location for the next
828    stack.  */
829 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
830     do                                                                  \
831       {                                                                 \
832         YYPTRDIFF_T yynewbytes;                                         \
833         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
834         Stack = &yyptr->Stack_alloc;                                    \
835         yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
836         yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
837       }                                                                 \
838     while (0)
839 
840 #endif
841 
842 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
843 /* Copy COUNT objects from SRC to DST.  The source and destination do
844    not overlap.  */
845 # ifndef YYCOPY
846 #  if defined __GNUC__ && 1 < __GNUC__
847 #   define YYCOPY(Dst, Src, Count) \
848       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
849 #  else
850 #   define YYCOPY(Dst, Src, Count)              \
851       do                                        \
852         {                                       \
853           YYPTRDIFF_T yyi;                      \
854           for (yyi = 0; yyi < (Count); yyi++)   \
855             (Dst)[yyi] = (Src)[yyi];            \
856         }                                       \
857       while (0)
858 #  endif
859 # endif
860 #endif /* !YYCOPY_NEEDED */
861 
862 /* YYFINAL -- State number of the termination state.  */
863 #define YYFINAL  47
864 /* YYLAST -- Last index in YYTABLE.  */
865 #define YYLAST   73
866 
867 /* YYNTOKENS -- Number of terminals.  */
868 #define YYNTOKENS  29
869 /* YYNNTS -- Number of nonterminals.  */
870 #define YYNNTS  16
871 /* YYNRULES -- Number of rules.  */
872 #define YYNRULES  44
873 /* YYNSTATES -- Number of states.  */
874 #define YYNSTATES  81
875 
876 /* YYMAXUTOK -- Last valid token kind.  */
877 #define YYMAXUTOK   267
878 
879 
880 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
881    as returned by yylex, with out-of-bounds checking.  */
882 #define YYTRANSLATE(YYX)                                \
883   (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
884    ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
885    : YYSYMBOL_YYUNDEF)
886 
887 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
888    as returned by yylex.  */
889 static const yytype_int8 yytranslate[] =
890 {
891        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
892        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
893        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
894        2,     2,     2,    19,     2,     2,     2,    15,    24,     2,
895       13,    14,    20,    17,     2,    16,     2,    21,     2,     2,
896        2,     2,     2,     2,     2,     2,     2,     2,    28,     2,
897       22,     2,    23,    27,     2,     2,     2,     2,     2,     2,
898        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
899        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
900        2,     2,     2,     2,    25,     2,     2,     2,     2,     2,
901        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
902        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
903        2,     2,     2,     2,    26,     2,    18,     2,     2,     2,
904        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
905        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
906        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
907        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
908        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
909        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
910        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
911        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
912        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
913        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
914        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
915        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
916        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
917        5,     6,     7,     8,     9,    10,    11,    12
918 };
919 
920 #if YYDEBUG
921 /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
922 static const yytype_int16 yyrline[] =
923 {
924        0,   354,   354,   355,   356,   357,   361,   362,   363,   367,
925      368,   369,   370,   371,   375,   376,   377,   378,   382,   383,
926      384,   388,   389,   390,   394,   395,   396,   397,   398,   402,
927      403,   404,   408,   409,   413,   414,   418,   419,   423,   424,
928      428,   429,   433,   434,   438
929 };
930 #endif
931 
932 /** Accessing symbol of state STATE.  */
933 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
934 
935 #if YYDEBUG || 0
936 /* The user-facing name of the symbol whose (internal) number is
937    YYSYMBOL.  No bounds checking.  */
938 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
939 
940 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
941    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
942 static const char *const yytname[] =
943 {
944   "\"end of file\"", "error", "\"invalid token\"", "INTEGER",
945   "IDENTIFIER", "LEFT_OP", "RIGHT_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP",
946   "AND_OP", "OR_OP", "'('", "')'", "'%'", "'-'", "'+'", "'~'", "'!'",
947   "'*'", "'/'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", "':'", "$accept",
948   "primary_expression", "addend", "unary_expression",
949   "multiplicative_expression", "additive_expression", "shift_expression",
950   "relational_expression", "equality_expression", "and_expression",
951   "exclusive_or_expression", "inclusive_or_expression",
952   "logical_and_expression", "logical_or_expression",
953   "conditional_expression", "expression", YY_NULLPTR
954 };
955 
956 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)957 yysymbol_name (yysymbol_kind_t yysymbol)
958 {
959   return yytname[yysymbol];
960 }
961 #endif
962 
963 #define YYPACT_NINF (-11)
964 
965 #define yypact_value_is_default(Yyn) \
966   ((Yyn) == YYPACT_NINF)
967 
968 #define YYTABLE_NINF (-1)
969 
970 #define yytable_value_is_error(Yyn) \
971   0
972 
973 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
974    STATE-NUM.  */
975 static const yytype_int8 yypact[] =
976 {
977        2,   -11,     2,    10,     2,     2,     2,     2,   -11,   -11,
978       -9,    -7,    36,     0,    37,    -8,    -1,     8,    27,     1,
979      -11,    43,    31,    40,   -11,   -11,   -11,   -11,     2,     2,
980        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
981        2,     2,     2,     2,     2,     2,     2,   -11,   -11,    45,
982      -11,   -11,   -11,    -9,    -9,    -7,    -7,    36,    36,    36,
983       36,     0,     0,    37,    -8,    -1,     8,    27,    22,   -11,
984      -11,     2,    19,    23,   -11,   -11,    55,    56,   -11,   -11,
985      -11
986 };
987 
988 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
989    Performed when YYTABLE does not specify something else to do.  Zero
990    means the default is an error.  */
991 static const yytype_int8 yydefact[] =
992 {
993        0,     2,     0,     0,     0,     0,     0,     0,     9,    14,
994       18,    21,    24,    29,    32,    34,    36,    38,    40,    42,
995       44,     0,     0,     0,    11,    10,    12,    13,     0,     0,
996        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
997        0,     0,     0,     0,     0,     0,     0,     1,     3,     0,
998       17,    15,    16,    20,    19,    22,    23,    27,    28,    25,
999       26,    30,    31,    33,    35,    37,    39,    41,     0,     8,
1000        8,     0,     0,     0,    43,     5,     0,     0,     4,     6,
1001        7
1002 };
1003 
1004 /* YYPGOTO[NTERM-NUM].  */
1005 static const yytype_int8 yypgoto[] =
1006 {
1007      -11,   -11,   -10,    -3,    20,    21,    -6,    17,    24,    25,
1008       18,    26,    28,   -11,    -5,    -2
1009 };
1010 
1011 /* YYDEFGOTO[NTERM-NUM].  */
1012 static const yytype_int8 yydefgoto[] =
1013 {
1014        0,     8,    72,     9,    10,    11,    12,    13,    14,    15,
1015       16,    17,    18,    19,    20,    21
1016 };
1017 
1018 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
1019    positive, shift that token.  If negative, reduce the rule whose
1020    number is the opposite.  If YYTABLE_NINF, syntax error.  */
1021 static const yytype_int8 yytable[] =
1022 {
1023       22,    24,    25,    26,    27,     1,    28,    35,    36,    31,
1024       32,    29,    30,    45,    23,     2,    41,     3,     4,     5,
1025        6,     7,    37,    38,    42,    50,    51,    52,    46,    57,
1026       58,    59,    60,    75,    43,    76,    77,    78,    44,    76,
1027       77,    33,    34,    47,    68,    48,    39,    40,    69,    70,
1028       71,    53,    54,    49,    55,    56,    61,    62,    79,    80,
1029       73,    65,     0,     0,     0,    63,    74,    64,     0,     0,
1030       66,     0,     0,    67
1031 };
1032 
1033 static const yytype_int8 yycheck[] =
1034 {
1035        2,     4,     5,     6,     7,     3,    15,     7,     8,    16,
1036       17,    20,    21,    12,     4,    13,    24,    15,    16,    17,
1037       18,    19,    22,    23,    25,    28,    29,    30,    27,    35,
1038       36,    37,    38,    14,    26,    16,    17,    14,    11,    16,
1039       17,     5,     6,     0,    46,    14,     9,    10,     3,     4,
1040       28,    31,    32,    13,    33,    34,    39,    40,     3,     3,
1041       70,    43,    -1,    -1,    -1,    41,    71,    42,    -1,    -1,
1042       44,    -1,    -1,    45
1043 };
1044 
1045 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
1046    state STATE-NUM.  */
1047 static const yytype_int8 yystos[] =
1048 {
1049        0,     3,    13,    15,    16,    17,    18,    19,    30,    32,
1050       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
1051       43,    44,    44,     4,    32,    32,    32,    32,    15,    20,
1052       21,    16,    17,     5,     6,     7,     8,    22,    23,     9,
1053       10,    24,    25,    26,    11,    12,    27,     0,    14,    13,
1054       32,    32,    32,    33,    33,    34,    34,    35,    35,    35,
1055       35,    36,    36,    37,    38,    39,    40,    41,    44,     3,
1056        4,    28,    31,    31,    43,    14,    16,    17,    14,     3,
1057        3
1058 };
1059 
1060 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
1061 static const yytype_int8 yyr1[] =
1062 {
1063        0,    29,    30,    30,    30,    30,    31,    31,    31,    32,
1064       32,    32,    32,    32,    33,    33,    33,    33,    34,    34,
1065       34,    35,    35,    35,    36,    36,    36,    36,    36,    37,
1066       37,    37,    38,    38,    39,    39,    40,    40,    41,    41,
1067       42,    42,    43,    43,    44
1068 };
1069 
1070 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
1071 static const yytype_int8 yyr2[] =
1072 {
1073        0,     2,     1,     3,     6,     6,     3,     3,     0,     1,
1074        2,     2,     2,     2,     1,     3,     3,     3,     1,     3,
1075        3,     1,     3,     3,     1,     3,     3,     3,     3,     1,
1076        3,     3,     1,     3,     1,     3,     1,     3,     1,     3,
1077        1,     3,     1,     5,     1
1078 };
1079 
1080 
1081 enum { YYENOMEM = -2 };
1082 
1083 #define yyerrok         (yyerrstatus = 0)
1084 #define yyclearin       (yychar = YYEMPTY)
1085 
1086 #define YYACCEPT        goto yyacceptlab
1087 #define YYABORT         goto yyabortlab
1088 #define YYERROR         goto yyerrorlab
1089 #define YYNOMEM         goto yyexhaustedlab
1090 
1091 
1092 #define YYRECOVERING()  (!!yyerrstatus)
1093 
1094 #define YYBACKUP(Token, Value)                                    \
1095   do                                                              \
1096     if (yychar == YYEMPTY)                                        \
1097       {                                                           \
1098         yychar = (Token);                                         \
1099         yylval = (Value);                                         \
1100         YYPOPSTACK (yylen);                                       \
1101         yystate = *yyssp;                                         \
1102         goto yybackup;                                            \
1103       }                                                           \
1104     else                                                          \
1105       {                                                           \
1106         yyerror (YY_("syntax error: cannot back up")); \
1107         YYERROR;                                                  \
1108       }                                                           \
1109   while (0)
1110 
1111 /* Backward compatibility with an undocumented macro.
1112    Use YYerror or YYUNDEF. */
1113 #define YYERRCODE YYUNDEF
1114 
1115 
1116 /* Enable debugging if requested.  */
1117 #if YYDEBUG
1118 
1119 # ifndef YYFPRINTF
1120 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1121 #  define YYFPRINTF fprintf
1122 # endif
1123 
1124 # define YYDPRINTF(Args)                        \
1125 do {                                            \
1126   if (yydebug)                                  \
1127     YYFPRINTF Args;                             \
1128 } while (0)
1129 
1130 
1131 
1132 
1133 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
1134 do {                                                                      \
1135   if (yydebug)                                                            \
1136     {                                                                     \
1137       YYFPRINTF (stderr, "%s ", Title);                                   \
1138       yy_symbol_print (stderr,                                            \
1139                   Kind, Value); \
1140       YYFPRINTF (stderr, "\n");                                           \
1141     }                                                                     \
1142 } while (0)
1143 
1144 
1145 /*-----------------------------------.
1146 | Print this symbol's value on YYO.  |
1147 `-----------------------------------*/
1148 
1149 static void
yy_symbol_value_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep)1150 yy_symbol_value_print (FILE *yyo,
1151                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1152 {
1153   FILE *yyoutput = yyo;
1154   YY_USE (yyoutput);
1155   if (!yyvaluep)
1156     return;
1157   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1158   YY_USE (yykind);
1159   YY_IGNORE_MAYBE_UNINITIALIZED_END
1160 }
1161 
1162 
1163 /*---------------------------.
1164 | Print this symbol on YYO.  |
1165 `---------------------------*/
1166 
1167 static void
yy_symbol_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep)1168 yy_symbol_print (FILE *yyo,
1169                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1170 {
1171   YYFPRINTF (yyo, "%s %s (",
1172              yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1173 
1174   yy_symbol_value_print (yyo, yykind, yyvaluep);
1175   YYFPRINTF (yyo, ")");
1176 }
1177 
1178 /*------------------------------------------------------------------.
1179 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1180 | TOP (included).                                                   |
1181 `------------------------------------------------------------------*/
1182 
1183 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)1184 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1185 {
1186   YYFPRINTF (stderr, "Stack now");
1187   for (; yybottom <= yytop; yybottom++)
1188     {
1189       int yybot = *yybottom;
1190       YYFPRINTF (stderr, " %d", yybot);
1191     }
1192   YYFPRINTF (stderr, "\n");
1193 }
1194 
1195 # define YY_STACK_PRINT(Bottom, Top)                            \
1196 do {                                                            \
1197   if (yydebug)                                                  \
1198     yy_stack_print ((Bottom), (Top));                           \
1199 } while (0)
1200 
1201 
1202 /*------------------------------------------------.
1203 | Report that the YYRULE is going to be reduced.  |
1204 `------------------------------------------------*/
1205 
1206 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule)1207 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1208                  int yyrule)
1209 {
1210   int yylno = yyrline[yyrule];
1211   int yynrhs = yyr2[yyrule];
1212   int yyi;
1213   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1214              yyrule - 1, yylno);
1215   /* The symbols being reduced.  */
1216   for (yyi = 0; yyi < yynrhs; yyi++)
1217     {
1218       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1219       yy_symbol_print (stderr,
1220                        YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1221                        &yyvsp[(yyi + 1) - (yynrhs)]);
1222       YYFPRINTF (stderr, "\n");
1223     }
1224 }
1225 
1226 # define YY_REDUCE_PRINT(Rule)          \
1227 do {                                    \
1228   if (yydebug)                          \
1229     yy_reduce_print (yyssp, yyvsp, Rule); \
1230 } while (0)
1231 
1232 /* Nonzero means print parse trace.  It is left uninitialized so that
1233    multiple parsers can coexist.  */
1234 int yydebug;
1235 #else /* !YYDEBUG */
1236 # define YYDPRINTF(Args) ((void) 0)
1237 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1238 # define YY_STACK_PRINT(Bottom, Top)
1239 # define YY_REDUCE_PRINT(Rule)
1240 #endif /* !YYDEBUG */
1241 
1242 
1243 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1244 #ifndef YYINITDEPTH
1245 # define YYINITDEPTH 200
1246 #endif
1247 
1248 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1249    if the built-in stack extension method is used).
1250 
1251    Do not make this value too large; the results are undefined if
1252    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1253    evaluated with infinite-precision integer arithmetic.  */
1254 
1255 #ifndef YYMAXDEPTH
1256 # define YYMAXDEPTH 10000
1257 #endif
1258 
1259 
1260 
1261 
1262 
1263 
1264 /*-----------------------------------------------.
1265 | Release the memory associated to this symbol.  |
1266 `-----------------------------------------------*/
1267 
1268 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep)1269 yydestruct (const char *yymsg,
1270             yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1271 {
1272   YY_USE (yyvaluep);
1273   if (!yymsg)
1274     yymsg = "Deleting";
1275   YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1276 
1277   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1278   YY_USE (yykind);
1279   YY_IGNORE_MAYBE_UNINITIALIZED_END
1280 }
1281 
1282 
1283 /* Lookahead token kind.  */
1284 int yychar;
1285 
1286 /* The semantic value of the lookahead symbol.  */
1287 YYSTYPE yylval;
1288 /* Number of syntax errors so far.  */
1289 int yynerrs;
1290 
1291 
1292 
1293 
1294 /*----------.
1295 | yyparse.  |
1296 `----------*/
1297 
1298 int
yyparse(void)1299 yyparse (void)
1300 {
1301     yy_state_fast_t yystate = 0;
1302     /* Number of tokens to shift before error messages enabled.  */
1303     int yyerrstatus = 0;
1304 
1305     /* Refer to the stacks through separate pointers, to allow yyoverflow
1306        to reallocate them elsewhere.  */
1307 
1308     /* Their size.  */
1309     YYPTRDIFF_T yystacksize = YYINITDEPTH;
1310 
1311     /* The state stack: array, bottom, top.  */
1312     yy_state_t yyssa[YYINITDEPTH];
1313     yy_state_t *yyss = yyssa;
1314     yy_state_t *yyssp = yyss;
1315 
1316     /* The semantic value stack: array, bottom, top.  */
1317     YYSTYPE yyvsa[YYINITDEPTH];
1318     YYSTYPE *yyvs = yyvsa;
1319     YYSTYPE *yyvsp = yyvs;
1320 
1321   int yyn;
1322   /* The return value of yyparse.  */
1323   int yyresult;
1324   /* Lookahead symbol kind.  */
1325   yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1326   /* The variables used to return semantic value and location from the
1327      action routines.  */
1328   YYSTYPE yyval;
1329 
1330 
1331 
1332 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1333 
1334   /* The number of symbols on the RHS of the reduced rule.
1335      Keep to zero when no symbol should be popped.  */
1336   int yylen = 0;
1337 
1338   YYDPRINTF ((stderr, "Starting parse\n"));
1339 
1340   yychar = YYEMPTY; /* Cause a token to be read.  */
1341 
1342   goto yysetstate;
1343 
1344 
1345 /*------------------------------------------------------------.
1346 | yynewstate -- push a new state, which is found in yystate.  |
1347 `------------------------------------------------------------*/
1348 yynewstate:
1349   /* In all cases, when you get here, the value and location stacks
1350      have just been pushed.  So pushing a state here evens the stacks.  */
1351   yyssp++;
1352 
1353 
1354 /*--------------------------------------------------------------------.
1355 | yysetstate -- set current state (the top of the stack) to yystate.  |
1356 `--------------------------------------------------------------------*/
1357 yysetstate:
1358   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1359   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1360   YY_IGNORE_USELESS_CAST_BEGIN
1361   *yyssp = YY_CAST (yy_state_t, yystate);
1362   YY_IGNORE_USELESS_CAST_END
1363   YY_STACK_PRINT (yyss, yyssp);
1364 
1365   if (yyss + yystacksize - 1 <= yyssp)
1366 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1367     YYNOMEM;
1368 #else
1369     {
1370       /* Get the current used size of the three stacks, in elements.  */
1371       YYPTRDIFF_T yysize = yyssp - yyss + 1;
1372 
1373 # if defined yyoverflow
1374       {
1375         /* Give user a chance to reallocate the stack.  Use copies of
1376            these so that the &'s don't force the real ones into
1377            memory.  */
1378         yy_state_t *yyss1 = yyss;
1379         YYSTYPE *yyvs1 = yyvs;
1380 
1381         /* Each stack pointer address is followed by the size of the
1382            data in use in that stack, in bytes.  This used to be a
1383            conditional around just the two extra args, but that might
1384            be undefined if yyoverflow is a macro.  */
1385         yyoverflow (YY_("memory exhausted"),
1386                     &yyss1, yysize * YYSIZEOF (*yyssp),
1387                     &yyvs1, yysize * YYSIZEOF (*yyvsp),
1388                     &yystacksize);
1389         yyss = yyss1;
1390         yyvs = yyvs1;
1391       }
1392 # else /* defined YYSTACK_RELOCATE */
1393       /* Extend the stack our own way.  */
1394       if (YYMAXDEPTH <= yystacksize)
1395         YYNOMEM;
1396       yystacksize *= 2;
1397       if (YYMAXDEPTH < yystacksize)
1398         yystacksize = YYMAXDEPTH;
1399 
1400       {
1401         yy_state_t *yyss1 = yyss;
1402         union yyalloc *yyptr =
1403           YY_CAST (union yyalloc *,
1404                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1405         if (! yyptr)
1406           YYNOMEM;
1407         YYSTACK_RELOCATE (yyss_alloc, yyss);
1408         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1409 #  undef YYSTACK_RELOCATE
1410         if (yyss1 != yyssa)
1411           YYSTACK_FREE (yyss1);
1412       }
1413 # endif
1414 
1415       yyssp = yyss + yysize - 1;
1416       yyvsp = yyvs + yysize - 1;
1417 
1418       YY_IGNORE_USELESS_CAST_BEGIN
1419       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1420                   YY_CAST (long, yystacksize)));
1421       YY_IGNORE_USELESS_CAST_END
1422 
1423       if (yyss + yystacksize - 1 <= yyssp)
1424         YYABORT;
1425     }
1426 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1427 
1428 
1429   if (yystate == YYFINAL)
1430     YYACCEPT;
1431 
1432   goto yybackup;
1433 
1434 
1435 /*-----------.
1436 | yybackup.  |
1437 `-----------*/
1438 yybackup:
1439   /* Do appropriate processing given the current state.  Read a
1440      lookahead token if we need one and don't already have one.  */
1441 
1442   /* First try to decide what to do without reference to lookahead token.  */
1443   yyn = yypact[yystate];
1444   if (yypact_value_is_default (yyn))
1445     goto yydefault;
1446 
1447   /* Not known => get a lookahead token if don't already have one.  */
1448 
1449   /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
1450   if (yychar == YYEMPTY)
1451     {
1452       YYDPRINTF ((stderr, "Reading a token\n"));
1453       yychar = yylex ();
1454     }
1455 
1456   if (yychar <= YYEOF)
1457     {
1458       yychar = YYEOF;
1459       yytoken = YYSYMBOL_YYEOF;
1460       YYDPRINTF ((stderr, "Now at end of input.\n"));
1461     }
1462   else if (yychar == YYerror)
1463     {
1464       /* The scanner already issued an error message, process directly
1465          to error recovery.  But do not keep the error token as
1466          lookahead, it is too special and may lead us to an endless
1467          loop in error recovery. */
1468       yychar = YYUNDEF;
1469       yytoken = YYSYMBOL_YYerror;
1470       goto yyerrlab1;
1471     }
1472   else
1473     {
1474       yytoken = YYTRANSLATE (yychar);
1475       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1476     }
1477 
1478   /* If the proper action on seeing token YYTOKEN is to reduce or to
1479      detect an error, take that action.  */
1480   yyn += yytoken;
1481   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1482     goto yydefault;
1483   yyn = yytable[yyn];
1484   if (yyn <= 0)
1485     {
1486       if (yytable_value_is_error (yyn))
1487         goto yyerrlab;
1488       yyn = -yyn;
1489       goto yyreduce;
1490     }
1491 
1492   /* Count tokens shifted since error; after three, turn off error
1493      status.  */
1494   if (yyerrstatus)
1495     yyerrstatus--;
1496 
1497   /* Shift the lookahead token.  */
1498   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1499   yystate = yyn;
1500   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1501   *++yyvsp = yylval;
1502   YY_IGNORE_MAYBE_UNINITIALIZED_END
1503 
1504   /* Discard the shifted token.  */
1505   yychar = YYEMPTY;
1506   goto yynewstate;
1507 
1508 
1509 /*-----------------------------------------------------------.
1510 | yydefault -- do the default action for the current state.  |
1511 `-----------------------------------------------------------*/
1512 yydefault:
1513   yyn = yydefact[yystate];
1514   if (yyn == 0)
1515     goto yyerrlab;
1516   goto yyreduce;
1517 
1518 
1519 /*-----------------------------.
1520 | yyreduce -- do a reduction.  |
1521 `-----------------------------*/
1522 yyreduce:
1523   /* yyn is the number of a rule to reduce with.  */
1524   yylen = yyr2[yyn];
1525 
1526   /* If YYLEN is nonzero, implement the default value of the action:
1527      '$$ = $1'.
1528 
1529      Otherwise, the following line sets YYVAL to garbage.
1530      This behavior is undocumented and Bison
1531      users should not rely upon it.  Assigning to YYVAL
1532      unconditionally makes the parser a bit smaller, and it avoids a
1533      GCC warning that YYVAL may be used uninitialized.  */
1534   yyval = yyvsp[1-yylen];
1535 
1536 
1537   YY_REDUCE_PRINT (yyn);
1538   switch (yyn)
1539     {
1540   case 2: /* primary_expression: INTEGER  */
1541 #line 354 "./config/loongarch-parse.y"
1542                   {emit_const ((yyvsp[0].imm));}
1543 #line 1544 "config/loongarch-parse.c"
1544     break;
1545 
1546   case 4: /* primary_expression: '%' IDENTIFIER '(' IDENTIFIER addend ')'  */
1547 #line 356 "./config/loongarch-parse.y"
1548                                                    {reloc ((yyvsp[-4].c_str), (yyvsp[-2].c_str), (yyvsp[-1].imm)); free ((yyvsp[-4].c_str)); free ((yyvsp[-2].c_str));}
1549 #line 1550 "config/loongarch-parse.c"
1550     break;
1551 
1552   case 5: /* primary_expression: '%' IDENTIFIER '(' INTEGER addend ')'  */
1553 #line 357 "./config/loongarch-parse.y"
1554                                                 {reloc ((yyvsp[-4].c_str), NULL, (yyvsp[-2].imm) + (yyvsp[-1].imm)); free ((yyvsp[-4].c_str));}
1555 #line 1556 "config/loongarch-parse.c"
1556     break;
1557 
1558   case 6: /* addend: addend '-' INTEGER  */
1559 #line 361 "./config/loongarch-parse.y"
1560                              {(yyval.imm) -= (yyvsp[0].imm);}
1561 #line 1562 "config/loongarch-parse.c"
1562     break;
1563 
1564   case 7: /* addend: addend '+' INTEGER  */
1565 #line 362 "./config/loongarch-parse.y"
1566                              {(yyval.imm) += (yyvsp[0].imm);}
1567 #line 1568 "config/loongarch-parse.c"
1568     break;
1569 
1570   case 8: /* addend: %empty  */
1571 #line 363 "./config/loongarch-parse.y"
1572           {(yyval.imm) = 0;}
1573 #line 1574 "config/loongarch-parse.c"
1574     break;
1575 
1576   case 10: /* unary_expression: '+' unary_expression  */
1577 #line 368 "./config/loongarch-parse.y"
1578                                {emit_unary ('+');}
1579 #line 1580 "config/loongarch-parse.c"
1580     break;
1581 
1582   case 11: /* unary_expression: '-' unary_expression  */
1583 #line 369 "./config/loongarch-parse.y"
1584                                {emit_unary ('-');}
1585 #line 1586 "config/loongarch-parse.c"
1586     break;
1587 
1588   case 12: /* unary_expression: '~' unary_expression  */
1589 #line 370 "./config/loongarch-parse.y"
1590                                {emit_unary ('~');}
1591 #line 1592 "config/loongarch-parse.c"
1592     break;
1593 
1594   case 13: /* unary_expression: '!' unary_expression  */
1595 #line 371 "./config/loongarch-parse.y"
1596                                {emit_unary ('!');}
1597 #line 1598 "config/loongarch-parse.c"
1598     break;
1599 
1600   case 15: /* multiplicative_expression: multiplicative_expression '*' unary_expression  */
1601 #line 376 "./config/loongarch-parse.y"
1602                                                          {emit_bin ('*');}
1603 #line 1604 "config/loongarch-parse.c"
1604     break;
1605 
1606   case 16: /* multiplicative_expression: multiplicative_expression '/' unary_expression  */
1607 #line 377 "./config/loongarch-parse.y"
1608                                                          {emit_bin ('/');}
1609 #line 1610 "config/loongarch-parse.c"
1610     break;
1611 
1612   case 17: /* multiplicative_expression: multiplicative_expression '%' unary_expression  */
1613 #line 378 "./config/loongarch-parse.y"
1614                                                          {emit_bin ('%');}
1615 #line 1616 "config/loongarch-parse.c"
1616     break;
1617 
1618   case 19: /* additive_expression: additive_expression '+' multiplicative_expression  */
1619 #line 383 "./config/loongarch-parse.y"
1620                                                             {emit_bin ('+');}
1621 #line 1622 "config/loongarch-parse.c"
1622     break;
1623 
1624   case 20: /* additive_expression: additive_expression '-' multiplicative_expression  */
1625 #line 384 "./config/loongarch-parse.y"
1626                                                             {emit_bin ('-');}
1627 #line 1628 "config/loongarch-parse.c"
1628     break;
1629 
1630   case 22: /* shift_expression: shift_expression LEFT_OP additive_expression  */
1631 #line 389 "./config/loongarch-parse.y"
1632                                                        {emit_bin (LEFT_OP);}
1633 #line 1634 "config/loongarch-parse.c"
1634     break;
1635 
1636   case 23: /* shift_expression: shift_expression RIGHT_OP additive_expression  */
1637 #line 390 "./config/loongarch-parse.y"
1638                                                         {emit_bin (RIGHT_OP);}
1639 #line 1640 "config/loongarch-parse.c"
1640     break;
1641 
1642   case 25: /* relational_expression: relational_expression '<' shift_expression  */
1643 #line 395 "./config/loongarch-parse.y"
1644                                                      {emit_bin ('<');}
1645 #line 1646 "config/loongarch-parse.c"
1646     break;
1647 
1648   case 26: /* relational_expression: relational_expression '>' shift_expression  */
1649 #line 396 "./config/loongarch-parse.y"
1650                                                      {emit_bin ('>');}
1651 #line 1652 "config/loongarch-parse.c"
1652     break;
1653 
1654   case 27: /* relational_expression: relational_expression LE_OP shift_expression  */
1655 #line 397 "./config/loongarch-parse.y"
1656                                                        {emit_bin (LE_OP);}
1657 #line 1658 "config/loongarch-parse.c"
1658     break;
1659 
1660   case 28: /* relational_expression: relational_expression GE_OP shift_expression  */
1661 #line 398 "./config/loongarch-parse.y"
1662                                                        {emit_bin (GE_OP);}
1663 #line 1664 "config/loongarch-parse.c"
1664     break;
1665 
1666   case 30: /* equality_expression: equality_expression EQ_OP relational_expression  */
1667 #line 403 "./config/loongarch-parse.y"
1668                                                           {emit_bin (EQ_OP);}
1669 #line 1670 "config/loongarch-parse.c"
1670     break;
1671 
1672   case 31: /* equality_expression: equality_expression NE_OP relational_expression  */
1673 #line 404 "./config/loongarch-parse.y"
1674                                                           {emit_bin (NE_OP);}
1675 #line 1676 "config/loongarch-parse.c"
1676     break;
1677 
1678   case 33: /* and_expression: and_expression '&' equality_expression  */
1679 #line 409 "./config/loongarch-parse.y"
1680                                                  {emit_bin ('&');}
1681 #line 1682 "config/loongarch-parse.c"
1682     break;
1683 
1684   case 35: /* exclusive_or_expression: exclusive_or_expression '^' and_expression  */
1685 #line 414 "./config/loongarch-parse.y"
1686                                                      {emit_bin ('^');}
1687 #line 1688 "config/loongarch-parse.c"
1688     break;
1689 
1690   case 37: /* inclusive_or_expression: inclusive_or_expression '|' exclusive_or_expression  */
1691 #line 419 "./config/loongarch-parse.y"
1692                                                               {emit_bin ('|');}
1693 #line 1694 "config/loongarch-parse.c"
1694     break;
1695 
1696   case 39: /* logical_and_expression: logical_and_expression AND_OP inclusive_or_expression  */
1697 #line 424 "./config/loongarch-parse.y"
1698                                                                 {emit_bin (AND_OP);}
1699 #line 1700 "config/loongarch-parse.c"
1700     break;
1701 
1702   case 41: /* logical_or_expression: logical_or_expression OR_OP logical_and_expression  */
1703 #line 429 "./config/loongarch-parse.y"
1704                                                              {emit_bin (OR_OP);}
1705 #line 1706 "config/loongarch-parse.c"
1706     break;
1707 
1708   case 43: /* conditional_expression: logical_or_expression '?' expression ':' conditional_expression  */
1709 #line 434 "./config/loongarch-parse.y"
1710                                                                           {emit_if_else ();}
1711 #line 1712 "config/loongarch-parse.c"
1712     break;
1713 
1714 
1715 #line 1716 "config/loongarch-parse.c"
1716 
1717       default: break;
1718     }
1719   /* User semantic actions sometimes alter yychar, and that requires
1720      that yytoken be updated with the new translation.  We take the
1721      approach of translating immediately before every use of yytoken.
1722      One alternative is translating here after every semantic action,
1723      but that translation would be missed if the semantic action invokes
1724      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1725      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1726      incorrect destructor might then be invoked immediately.  In the
1727      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1728      to an incorrect destructor call or verbose syntax error message
1729      before the lookahead is translated.  */
1730   YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1731 
1732   YYPOPSTACK (yylen);
1733   yylen = 0;
1734 
1735   *++yyvsp = yyval;
1736 
1737   /* Now 'shift' the result of the reduction.  Determine what state
1738      that goes to, based on the state we popped back to and the rule
1739      number reduced by.  */
1740   {
1741     const int yylhs = yyr1[yyn] - YYNTOKENS;
1742     const int yyi = yypgoto[yylhs] + *yyssp;
1743     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1744                ? yytable[yyi]
1745                : yydefgoto[yylhs]);
1746   }
1747 
1748   goto yynewstate;
1749 
1750 
1751 /*--------------------------------------.
1752 | yyerrlab -- here on detecting error.  |
1753 `--------------------------------------*/
1754 yyerrlab:
1755   /* Make sure we have latest lookahead translation.  See comments at
1756      user semantic actions for why this is necessary.  */
1757   yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1758   /* If not already recovering from an error, report this error.  */
1759   if (!yyerrstatus)
1760     {
1761       ++yynerrs;
1762       yyerror (YY_("syntax error"));
1763     }
1764 
1765   if (yyerrstatus == 3)
1766     {
1767       /* If just tried and failed to reuse lookahead token after an
1768          error, discard it.  */
1769 
1770       if (yychar <= YYEOF)
1771         {
1772           /* Return failure if at end of input.  */
1773           if (yychar == YYEOF)
1774             YYABORT;
1775         }
1776       else
1777         {
1778           yydestruct ("Error: discarding",
1779                       yytoken, &yylval);
1780           yychar = YYEMPTY;
1781         }
1782     }
1783 
1784   /* Else will try to reuse lookahead token after shifting the error
1785      token.  */
1786   goto yyerrlab1;
1787 
1788 
1789 /*---------------------------------------------------.
1790 | yyerrorlab -- error raised explicitly by YYERROR.  |
1791 `---------------------------------------------------*/
1792 yyerrorlab:
1793   /* Pacify compilers when the user code never invokes YYERROR and the
1794      label yyerrorlab therefore never appears in user code.  */
1795   if (0)
1796     YYERROR;
1797   ++yynerrs;
1798 
1799   /* Do not reclaim the symbols of the rule whose action triggered
1800      this YYERROR.  */
1801   YYPOPSTACK (yylen);
1802   yylen = 0;
1803   YY_STACK_PRINT (yyss, yyssp);
1804   yystate = *yyssp;
1805   goto yyerrlab1;
1806 
1807 
1808 /*-------------------------------------------------------------.
1809 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1810 `-------------------------------------------------------------*/
1811 yyerrlab1:
1812   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1813 
1814   /* Pop stack until we find a state that shifts the error token.  */
1815   for (;;)
1816     {
1817       yyn = yypact[yystate];
1818       if (!yypact_value_is_default (yyn))
1819         {
1820           yyn += YYSYMBOL_YYerror;
1821           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1822             {
1823               yyn = yytable[yyn];
1824               if (0 < yyn)
1825                 break;
1826             }
1827         }
1828 
1829       /* Pop the current state because it cannot handle the error token.  */
1830       if (yyssp == yyss)
1831         YYABORT;
1832 
1833 
1834       yydestruct ("Error: popping",
1835                   YY_ACCESSING_SYMBOL (yystate), yyvsp);
1836       YYPOPSTACK (1);
1837       yystate = *yyssp;
1838       YY_STACK_PRINT (yyss, yyssp);
1839     }
1840 
1841   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1842   *++yyvsp = yylval;
1843   YY_IGNORE_MAYBE_UNINITIALIZED_END
1844 
1845 
1846   /* Shift the error token.  */
1847   YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1848 
1849   yystate = yyn;
1850   goto yynewstate;
1851 
1852 
1853 /*-------------------------------------.
1854 | yyacceptlab -- YYACCEPT comes here.  |
1855 `-------------------------------------*/
1856 yyacceptlab:
1857   yyresult = 0;
1858   goto yyreturnlab;
1859 
1860 
1861 /*-----------------------------------.
1862 | yyabortlab -- YYABORT comes here.  |
1863 `-----------------------------------*/
1864 yyabortlab:
1865   yyresult = 1;
1866   goto yyreturnlab;
1867 
1868 
1869 /*-----------------------------------------------------------.
1870 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
1871 `-----------------------------------------------------------*/
1872 yyexhaustedlab:
1873   yyerror (YY_("memory exhausted"));
1874   yyresult = 2;
1875   goto yyreturnlab;
1876 
1877 
1878 /*----------------------------------------------------------.
1879 | yyreturnlab -- parsing is finished, clean up and return.  |
1880 `----------------------------------------------------------*/
1881 yyreturnlab:
1882   if (yychar != YYEMPTY)
1883     {
1884       /* Make sure we have latest lookahead translation.  See comments at
1885          user semantic actions for why this is necessary.  */
1886       yytoken = YYTRANSLATE (yychar);
1887       yydestruct ("Cleanup: discarding lookahead",
1888                   yytoken, &yylval);
1889     }
1890   /* Do not reclaim the symbols of the rule whose action triggered
1891      this YYABORT or YYACCEPT.  */
1892   YYPOPSTACK (yylen);
1893   YY_STACK_PRINT (yyss, yyssp);
1894   while (yyssp != yyss)
1895     {
1896       yydestruct ("Cleanup: popping",
1897                   YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1898       YYPOPSTACK (1);
1899     }
1900 #ifndef yyoverflow
1901   if (yyss != yyssa)
1902     YYSTACK_FREE (yyss);
1903 #endif
1904 
1905   return yyresult;
1906 }
1907 
1908 #line 440 "./config/loongarch-parse.y"
1909 
1910 
1911