1 /* A Bison parser, made by GNU Bison 3.4.1. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
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.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
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.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
44 /* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
47 /* Identify Bison output. */
51 #define YYBISON_VERSION "3.4.1"
54 #define YYSKELETON_NAME "yacc.c"
66 /* Substitute the variable and function names. */
67 #define yyparse ppy_parse
69 #define yyerror ppy_error
70 #define yydebug ppy_debug
71 #define yynerrs ppy_nerrs
73 #define yylval ppy_lval
74 #define yychar ppy_char
76 /* First part of user prologue. */
85 #include "wpp_private.h"
88 #define UNARY_OP(r, v, OP) \
91 case cv_sint: r.val.si = OP v.val.si; break; \
92 case cv_uint: r.val.ui = OP v.val.ui; break; \
93 case cv_slong: r.val.sl = OP v.val.sl; break; \
94 case cv_ulong: r.val.ul = OP v.val.ul; break; \
95 case cv_sll: r.val.sll = OP v.val.sll; break; \
96 case cv_ull: r.val.ull = OP v.val.ull; break; \
99 #define cv_signed(v) ((v.type & FLAG_SIGNED) != 0)
101 #define BIN_OP_INT(r, v1, v2, OP) \
103 if(cv_signed(v1) && cv_signed(v2)) \
104 r.val.si = v1.val.si OP v2.val.si; \
105 else if(cv_signed(v1) && !cv_signed(v2)) \
106 r.val.si = v1.val.si OP (signed) v2.val.ui; \
107 else if(!cv_signed(v1) && cv_signed(v2)) \
108 r.val.si = (signed) v1.val.ui OP v2.val.si; \
110 r.val.ui = v1.val.ui OP v2.val.ui;
112 #define BIN_OP_LONG(r, v1, v2, OP) \
114 if(cv_signed(v1) && cv_signed(v2)) \
115 r.val.sl = v1.val.sl OP v2.val.sl; \
116 else if(cv_signed(v1) && !cv_signed(v2)) \
117 r.val.sl = v1.val.sl OP (signed long) v2.val.ul; \
118 else if(!cv_signed(v1) && cv_signed(v2)) \
119 r.val.sl = (signed long) v1.val.ul OP v2.val.sl; \
121 r.val.ul = v1.val.ul OP v2.val.ul;
123 #define BIN_OP_LONGLONG(r, v1, v2, OP) \
125 if(cv_signed(v1) && cv_signed(v2)) \
126 r.val.sll = v1.val.sll OP v2.val.sll; \
127 else if(cv_signed(v1) && !cv_signed(v2)) \
128 r.val.sll = v1.val.sll OP (__int64) v2.val.ull; \
129 else if(!cv_signed(v1) && cv_signed(v2)) \
130 r.val.sll = (__int64) v1.val.ull OP v2.val.sll; \
132 r.val.ull = v1.val.ull OP v2.val.ull;
134 #define BIN_OP(r, v1, v2, OP) \
135 switch(v1.type & SIZE_MASK) \
137 case SIZE_INT: BIN_OP_INT(r, v1, v2, OP); break; \
138 case SIZE_LONG: BIN_OP_LONG(r, v1, v2, OP); break; \
139 case SIZE_LONGLONG: BIN_OP_LONGLONG(r, v1, v2, OP); break; \
140 default: pp_internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type); \
147 static int boolean(cval_t
*v
);
148 static void promote_equal_size(cval_t
*v1
, cval_t
*v2
);
149 static void cast_to_sint(cval_t
*v
);
150 static void cast_to_uint(cval_t
*v
);
151 static void cast_to_slong(cval_t
*v
);
152 static void cast_to_ulong(cval_t
*v
);
153 static void cast_to_sll(cval_t
*v
);
154 static void cast_to_ull(cval_t
*v
);
155 static marg_t
*new_marg(char *str
, def_arg_t type
);
156 static marg_t
*add_new_marg(char *str
, def_arg_t type
);
157 static int marg_index(char *id
);
158 static mtext_t
*new_mtext(char *str
, int idx
, def_exp_t type
);
159 static mtext_t
*combine_mtext(mtext_t
*tail
, mtext_t
*mtp
);
160 static char *merge_text(char *s1
, char *s2
);
165 static marg_t
**macro_args
; /* Macro parameters array while parsing */
166 static int nmacro_args
;
169 #line 170 "ppy.tab.c"
172 # if defined __cplusplus
173 # if 201103L <= __cplusplus
174 # define YY_NULLPTR nullptr
176 # define YY_NULLPTR 0
179 # define YY_NULLPTR ((void*)0)
183 /* Enabling verbose error messages. */
184 #ifdef YYERROR_VERBOSE
185 # undef YYERROR_VERBOSE
186 # define YYERROR_VERBOSE 1
188 # define YYERROR_VERBOSE 0
191 /* Use api.header.include to #include this header
192 instead of duplicating it here. */
193 #ifndef YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED
194 # define YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED
200 extern int ppy_debug
;
242 tRCINCLUDEPATH
= 292,
255 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
265 unsigned __int64 ull
;
272 #line 273 "ppy.tab.c"
275 typedef union YYSTYPE YYSTYPE
;
276 # define YYSTYPE_IS_TRIVIAL 1
277 # define YYSTYPE_IS_DECLARED 1
281 extern YYSTYPE ppy_lval
;
283 int ppy_parse (void);
285 #endif /* !YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED */
294 typedef YYTYPE_UINT8 yytype_uint8
;
296 typedef unsigned char yytype_uint8
;
300 typedef YYTYPE_INT8 yytype_int8
;
302 typedef signed char yytype_int8
;
306 typedef YYTYPE_UINT16 yytype_uint16
;
308 typedef unsigned short yytype_uint16
;
312 typedef YYTYPE_INT16 yytype_int16
;
314 typedef short yytype_int16
;
318 # ifdef __SIZE_TYPE__
319 # define YYSIZE_T __SIZE_TYPE__
320 # elif defined size_t
321 # define YYSIZE_T size_t
322 # elif ! defined YYSIZE_T
323 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
324 # define YYSIZE_T size_t
326 # define YYSIZE_T unsigned
330 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
333 # if defined YYENABLE_NLS && YYENABLE_NLS
335 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
336 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
340 # define YY_(Msgid) Msgid
345 # if (defined __GNUC__ \
346 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
347 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
348 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
350 # define YY_ATTRIBUTE(Spec) /* empty */
354 #ifndef YY_ATTRIBUTE_PURE
355 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
358 #ifndef YY_ATTRIBUTE_UNUSED
359 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
362 /* Suppress unused-variable warnings by "using" E. */
363 #if ! defined lint || defined __GNUC__
364 # define YYUSE(E) ((void) (E))
366 # define YYUSE(E) /* empty */
369 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
370 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
371 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
372 _Pragma ("GCC diagnostic push") \
373 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
374 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
375 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
376 _Pragma ("GCC diagnostic pop")
378 # define YY_INITIAL_VALUE(Value) Value
380 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
381 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
382 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
384 #ifndef YY_INITIAL_VALUE
385 # define YY_INITIAL_VALUE(Value) /* Nothing. */
389 #define YY_ASSERT(E) ((void) (0 && (E)))
391 #if ! defined yyoverflow || YYERROR_VERBOSE
393 /* The parser invokes alloca or malloc; define the necessary symbols. */
395 # ifdef YYSTACK_USE_ALLOCA
396 # if YYSTACK_USE_ALLOCA
398 # define YYSTACK_ALLOC __builtin_alloca
399 # elif defined __BUILTIN_VA_ARG_INCR
400 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
402 # define YYSTACK_ALLOC __alloca
403 # elif defined _MSC_VER
404 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
405 # define alloca _alloca
407 # define YYSTACK_ALLOC alloca
408 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
409 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
410 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
411 # ifndef EXIT_SUCCESS
412 # define EXIT_SUCCESS 0
419 # ifdef YYSTACK_ALLOC
420 /* Pacify GCC's 'empty if-body' warning. */
421 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
422 # ifndef YYSTACK_ALLOC_MAXIMUM
423 /* The OS might guarantee only one guard page at the bottom of the stack,
424 and a page size can be as small as 4096 bytes. So we cannot safely
425 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
426 to allow for a few compiler-allocated temporary stack slots. */
427 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
430 # define YYSTACK_ALLOC YYMALLOC
431 # define YYSTACK_FREE YYFREE
432 # ifndef YYSTACK_ALLOC_MAXIMUM
433 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
435 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
436 && ! ((defined YYMALLOC || defined malloc) \
437 && (defined YYFREE || defined free)))
438 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
439 # ifndef EXIT_SUCCESS
440 # define EXIT_SUCCESS 0
444 # define YYMALLOC malloc
445 # if ! defined malloc && ! defined EXIT_SUCCESS
446 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
451 # if ! defined free && ! defined EXIT_SUCCESS
452 void free (void *); /* INFRINGES ON USER NAME SPACE */
456 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
459 #if (! defined yyoverflow \
460 && (! defined __cplusplus \
461 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
463 /* A type that is properly aligned for any stack member. */
466 yytype_int16 yyss_alloc
;
470 /* The size of the maximum gap between one aligned stack and the next. */
471 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
473 /* The size of an array large to enough to hold all stacks, each with
475 # define YYSTACK_BYTES(N) \
476 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
477 + YYSTACK_GAP_MAXIMUM)
479 # define YYCOPY_NEEDED 1
481 /* Relocate STACK from its old location to the new one. The
482 local variables YYSIZE and YYSTACKSIZE give the old and new number of
483 elements in the stack, and YYPTR gives the new location of the
484 stack. Advance YYPTR to a properly aligned location for the next
486 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
489 YYSIZE_T yynewbytes; \
490 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
491 Stack = &yyptr->Stack_alloc; \
492 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
493 yyptr += yynewbytes / sizeof (*yyptr); \
499 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
500 /* Copy COUNT objects from SRC to DST. The source and destination do
503 # if defined __GNUC__ && 1 < __GNUC__
504 # define YYCOPY(Dst, Src, Count) \
505 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
507 # define YYCOPY(Dst, Src, Count) \
511 for (yyi = 0; yyi < (Count); yyi++) \
512 (Dst)[yyi] = (Src)[yyi]; \
517 #endif /* !YYCOPY_NEEDED */
519 /* YYFINAL -- State number of the termination state. */
521 /* YYLAST -- Last index in YYTABLE. */
524 /* YYNTOKENS -- Number of terminals. */
526 /* YYNNTS -- Number of nonterminals. */
528 /* YYNRULES -- Number of rules. */
530 /* YYNSTATES -- Number of states. */
531 #define YYNSTATES 153
534 #define YYMAXUTOK 300
536 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
537 as returned by yylex, with out-of-bounds checking. */
538 #define YYTRANSLATE(YYX) \
539 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
541 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
542 as returned by yylex. */
543 static const yytype_uint8 yytranslate
[] =
545 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 58, 2, 2, 2, 2, 44, 2,
549 60, 61, 55, 53, 59, 54, 2, 56, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 39, 2,
551 47, 2, 49, 38, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 43, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 42, 2, 57, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
571 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
572 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
573 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
574 35, 36, 37, 40, 41, 45, 46, 48, 50, 51,
579 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
580 static const yytype_uint16 yyrline
[] =
582 0, 169, 169, 170, 174, 175, 176, 177, 178, 195,
583 219, 245, 259, 260, 261, 264, 265, 266, 268, 270,
584 272, 274, 275, 276, 277, 278, 279, 292, 298, 299,
585 302, 303, 304, 305, 306, 307, 310, 313, 314, 317,
586 318, 321, 322, 326, 327, 333, 334, 337, 338, 339,
587 340, 341, 348, 357, 358, 359, 360, 361, 362, 363,
588 364, 365, 366, 367, 368, 369, 370, 371, 372, 373,
589 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
590 384, 385, 386, 387, 388
594 #if YYDEBUG || YYERROR_VERBOSE || 0
595 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
596 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
597 static const char *const yytname
[] =
599 "$end", "error", "$undefined", "tRCINCLUDE", "tIF", "tIFDEF", "tIFNDEF",
600 "tELSE", "tELIF", "tENDIF", "tDEFINED", "tNL", "tINCLUDE", "tLINE",
601 "tGCCLINE", "tERROR", "tWARNING", "tPRAGMA", "tPPIDENT", "tUNDEF",
602 "tMACROEND", "tCONCAT", "tELIPSIS", "tSTRINGIZE", "tIDENT", "tLITERAL",
603 "tMACRO", "tDEFINE", "tDQSTRING", "tSQSTRING", "tIQSTRING", "tUINT",
604 "tSINT", "tULONG", "tSLONG", "tULONGLONG", "tSLONGLONG",
605 "tRCINCLUDEPATH", "'?'", "':'", "tLOGOR", "tLOGAND", "'|'", "'^'", "'&'",
606 "tEQ", "tNE", "'<'", "tLTE", "'>'", "tGTE", "tLSHIFT", "tRSHIFT", "'+'",
607 "'-'", "'*'", "'/'", "'~'", "'!'", "','", "'('", "')'", "$accept",
608 "pp_file", "preprocessor", "opt_text", "text", "res_arg", "allmargs",
609 "emargs", "margs", "opt_mtexts", "mtexts", "mtext", "pp_expr", YY_NULLPTR
614 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
615 (internal) symbol number NUM (which must be that of a token). */
616 static const yytype_uint16 yytoknum
[] =
618 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
619 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
620 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
621 285, 286, 287, 288, 289, 290, 291, 292, 63, 58,
622 293, 294, 124, 94, 38, 295, 296, 60, 297, 62,
623 298, 299, 300, 43, 45, 42, 47, 126, 33, 44,
628 #define YYPACT_NINF -27
630 #define yypact_value_is_default(Yystate) \
631 (!!((Yystate) == (-27)))
633 #define YYTABLE_NINF -1
635 #define yytable_value_is_error(Yytable_value) \
638 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
640 static const yytype_int16 yypact
[] =
642 -27, 142, -27, -26, -3, -12, -2, 30, -3, 41,
643 91, 21, 2, -19, -19, -19, -19, 32, -27, -19,
644 -27, -27, -27, -23, -27, -27, -27, -27, -27, -27,
645 -27, -3, -3, -3, -3, -3, 38, 66, 109, -27,
646 85, -27, 113, 133, 115, -27, 124, -27, -27, -27,
647 179, -9, 278, 280, 281, 282, 129, 283, -27, 271,
648 -10, -10, -27, -27, 57, -27, -3, -3, -3, -3,
649 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
650 -3, -3, -3, -3, -27, -27, -27, -27, -27, 285,
651 3, -27, -27, -27, -27, -27, -27, -27, -27, -27,
652 277, -27, 239, -27, 238, -27, 132, 167, 182, 196,
653 209, 221, 231, 231, 111, 111, 111, 111, 61, 61,
654 -10, -10, -27, -27, -27, -27, 4, 19, 266, -27,
655 -3, -27, 6, -27, 276, -27, -27, -27, -27, 290,
656 19, -27, -27, -27, 151, -27, 7, -27, -27, -27,
660 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
661 Performed when YYTABLE does not specify something else to do. Zero
662 means the default is an error. */
663 static const yytype_uint8 yydefact
[] =
665 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
666 0, 0, 0, 28, 28, 28, 28, 0, 36, 28,
667 3, 27, 26, 0, 61, 54, 53, 56, 55, 58,
668 57, 0, 0, 0, 0, 0, 0, 0, 0, 10,
669 0, 11, 0, 0, 0, 21, 0, 30, 31, 32,
670 0, 29, 0, 0, 0, 0, 37, 0, 59, 0,
671 79, 80, 81, 82, 0, 6, 0, 0, 0, 0,
672 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
673 0, 0, 0, 0, 7, 8, 9, 4, 5, 0,
674 0, 22, 33, 34, 35, 23, 24, 25, 12, 42,
675 0, 38, 39, 13, 0, 83, 0, 62, 63, 74,
676 72, 73, 64, 65, 66, 68, 67, 69, 77, 78,
677 70, 71, 75, 76, 15, 16, 0, 43, 0, 60,
678 0, 17, 0, 50, 0, 52, 47, 48, 49, 0,
679 44, 45, 40, 41, 84, 18, 0, 51, 14, 46,
683 /* YYPGOTO[NTERM-NUM]. */
684 static const yytype_int16 yypgoto
[] =
686 -27, -27, -27, -11, -27, -27, -27, -27, -27, -27,
690 /* YYDEFGOTO[NTERM-NUM]. */
691 static const yytype_int16 yydefgoto
[] =
693 -1, 1, 20, 50, 51, 56, 100, 101, 102, 139,
697 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
698 positive, shift that token. If negative, reduce the rule whose
699 number is the opposite. If YYTABLE_NINF, syntax error. */
700 static const yytype_uint8 yytable
[] =
702 40, 58, 21, 52, 53, 54, 47, 23, 57, 48,
703 49, 22, 37, 45, 125, 131, 92, 145, 150, 93,
704 94, 24, 38, 60, 61, 62, 63, 64, 25, 26,
705 27, 28, 29, 30, 46, 126, 132, 59, 146, 151,
706 133, 39, 134, 135, 136, 82, 83, 137, 138, 65,
707 31, 32, 41, 44, 33, 34, 55, 35, 106, 107,
708 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
709 118, 119, 120, 121, 122, 123, 66, 84, 67, 68,
710 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
711 79, 80, 81, 82, 83, 66, 86, 67, 68, 69,
712 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
713 80, 81, 82, 83, 80, 81, 82, 83, 105, 42,
714 85, 43, 144, 66, 87, 67, 68, 69, 70, 71,
715 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
716 82, 83, 2, 89, 88, 3, 4, 5, 6, 7,
717 8, 9, 90, 99, 10, 11, 12, 13, 14, 15,
718 16, 17, 78, 79, 80, 81, 82, 83, 18, 19,
719 66, 130, 67, 68, 69, 70, 71, 72, 73, 74,
720 75, 76, 77, 78, 79, 80, 81, 82, 83, 66,
721 91, 67, 68, 69, 70, 71, 72, 73, 74, 75,
722 76, 77, 78, 79, 80, 81, 82, 83, 68, 69,
723 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
724 80, 81, 82, 83, 69, 70, 71, 72, 73, 74,
725 75, 76, 77, 78, 79, 80, 81, 82, 83, 70,
726 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
727 81, 82, 83, 71, 72, 73, 74, 75, 76, 77,
728 78, 79, 80, 81, 82, 83, 72, 73, 74, 75,
729 76, 77, 78, 79, 80, 81, 82, 83, 74, 75,
730 76, 77, 78, 79, 80, 81, 82, 83, 142, 95,
731 143, 96, 97, 98, 103, 104, 124, 127, 128, 129,
735 static const yytype_uint8 yycheck
[] =
737 8, 24, 28, 14, 15, 16, 25, 10, 19, 28,
738 29, 37, 24, 11, 11, 11, 25, 11, 11, 28,
739 29, 24, 24, 31, 32, 33, 34, 35, 31, 32,
740 33, 34, 35, 36, 32, 32, 32, 60, 32, 32,
741 21, 11, 23, 24, 25, 55, 56, 28, 29, 11,
742 53, 54, 11, 32, 57, 58, 24, 60, 66, 67,
743 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
744 78, 79, 80, 81, 82, 83, 38, 11, 40, 41,
745 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
746 52, 53, 54, 55, 56, 38, 11, 40, 41, 42,
747 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
748 53, 54, 55, 56, 53, 54, 55, 56, 61, 28,
749 11, 30, 130, 38, 11, 40, 41, 42, 43, 44,
750 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
751 55, 56, 0, 28, 11, 3, 4, 5, 6, 7,
752 8, 9, 28, 24, 12, 13, 14, 15, 16, 17,
753 18, 19, 51, 52, 53, 54, 55, 56, 26, 27,
754 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
755 48, 49, 50, 51, 52, 53, 54, 55, 56, 38,
756 11, 40, 41, 42, 43, 44, 45, 46, 47, 48,
757 49, 50, 51, 52, 53, 54, 55, 56, 41, 42,
758 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
759 53, 54, 55, 56, 42, 43, 44, 45, 46, 47,
760 48, 49, 50, 51, 52, 53, 54, 55, 56, 43,
761 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
762 54, 55, 56, 44, 45, 46, 47, 48, 49, 50,
763 51, 52, 53, 54, 55, 56, 45, 46, 47, 48,
764 49, 50, 51, 52, 53, 54, 55, 56, 47, 48,
765 49, 50, 51, 52, 53, 54, 55, 56, 22, 11,
766 24, 11, 11, 11, 11, 24, 11, 20, 59, 61,
770 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
771 symbol of state STATE-NUM. */
772 static const yytype_uint8 yystos
[] =
774 0, 63, 0, 3, 4, 5, 6, 7, 8, 9,
775 12, 13, 14, 15, 16, 17, 18, 19, 26, 27,
776 64, 28, 37, 10, 24, 31, 32, 33, 34, 35,
777 36, 53, 54, 57, 58, 60, 74, 24, 24, 11,
778 74, 11, 28, 30, 32, 11, 32, 25, 28, 29,
779 65, 66, 65, 65, 65, 24, 67, 65, 24, 60,
780 74, 74, 74, 74, 74, 11, 38, 40, 41, 42,
781 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
782 53, 54, 55, 56, 11, 11, 11, 11, 11, 28,
783 28, 11, 25, 28, 29, 11, 11, 11, 11, 24,
784 68, 69, 70, 11, 24, 61, 74, 74, 74, 74,
785 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
786 74, 74, 74, 74, 11, 11, 32, 20, 59, 61,
787 39, 11, 32, 21, 23, 24, 25, 28, 29, 71,
788 72, 73, 22, 24, 74, 11, 32, 24, 11, 73,
792 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
793 static const yytype_uint8 yyr1
[] =
795 0, 62, 63, 63, 64, 64, 64, 64, 64, 64,
796 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
797 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
798 66, 66, 66, 66, 66, 66, 67, 68, 68, 69,
799 69, 70, 70, 71, 71, 72, 72, 73, 73, 73,
800 73, 73, 73, 74, 74, 74, 74, 74, 74, 74,
801 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
802 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
806 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
807 static const yytype_uint8 yyr2
[] =
809 0, 2, 0, 2, 3, 3, 3, 3, 3, 3,
810 2, 2, 3, 3, 6, 4, 4, 5, 6, 7,
811 8, 2, 3, 3, 3, 3, 2, 2, 0, 1,
812 1, 1, 1, 2, 2, 2, 0, 0, 1, 1,
813 3, 3, 1, 0, 1, 1, 2, 1, 1, 1,
814 1, 2, 1, 1, 1, 1, 1, 1, 1, 2,
815 4, 1, 3, 3, 3, 3, 3, 3, 3, 3,
816 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
821 #define yyerrok (yyerrstatus = 0)
822 #define yyclearin (yychar = YYEMPTY)
826 #define YYACCEPT goto yyacceptlab
827 #define YYABORT goto yyabortlab
828 #define YYERROR goto yyerrorlab
831 #define YYRECOVERING() (!!yyerrstatus)
833 #define YYBACKUP(Token, Value) \
835 if (yychar == YYEMPTY) \
839 YYPOPSTACK (yylen); \
845 yyerror (YY_("syntax error: cannot back up")); \
850 /* Error token number */
852 #define YYERRCODE 256
856 /* Enable debugging if requested. */
860 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
861 # define YYFPRINTF fprintf
864 # define YYDPRINTF(Args) \
870 /* This macro is provided for backward compatibility. */
871 #ifndef YY_LOCATION_PRINT
872 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
876 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
880 YYFPRINTF (stderr, "%s ", Title); \
881 yy_symbol_print (stderr, \
883 YYFPRINTF (stderr, "\n"); \
888 /*-----------------------------------.
889 | Print this symbol's value on YYO. |
890 `-----------------------------------*/
893 yy_symbol_value_print (FILE *yyo
, int yytype
, YYSTYPE
const * const yyvaluep
)
895 FILE *yyoutput
= yyo
;
900 if (yytype
< YYNTOKENS
)
901 YYPRINT (yyo
, yytoknum
[yytype
], *yyvaluep
);
907 /*---------------------------.
908 | Print this symbol on YYO. |
909 `---------------------------*/
912 yy_symbol_print (FILE *yyo
, int yytype
, YYSTYPE
const * const yyvaluep
)
914 YYFPRINTF (yyo
, "%s %s (",
915 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
917 yy_symbol_value_print (yyo
, yytype
, yyvaluep
);
918 YYFPRINTF (yyo
, ")");
921 /*------------------------------------------------------------------.
922 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
924 `------------------------------------------------------------------*/
927 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
929 YYFPRINTF (stderr
, "Stack now");
930 for (; yybottom
<= yytop
; yybottom
++)
932 int yybot
= *yybottom
;
933 YYFPRINTF (stderr
, " %d", yybot
);
935 YYFPRINTF (stderr
, "\n");
938 # define YY_STACK_PRINT(Bottom, Top) \
941 yy_stack_print ((Bottom), (Top)); \
945 /*------------------------------------------------.
946 | Report that the YYRULE is going to be reduced. |
947 `------------------------------------------------*/
950 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, int yyrule
)
952 unsigned long yylno
= yyrline
[yyrule
];
953 int yynrhs
= yyr2
[yyrule
];
955 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
957 /* The symbols being reduced. */
958 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
960 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
961 yy_symbol_print (stderr
,
962 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
963 &yyvsp
[(yyi
+ 1) - (yynrhs
)]
965 YYFPRINTF (stderr
, "\n");
969 # define YY_REDUCE_PRINT(Rule) \
972 yy_reduce_print (yyssp, yyvsp, Rule); \
975 /* Nonzero means print parse trace. It is left uninitialized so that
976 multiple parsers can coexist. */
979 # define YYDPRINTF(Args)
980 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
981 # define YY_STACK_PRINT(Bottom, Top)
982 # define YY_REDUCE_PRINT(Rule)
983 #endif /* !YYDEBUG */
986 /* YYINITDEPTH -- initial size of the parser's stacks. */
988 # define YYINITDEPTH 200
991 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
992 if the built-in stack extension method is used).
994 Do not make this value too large; the results are undefined if
995 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
996 evaluated with infinite-precision integer arithmetic. */
999 # define YYMAXDEPTH 10000
1006 # if defined __GLIBC__ && defined _STRING_H
1007 # define yystrlen strlen
1009 /* Return the length of YYSTR. */
1011 yystrlen (const char *yystr
)
1014 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1022 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1023 # define yystpcpy stpcpy
1025 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1028 yystpcpy (char *yydest
, const char *yysrc
)
1031 const char *yys
= yysrc
;
1033 while ((*yyd
++ = *yys
++) != '\0')
1042 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1043 quotes and backslashes, so that it's suitable for yyerror. The
1044 heuristic is that double-quoting is unnecessary unless the string
1045 contains an apostrophe, a comma, or backslash (other than
1046 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1047 null, do not copy; instead, return the length of what the result
1050 yytnamerr (char *yyres
, const char *yystr
)
1055 char const *yyp
= yystr
;
1062 goto do_not_strip_quotes
;
1066 goto do_not_strip_quotes
;
1082 do_not_strip_quotes
: ;
1086 return yystrlen (yystr
);
1088 return (YYSIZE_T
) (yystpcpy (yyres
, yystr
) - yyres
);
1092 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1093 about the unexpected token YYTOKEN for the state stack whose top is
1096 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1097 not large enough to hold the message. In that case, also set
1098 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1099 required number of bytes is too large to store. */
1101 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1102 yytype_int16
*yyssp
, int yytoken
)
1104 YYSIZE_T yysize0
= yytnamerr (YY_NULLPTR
, yytname
[yytoken
]);
1105 YYSIZE_T yysize
= yysize0
;
1106 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1107 /* Internationalized format string. */
1108 const char *yyformat
= YY_NULLPTR
;
1109 /* Arguments of yyformat. */
1110 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1111 /* Number of reported tokens (one for the "unexpected", one per
1115 /* There are many possibilities here to consider:
1116 - If this state is a consistent state with a default action, then
1117 the only way this function was invoked is if the default action
1118 is an error action. In that case, don't check for expected
1119 tokens because there are none.
1120 - The only way there can be no lookahead present (in yychar) is if
1121 this state is a consistent state with a default action. Thus,
1122 detecting the absence of a lookahead is sufficient to determine
1123 that there is no unexpected or expected token to report. In that
1124 case, just report a simple "syntax error".
1125 - Don't assume there isn't a lookahead just because this state is a
1126 consistent state with a default action. There might have been a
1127 previous inconsistent state, consistent state with a non-default
1128 action, or user semantic action that manipulated yychar.
1129 - Of course, the expected token list depends on states to have
1130 correct lookahead information, and it depends on the parser not
1131 to perform extra reductions after fetching a lookahead from the
1132 scanner and before detecting a syntax error. Thus, state merging
1133 (from LALR or IELR) and default reductions corrupt the expected
1134 token list. However, the list is correct for canonical LR with
1135 one exception: it will still contain any token that will not be
1136 accepted due to an error action in a later state.
1138 if (yytoken
!= YYEMPTY
)
1140 int yyn
= yypact
[*yyssp
];
1141 yyarg
[yycount
++] = yytname
[yytoken
];
1142 if (!yypact_value_is_default (yyn
))
1144 /* Start YYX at -YYN if negative to avoid negative indexes in
1145 YYCHECK. In other words, skip the first -YYN actions for
1146 this state because they are default actions. */
1147 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1148 /* Stay within bounds of both yycheck and yytname. */
1149 int yychecklim
= YYLAST
- yyn
+ 1;
1150 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1153 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1154 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1155 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1157 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1163 yyarg
[yycount
++] = yytname
[yyx
];
1165 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
1166 if (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
)
1177 # define YYCASE_(N, S) \
1181 default: /* Avoid compiler warnings. */
1182 YYCASE_(0, YY_("syntax error"));
1183 YYCASE_(1, YY_("syntax error, unexpected %s"));
1184 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1185 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1186 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1187 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1192 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1193 if (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
)
1199 if (*yymsg_alloc
< yysize
)
1201 *yymsg_alloc
= 2 * yysize
;
1202 if (! (yysize
<= *yymsg_alloc
1203 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1204 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1208 /* Avoid sprintf, as that infringes on the user's name space.
1209 Don't have undefined behavior even if the translation
1210 produced a string with the wrong number of "%s"s. */
1214 while ((*yyp
= *yyformat
) != '\0')
1215 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1217 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1228 #endif /* YYERROR_VERBOSE */
1230 /*-----------------------------------------------.
1231 | Release the memory associated to this symbol. |
1232 `-----------------------------------------------*/
1235 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1240 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1242 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1244 YY_IGNORE_MAYBE_UNINITIALIZED_END
1250 /* The lookahead symbol. */
1253 /* The semantic value of the lookahead symbol. */
1255 /* Number of syntax errors so far. */
1267 /* Number of tokens to shift before error messages enabled. */
1270 /* The stacks and their tools:
1271 'yyss': related to states.
1272 'yyvs': related to semantic values.
1274 Refer to the stacks through separate pointers, to allow yyoverflow
1275 to reallocate them elsewhere. */
1277 /* The state stack. */
1278 yytype_int16 yyssa
[YYINITDEPTH
];
1280 yytype_int16
*yyssp
;
1282 /* The semantic value stack. */
1283 YYSTYPE yyvsa
[YYINITDEPTH
];
1287 YYSIZE_T yystacksize
;
1291 /* Lookahead token as an internal (translated) token number. */
1293 /* The variables used to return semantic value and location from the
1298 /* Buffer for error messages, and its allocated size. */
1300 char *yymsg
= yymsgbuf
;
1301 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1304 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1306 /* The number of symbols on the RHS of the reduced rule.
1307 Keep to zero when no symbol should be popped. */
1310 yyssp
= yyss
= yyssa
;
1311 yyvsp
= yyvs
= yyvsa
;
1312 yystacksize
= YYINITDEPTH
;
1314 YYDPRINTF ((stderr
, "Starting parse\n"));
1319 yychar
= YYEMPTY
; /* Cause a token to be read. */
1323 /*------------------------------------------------------------.
1324 | yynewstate -- push a new state, which is found in yystate. |
1325 `------------------------------------------------------------*/
1327 /* In all cases, when you get here, the value and location stacks
1328 have just been pushed. So pushing a state here evens the stacks. */
1332 /*--------------------------------------------------------------------.
1333 | yynewstate -- set current state (the top of the stack) to yystate. |
1334 `--------------------------------------------------------------------*/
1336 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1337 YY_ASSERT (0 <= yystate
&& yystate
< YYNSTATES
);
1338 *yyssp
= (yytype_int16
) yystate
;
1340 if (yyss
+ yystacksize
- 1 <= yyssp
)
1341 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1342 goto yyexhaustedlab
;
1345 /* Get the current used size of the three stacks, in elements. */
1346 YYSIZE_T yysize
= (YYSIZE_T
) (yyssp
- yyss
+ 1);
1348 # if defined yyoverflow
1350 /* Give user a chance to reallocate the stack. Use copies of
1351 these so that the &'s don't force the real ones into
1353 YYSTYPE
*yyvs1
= yyvs
;
1354 yytype_int16
*yyss1
= yyss
;
1356 /* Each stack pointer address is followed by the size of the
1357 data in use in that stack, in bytes. This used to be a
1358 conditional around just the two extra args, but that might
1359 be undefined if yyoverflow is a macro. */
1360 yyoverflow (YY_("memory exhausted"),
1361 &yyss1
, yysize
* sizeof (*yyssp
),
1362 &yyvs1
, yysize
* sizeof (*yyvsp
),
1367 # else /* defined YYSTACK_RELOCATE */
1368 /* Extend the stack our own way. */
1369 if (YYMAXDEPTH
<= yystacksize
)
1370 goto yyexhaustedlab
;
1372 if (YYMAXDEPTH
< yystacksize
)
1373 yystacksize
= YYMAXDEPTH
;
1376 yytype_int16
*yyss1
= yyss
;
1377 union yyalloc
*yyptr
=
1378 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1380 goto yyexhaustedlab
;
1381 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1382 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1383 # undef YYSTACK_RELOCATE
1385 YYSTACK_FREE (yyss1
);
1389 yyssp
= yyss
+ yysize
- 1;
1390 yyvsp
= yyvs
+ yysize
- 1;
1392 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1393 (unsigned long) yystacksize
));
1395 if (yyss
+ yystacksize
- 1 <= yyssp
)
1398 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1400 if (yystate
== YYFINAL
)
1410 /* Do appropriate processing given the current state. Read a
1411 lookahead token if we need one and don't already have one. */
1413 /* First try to decide what to do without reference to lookahead token. */
1414 yyn
= yypact
[yystate
];
1415 if (yypact_value_is_default (yyn
))
1418 /* Not known => get a lookahead token if don't already have one. */
1420 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1421 if (yychar
== YYEMPTY
)
1423 YYDPRINTF ((stderr
, "Reading a token: "));
1427 if (yychar
<= YYEOF
)
1429 yychar
= yytoken
= YYEOF
;
1430 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1434 yytoken
= YYTRANSLATE (yychar
);
1435 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1438 /* If the proper action on seeing token YYTOKEN is to reduce or to
1439 detect an error, take that action. */
1441 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1446 if (yytable_value_is_error (yyn
))
1452 /* Count tokens shifted since error; after three, turn off error
1457 /* Shift the lookahead token. */
1458 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1460 /* Discard the shifted token. */
1464 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1466 YY_IGNORE_MAYBE_UNINITIALIZED_END
1470 /*-----------------------------------------------------------.
1471 | yydefault -- do the default action for the current state. |
1472 `-----------------------------------------------------------*/
1474 yyn
= yydefact
[yystate
];
1480 /*-----------------------------.
1481 | yyreduce -- do a reduction. |
1482 `-----------------------------*/
1484 /* yyn is the number of a rule to reduce with. */
1487 /* If YYLEN is nonzero, implement the default value of the action:
1490 Otherwise, the following line sets YYVAL to garbage.
1491 This behavior is undocumented and Bison
1492 users should not rely upon it. Assigning to YYVAL
1493 unconditionally makes the parser a bit smaller, and it avoids a
1494 GCC warning that YYVAL may be used uninitialized. */
1495 yyval
= yyvsp
[1-yylen
];
1498 YY_REDUCE_PRINT (yyn
);
1503 { pp_do_include((yyvsp
[-1].cptr
), 1); }
1504 #line 1505 "ppy.tab.c"
1509 { pp_do_include((yyvsp
[-1].cptr
), 0); }
1510 #line 1511 "ppy.tab.c"
1515 { pp_next_if_state(boolean(&(yyvsp
[-1].cval
))); }
1516 #line 1517 "ppy.tab.c"
1521 { pp_next_if_state(pplookup((yyvsp
[-1].cptr
)) != NULL
); free((yyvsp
[-1].cptr
)); }
1522 #line 1523 "ppy.tab.c"
1528 int t
= pplookup((yyvsp
[-1].cptr
)) == NULL
;
1529 if(pp_incl_state
.state
== 0 && t
&& !pp_incl_state
.seen_junk
)
1531 pp_incl_state
.state
= 1;
1532 pp_incl_state
.ppp
= (yyvsp
[-1].cptr
);
1533 pp_incl_state
.ifdepth
= pp_get_if_depth();
1535 else if(pp_incl_state
.state
!= 1)
1537 pp_incl_state
.state
= -1;
1538 free((yyvsp
[-1].cptr
));
1541 free((yyvsp
[-1].cptr
));
1542 pp_next_if_state(t
);
1544 #line 1545 "ppy.tab.c"
1550 pp_if_state_t s
= pp_pop_if();
1555 pp_push_if(if_elif
);
1558 pp_push_if(boolean(&(yyvsp
[-1].cval
)) ? if_true
: if_false
);
1561 pp_push_if(if_ignore
);
1565 ppy_error("#elif cannot follow #else");
1570 pp_internal_error(__FILE__
, __LINE__
, "Invalid pp_if_state (%d) in #elif directive", s
);
1573 #line 1574 "ppy.tab.c"
1579 pp_if_state_t s
= pp_pop_if();
1583 pp_push_if(if_elsefalse
);
1586 pp_push_if(if_elif
);
1589 pp_push_if(if_elsetrue
);
1592 pp_push_if(if_ignore
);
1596 ppy_error("#else clause already defined");
1601 pp_internal_error(__FILE__
, __LINE__
, "Invalid pp_if_state (%d) in #else directive", s
);
1604 #line 1605 "ppy.tab.c"
1610 if(pp_pop_if() != if_error
)
1612 if(pp_incl_state
.ifdepth
== pp_get_if_depth() && pp_incl_state
.state
== 1)
1614 pp_incl_state
.state
= 2;
1615 pp_incl_state
.seen_junk
= 0;
1617 else if(pp_incl_state
.state
!= 1)
1619 pp_incl_state
.state
= -1;
1623 #line 1624 "ppy.tab.c"
1628 { pp_del_define((yyvsp
[-1].cptr
)); free((yyvsp
[-1].cptr
)); }
1629 #line 1630 "ppy.tab.c"
1634 { pp_add_define((yyvsp
[-2].cptr
), (yyvsp
[-1].cptr
)); free((yyvsp
[-2].cptr
)); free((yyvsp
[-1].cptr
)); }
1635 #line 1636 "ppy.tab.c"
1641 pp_add_macro((yyvsp
[-5].cptr
), macro_args
, nmacro_args
, (yyvsp
[-1].mtext
));
1643 #line 1644 "ppy.tab.c"
1648 { if((yyvsp
[-1].cptr
)) pp_writestring("# %d %s\n", (yyvsp
[-2].sint
) , (yyvsp
[-1].cptr
)); free((yyvsp
[-1].cptr
)); }
1649 #line 1650 "ppy.tab.c"
1654 { if((yyvsp
[-1].cptr
)) pp_writestring("# %d %s\n", (yyvsp
[-2].sint
) , (yyvsp
[-1].cptr
)); free((yyvsp
[-1].cptr
)); }
1655 #line 1656 "ppy.tab.c"
1660 { if((yyvsp
[-2].cptr
)) pp_writestring("# %d %s %d\n", (yyvsp
[-3].sint
), (yyvsp
[-2].cptr
), (yyvsp
[-1].sint
)); free((yyvsp
[-2].cptr
)); }
1661 #line 1662 "ppy.tab.c"
1666 { if((yyvsp
[-3].cptr
)) pp_writestring("# %d %s %d %d\n", (yyvsp
[-4].sint
) ,(yyvsp
[-3].cptr
), (yyvsp
[-2].sint
), (yyvsp
[-1].sint
)); free((yyvsp
[-3].cptr
)); }
1667 #line 1668 "ppy.tab.c"
1672 { if((yyvsp
[-4].cptr
)) pp_writestring("# %d %s %d %d %d\n", (yyvsp
[-5].sint
) ,(yyvsp
[-4].cptr
) ,(yyvsp
[-3].sint
) ,(yyvsp
[-2].sint
), (yyvsp
[-1].sint
)); free((yyvsp
[-4].cptr
)); }
1673 #line 1674 "ppy.tab.c"
1678 { if((yyvsp
[-5].cptr
)) pp_writestring("# %d %s %d %d %d %d\n", (yyvsp
[-6].sint
) ,(yyvsp
[-5].cptr
) ,(yyvsp
[-4].sint
) ,(yyvsp
[-3].sint
), (yyvsp
[-2].sint
), (yyvsp
[-1].sint
)); free((yyvsp
[-5].cptr
)); }
1679 #line 1680 "ppy.tab.c"
1684 { ppy_error("#error directive: '%s'", (yyvsp
[-1].cptr
)); free((yyvsp
[-1].cptr
)); }
1685 #line 1686 "ppy.tab.c"
1690 { ppy_warning("#warning directive: '%s'", (yyvsp
[-1].cptr
)); free((yyvsp
[-1].cptr
)); }
1691 #line 1692 "ppy.tab.c"
1696 { pp_writestring("#pragma %s\n", (yyvsp
[-1].cptr
) ? (yyvsp
[-1].cptr
) : ""); free((yyvsp
[-1].cptr
)); }
1697 #line 1698 "ppy.tab.c"
1702 { if(pp_status
.pedantic
) ppy_warning("#ident ignored (arg: '%s')", (yyvsp
[-1].cptr
)); free((yyvsp
[-1].cptr
)); }
1703 #line 1704 "ppy.tab.c"
1711 int nl
=strlen((yyvsp
[0].cptr
)) +3;
1712 char *fn
=pp_xmalloc(nl
);
1715 sprintf(fn
,"\"%s\"",(yyvsp
[0].cptr
));
1716 pp_do_include(fn
,1);
1718 free((yyvsp
[0].cptr
));
1721 #line 1722 "ppy.tab.c"
1727 pp_do_include((yyvsp
[0].cptr
),1);
1729 #line 1730 "ppy.tab.c"
1734 { (yyval
.cptr
) = NULL
; }
1735 #line 1736 "ppy.tab.c"
1740 { (yyval
.cptr
) = (yyvsp
[0].cptr
); }
1741 #line 1742 "ppy.tab.c"
1746 { (yyval
.cptr
) = (yyvsp
[0].cptr
); }
1747 #line 1748 "ppy.tab.c"
1752 { (yyval
.cptr
) = (yyvsp
[0].cptr
); }
1753 #line 1754 "ppy.tab.c"
1758 { (yyval
.cptr
) = (yyvsp
[0].cptr
); }
1759 #line 1760 "ppy.tab.c"
1764 { (yyval
.cptr
) = merge_text((yyvsp
[-1].cptr
), (yyvsp
[0].cptr
)); }
1765 #line 1766 "ppy.tab.c"
1770 { (yyval
.cptr
) = merge_text((yyvsp
[-1].cptr
), (yyvsp
[0].cptr
)); }
1771 #line 1772 "ppy.tab.c"
1776 { (yyval
.cptr
) = merge_text((yyvsp
[-1].cptr
), (yyvsp
[0].cptr
)); }
1777 #line 1778 "ppy.tab.c"
1782 { macro_args
= NULL
; nmacro_args
= 0; }
1783 #line 1784 "ppy.tab.c"
1788 { (yyval
.sint
) = 0; macro_args
= NULL
; nmacro_args
= 0; }
1789 #line 1790 "ppy.tab.c"
1794 { (yyval
.sint
) = nmacro_args
; }
1795 #line 1796 "ppy.tab.c"
1800 { (yyval
.marg
) = (yyvsp
[0].marg
); }
1801 #line 1802 "ppy.tab.c"
1806 { (yyval
.marg
) = add_new_marg(NULL
, arg_list
); nmacro_args
*= -1; }
1807 #line 1808 "ppy.tab.c"
1812 { (yyval
.marg
) = add_new_marg((yyvsp
[0].cptr
), arg_single
); }
1813 #line 1814 "ppy.tab.c"
1818 { (yyval
.marg
) = add_new_marg((yyvsp
[0].cptr
), arg_single
); }
1819 #line 1820 "ppy.tab.c"
1824 { (yyval
.mtext
) = NULL
; }
1825 #line 1826 "ppy.tab.c"
1831 for((yyval
.mtext
) = (yyvsp
[0].mtext
); (yyval
.mtext
) && (yyval
.mtext
)->prev
; (yyval
.mtext
) = (yyval
.mtext
)->prev
)
1834 #line 1835 "ppy.tab.c"
1839 { (yyval
.mtext
) = (yyvsp
[0].mtext
); }
1840 #line 1841 "ppy.tab.c"
1845 { (yyval
.mtext
) = combine_mtext((yyvsp
[-1].mtext
), (yyvsp
[0].mtext
)); }
1846 #line 1847 "ppy.tab.c"
1851 { (yyval
.mtext
) = new_mtext((yyvsp
[0].cptr
), 0, exp_text
); }
1852 #line 1853 "ppy.tab.c"
1857 { (yyval
.mtext
) = new_mtext((yyvsp
[0].cptr
), 0, exp_text
); }
1858 #line 1859 "ppy.tab.c"
1863 { (yyval
.mtext
) = new_mtext((yyvsp
[0].cptr
), 0, exp_text
); }
1864 #line 1865 "ppy.tab.c"
1869 { (yyval
.mtext
) = new_mtext(NULL
, 0, exp_concat
); }
1870 #line 1871 "ppy.tab.c"
1876 int mat
= marg_index((yyvsp
[0].cptr
));
1878 ppy_error("Stringification identifier must be an argument parameter");
1880 (yyval
.mtext
) = new_mtext(NULL
, mat
, exp_stringize
);
1882 #line 1883 "ppy.tab.c"
1888 int mat
= marg_index((yyvsp
[0].cptr
));
1890 (yyval
.mtext
) = new_mtext(NULL
, mat
, exp_subst
);
1891 else if((yyvsp
[0].cptr
))
1892 (yyval
.mtext
) = new_mtext((yyvsp
[0].cptr
), 0, exp_text
);
1894 #line 1895 "ppy.tab.c"
1899 { (yyval
.cval
).type
= cv_sint
; (yyval
.cval
).val
.si
= (yyvsp
[0].sint
); }
1900 #line 1901 "ppy.tab.c"
1905 { (yyval
.cval
).type
= cv_uint
; (yyval
.cval
).val
.ui
= (yyvsp
[0].uint
); }
1906 #line 1907 "ppy.tab.c"
1911 { (yyval
.cval
).type
= cv_slong
; (yyval
.cval
).val
.sl
= (yyvsp
[0].slong
); }
1912 #line 1913 "ppy.tab.c"
1917 { (yyval
.cval
).type
= cv_ulong
; (yyval
.cval
).val
.ul
= (yyvsp
[0].ulong
); }
1918 #line 1919 "ppy.tab.c"
1923 { (yyval
.cval
).type
= cv_sll
; (yyval
.cval
).val
.sll
= (yyvsp
[0].sll
); }
1924 #line 1925 "ppy.tab.c"
1929 { (yyval
.cval
).type
= cv_ull
; (yyval
.cval
).val
.ull
= (yyvsp
[0].ull
); }
1930 #line 1931 "ppy.tab.c"
1935 { (yyval
.cval
).type
= cv_sint
; (yyval
.cval
).val
.si
= pplookup((yyvsp
[0].cptr
)) != NULL
; }
1936 #line 1937 "ppy.tab.c"
1941 { (yyval
.cval
).type
= cv_sint
; (yyval
.cval
).val
.si
= pplookup((yyvsp
[-1].cptr
)) != NULL
; }
1942 #line 1943 "ppy.tab.c"
1947 { (yyval
.cval
).type
= cv_sint
; (yyval
.cval
).val
.si
= 0; }
1948 #line 1949 "ppy.tab.c"
1953 { (yyval
.cval
).type
= cv_sint
; (yyval
.cval
).val
.si
= boolean(&(yyvsp
[-2].cval
)) || boolean(&(yyvsp
[0].cval
)); }
1954 #line 1955 "ppy.tab.c"
1959 { (yyval
.cval
).type
= cv_sint
; (yyval
.cval
).val
.si
= boolean(&(yyvsp
[-2].cval
)) && boolean(&(yyvsp
[0].cval
)); }
1960 #line 1961 "ppy.tab.c"
1965 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), ==); }
1966 #line 1967 "ppy.tab.c"
1971 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), !=); }
1972 #line 1973 "ppy.tab.c"
1977 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), <); }
1978 #line 1979 "ppy.tab.c"
1983 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), >); }
1984 #line 1985 "ppy.tab.c"
1989 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), <=); }
1990 #line 1991 "ppy.tab.c"
1995 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), >=); }
1996 #line 1997 "ppy.tab.c"
2001 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), +); }
2002 #line 2003 "ppy.tab.c"
2007 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), -); }
2008 #line 2009 "ppy.tab.c"
2013 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), ^); }
2014 #line 2015 "ppy.tab.c"
2019 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), &); }
2020 #line 2021 "ppy.tab.c"
2025 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), |); }
2026 #line 2027 "ppy.tab.c"
2031 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), *); }
2032 #line 2033 "ppy.tab.c"
2037 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), /); }
2038 #line 2039 "ppy.tab.c"
2043 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), <<); }
2044 #line 2045 "ppy.tab.c"
2049 { promote_equal_size(&(yyvsp
[-2].cval
), &(yyvsp
[0].cval
)); BIN_OP((yyval
.cval
), (yyvsp
[-2].cval
), (yyvsp
[0].cval
), >>); }
2050 #line 2051 "ppy.tab.c"
2055 { (yyval
.cval
) = (yyvsp
[0].cval
); }
2056 #line 2057 "ppy.tab.c"
2061 { UNARY_OP((yyval
.cval
), (yyvsp
[0].cval
), -); }
2062 #line 2063 "ppy.tab.c"
2067 { UNARY_OP((yyval
.cval
), (yyvsp
[0].cval
), ~); }
2068 #line 2069 "ppy.tab.c"
2073 { (yyval
.cval
).type
= cv_sint
; (yyval
.cval
).val
.si
= !boolean(&(yyvsp
[0].cval
)); }
2074 #line 2075 "ppy.tab.c"
2079 { (yyval
.cval
) = (yyvsp
[-1].cval
); }
2080 #line 2081 "ppy.tab.c"
2085 { (yyval
.cval
) = boolean(&(yyvsp
[-4].cval
)) ? (yyvsp
[-2].cval
) : (yyvsp
[0].cval
); }
2086 #line 2087 "ppy.tab.c"
2090 #line 2091 "ppy.tab.c"
2094 /* User semantic actions sometimes alter yychar, and that requires
2095 that yytoken be updated with the new translation. We take the
2096 approach of translating immediately before every use of yytoken.
2097 One alternative is translating here after every semantic action,
2098 but that translation would be missed if the semantic action invokes
2099 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2100 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2101 incorrect destructor might then be invoked immediately. In the
2102 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2103 to an incorrect destructor call or verbose syntax error message
2104 before the lookahead is translated. */
2105 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2109 YY_STACK_PRINT (yyss
, yyssp
);
2113 /* Now 'shift' the result of the reduction. Determine what state
2114 that goes to, based on the state we popped back to and the rule
2115 number reduced by. */
2117 const int yylhs
= yyr1
[yyn
] - YYNTOKENS
;
2118 const int yyi
= yypgoto
[yylhs
] + *yyssp
;
2119 yystate
= (0 <= yyi
&& yyi
<= YYLAST
&& yycheck
[yyi
] == *yyssp
2121 : yydefgoto
[yylhs
]);
2127 /*--------------------------------------.
2128 | yyerrlab -- here on detecting error. |
2129 `--------------------------------------*/
2131 /* Make sure we have latest lookahead translation. See comments at
2132 user semantic actions for why this is necessary. */
2133 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2135 /* If not already recovering from an error, report this error. */
2139 #if ! YYERROR_VERBOSE
2140 yyerror (YY_("syntax error"));
2142 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2145 char const *yymsgp
= YY_("syntax error");
2146 int yysyntax_error_status
;
2147 yysyntax_error_status
= YYSYNTAX_ERROR
;
2148 if (yysyntax_error_status
== 0)
2150 else if (yysyntax_error_status
== 1)
2152 if (yymsg
!= yymsgbuf
)
2153 YYSTACK_FREE (yymsg
);
2154 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2158 yymsg_alloc
= sizeof yymsgbuf
;
2159 yysyntax_error_status
= 2;
2163 yysyntax_error_status
= YYSYNTAX_ERROR
;
2168 if (yysyntax_error_status
== 2)
2169 goto yyexhaustedlab
;
2171 # undef YYSYNTAX_ERROR
2177 if (yyerrstatus
== 3)
2179 /* If just tried and failed to reuse lookahead token after an
2180 error, discard it. */
2182 if (yychar
<= YYEOF
)
2184 /* Return failure if at end of input. */
2185 if (yychar
== YYEOF
)
2190 yydestruct ("Error: discarding",
2196 /* Else will try to reuse lookahead token after shifting the error
2201 /*---------------------------------------------------.
2202 | yyerrorlab -- error raised explicitly by YYERROR. |
2203 `---------------------------------------------------*/
2205 /* Pacify compilers when the user code never invokes YYERROR and the
2206 label yyerrorlab therefore never appears in user code. */
2210 /* Do not reclaim the symbols of the rule whose action triggered
2214 YY_STACK_PRINT (yyss
, yyssp
);
2219 /*-------------------------------------------------------------.
2220 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2221 `-------------------------------------------------------------*/
2223 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2227 yyn
= yypact
[yystate
];
2228 if (!yypact_value_is_default (yyn
))
2231 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2239 /* Pop the current state because it cannot handle the error token. */
2244 yydestruct ("Error: popping",
2245 yystos
[yystate
], yyvsp
);
2248 YY_STACK_PRINT (yyss
, yyssp
);
2251 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2253 YY_IGNORE_MAYBE_UNINITIALIZED_END
2256 /* Shift the error token. */
2257 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2263 /*-------------------------------------.
2264 | yyacceptlab -- YYACCEPT comes here. |
2265 `-------------------------------------*/
2271 /*-----------------------------------.
2272 | yyabortlab -- YYABORT comes here. |
2273 `-----------------------------------*/
2279 #if !defined yyoverflow || YYERROR_VERBOSE
2280 /*-------------------------------------------------.
2281 | yyexhaustedlab -- memory exhaustion comes here. |
2282 `-------------------------------------------------*/
2284 yyerror (YY_("memory exhausted"));
2290 /*-----------------------------------------------------.
2291 | yyreturn -- parsing is finished, return the result. |
2292 `-----------------------------------------------------*/
2294 if (yychar
!= YYEMPTY
)
2296 /* Make sure we have latest lookahead translation. See comments at
2297 user semantic actions for why this is necessary. */
2298 yytoken
= YYTRANSLATE (yychar
);
2299 yydestruct ("Cleanup: discarding lookahead",
2302 /* Do not reclaim the symbols of the rule whose action triggered
2303 this YYABORT or YYACCEPT. */
2305 YY_STACK_PRINT (yyss
, yyssp
);
2306 while (yyssp
!= yyss
)
2308 yydestruct ("Cleanup: popping",
2309 yystos
[*yyssp
], yyvsp
);
2314 YYSTACK_FREE (yyss
);
2317 if (yymsg
!= yymsgbuf
)
2318 YYSTACK_FREE (yymsg
);
2326 **************************************************************************
2328 **************************************************************************
2331 static void cast_to_sint(cval_t
*v
)
2335 case cv_sint
: break;
2336 case cv_uint
: break;
2337 case cv_slong
: v
->val
.si
= v
->val
.sl
; break;
2338 case cv_ulong
: v
->val
.si
= v
->val
.ul
; break;
2339 case cv_sll
: v
->val
.si
= v
->val
.sll
; break;
2340 case cv_ull
: v
->val
.si
= v
->val
.ull
; break;
2345 static void cast_to_uint(cval_t
*v
)
2349 case cv_sint
: break;
2350 case cv_uint
: break;
2351 case cv_slong
: v
->val
.ui
= v
->val
.sl
; break;
2352 case cv_ulong
: v
->val
.ui
= v
->val
.ul
; break;
2353 case cv_sll
: v
->val
.ui
= v
->val
.sll
; break;
2354 case cv_ull
: v
->val
.ui
= v
->val
.ull
; break;
2359 static void cast_to_slong(cval_t
*v
)
2363 case cv_sint
: v
->val
.sl
= v
->val
.si
; break;
2364 case cv_uint
: v
->val
.sl
= v
->val
.ui
; break;
2365 case cv_slong
: break;
2366 case cv_ulong
: break;
2367 case cv_sll
: v
->val
.sl
= v
->val
.sll
; break;
2368 case cv_ull
: v
->val
.sl
= v
->val
.ull
; break;
2373 static void cast_to_ulong(cval_t
*v
)
2377 case cv_sint
: v
->val
.ul
= v
->val
.si
; break;
2378 case cv_uint
: v
->val
.ul
= v
->val
.ui
; break;
2379 case cv_slong
: break;
2380 case cv_ulong
: break;
2381 case cv_sll
: v
->val
.ul
= v
->val
.sll
; break;
2382 case cv_ull
: v
->val
.ul
= v
->val
.ull
; break;
2387 static void cast_to_sll(cval_t
*v
)
2391 case cv_sint
: v
->val
.sll
= v
->val
.si
; break;
2392 case cv_uint
: v
->val
.sll
= v
->val
.ui
; break;
2393 case cv_slong
: v
->val
.sll
= v
->val
.sl
; break;
2394 case cv_ulong
: v
->val
.sll
= v
->val
.ul
; break;
2401 static void cast_to_ull(cval_t
*v
)
2405 case cv_sint
: v
->val
.ull
= v
->val
.si
; break;
2406 case cv_uint
: v
->val
.ull
= v
->val
.ui
; break;
2407 case cv_slong
: v
->val
.ull
= v
->val
.sl
; break;
2408 case cv_ulong
: v
->val
.ull
= v
->val
.ul
; break;
2416 static void promote_equal_size(cval_t
*v1
, cval_t
*v2
)
2418 #define cv_sizeof(v) ((int)(v->type & SIZE_MASK))
2419 int s1
= cv_sizeof(v1
);
2420 int s2
= cv_sizeof(v2
);
2429 case cv_sint
: cast_to_sint(v2
); break;
2430 case cv_uint
: cast_to_uint(v2
); break;
2431 case cv_slong
: cast_to_slong(v2
); break;
2432 case cv_ulong
: cast_to_ulong(v2
); break;
2433 case cv_sll
: cast_to_sll(v2
); break;
2434 case cv_ull
: cast_to_ull(v2
); break;
2441 case cv_sint
: cast_to_sint(v1
); break;
2442 case cv_uint
: cast_to_uint(v1
); break;
2443 case cv_slong
: cast_to_slong(v1
); break;
2444 case cv_ulong
: cast_to_ulong(v1
); break;
2445 case cv_sll
: cast_to_sll(v1
); break;
2446 case cv_ull
: cast_to_ull(v1
); break;
2452 static int boolean(cval_t
*v
)
2456 case cv_sint
: return v
->val
.si
!= 0;
2457 case cv_uint
: return v
->val
.ui
!= 0;
2458 case cv_slong
: return v
->val
.sl
!= 0;
2459 case cv_ulong
: return v
->val
.ul
!= 0;
2460 case cv_sll
: return v
->val
.sll
!= 0;
2461 case cv_ull
: return v
->val
.ull
!= 0;
2466 static marg_t
*new_marg(char *str
, def_arg_t type
)
2468 marg_t
*ma
= pp_xmalloc(sizeof(marg_t
));
2477 static marg_t
*add_new_marg(char *str
, def_arg_t type
)
2479 marg_t
**new_macro_args
;
2483 new_macro_args
= pp_xrealloc(macro_args
, (nmacro_args
+1) * sizeof(macro_args
[0]));
2486 macro_args
= new_macro_args
;
2487 ma
= new_marg(str
, type
);
2490 macro_args
[nmacro_args
] = ma
;
2495 static int marg_index(char *id
)
2500 for(t
= 0; t
< nmacro_args
; t
++)
2502 if(!strcmp(id
, macro_args
[t
]->arg
))
2505 return t
< nmacro_args
? t
: -1;
2508 static mtext_t
*new_mtext(char *str
, int idx
, def_exp_t type
)
2510 mtext_t
*mt
= pp_xmalloc(sizeof(mtext_t
));
2514 mt
->subst
.argidx
= idx
;
2516 mt
->subst
.text
= str
;
2518 mt
->next
= mt
->prev
= NULL
;
2522 static mtext_t
*combine_mtext(mtext_t
*tail
, mtext_t
*mtp
)
2530 if(tail
->type
== exp_text
&& mtp
->type
== exp_text
)
2533 new_text
= pp_xrealloc(tail
->subst
.text
, strlen(tail
->subst
.text
)+strlen(mtp
->subst
.text
)+1);
2536 tail
->subst
.text
= new_text
;
2537 strcat(tail
->subst
.text
, mtp
->subst
.text
);
2538 free(mtp
->subst
.text
);
2543 if(tail
->type
== exp_concat
&& mtp
->type
== exp_concat
)
2549 if(tail
->type
== exp_concat
&& mtp
->type
== exp_text
)
2551 int len
= strlen(mtp
->subst
.text
);
2554 /* FIXME: should delete space from head of string */
2555 if(isspace(mtp
->subst
.text
[len
-1] & 0xff))
2556 mtp
->subst
.text
[--len
] = '\0';
2563 free(mtp
->subst
.text
);
2569 if(tail
->type
== exp_text
&& mtp
->type
== exp_concat
)
2571 int len
= strlen(tail
->subst
.text
);
2574 if(isspace(tail
->subst
.text
[len
-1] & 0xff))
2575 tail
->subst
.text
[--len
] = '\0';
2582 mtp
->prev
= tail
->prev
;
2583 mtp
->next
= tail
->next
;
2585 tail
->prev
->next
= mtp
;
2586 free(tail
->subst
.text
);
2598 static char *merge_text(char *s1
, char *s2
)
2609 snew
= pp_xrealloc(s1
, l1
+l2
+1);
2616 memcpy(s1
+l1
, s2
, l2
+1);