CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / LexerParser / cmExprParser.cxx
blob80c0abdc40ff04ed186c3c6f4bbaf543182ef7f2
1 /* A Bison parser, made by GNU Bison 3.8.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 Inc.
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 <https://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 /* 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. */
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. */
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30802
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
57 /* Pure parsers. */
58 #define YYPURE 1
60 /* Push parsers. */
61 #define YYPUSH 0
63 /* Pull parsers. */
64 #define YYPULL 1
67 /* Substitute the variable and function names. */
68 #define yyparse cmExpr_yyparse
69 #define yylex cmExpr_yylex
70 #define yyerror cmExpr_yyerror
71 #define yydebug cmExpr_yydebug
72 #define yynerrs cmExpr_yynerrs
74 /* First part of user prologue. */
75 #line 1 "cmExprParser.y"
77 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
78 file Copyright.txt or https://cmake.org/licensing for details. */
81 This file must be translated to C and modified to build everywhere.
83 Run bison like this:
85 bison --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h -ocmExprParser.cxx cmExprParser.y
89 #include "cmConfigure.h" // IWYU pragma: keep
91 #include <stdlib.h>
92 #include <string.h>
93 #include <stdexcept>
95 /*-------------------------------------------------------------------------*/
96 #define YYDEBUG 1
97 #include "cmExprParserHelper.h" /* Interface to parser object. */
98 #include "cmExprLexer.h" /* Interface to lexer object. */
99 #include "cmExprParserTokens.h" /* Need YYSTYPE for YY_DECL. */
101 /* Forward declare the lexer entry point. */
102 YY_DECL;
104 /* Helper function to forward error callback from parser. */
105 static void cmExpr_yyerror(yyscan_t yyscanner, const char* message);
107 /* Disable some warnings in the generated code. */
108 #ifdef _MSC_VER
109 # pragma warning (disable: 4102) /* Unused goto label. */
110 # pragma warning (disable: 4065) /* Switch statement contains default but no case. */
111 #endif
112 #if defined(__GNUC__) && __GNUC__ >= 8
113 # pragma GCC diagnostic ignored "-Wconversion"
114 # pragma GCC diagnostic ignored "-Wfree-nonheap-object"
115 #endif
116 #if defined(__clang__) && defined(__has_warning)
117 # if __has_warning("-Wunused-but-set-variable")
118 # pragma clang diagnostic ignored "-Wunused-but-set-variable"
119 # endif
120 # if __has_warning("-Wused-but-marked-unused")
121 # pragma clang diagnostic ignored "-Wused-but-marked-unused"
122 # endif
123 #endif
125 #if defined(__NVCOMPILER)
126 # pragma diag_suppress 550 /* variable set but never used */
127 #endif
129 #line 130 "cmExprParser.cxx"
131 # ifndef YY_CAST
132 # ifdef __cplusplus
133 # define YY_CAST(Type, Val) static_cast<Type> (Val)
134 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
135 # else
136 # define YY_CAST(Type, Val) ((Type) (Val))
137 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
138 # endif
139 # endif
140 # ifndef YY_NULLPTR
141 # if defined __cplusplus
142 # if 201103L <= __cplusplus
143 # define YY_NULLPTR nullptr
144 # else
145 # define YY_NULLPTR 0
146 # endif
147 # else
148 # define YY_NULLPTR ((void*)0)
149 # endif
150 # endif
152 #include "cmExprParserTokens.h"
153 /* Symbol kind. */
154 enum yysymbol_kind_t
156 YYSYMBOL_YYEMPTY = -2,
157 YYSYMBOL_YYEOF = 0, /* "end of file" */
158 YYSYMBOL_YYerror = 1, /* error */
159 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
160 YYSYMBOL_exp_PLUS = 3, /* exp_PLUS */
161 YYSYMBOL_exp_MINUS = 4, /* exp_MINUS */
162 YYSYMBOL_exp_TIMES = 5, /* exp_TIMES */
163 YYSYMBOL_exp_DIVIDE = 6, /* exp_DIVIDE */
164 YYSYMBOL_exp_MOD = 7, /* exp_MOD */
165 YYSYMBOL_exp_SHIFTLEFT = 8, /* exp_SHIFTLEFT */
166 YYSYMBOL_exp_SHIFTRIGHT = 9, /* exp_SHIFTRIGHT */
167 YYSYMBOL_exp_OPENPARENT = 10, /* exp_OPENPARENT */
168 YYSYMBOL_exp_CLOSEPARENT = 11, /* exp_CLOSEPARENT */
169 YYSYMBOL_exp_OR = 12, /* exp_OR */
170 YYSYMBOL_exp_AND = 13, /* exp_AND */
171 YYSYMBOL_exp_XOR = 14, /* exp_XOR */
172 YYSYMBOL_exp_NOT = 15, /* exp_NOT */
173 YYSYMBOL_exp_NUMBER = 16, /* exp_NUMBER */
174 YYSYMBOL_YYACCEPT = 17, /* $accept */
175 YYSYMBOL_start = 18, /* start */
176 YYSYMBOL_exp = 19, /* exp */
177 YYSYMBOL_bitwiseor = 20, /* bitwiseor */
178 YYSYMBOL_bitwisexor = 21, /* bitwisexor */
179 YYSYMBOL_bitwiseand = 22, /* bitwiseand */
180 YYSYMBOL_shift = 23, /* shift */
181 YYSYMBOL_term = 24, /* term */
182 YYSYMBOL_unary = 25, /* unary */
183 YYSYMBOL_factor = 26 /* factor */
185 typedef enum yysymbol_kind_t yysymbol_kind_t;
190 #ifdef short
191 # undef short
192 #endif
194 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
195 <limits.h> and (if available) <stdint.h> are included
196 so that the code can choose integer types of a good width. */
198 #ifndef __PTRDIFF_MAX__
199 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
200 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
201 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
202 # define YY_STDINT_H
203 # endif
204 #endif
206 /* Narrow types that promote to a signed type and that can represent a
207 signed or unsigned integer of at least N bits. In tables they can
208 save space and decrease cache pressure. Promoting to a signed type
209 helps avoid bugs in integer arithmetic. */
211 #ifdef __INT_LEAST8_MAX__
212 typedef __INT_LEAST8_TYPE__ yytype_int8;
213 #elif defined YY_STDINT_H
214 typedef int_least8_t yytype_int8;
215 #else
216 typedef signed char yytype_int8;
217 #endif
219 #ifdef __INT_LEAST16_MAX__
220 typedef __INT_LEAST16_TYPE__ yytype_int16;
221 #elif defined YY_STDINT_H
222 typedef int_least16_t yytype_int16;
223 #else
224 typedef short yytype_int16;
225 #endif
227 /* Work around bug in HP-UX 11.23, which defines these macros
228 incorrectly for preprocessor constants. This workaround can likely
229 be removed in 2023, as HPE has promised support for HP-UX 11.23
230 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
231 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
232 #ifdef __hpux
233 # undef UINT_LEAST8_MAX
234 # undef UINT_LEAST16_MAX
235 # define UINT_LEAST8_MAX 255
236 # define UINT_LEAST16_MAX 65535
237 #endif
239 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
240 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
241 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
242 && UINT_LEAST8_MAX <= INT_MAX)
243 typedef uint_least8_t yytype_uint8;
244 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
245 typedef unsigned char yytype_uint8;
246 #else
247 typedef short yytype_uint8;
248 #endif
250 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
251 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
252 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
253 && UINT_LEAST16_MAX <= INT_MAX)
254 typedef uint_least16_t yytype_uint16;
255 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
256 typedef unsigned short yytype_uint16;
257 #else
258 typedef int yytype_uint16;
259 #endif
261 #ifndef YYPTRDIFF_T
262 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
263 # define YYPTRDIFF_T __PTRDIFF_TYPE__
264 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
265 # elif defined PTRDIFF_MAX
266 # ifndef ptrdiff_t
267 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
268 # endif
269 # define YYPTRDIFF_T ptrdiff_t
270 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
271 # else
272 # define YYPTRDIFF_T long
273 # define YYPTRDIFF_MAXIMUM LONG_MAX
274 # endif
275 #endif
277 #ifndef YYSIZE_T
278 # ifdef __SIZE_TYPE__
279 # define YYSIZE_T __SIZE_TYPE__
280 # elif defined size_t
281 # define YYSIZE_T size_t
282 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
283 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
284 # define YYSIZE_T size_t
285 # else
286 # define YYSIZE_T unsigned
287 # endif
288 #endif
290 #define YYSIZE_MAXIMUM \
291 YY_CAST (YYPTRDIFF_T, \
292 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
293 ? YYPTRDIFF_MAXIMUM \
294 : YY_CAST (YYSIZE_T, -1)))
296 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
299 /* Stored state numbers (used for stacks). */
300 typedef yytype_int8 yy_state_t;
302 /* State numbers in computations. */
303 typedef int yy_state_fast_t;
305 #ifndef YY_
306 # if defined YYENABLE_NLS && YYENABLE_NLS
307 # if ENABLE_NLS
308 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
309 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
310 # endif
311 # endif
312 # ifndef YY_
313 # define YY_(Msgid) Msgid
314 # endif
315 #endif
318 #ifndef YY_ATTRIBUTE_PURE
319 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
320 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
321 # else
322 # define YY_ATTRIBUTE_PURE
323 # endif
324 #endif
326 #ifndef YY_ATTRIBUTE_UNUSED
327 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
328 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
329 # else
330 # define YY_ATTRIBUTE_UNUSED
331 # endif
332 #endif
334 /* Suppress unused-variable warnings by "using" E. */
335 #if ! defined lint || defined __GNUC__
336 # define YY_USE(E) ((void) (E))
337 #else
338 # define YY_USE(E) /* empty */
339 #endif
341 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
342 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
343 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
344 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
345 _Pragma ("GCC diagnostic push") \
346 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
347 # else
348 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
349 _Pragma ("GCC diagnostic push") \
350 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
351 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
352 # endif
353 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
354 _Pragma ("GCC diagnostic pop")
355 #else
356 # define YY_INITIAL_VALUE(Value) Value
357 #endif
358 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
359 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
360 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
361 #endif
362 #ifndef YY_INITIAL_VALUE
363 # define YY_INITIAL_VALUE(Value) /* Nothing. */
364 #endif
366 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
367 # define YY_IGNORE_USELESS_CAST_BEGIN \
368 _Pragma ("GCC diagnostic push") \
369 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
370 # define YY_IGNORE_USELESS_CAST_END \
371 _Pragma ("GCC diagnostic pop")
372 #endif
373 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
374 # define YY_IGNORE_USELESS_CAST_BEGIN
375 # define YY_IGNORE_USELESS_CAST_END
376 #endif
379 #define YY_ASSERT(E) ((void) (0 && (E)))
381 #if 1
383 /* The parser invokes alloca or malloc; define the necessary symbols. */
385 # ifdef YYSTACK_USE_ALLOCA
386 # if YYSTACK_USE_ALLOCA
387 # ifdef __GNUC__
388 # define YYSTACK_ALLOC __builtin_alloca
389 # elif defined __BUILTIN_VA_ARG_INCR
390 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
391 # elif defined _AIX
392 # define YYSTACK_ALLOC __alloca
393 # elif defined _MSC_VER
394 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
395 # define alloca _alloca
396 # else
397 # define YYSTACK_ALLOC alloca
398 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
399 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
400 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
401 # ifndef EXIT_SUCCESS
402 # define EXIT_SUCCESS 0
403 # endif
404 # endif
405 # endif
406 # endif
407 # endif
409 # ifdef YYSTACK_ALLOC
410 /* Pacify GCC's 'empty if-body' warning. */
411 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
412 # ifndef YYSTACK_ALLOC_MAXIMUM
413 /* The OS might guarantee only one guard page at the bottom of the stack,
414 and a page size can be as small as 4096 bytes. So we cannot safely
415 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
416 to allow for a few compiler-allocated temporary stack slots. */
417 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
418 # endif
419 # else
420 # define YYSTACK_ALLOC YYMALLOC
421 # define YYSTACK_FREE YYFREE
422 # ifndef YYSTACK_ALLOC_MAXIMUM
423 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
424 # endif
425 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
426 && ! ((defined YYMALLOC || defined malloc) \
427 && (defined YYFREE || defined free)))
428 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
429 # ifndef EXIT_SUCCESS
430 # define EXIT_SUCCESS 0
431 # endif
432 # endif
433 # ifndef YYMALLOC
434 # define YYMALLOC malloc
435 # if ! defined malloc && ! defined EXIT_SUCCESS
436 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
437 # endif
438 # endif
439 # ifndef YYFREE
440 # define YYFREE free
441 # if ! defined free && ! defined EXIT_SUCCESS
442 void free (void *); /* INFRINGES ON USER NAME SPACE */
443 # endif
444 # endif
445 # endif
446 #endif /* 1 */
448 #if (! defined yyoverflow \
449 && (! defined __cplusplus \
450 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
452 /* A type that is properly aligned for any stack member. */
453 union yyalloc
455 yy_state_t yyss_alloc;
456 YYSTYPE yyvs_alloc;
459 /* The size of the maximum gap between one aligned stack and the next. */
460 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
462 /* The size of an array large to enough to hold all stacks, each with
463 N elements. */
464 # define YYSTACK_BYTES(N) \
465 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
466 + YYSTACK_GAP_MAXIMUM)
468 # define YYCOPY_NEEDED 1
470 /* Relocate STACK from its old location to the new one. The
471 local variables YYSIZE and YYSTACKSIZE give the old and new number of
472 elements in the stack, and YYPTR gives the new location of the
473 stack. Advance YYPTR to a properly aligned location for the next
474 stack. */
475 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
476 do \
478 YYPTRDIFF_T yynewbytes; \
479 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
480 Stack = &yyptr->Stack_alloc; \
481 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
482 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
484 while (0)
486 #endif
488 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
489 /* Copy COUNT objects from SRC to DST. The source and destination do
490 not overlap. */
491 # ifndef YYCOPY
492 # if defined __GNUC__ && 1 < __GNUC__
493 # define YYCOPY(Dst, Src, Count) \
494 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
495 # else
496 # define YYCOPY(Dst, Src, Count) \
497 do \
499 YYPTRDIFF_T yyi; \
500 for (yyi = 0; yyi < (Count); yyi++) \
501 (Dst)[yyi] = (Src)[yyi]; \
503 while (0)
504 # endif
505 # endif
506 #endif /* !YYCOPY_NEEDED */
508 /* YYFINAL -- State number of the termination state. */
509 #define YYFINAL 19
510 /* YYLAST -- Last index in YYTABLE. */
511 #define YYLAST 34
513 /* YYNTOKENS -- Number of terminals. */
514 #define YYNTOKENS 17
515 /* YYNNTS -- Number of nonterminals. */
516 #define YYNNTS 10
517 /* YYNRULES -- Number of rules. */
518 #define YYNRULES 24
519 /* YYNSTATES -- Number of states. */
520 #define YYNSTATES 41
522 /* YYMAXUTOK -- Last valid token kind. */
523 #define YYMAXUTOK 271
526 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
527 as returned by yylex, with out-of-bounds checking. */
528 #define YYTRANSLATE(YYX) \
529 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
530 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
531 : YYSYMBOL_YYUNDEF)
533 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
534 as returned by yylex. */
535 static const yytype_int8 yytranslate[] =
537 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 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, 2, 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, 2, 2, 2, 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, 1, 2, 3, 4,
563 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
564 15, 16
567 #if YYDEBUG
568 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
569 static const yytype_uint8 yyrline[] =
571 0, 87, 87, 92, 95, 100, 103, 108, 111, 116,
572 119, 122, 127, 130, 133, 138, 141, 144, 150, 155,
573 158, 161, 164, 169, 172
575 #endif
577 /** Accessing symbol of state STATE. */
578 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
580 #if 1
581 /* The user-facing name of the symbol whose (internal) number is
582 YYSYMBOL. No bounds checking. */
583 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
585 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
586 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
587 static const char *const yytname[] =
589 "\"end of file\"", "error", "\"invalid token\"", "exp_PLUS",
590 "exp_MINUS", "exp_TIMES", "exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT",
591 "exp_SHIFTRIGHT", "exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR",
592 "exp_AND", "exp_XOR", "exp_NOT", "exp_NUMBER", "$accept", "start", "exp",
593 "bitwiseor", "bitwisexor", "bitwiseand", "shift", "term", "unary",
594 "factor", YY_NULLPTR
597 static const char *
598 yysymbol_name (yysymbol_kind_t yysymbol)
600 return yytname[yysymbol];
602 #endif
604 #define YYPACT_NINF (-11)
606 #define yypact_value_is_default(Yyn) \
607 ((Yyn) == YYPACT_NINF)
609 #define YYTABLE_NINF (-1)
611 #define yytable_value_is_error(Yyn) \
614 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
615 STATE-NUM. */
616 static const yytype_int8 yypact[] =
618 1, 1, 1, 1, 1, -11, 6, -10, -4, 9,
619 4, 11, 2, -11, -11, -11, -11, 7, -11, -11,
620 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
621 -11, -4, 9, 4, 11, 11, 2, 2, -11, -11,
625 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
626 Performed when YYTABLE does not specify something else to do. Zero
627 means the default is an error. */
628 static const yytype_int8 yydefact[] =
630 0, 0, 0, 0, 0, 23, 0, 2, 3, 5,
631 7, 9, 12, 15, 19, 20, 21, 0, 22, 1,
632 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
633 24, 4, 6, 8, 10, 11, 13, 14, 16, 17,
637 /* YYPGOTO[NTERM-NUM]. */
638 static const yytype_int8 yypgoto[] =
640 -11, -11, 22, 10, 8, 12, -3, -2, -1, -11
643 /* YYDEFGOTO[NTERM-NUM]. */
644 static const yytype_int8 yydefgoto[] =
646 0, 6, 7, 8, 9, 10, 11, 12, 13, 14
649 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
650 positive, shift that token. If negative, reduce the rule whose
651 number is the opposite. If YYTABLE_NINF, syntax error. */
652 static const yytype_int8 yytable[] =
654 15, 16, 20, 18, 1, 2, 19, 27, 28, 29,
655 21, 3, 23, 24, 25, 26, 4, 5, 30, 20,
656 34, 35, 22, 36, 37, 17, 38, 39, 40, 32,
657 31, 0, 0, 0, 33
660 static const yytype_int8 yycheck[] =
662 1, 2, 12, 4, 3, 4, 0, 5, 6, 7,
663 14, 10, 8, 9, 3, 4, 15, 16, 11, 12,
664 23, 24, 13, 25, 26, 3, 27, 28, 29, 21,
665 20, -1, -1, -1, 22
668 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
669 state STATE-NUM. */
670 static const yytype_int8 yystos[] =
672 0, 3, 4, 10, 15, 16, 18, 19, 20, 21,
673 22, 23, 24, 25, 26, 25, 25, 19, 25, 0,
674 12, 14, 13, 8, 9, 3, 4, 5, 6, 7,
675 11, 20, 21, 22, 23, 23, 24, 24, 25, 25,
679 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
680 static const yytype_int8 yyr1[] =
682 0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
683 22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
684 25, 25, 25, 26, 26
687 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
688 static const yytype_int8 yyr2[] =
690 0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
691 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
692 2, 2, 2, 1, 3
696 enum { YYENOMEM = -2 };
698 #define yyerrok (yyerrstatus = 0)
699 #define yyclearin (yychar = YYEMPTY)
701 #define YYACCEPT goto yyacceptlab
702 #define YYABORT goto yyabortlab
703 #define YYERROR goto yyerrorlab
704 #define YYNOMEM goto yyexhaustedlab
707 #define YYRECOVERING() (!!yyerrstatus)
709 #define YYBACKUP(Token, Value) \
710 do \
711 if (yychar == YYEMPTY) \
713 yychar = (Token); \
714 yylval = (Value); \
715 YYPOPSTACK (yylen); \
716 yystate = *yyssp; \
717 goto yybackup; \
719 else \
721 yyerror (yyscanner, YY_("syntax error: cannot back up")); \
722 YYERROR; \
724 while (0)
726 /* Backward compatibility with an undocumented macro.
727 Use YYerror or YYUNDEF. */
728 #define YYERRCODE YYUNDEF
731 /* Enable debugging if requested. */
732 #if YYDEBUG
734 # ifndef YYFPRINTF
735 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
736 # define YYFPRINTF fprintf
737 # endif
739 # define YYDPRINTF(Args) \
740 do { \
741 if (yydebug) \
742 YYFPRINTF Args; \
743 } while (0)
748 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
749 do { \
750 if (yydebug) \
752 YYFPRINTF (stderr, "%s ", Title); \
753 yy_symbol_print (stderr, \
754 Kind, Value, yyscanner); \
755 YYFPRINTF (stderr, "\n"); \
757 } while (0)
760 /*-----------------------------------.
761 | Print this symbol's value on YYO. |
762 `-----------------------------------*/
764 static void
765 yy_symbol_value_print (FILE *yyo,
766 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
768 FILE *yyoutput = yyo;
769 YY_USE (yyoutput);
770 YY_USE (yyscanner);
771 if (!yyvaluep)
772 return;
773 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
774 YY_USE (yykind);
775 YY_IGNORE_MAYBE_UNINITIALIZED_END
779 /*---------------------------.
780 | Print this symbol on YYO. |
781 `---------------------------*/
783 static void
784 yy_symbol_print (FILE *yyo,
785 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
787 YYFPRINTF (yyo, "%s %s (",
788 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
790 yy_symbol_value_print (yyo, yykind, yyvaluep, yyscanner);
791 YYFPRINTF (yyo, ")");
794 /*------------------------------------------------------------------.
795 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
796 | TOP (included). |
797 `------------------------------------------------------------------*/
799 static void
800 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
802 YYFPRINTF (stderr, "Stack now");
803 for (; yybottom <= yytop; yybottom++)
805 int yybot = *yybottom;
806 YYFPRINTF (stderr, " %d", yybot);
808 YYFPRINTF (stderr, "\n");
811 # define YY_STACK_PRINT(Bottom, Top) \
812 do { \
813 if (yydebug) \
814 yy_stack_print ((Bottom), (Top)); \
815 } while (0)
818 /*------------------------------------------------.
819 | Report that the YYRULE is going to be reduced. |
820 `------------------------------------------------*/
822 static void
823 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
824 int yyrule, yyscan_t yyscanner)
826 int yylno = yyrline[yyrule];
827 int yynrhs = yyr2[yyrule];
828 int yyi;
829 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
830 yyrule - 1, yylno);
831 /* The symbols being reduced. */
832 for (yyi = 0; yyi < yynrhs; yyi++)
834 YYFPRINTF (stderr, " $%d = ", yyi + 1);
835 yy_symbol_print (stderr,
836 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
837 &yyvsp[(yyi + 1) - (yynrhs)], yyscanner);
838 YYFPRINTF (stderr, "\n");
842 # define YY_REDUCE_PRINT(Rule) \
843 do { \
844 if (yydebug) \
845 yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \
846 } while (0)
848 /* Nonzero means print parse trace. It is left uninitialized so that
849 multiple parsers can coexist. */
850 int yydebug;
851 #else /* !YYDEBUG */
852 # define YYDPRINTF(Args) ((void) 0)
853 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
854 # define YY_STACK_PRINT(Bottom, Top)
855 # define YY_REDUCE_PRINT(Rule)
856 #endif /* !YYDEBUG */
859 /* YYINITDEPTH -- initial size of the parser's stacks. */
860 #ifndef YYINITDEPTH
861 # define YYINITDEPTH 200
862 #endif
864 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
865 if the built-in stack extension method is used).
867 Do not make this value too large; the results are undefined if
868 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
869 evaluated with infinite-precision integer arithmetic. */
871 #ifndef YYMAXDEPTH
872 # define YYMAXDEPTH 10000
873 #endif
876 /* Context of a parse error. */
877 typedef struct
879 yy_state_t *yyssp;
880 yysymbol_kind_t yytoken;
881 } yypcontext_t;
883 /* Put in YYARG at most YYARGN of the expected tokens given the
884 current YYCTX, and return the number of tokens stored in YYARG. If
885 YYARG is null, return the number of expected tokens (guaranteed to
886 be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
887 Return 0 if there are more than YYARGN expected tokens, yet fill
888 YYARG up to YYARGN. */
889 static int
890 yypcontext_expected_tokens (const yypcontext_t *yyctx,
891 yysymbol_kind_t yyarg[], int yyargn)
893 /* Actual size of YYARG. */
894 int yycount = 0;
895 int yyn = yypact[+*yyctx->yyssp];
896 if (!yypact_value_is_default (yyn))
898 /* Start YYX at -YYN if negative to avoid negative indexes in
899 YYCHECK. In other words, skip the first -YYN actions for
900 this state because they are default actions. */
901 int yyxbegin = yyn < 0 ? -yyn : 0;
902 /* Stay within bounds of both yycheck and yytname. */
903 int yychecklim = YYLAST - yyn + 1;
904 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
905 int yyx;
906 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
907 if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
908 && !yytable_value_is_error (yytable[yyx + yyn]))
910 if (!yyarg)
911 ++yycount;
912 else if (yycount == yyargn)
913 return 0;
914 else
915 yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
918 if (yyarg && yycount == 0 && 0 < yyargn)
919 yyarg[0] = YYSYMBOL_YYEMPTY;
920 return yycount;
926 #ifndef yystrlen
927 # if defined __GLIBC__ && defined _STRING_H
928 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
929 # else
930 /* Return the length of YYSTR. */
931 static YYPTRDIFF_T
932 yystrlen (const char *yystr)
934 YYPTRDIFF_T yylen;
935 for (yylen = 0; yystr[yylen]; yylen++)
936 continue;
937 return yylen;
939 # endif
940 #endif
942 #ifndef yystpcpy
943 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
944 # define yystpcpy stpcpy
945 # else
946 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
947 YYDEST. */
948 static char *
949 yystpcpy (char *yydest, const char *yysrc)
951 char *yyd = yydest;
952 const char *yys = yysrc;
954 while ((*yyd++ = *yys++) != '\0')
955 continue;
957 return yyd - 1;
959 # endif
960 #endif
962 #ifndef yytnamerr
963 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
964 quotes and backslashes, so that it's suitable for yyerror. The
965 heuristic is that double-quoting is unnecessary unless the string
966 contains an apostrophe, a comma, or backslash (other than
967 backslash-backslash). YYSTR is taken from yytname. If YYRES is
968 null, do not copy; instead, return the length of what the result
969 would have been. */
970 static YYPTRDIFF_T
971 yytnamerr (char *yyres, const char *yystr)
973 if (*yystr == '"')
975 YYPTRDIFF_T yyn = 0;
976 char const *yyp = yystr;
977 for (;;)
978 switch (*++yyp)
980 case '\'':
981 case ',':
982 goto do_not_strip_quotes;
984 case '\\':
985 if (*++yyp != '\\')
986 goto do_not_strip_quotes;
987 else
988 goto append;
990 append:
991 default:
992 if (yyres)
993 yyres[yyn] = *yyp;
994 yyn++;
995 break;
997 case '"':
998 if (yyres)
999 yyres[yyn] = '\0';
1000 return yyn;
1002 do_not_strip_quotes: ;
1005 if (yyres)
1006 return yystpcpy (yyres, yystr) - yyres;
1007 else
1008 return yystrlen (yystr);
1010 #endif
1013 static int
1014 yy_syntax_error_arguments (const yypcontext_t *yyctx,
1015 yysymbol_kind_t yyarg[], int yyargn)
1017 /* Actual size of YYARG. */
1018 int yycount = 0;
1019 /* There are many possibilities here to consider:
1020 - If this state is a consistent state with a default action, then
1021 the only way this function was invoked is if the default action
1022 is an error action. In that case, don't check for expected
1023 tokens because there are none.
1024 - The only way there can be no lookahead present (in yychar) is if
1025 this state is a consistent state with a default action. Thus,
1026 detecting the absence of a lookahead is sufficient to determine
1027 that there is no unexpected or expected token to report. In that
1028 case, just report a simple "syntax error".
1029 - Don't assume there isn't a lookahead just because this state is a
1030 consistent state with a default action. There might have been a
1031 previous inconsistent state, consistent state with a non-default
1032 action, or user semantic action that manipulated yychar.
1033 - Of course, the expected token list depends on states to have
1034 correct lookahead information, and it depends on the parser not
1035 to perform extra reductions after fetching a lookahead from the
1036 scanner and before detecting a syntax error. Thus, state merging
1037 (from LALR or IELR) and default reductions corrupt the expected
1038 token list. However, the list is correct for canonical LR with
1039 one exception: it will still contain any token that will not be
1040 accepted due to an error action in a later state.
1042 if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1044 int yyn;
1045 if (yyarg)
1046 yyarg[yycount] = yyctx->yytoken;
1047 ++yycount;
1048 yyn = yypcontext_expected_tokens (yyctx,
1049 yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1050 if (yyn == YYENOMEM)
1051 return YYENOMEM;
1052 else
1053 yycount += yyn;
1055 return yycount;
1058 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1059 about the unexpected token YYTOKEN for the state stack whose top is
1060 YYSSP.
1062 Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
1063 not large enough to hold the message. In that case, also set
1064 *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
1065 required number of bytes is too large to store. */
1066 static int
1067 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1068 const yypcontext_t *yyctx)
1070 enum { YYARGS_MAX = 5 };
1071 /* Internationalized format string. */
1072 const char *yyformat = YY_NULLPTR;
1073 /* Arguments of yyformat: reported tokens (one for the "unexpected",
1074 one per "expected"). */
1075 yysymbol_kind_t yyarg[YYARGS_MAX];
1076 /* Cumulated lengths of YYARG. */
1077 YYPTRDIFF_T yysize = 0;
1079 /* Actual size of YYARG. */
1080 int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1081 if (yycount == YYENOMEM)
1082 return YYENOMEM;
1084 switch (yycount)
1086 #define YYCASE_(N, S) \
1087 case N: \
1088 yyformat = S; \
1089 break
1090 default: /* Avoid compiler warnings. */
1091 YYCASE_(0, YY_("syntax error"));
1092 YYCASE_(1, YY_("syntax error, unexpected %s"));
1093 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1094 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1095 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1096 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1097 #undef YYCASE_
1100 /* Compute error message size. Don't count the "%s"s, but reserve
1101 room for the terminator. */
1102 yysize = yystrlen (yyformat) - 2 * yycount + 1;
1104 int yyi;
1105 for (yyi = 0; yyi < yycount; ++yyi)
1107 YYPTRDIFF_T yysize1
1108 = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1109 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1110 yysize = yysize1;
1111 else
1112 return YYENOMEM;
1116 if (*yymsg_alloc < yysize)
1118 *yymsg_alloc = 2 * yysize;
1119 if (! (yysize <= *yymsg_alloc
1120 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1121 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1122 return -1;
1125 /* Avoid sprintf, as that infringes on the user's name space.
1126 Don't have undefined behavior even if the translation
1127 produced a string with the wrong number of "%s"s. */
1129 char *yyp = *yymsg;
1130 int yyi = 0;
1131 while ((*yyp = *yyformat) != '\0')
1132 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1134 yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1135 yyformat += 2;
1137 else
1139 ++yyp;
1140 ++yyformat;
1143 return 0;
1147 /*-----------------------------------------------.
1148 | Release the memory associated to this symbol. |
1149 `-----------------------------------------------*/
1151 static void
1152 yydestruct (const char *yymsg,
1153 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, yyscan_t yyscanner)
1155 YY_USE (yyvaluep);
1156 YY_USE (yyscanner);
1157 if (!yymsg)
1158 yymsg = "Deleting";
1159 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1161 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1162 YY_USE (yykind);
1163 YY_IGNORE_MAYBE_UNINITIALIZED_END
1171 /*----------.
1172 | yyparse. |
1173 `----------*/
1176 yyparse (yyscan_t yyscanner)
1178 /* Lookahead token kind. */
1179 int yychar;
1182 /* The semantic value of the lookahead symbol. */
1183 /* Default value used for initialization, for pacifying older GCCs
1184 or non-GCC compilers. */
1185 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1186 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1188 /* Number of syntax errors so far. */
1189 int yynerrs = 0;
1191 yy_state_fast_t yystate = 0;
1192 /* Number of tokens to shift before error messages enabled. */
1193 int yyerrstatus = 0;
1195 /* Refer to the stacks through separate pointers, to allow yyoverflow
1196 to reallocate them elsewhere. */
1198 /* Their size. */
1199 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1201 /* The state stack: array, bottom, top. */
1202 yy_state_t yyssa[YYINITDEPTH];
1203 yy_state_t *yyss = yyssa;
1204 yy_state_t *yyssp = yyss;
1206 /* The semantic value stack: array, bottom, top. */
1207 YYSTYPE yyvsa[YYINITDEPTH];
1208 YYSTYPE *yyvs = yyvsa;
1209 YYSTYPE *yyvsp = yyvs;
1211 int yyn;
1212 /* The return value of yyparse. */
1213 int yyresult;
1214 /* Lookahead symbol kind. */
1215 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1216 /* The variables used to return semantic value and location from the
1217 action routines. */
1218 YYSTYPE yyval;
1220 /* Buffer for error messages, and its allocated size. */
1221 char yymsgbuf[128];
1222 char *yymsg = yymsgbuf;
1223 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1225 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1227 /* The number of symbols on the RHS of the reduced rule.
1228 Keep to zero when no symbol should be popped. */
1229 int yylen = 0;
1231 YYDPRINTF ((stderr, "Starting parse\n"));
1233 yychar = YYEMPTY; /* Cause a token to be read. */
1235 goto yysetstate;
1238 /*------------------------------------------------------------.
1239 | yynewstate -- push a new state, which is found in yystate. |
1240 `------------------------------------------------------------*/
1241 yynewstate:
1242 /* In all cases, when you get here, the value and location stacks
1243 have just been pushed. So pushing a state here evens the stacks. */
1244 yyssp++;
1247 /*--------------------------------------------------------------------.
1248 | yysetstate -- set current state (the top of the stack) to yystate. |
1249 `--------------------------------------------------------------------*/
1250 yysetstate:
1251 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1252 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1253 YY_IGNORE_USELESS_CAST_BEGIN
1254 *yyssp = YY_CAST (yy_state_t, yystate);
1255 YY_IGNORE_USELESS_CAST_END
1256 YY_STACK_PRINT (yyss, yyssp);
1258 if (yyss + yystacksize - 1 <= yyssp)
1259 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1260 YYNOMEM;
1261 #else
1263 /* Get the current used size of the three stacks, in elements. */
1264 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1266 # if defined yyoverflow
1268 /* Give user a chance to reallocate the stack. Use copies of
1269 these so that the &'s don't force the real ones into
1270 memory. */
1271 yy_state_t *yyss1 = yyss;
1272 YYSTYPE *yyvs1 = yyvs;
1274 /* Each stack pointer address is followed by the size of the
1275 data in use in that stack, in bytes. This used to be a
1276 conditional around just the two extra args, but that might
1277 be undefined if yyoverflow is a macro. */
1278 yyoverflow (YY_("memory exhausted"),
1279 &yyss1, yysize * YYSIZEOF (*yyssp),
1280 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1281 &yystacksize);
1282 yyss = yyss1;
1283 yyvs = yyvs1;
1285 # else /* defined YYSTACK_RELOCATE */
1286 /* Extend the stack our own way. */
1287 if (YYMAXDEPTH <= yystacksize)
1288 YYNOMEM;
1289 yystacksize *= 2;
1290 if (YYMAXDEPTH < yystacksize)
1291 yystacksize = YYMAXDEPTH;
1294 yy_state_t *yyss1 = yyss;
1295 union yyalloc *yyptr =
1296 YY_CAST (union yyalloc *,
1297 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1298 if (! yyptr)
1299 YYNOMEM;
1300 YYSTACK_RELOCATE (yyss_alloc, yyss);
1301 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1302 # undef YYSTACK_RELOCATE
1303 if (yyss1 != yyssa)
1304 YYSTACK_FREE (yyss1);
1306 # endif
1308 yyssp = yyss + yysize - 1;
1309 yyvsp = yyvs + yysize - 1;
1311 YY_IGNORE_USELESS_CAST_BEGIN
1312 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1313 YY_CAST (long, yystacksize)));
1314 YY_IGNORE_USELESS_CAST_END
1316 if (yyss + yystacksize - 1 <= yyssp)
1317 YYABORT;
1319 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1322 if (yystate == YYFINAL)
1323 YYACCEPT;
1325 goto yybackup;
1328 /*-----------.
1329 | yybackup. |
1330 `-----------*/
1331 yybackup:
1332 /* Do appropriate processing given the current state. Read a
1333 lookahead token if we need one and don't already have one. */
1335 /* First try to decide what to do without reference to lookahead token. */
1336 yyn = yypact[yystate];
1337 if (yypact_value_is_default (yyn))
1338 goto yydefault;
1340 /* Not known => get a lookahead token if don't already have one. */
1342 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1343 if (yychar == YYEMPTY)
1345 YYDPRINTF ((stderr, "Reading a token\n"));
1346 yychar = yylex (&yylval, yyscanner);
1349 if (yychar <= YYEOF)
1351 yychar = YYEOF;
1352 yytoken = YYSYMBOL_YYEOF;
1353 YYDPRINTF ((stderr, "Now at end of input.\n"));
1355 else if (yychar == YYerror)
1357 /* The scanner already issued an error message, process directly
1358 to error recovery. But do not keep the error token as
1359 lookahead, it is too special and may lead us to an endless
1360 loop in error recovery. */
1361 yychar = YYUNDEF;
1362 yytoken = YYSYMBOL_YYerror;
1363 goto yyerrlab1;
1365 else
1367 yytoken = YYTRANSLATE (yychar);
1368 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1371 /* If the proper action on seeing token YYTOKEN is to reduce or to
1372 detect an error, take that action. */
1373 yyn += yytoken;
1374 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1375 goto yydefault;
1376 yyn = yytable[yyn];
1377 if (yyn <= 0)
1379 if (yytable_value_is_error (yyn))
1380 goto yyerrlab;
1381 yyn = -yyn;
1382 goto yyreduce;
1385 /* Count tokens shifted since error; after three, turn off error
1386 status. */
1387 if (yyerrstatus)
1388 yyerrstatus--;
1390 /* Shift the lookahead token. */
1391 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1392 yystate = yyn;
1393 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1394 *++yyvsp = yylval;
1395 YY_IGNORE_MAYBE_UNINITIALIZED_END
1397 /* Discard the shifted token. */
1398 yychar = YYEMPTY;
1399 goto yynewstate;
1402 /*-----------------------------------------------------------.
1403 | yydefault -- do the default action for the current state. |
1404 `-----------------------------------------------------------*/
1405 yydefault:
1406 yyn = yydefact[yystate];
1407 if (yyn == 0)
1408 goto yyerrlab;
1409 goto yyreduce;
1412 /*-----------------------------.
1413 | yyreduce -- do a reduction. |
1414 `-----------------------------*/
1415 yyreduce:
1416 /* yyn is the number of a rule to reduce with. */
1417 yylen = yyr2[yyn];
1419 /* If YYLEN is nonzero, implement the default value of the action:
1420 '$$ = $1'.
1422 Otherwise, the following line sets YYVAL to garbage.
1423 This behavior is undocumented and Bison
1424 users should not rely upon it. Assigning to YYVAL
1425 unconditionally makes the parser a bit smaller, and it avoids a
1426 GCC warning that YYVAL may be used uninitialized. */
1427 yyval = yyvsp[1-yylen];
1430 YY_REDUCE_PRINT (yyn);
1431 switch (yyn)
1433 case 2: /* start: exp */
1434 #line 87 "cmExprParser.y"
1436 cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number));
1438 #line 1439 "cmExprParser.cxx"
1439 break;
1441 case 3: /* exp: bitwiseor */
1442 #line 92 "cmExprParser.y"
1444 (yyval.Number) = (yyvsp[0].Number);
1446 #line 1447 "cmExprParser.cxx"
1447 break;
1449 case 4: /* exp: exp exp_OR bitwiseor */
1450 #line 95 "cmExprParser.y"
1452 (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number);
1454 #line 1455 "cmExprParser.cxx"
1455 break;
1457 case 5: /* bitwiseor: bitwisexor */
1458 #line 100 "cmExprParser.y"
1460 (yyval.Number) = (yyvsp[0].Number);
1462 #line 1463 "cmExprParser.cxx"
1463 break;
1465 case 6: /* bitwiseor: bitwiseor exp_XOR bitwisexor */
1466 #line 103 "cmExprParser.y"
1468 (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number);
1470 #line 1471 "cmExprParser.cxx"
1471 break;
1473 case 7: /* bitwisexor: bitwiseand */
1474 #line 108 "cmExprParser.y"
1476 (yyval.Number) = (yyvsp[0].Number);
1478 #line 1479 "cmExprParser.cxx"
1479 break;
1481 case 8: /* bitwisexor: bitwisexor exp_AND bitwiseand */
1482 #line 111 "cmExprParser.y"
1484 (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number);
1486 #line 1487 "cmExprParser.cxx"
1487 break;
1489 case 9: /* bitwiseand: shift */
1490 #line 116 "cmExprParser.y"
1492 (yyval.Number) = (yyvsp[0].Number);
1494 #line 1495 "cmExprParser.cxx"
1495 break;
1497 case 10: /* bitwiseand: bitwiseand exp_SHIFTLEFT shift */
1498 #line 119 "cmExprParser.y"
1500 (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number);
1502 #line 1503 "cmExprParser.cxx"
1503 break;
1505 case 11: /* bitwiseand: bitwiseand exp_SHIFTRIGHT shift */
1506 #line 122 "cmExprParser.y"
1508 (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number);
1510 #line 1511 "cmExprParser.cxx"
1511 break;
1513 case 12: /* shift: term */
1514 #line 127 "cmExprParser.y"
1516 (yyval.Number) = (yyvsp[0].Number);
1518 #line 1519 "cmExprParser.cxx"
1519 break;
1521 case 13: /* shift: shift exp_PLUS term */
1522 #line 130 "cmExprParser.y"
1524 (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number);
1526 #line 1527 "cmExprParser.cxx"
1527 break;
1529 case 14: /* shift: shift exp_MINUS term */
1530 #line 133 "cmExprParser.y"
1532 (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number);
1534 #line 1535 "cmExprParser.cxx"
1535 break;
1537 case 15: /* term: unary */
1538 #line 138 "cmExprParser.y"
1540 (yyval.Number) = (yyvsp[0].Number);
1542 #line 1543 "cmExprParser.cxx"
1543 break;
1545 case 16: /* term: term exp_TIMES unary */
1546 #line 141 "cmExprParser.y"
1548 (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number);
1550 #line 1551 "cmExprParser.cxx"
1551 break;
1553 case 17: /* term: term exp_DIVIDE unary */
1554 #line 144 "cmExprParser.y"
1556 if (yyvsp[0].Number == 0) {
1557 throw std::overflow_error("divide by zero");
1559 (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number);
1561 #line 1562 "cmExprParser.cxx"
1562 break;
1564 case 18: /* term: term exp_MOD unary */
1565 #line 150 "cmExprParser.y"
1567 (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number);
1569 #line 1570 "cmExprParser.cxx"
1570 break;
1572 case 19: /* unary: factor */
1573 #line 155 "cmExprParser.y"
1575 (yyval.Number) = (yyvsp[0].Number);
1577 #line 1578 "cmExprParser.cxx"
1578 break;
1580 case 20: /* unary: exp_PLUS unary */
1581 #line 158 "cmExprParser.y"
1583 (yyval.Number) = + (yyvsp[0].Number);
1585 #line 1586 "cmExprParser.cxx"
1586 break;
1588 case 21: /* unary: exp_MINUS unary */
1589 #line 161 "cmExprParser.y"
1591 (yyval.Number) = - (yyvsp[0].Number);
1593 #line 1594 "cmExprParser.cxx"
1594 break;
1596 case 22: /* unary: exp_NOT unary */
1597 #line 164 "cmExprParser.y"
1599 (yyval.Number) = ~ (yyvsp[0].Number);
1601 #line 1602 "cmExprParser.cxx"
1602 break;
1604 case 23: /* factor: exp_NUMBER */
1605 #line 169 "cmExprParser.y"
1607 (yyval.Number) = (yyvsp[0].Number);
1609 #line 1610 "cmExprParser.cxx"
1610 break;
1612 case 24: /* factor: exp_OPENPARENT exp exp_CLOSEPARENT */
1613 #line 172 "cmExprParser.y"
1615 (yyval.Number) = (yyvsp[-1].Number);
1617 #line 1618 "cmExprParser.cxx"
1618 break;
1621 #line 1622 "cmExprParser.cxx"
1623 default: break;
1625 /* User semantic actions sometimes alter yychar, and that requires
1626 that yytoken be updated with the new translation. We take the
1627 approach of translating immediately before every use of yytoken.
1628 One alternative is translating here after every semantic action,
1629 but that translation would be missed if the semantic action invokes
1630 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1631 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1632 incorrect destructor might then be invoked immediately. In the
1633 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1634 to an incorrect destructor call or verbose syntax error message
1635 before the lookahead is translated. */
1636 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1638 YYPOPSTACK (yylen);
1639 yylen = 0;
1641 *++yyvsp = yyval;
1643 /* Now 'shift' the result of the reduction. Determine what state
1644 that goes to, based on the state we popped back to and the rule
1645 number reduced by. */
1647 const int yylhs = yyr1[yyn] - YYNTOKENS;
1648 const int yyi = yypgoto[yylhs] + *yyssp;
1649 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1650 ? yytable[yyi]
1651 : yydefgoto[yylhs]);
1654 goto yynewstate;
1657 /*--------------------------------------.
1658 | yyerrlab -- here on detecting error. |
1659 `--------------------------------------*/
1660 yyerrlab:
1661 /* Make sure we have latest lookahead translation. See comments at
1662 user semantic actions for why this is necessary. */
1663 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1664 /* If not already recovering from an error, report this error. */
1665 if (!yyerrstatus)
1667 ++yynerrs;
1669 yypcontext_t yyctx
1670 = {yyssp, yytoken};
1671 char const *yymsgp = YY_("syntax error");
1672 int yysyntax_error_status;
1673 yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
1674 if (yysyntax_error_status == 0)
1675 yymsgp = yymsg;
1676 else if (yysyntax_error_status == -1)
1678 if (yymsg != yymsgbuf)
1679 YYSTACK_FREE (yymsg);
1680 yymsg = YY_CAST (char *,
1681 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
1682 if (yymsg)
1684 yysyntax_error_status
1685 = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
1686 yymsgp = yymsg;
1688 else
1690 yymsg = yymsgbuf;
1691 yymsg_alloc = sizeof yymsgbuf;
1692 yysyntax_error_status = YYENOMEM;
1695 yyerror (yyscanner, yymsgp);
1696 if (yysyntax_error_status == YYENOMEM)
1697 YYNOMEM;
1701 if (yyerrstatus == 3)
1703 /* If just tried and failed to reuse lookahead token after an
1704 error, discard it. */
1706 if (yychar <= YYEOF)
1708 /* Return failure if at end of input. */
1709 if (yychar == YYEOF)
1710 YYABORT;
1712 else
1714 yydestruct ("Error: discarding",
1715 yytoken, &yylval, yyscanner);
1716 yychar = YYEMPTY;
1720 /* Else will try to reuse lookahead token after shifting the error
1721 token. */
1722 goto yyerrlab1;
1725 /*---------------------------------------------------.
1726 | yyerrorlab -- error raised explicitly by YYERROR. |
1727 `---------------------------------------------------*/
1728 yyerrorlab:
1729 /* Pacify compilers when the user code never invokes YYERROR and the
1730 label yyerrorlab therefore never appears in user code. */
1731 if (0)
1732 YYERROR;
1733 ++yynerrs;
1735 /* Do not reclaim the symbols of the rule whose action triggered
1736 this YYERROR. */
1737 YYPOPSTACK (yylen);
1738 yylen = 0;
1739 YY_STACK_PRINT (yyss, yyssp);
1740 yystate = *yyssp;
1741 goto yyerrlab1;
1744 /*-------------------------------------------------------------.
1745 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1746 `-------------------------------------------------------------*/
1747 yyerrlab1:
1748 yyerrstatus = 3; /* Each real token shifted decrements this. */
1750 /* Pop stack until we find a state that shifts the error token. */
1751 for (;;)
1753 yyn = yypact[yystate];
1754 if (!yypact_value_is_default (yyn))
1756 yyn += YYSYMBOL_YYerror;
1757 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1759 yyn = yytable[yyn];
1760 if (0 < yyn)
1761 break;
1765 /* Pop the current state because it cannot handle the error token. */
1766 if (yyssp == yyss)
1767 YYABORT;
1770 yydestruct ("Error: popping",
1771 YY_ACCESSING_SYMBOL (yystate), yyvsp, yyscanner);
1772 YYPOPSTACK (1);
1773 yystate = *yyssp;
1774 YY_STACK_PRINT (yyss, yyssp);
1777 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1778 *++yyvsp = yylval;
1779 YY_IGNORE_MAYBE_UNINITIALIZED_END
1782 /* Shift the error token. */
1783 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1785 yystate = yyn;
1786 goto yynewstate;
1789 /*-------------------------------------.
1790 | yyacceptlab -- YYACCEPT comes here. |
1791 `-------------------------------------*/
1792 yyacceptlab:
1793 yyresult = 0;
1794 goto yyreturnlab;
1797 /*-----------------------------------.
1798 | yyabortlab -- YYABORT comes here. |
1799 `-----------------------------------*/
1800 yyabortlab:
1801 yyresult = 1;
1802 goto yyreturnlab;
1805 /*-----------------------------------------------------------.
1806 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1807 `-----------------------------------------------------------*/
1808 yyexhaustedlab:
1809 yyerror (yyscanner, YY_("memory exhausted"));
1810 yyresult = 2;
1811 goto yyreturnlab;
1814 /*----------------------------------------------------------.
1815 | yyreturnlab -- parsing is finished, clean up and return. |
1816 `----------------------------------------------------------*/
1817 yyreturnlab:
1818 if (yychar != YYEMPTY)
1820 /* Make sure we have latest lookahead translation. See comments at
1821 user semantic actions for why this is necessary. */
1822 yytoken = YYTRANSLATE (yychar);
1823 yydestruct ("Cleanup: discarding lookahead",
1824 yytoken, &yylval, yyscanner);
1826 /* Do not reclaim the symbols of the rule whose action triggered
1827 this YYABORT or YYACCEPT. */
1828 YYPOPSTACK (yylen);
1829 YY_STACK_PRINT (yyss, yyssp);
1830 while (yyssp != yyss)
1832 yydestruct ("Cleanup: popping",
1833 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yyscanner);
1834 YYPOPSTACK (1);
1836 #ifndef yyoverflow
1837 if (yyss != yyssa)
1838 YYSTACK_FREE (yyss);
1839 #endif
1840 if (yymsg != yymsgbuf)
1841 YYSTACK_FREE (yymsg);
1842 return yyresult;
1845 #line 177 "cmExprParser.y"
1847 /* End of grammar */
1849 /*--------------------------------------------------------------------------*/
1850 void cmExpr_yyerror(yyscan_t yyscanner, const char* message)
1852 cmExpr_yyget_extra(yyscanner)->Error(message);