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,
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. */
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
55 #define YYSKELETON_NAME "yacc.c"
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.
85 bison --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h -ocmExprParser.cxx cmExprParser.y
89 #include "cmConfigure.h" // IWYU pragma: keep
95 /*-------------------------------------------------------------------------*/
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. */
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. */
109 # pragma warning (disable: 4102) /* Unused goto label. */
110 # pragma warning (disable: 4065) /* Switch statement contains default but no case. */
112 #if defined(__GNUC__) && __GNUC__ >= 8
113 # pragma GCC diagnostic ignored "-Wconversion"
114 # pragma GCC diagnostic ignored "-Wfree-nonheap-object"
116 #if defined(__clang__) && defined(__has_warning)
117 # if __has_warning("-Wunused-but-set-variable")
118 # pragma clang diagnostic ignored "-Wunused-but-set-variable"
120 # if __has_warning("-Wused-but-marked-unused")
121 # pragma clang diagnostic ignored "-Wused-but-marked-unused"
125 #if defined(__NVCOMPILER)
126 # pragma diag_suppress 550 /* variable set but never used */
129 #line 130 "cmExprParser.cxx"
133 # define YY_CAST(Type, Val) static_cast<Type> (Val)
134 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
136 # define YY_CAST(Type, Val) ((Type) (Val))
137 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
141 # if defined __cplusplus
142 # if 201103L <= __cplusplus
143 # define YY_NULLPTR nullptr
145 # define YY_NULLPTR 0
148 # define YY_NULLPTR ((void*)0)
152 #include "cmExprParserTokens.h"
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
;
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 */
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
;
216 typedef signed char yytype_int8
;
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
;
224 typedef short yytype_int16
;
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>. */
233 # undef UINT_LEAST8_MAX
234 # undef UINT_LEAST16_MAX
235 # define UINT_LEAST8_MAX 255
236 # define UINT_LEAST16_MAX 65535
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
;
247 typedef short yytype_uint8
;
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
;
258 typedef int yytype_uint16
;
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
267 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
269 # define YYPTRDIFF_T ptrdiff_t
270 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
272 # define YYPTRDIFF_T long
273 # define YYPTRDIFF_MAXIMUM LONG_MAX
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
286 # define YYSIZE_T unsigned
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
;
306 # if defined YYENABLE_NLS && YYENABLE_NLS
308 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
309 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
313 # define YY_(Msgid) Msgid
318 #ifndef YY_ATTRIBUTE_PURE
319 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
320 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
322 # define YY_ATTRIBUTE_PURE
326 #ifndef YY_ATTRIBUTE_UNUSED
327 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
328 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
330 # define YY_ATTRIBUTE_UNUSED
334 /* Suppress unused-variable warnings by "using" E. */
335 #if ! defined lint || defined __GNUC__
336 # define YY_USE(E) ((void) (E))
338 # define YY_USE(E) /* empty */
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\"")
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\"")
353 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
354 _Pragma ("GCC diagnostic pop")
356 # define YY_INITIAL_VALUE(Value) Value
358 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
359 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
360 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
362 #ifndef YY_INITIAL_VALUE
363 # define YY_INITIAL_VALUE(Value) /* Nothing. */
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")
373 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
374 # define YY_IGNORE_USELESS_CAST_BEGIN
375 # define YY_IGNORE_USELESS_CAST_END
379 #define YY_ASSERT(E) ((void) (0 && (E)))
383 /* The parser invokes alloca or malloc; define the necessary symbols. */
385 # ifdef YYSTACK_USE_ALLOCA
386 # if YYSTACK_USE_ALLOCA
388 # define YYSTACK_ALLOC __builtin_alloca
389 # elif defined __BUILTIN_VA_ARG_INCR
390 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
392 # define YYSTACK_ALLOC __alloca
393 # elif defined _MSC_VER
394 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
395 # define alloca _alloca
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
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 */
420 # define YYSTACK_ALLOC YYMALLOC
421 # define YYSTACK_FREE YYFREE
422 # ifndef YYSTACK_ALLOC_MAXIMUM
423 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
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
434 # define YYMALLOC malloc
435 # if ! defined malloc && ! defined EXIT_SUCCESS
436 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
441 # if ! defined free && ! defined EXIT_SUCCESS
442 void free (void *); /* INFRINGES ON USER NAME SPACE */
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. */
455 yy_state_t yyss_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
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
475 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
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); \
488 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
489 /* Copy COUNT objects from SRC to DST. The source and destination do
492 # if defined __GNUC__ && 1 < __GNUC__
493 # define YYCOPY(Dst, Src, Count) \
494 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
496 # define YYCOPY(Dst, Src, Count) \
500 for (yyi = 0; yyi < (Count); yyi++) \
501 (Dst)[yyi] = (Src)[yyi]; \
506 #endif /* !YYCOPY_NEEDED */
508 /* YYFINAL -- State number of the termination state. */
510 /* YYLAST -- Last index in YYTABLE. */
513 /* YYNTOKENS -- Number of terminals. */
515 /* YYNNTS -- Number of nonterminals. */
517 /* YYNRULES -- Number of rules. */
519 /* YYNSTATES -- Number of states. */
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]) \
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,
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
577 /** Accessing symbol of state STATE. */
578 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
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",
598 yysymbol_name (yysymbol_kind_t yysymbol
)
600 return yytname
[yysymbol
];
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
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,
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,
668 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
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,
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,
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) \
711 if (yychar == YYEMPTY) \
715 YYPOPSTACK (yylen); \
721 yyerror (yyscanner, YY_("syntax error: cannot back up")); \
726 /* Backward compatibility with an undocumented macro.
727 Use YYerror or YYUNDEF. */
728 #define YYERRCODE YYUNDEF
731 /* Enable debugging if requested. */
735 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
736 # define YYFPRINTF fprintf
739 # define YYDPRINTF(Args) \
748 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
752 YYFPRINTF (stderr, "%s ", Title); \
753 yy_symbol_print (stderr, \
754 Kind, Value, yyscanner); \
755 YYFPRINTF (stderr, "\n"); \
760 /*-----------------------------------.
761 | Print this symbol's value on YYO. |
762 `-----------------------------------*/
765 yy_symbol_value_print (FILE *yyo
,
766 yysymbol_kind_t yykind
, YYSTYPE
const * const yyvaluep
, yyscan_t yyscanner
)
768 FILE *yyoutput
= yyo
;
773 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
775 YY_IGNORE_MAYBE_UNINITIALIZED_END
779 /*---------------------------.
780 | Print this symbol on YYO. |
781 `---------------------------*/
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 |
797 `------------------------------------------------------------------*/
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) \
814 yy_stack_print ((Bottom), (Top)); \
818 /*------------------------------------------------.
819 | Report that the YYRULE is going to be reduced. |
820 `------------------------------------------------*/
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
];
829 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %d):\n",
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) \
845 yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \
848 /* Nonzero means print parse trace. It is left uninitialized so that
849 multiple parsers can coexist. */
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. */
861 # define YYINITDEPTH 200
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. */
872 # define YYMAXDEPTH 10000
876 /* Context of a parse error. */
880 yysymbol_kind_t yytoken
;
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. */
890 yypcontext_expected_tokens (const yypcontext_t
*yyctx
,
891 yysymbol_kind_t yyarg
[], int yyargn
)
893 /* Actual size of YYARG. */
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
;
906 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
907 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYSYMBOL_YYerror
908 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
912 else if (yycount
== yyargn
)
915 yyarg
[yycount
++] = YY_CAST (yysymbol_kind_t
, yyx
);
918 if (yyarg
&& yycount
== 0 && 0 < yyargn
)
919 yyarg
[0] = YYSYMBOL_YYEMPTY
;
927 # if defined __GLIBC__ && defined _STRING_H
928 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
930 /* Return the length of YYSTR. */
932 yystrlen (const char *yystr
)
935 for (yylen
= 0; yystr
[yylen
]; yylen
++)
943 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
944 # define yystpcpy stpcpy
946 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
949 yystpcpy (char *yydest
, const char *yysrc
)
952 const char *yys
= yysrc
;
954 while ((*yyd
++ = *yys
++) != '\0')
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
971 yytnamerr (char *yyres
, const char *yystr
)
976 char const *yyp
= yystr
;
982 goto do_not_strip_quotes
;
986 goto do_not_strip_quotes
;
1002 do_not_strip_quotes
: ;
1006 return yystpcpy (yyres
, yystr
) - yyres
;
1008 return yystrlen (yystr
);
1014 yy_syntax_error_arguments (const yypcontext_t
*yyctx
,
1015 yysymbol_kind_t yyarg
[], int yyargn
)
1017 /* Actual size of YYARG. */
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
)
1046 yyarg
[yycount
] = yyctx
->yytoken
;
1048 yyn
= yypcontext_expected_tokens (yyctx
,
1049 yyarg
? yyarg
+ 1 : yyarg
, yyargn
- 1);
1050 if (yyn
== YYENOMEM
)
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
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. */
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
)
1086 #define YYCASE_(N, S) \
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"));
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;
1105 for (yyi
= 0; yyi
< yycount
; ++yyi
)
1108 = yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyarg
[yyi
]]);
1109 if (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
)
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
;
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. */
1131 while ((*yyp
= *yyformat
) != '\0')
1132 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1134 yyp
+= yytnamerr (yyp
, yytname
[yyarg
[yyi
++]]);
1147 /*-----------------------------------------------.
1148 | Release the memory associated to this symbol. |
1149 `-----------------------------------------------*/
1152 yydestruct (const char *yymsg
,
1153 yysymbol_kind_t yykind
, YYSTYPE
*yyvaluep
, yyscan_t yyscanner
)
1159 YY_SYMBOL_PRINT (yymsg
, yykind
, yyvaluep
, yylocationp
);
1161 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1163 YY_IGNORE_MAYBE_UNINITIALIZED_END
1176 yyparse (yyscan_t yyscanner
)
1178 /* Lookahead token kind. */
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. */
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. */
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
;
1212 /* The return value of yyparse. */
1214 /* Lookahead symbol kind. */
1215 yysymbol_kind_t yytoken
= YYSYMBOL_YYEMPTY
;
1216 /* The variables used to return semantic value and location from the
1220 /* Buffer for error messages, and its allocated size. */
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. */
1231 YYDPRINTF ((stderr
, "Starting parse\n"));
1233 yychar
= YYEMPTY
; /* Cause a token to be read. */
1238 /*------------------------------------------------------------.
1239 | yynewstate -- push a new state, which is found in yystate. |
1240 `------------------------------------------------------------*/
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. */
1247 /*--------------------------------------------------------------------.
1248 | yysetstate -- set current state (the top of the stack) to yystate. |
1249 `--------------------------------------------------------------------*/
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
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
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
),
1285 # else /* defined YYSTACK_RELOCATE */
1286 /* Extend the stack our own way. */
1287 if (YYMAXDEPTH
<= yystacksize
)
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
))));
1300 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1301 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1302 # undef YYSTACK_RELOCATE
1304 YYSTACK_FREE (yyss1
);
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
)
1319 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1322 if (yystate
== YYFINAL
)
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
))
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
)
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. */
1362 yytoken
= YYSYMBOL_YYerror
;
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. */
1374 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1379 if (yytable_value_is_error (yyn
))
1385 /* Count tokens shifted since error; after three, turn off error
1390 /* Shift the lookahead token. */
1391 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1393 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1395 YY_IGNORE_MAYBE_UNINITIALIZED_END
1397 /* Discard the shifted token. */
1402 /*-----------------------------------------------------------.
1403 | yydefault -- do the default action for the current state. |
1404 `-----------------------------------------------------------*/
1406 yyn
= yydefact
[yystate
];
1412 /*-----------------------------.
1413 | yyreduce -- do a reduction. |
1414 `-----------------------------*/
1416 /* yyn is the number of a rule to reduce with. */
1419 /* If YYLEN is nonzero, implement the default value of the action:
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
);
1433 case 2: /* start: exp */
1434 #line 87 "cmExprParser.y"
1436 cmExpr_yyget_extra(yyscanner
)->SetResult((yyvsp
[0].Number
));
1438 #line 1439 "cmExprParser.cxx"
1441 case 3: /* exp: bitwiseor */
1442 #line 92 "cmExprParser.y"
1444 (yyval
.Number
) = (yyvsp
[0].Number
);
1446 #line 1447 "cmExprParser.cxx"
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"
1457 case 5: /* bitwiseor: bitwisexor */
1458 #line 100 "cmExprParser.y"
1460 (yyval
.Number
) = (yyvsp
[0].Number
);
1462 #line 1463 "cmExprParser.cxx"
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"
1473 case 7: /* bitwisexor: bitwiseand */
1474 #line 108 "cmExprParser.y"
1476 (yyval
.Number
) = (yyvsp
[0].Number
);
1478 #line 1479 "cmExprParser.cxx"
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"
1489 case 9: /* bitwiseand: shift */
1490 #line 116 "cmExprParser.y"
1492 (yyval
.Number
) = (yyvsp
[0].Number
);
1494 #line 1495 "cmExprParser.cxx"
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"
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"
1513 case 12: /* shift: term */
1514 #line 127 "cmExprParser.y"
1516 (yyval
.Number
) = (yyvsp
[0].Number
);
1518 #line 1519 "cmExprParser.cxx"
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"
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"
1537 case 15: /* term: unary */
1538 #line 138 "cmExprParser.y"
1540 (yyval
.Number
) = (yyvsp
[0].Number
);
1542 #line 1543 "cmExprParser.cxx"
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"
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"
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"
1572 case 19: /* unary: factor */
1573 #line 155 "cmExprParser.y"
1575 (yyval
.Number
) = (yyvsp
[0].Number
);
1577 #line 1578 "cmExprParser.cxx"
1580 case 20: /* unary: exp_PLUS unary */
1581 #line 158 "cmExprParser.y"
1583 (yyval
.Number
) = + (yyvsp
[0].Number
);
1585 #line 1586 "cmExprParser.cxx"
1588 case 21: /* unary: exp_MINUS unary */
1589 #line 161 "cmExprParser.y"
1591 (yyval
.Number
) = - (yyvsp
[0].Number
);
1593 #line 1594 "cmExprParser.cxx"
1596 case 22: /* unary: exp_NOT unary */
1597 #line 164 "cmExprParser.y"
1599 (yyval
.Number
) = ~ (yyvsp
[0].Number
);
1601 #line 1602 "cmExprParser.cxx"
1604 case 23: /* factor: exp_NUMBER */
1605 #line 169 "cmExprParser.y"
1607 (yyval
.Number
) = (yyvsp
[0].Number
);
1609 #line 1610 "cmExprParser.cxx"
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"
1621 #line 1622 "cmExprParser.cxx"
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
);
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
1651 : yydefgoto
[yylhs
]);
1657 /*--------------------------------------.
1658 | yyerrlab -- here on detecting error. |
1659 `--------------------------------------*/
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. */
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)
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
)));
1684 yysyntax_error_status
1685 = yysyntax_error (&yymsg_alloc
, &yymsg
, &yyctx
);
1691 yymsg_alloc
= sizeof yymsgbuf
;
1692 yysyntax_error_status
= YYENOMEM
;
1695 yyerror (yyscanner
, yymsgp
);
1696 if (yysyntax_error_status
== YYENOMEM
)
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
)
1714 yydestruct ("Error: discarding",
1715 yytoken
, &yylval
, yyscanner
);
1720 /* Else will try to reuse lookahead token after shifting the error
1725 /*---------------------------------------------------.
1726 | yyerrorlab -- error raised explicitly by YYERROR. |
1727 `---------------------------------------------------*/
1729 /* Pacify compilers when the user code never invokes YYERROR and the
1730 label yyerrorlab therefore never appears in user code. */
1735 /* Do not reclaim the symbols of the rule whose action triggered
1739 YY_STACK_PRINT (yyss
, yyssp
);
1744 /*-------------------------------------------------------------.
1745 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1746 `-------------------------------------------------------------*/
1748 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1750 /* Pop stack until we find a state that shifts the error token. */
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
)
1765 /* Pop the current state because it cannot handle the error token. */
1770 yydestruct ("Error: popping",
1771 YY_ACCESSING_SYMBOL (yystate
), yyvsp
, yyscanner
);
1774 YY_STACK_PRINT (yyss
, yyssp
);
1777 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1779 YY_IGNORE_MAYBE_UNINITIALIZED_END
1782 /* Shift the error token. */
1783 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn
), yyvsp
, yylsp
);
1789 /*-------------------------------------.
1790 | yyacceptlab -- YYACCEPT comes here. |
1791 `-------------------------------------*/
1797 /*-----------------------------------.
1798 | yyabortlab -- YYABORT comes here. |
1799 `-----------------------------------*/
1805 /*-----------------------------------------------------------.
1806 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1807 `-----------------------------------------------------------*/
1809 yyerror (yyscanner
, YY_("memory exhausted"));
1814 /*----------------------------------------------------------.
1815 | yyreturnlab -- parsing is finished, clean up and return. |
1816 `----------------------------------------------------------*/
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. */
1829 YY_STACK_PRINT (yyss
, yyssp
);
1830 while (yyssp
!= yyss
)
1832 yydestruct ("Cleanup: popping",
1833 YY_ACCESSING_SYMBOL (+*yyssp
), yyvsp
, yyscanner
);
1838 YYSTACK_FREE (yyss
);
1840 if (yymsg
!= yymsgbuf
)
1841 YYSTACK_FREE (yymsg
);
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
);