/src/CMake/Source/LexerParser/cmExprParser.cxx
Line | Count | Source |
1 | | /* A Bison parser, made by GNU Bison 3.8.2. */ |
2 | | |
3 | | /* Bison implementation for Yacc-like parsers in C |
4 | | |
5 | | Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, |
6 | | Inc. |
7 | | |
8 | | This program is free software: you can redistribute it and/or modify |
9 | | it under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
20 | | |
21 | | /* As a special exception, you may create a larger work that contains |
22 | | part or all of the Bison parser skeleton and distribute that work |
23 | | under terms of your choice, so long as that work isn't itself a |
24 | | parser generator using the skeleton or a modified version thereof |
25 | | as a parser skeleton. Alternatively, if you modify or redistribute |
26 | | the parser skeleton itself, you may (at your option) remove this |
27 | | special exception, which will cause the skeleton and the resulting |
28 | | Bison output files to be licensed under the GNU General Public |
29 | | License without this special exception. |
30 | | |
31 | | This special exception was added by the Free Software Foundation in |
32 | | version 2.2 of Bison. */ |
33 | | |
34 | | /* C LALR(1) parser skeleton written by Richard Stallman, by |
35 | | simplifying the original so-called "semantic" parser. */ |
36 | | |
37 | | /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, |
38 | | especially those whose name start with YY_ or yy_. They are |
39 | | private implementation details that can be changed or removed. */ |
40 | | |
41 | | /* All symbols defined below should begin with yy or YY, to avoid |
42 | | infringing on user name space. This should be done even for local |
43 | | variables, as they might otherwise be expanded by user macros. |
44 | | There are some unavoidable exceptions within include files to |
45 | | define necessary library symbols; they are noted "INFRINGES ON |
46 | | USER NAME SPACE" below. */ |
47 | | |
48 | | /* Identify Bison output, and Bison version. */ |
49 | | #define YYBISON 30802 |
50 | | |
51 | | /* Bison version string. */ |
52 | | #define YYBISON_VERSION "3.8.2" |
53 | | |
54 | | /* Skeleton name. */ |
55 | | #define YYSKELETON_NAME "yacc.c" |
56 | | |
57 | | /* Pure parsers. */ |
58 | | #define YYPURE 1 |
59 | | |
60 | | /* Push parsers. */ |
61 | | #define YYPUSH 0 |
62 | | |
63 | | /* Pull parsers. */ |
64 | | #define YYPULL 1 |
65 | | |
66 | | |
67 | | /* Substitute the variable and function names. */ |
68 | | #define yyparse cmExpr_yyparse |
69 | 18.6k | #define yylex cmExpr_yylex |
70 | 234 | #define yyerror cmExpr_yyerror |
71 | 266k | #define yydebug cmExpr_yydebug |
72 | 233 | #define yynerrs cmExpr_yynerrs |
73 | | |
74 | | /* First part of user prologue. */ |
75 | | #line 1 "cmExprParser.y" |
76 | | |
77 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
78 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
79 | | /* |
80 | | |
81 | | This file must be translated to C and modified to build everywhere. |
82 | | |
83 | | Run bison like this: |
84 | | |
85 | | bison --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h -ocmExprParser.cxx cmExprParser.y |
86 | | |
87 | | */ |
88 | | |
89 | | #include "cmConfigure.h" // IWYU pragma: keep |
90 | | |
91 | | #include <stdlib.h> |
92 | | #include <string.h> |
93 | | #include <stdexcept> |
94 | | |
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. */ |
100 | | |
101 | | /* Forward declare the lexer entry point. */ |
102 | | YY_DECL; |
103 | | |
104 | | /* Helper function to forward error callback from parser. */ |
105 | | static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); |
106 | | |
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 |
124 | | |
125 | | #if defined(__NVCOMPILER) |
126 | | # pragma diag_suppress 550 /* variable set but never used */ |
127 | | #endif |
128 | | |
129 | | #line 130 "cmExprParser.cxx" |
130 | | |
131 | | # ifndef YY_CAST |
132 | | # ifdef __cplusplus |
133 | 92.1k | # 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 | 544 | # 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 |
151 | | |
152 | | #include "cmExprParserTokens.h" |
153 | | /* Symbol kind. */ |
154 | | enum yysymbol_kind_t |
155 | | { |
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 */ |
184 | | }; |
185 | | typedef enum yysymbol_kind_t yysymbol_kind_t; |
186 | | |
187 | | |
188 | | |
189 | | |
190 | | #ifdef short |
191 | | # undef short |
192 | | #endif |
193 | | |
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. */ |
197 | | |
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 |
205 | | |
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. */ |
210 | | |
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 |
218 | | |
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 |
226 | | |
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 |
238 | | |
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 |
249 | | |
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 |
260 | | |
261 | | #ifndef YYPTRDIFF_T |
262 | | # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
263 | 2.38k | # 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 |
276 | | |
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 |
289 | | |
290 | | #define YYSIZE_MAXIMUM \ |
291 | 311 | YY_CAST (YYPTRDIFF_T, \ |
292 | | (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
293 | | ? YYPTRDIFF_MAXIMUM \ |
294 | | : YY_CAST (YYSIZE_T, -1))) |
295 | | |
296 | | #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
297 | | |
298 | | |
299 | | /* Stored state numbers (used for stacks). */ |
300 | | typedef yytype_int8 yy_state_t; |
301 | | |
302 | | /* State numbers in computations. */ |
303 | | typedef int yy_state_fast_t; |
304 | | |
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 | 234 | # define YY_(Msgid) Msgid |
314 | | # endif |
315 | | #endif |
316 | | |
317 | | |
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 |
325 | | |
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 |
333 | | |
334 | | /* Suppress unused-variable warnings by "using" E. */ |
335 | | #if ! defined lint || defined __GNUC__ |
336 | 11.3k | # define YY_USE(E) ((void) (E)) |
337 | | #else |
338 | | # define YY_USE(E) /* empty */ |
339 | | #endif |
340 | | |
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 | 1.49k | # 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 |
365 | | |
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 |
377 | | |
378 | | |
379 | 56.5k | #define YY_ASSERT(E) ((void) (0 && (E))) |
380 | | |
381 | | #if 1 |
382 | | |
383 | | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
384 | | |
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 |
408 | | |
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 | 0 | # define YYSTACK_FREE YYFREE |
422 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
423 | 311 | # 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 | 0 | # 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 */ |
447 | | |
448 | | #if (! defined yyoverflow \ |
449 | | && (! defined __cplusplus \ |
450 | | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
451 | | |
452 | | /* A type that is properly aligned for any stack member. */ |
453 | | union yyalloc |
454 | | { |
455 | | yy_state_t yyss_alloc; |
456 | | YYSTYPE yyvs_alloc; |
457 | | }; |
458 | | |
459 | | /* The size of the maximum gap between one aligned stack and the next. */ |
460 | | # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
461 | | |
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) |
467 | | |
468 | | # define YYCOPY_NEEDED 1 |
469 | | |
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 \ |
477 | | { \ |
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); \ |
483 | | } \ |
484 | | while (0) |
485 | | |
486 | | #endif |
487 | | |
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 \ |
498 | | { \ |
499 | | YYPTRDIFF_T yyi; \ |
500 | | for (yyi = 0; yyi < (Count); yyi++) \ |
501 | | (Dst)[yyi] = (Src)[yyi]; \ |
502 | | } \ |
503 | | while (0) |
504 | | # endif |
505 | | # endif |
506 | | #endif /* !YYCOPY_NEEDED */ |
507 | | |
508 | | /* YYFINAL -- State number of the termination state. */ |
509 | 56.5k | #define YYFINAL 19 |
510 | | /* YYLAST -- Last index in YYTABLE. */ |
511 | 106k | #define YYLAST 34 |
512 | | |
513 | | /* YYNTOKENS -- Number of terminals. */ |
514 | 37.9k | #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 |
521 | | |
522 | | /* YYMAXUTOK -- Last valid token kind. */ |
523 | 30.5k | #define YYMAXUTOK 271 |
524 | | |
525 | | |
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 | 30.8k | (0 <= (YYX) && (YYX) <= YYMAXUTOK \ |
530 | 30.8k | ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ |
531 | 30.8k | : YYSYMBOL_YYUNDEF) |
532 | | |
533 | | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
534 | | as returned by yylex. */ |
535 | | static const yytype_int8 yytranslate[] = |
536 | | { |
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 |
565 | | }; |
566 | | |
567 | | #if YYDEBUG |
568 | | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
569 | | static const yytype_uint8 yyrline[] = |
570 | | { |
571 | | 0, 87, 87, 92, 95, 100, 103, 108, 111, 116, |
572 | | 119, 122, 127, 130, 133, 138, 141, 144, 150, 158, |
573 | | 161, 164, 167, 172, 175 |
574 | | }; |
575 | | #endif |
576 | | |
577 | | /** Accessing symbol of state STATE. */ |
578 | 3.56k | #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
579 | | |
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; |
584 | | |
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[] = |
588 | | { |
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 |
595 | | }; |
596 | | |
597 | | static const char * |
598 | | yysymbol_name (yysymbol_kind_t yysymbol) |
599 | 0 | { |
600 | 0 | return yytname[yysymbol]; |
601 | 0 | } |
602 | | #endif |
603 | | |
604 | 59.1k | #define YYPACT_NINF (-11) |
605 | | |
606 | | #define yypact_value_is_default(Yyn) \ |
607 | 59.1k | ((Yyn) == YYPACT_NINF) |
608 | | |
609 | | #define YYTABLE_NINF (-1) |
610 | | |
611 | | #define yytable_value_is_error(Yyn) \ |
612 | 0 | 0 |
613 | | |
614 | | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
615 | | STATE-NUM. */ |
616 | | static const yytype_int8 yypact[] = |
617 | | { |
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, |
622 | | -11 |
623 | | }; |
624 | | |
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[] = |
629 | | { |
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, |
634 | | 18 |
635 | | }; |
636 | | |
637 | | /* YYPGOTO[NTERM-NUM]. */ |
638 | | static const yytype_int8 yypgoto[] = |
639 | | { |
640 | | -11, -11, 22, 10, 8, 12, -3, -2, -1, -11 |
641 | | }; |
642 | | |
643 | | /* YYDEFGOTO[NTERM-NUM]. */ |
644 | | static const yytype_int8 yydefgoto[] = |
645 | | { |
646 | | 0, 6, 7, 8, 9, 10, 11, 12, 13, 14 |
647 | | }; |
648 | | |
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[] = |
653 | | { |
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 |
658 | | }; |
659 | | |
660 | | static const yytype_int8 yycheck[] = |
661 | | { |
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 |
666 | | }; |
667 | | |
668 | | /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of |
669 | | state STATE-NUM. */ |
670 | | static const yytype_int8 yystos[] = |
671 | | { |
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, |
676 | | 25 |
677 | | }; |
678 | | |
679 | | /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ |
680 | | static const yytype_int8 yyr1[] = |
681 | | { |
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 |
685 | | }; |
686 | | |
687 | | /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ |
688 | | static const yytype_int8 yyr2[] = |
689 | | { |
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 |
693 | | }; |
694 | | |
695 | | |
696 | | enum { YYENOMEM = -2 }; |
697 | | |
698 | | #define yyerrok (yyerrstatus = 0) |
699 | | #define yyclearin (yychar = YYEMPTY) |
700 | | |
701 | 429 | #define YYACCEPT goto yyacceptlab |
702 | 233 | #define YYABORT goto yyabortlab |
703 | 0 | #define YYERROR goto yyerrorlab |
704 | 1 | #define YYNOMEM goto yyexhaustedlab |
705 | | |
706 | | |
707 | | #define YYRECOVERING() (!!yyerrstatus) |
708 | | |
709 | | #define YYBACKUP(Token, Value) \ |
710 | | do \ |
711 | | if (yychar == YYEMPTY) \ |
712 | | { \ |
713 | | yychar = (Token); \ |
714 | | yylval = (Value); \ |
715 | | YYPOPSTACK (yylen); \ |
716 | | yystate = *yyssp; \ |
717 | | goto yybackup; \ |
718 | | } \ |
719 | | else \ |
720 | | { \ |
721 | | yyerror (yyscanner, YY_("syntax error: cannot back up")); \ |
722 | | YYERROR; \ |
723 | | } \ |
724 | | while (0) |
725 | | |
726 | | /* Backward compatibility with an undocumented macro. |
727 | | Use YYerror or YYUNDEF. */ |
728 | | #define YYERRCODE YYUNDEF |
729 | | |
730 | | |
731 | | /* Enable debugging if requested. */ |
732 | | #if YYDEBUG |
733 | | |
734 | | # ifndef YYFPRINTF |
735 | | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
736 | 0 | # define YYFPRINTF fprintf |
737 | | # endif |
738 | | |
739 | 79.1k | # define YYDPRINTF(Args) \ |
740 | 79.1k | do { \ |
741 | 79.1k | if (yydebug) \ |
742 | 79.1k | YYFPRINTF Args; \ |
743 | 79.1k | } while (0) |
744 | | |
745 | | |
746 | | |
747 | | |
748 | 89.8k | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ |
749 | 89.8k | do { \ |
750 | 89.8k | if (yydebug) \ |
751 | 89.8k | { \ |
752 | 0 | YYFPRINTF (stderr, "%s ", Title); \ |
753 | 0 | yy_symbol_print (stderr, \ |
754 | 0 | Kind, Value, yyscanner); \ |
755 | 0 | YYFPRINTF (stderr, "\n"); \ |
756 | 0 | } \ |
757 | 89.8k | } while (0) |
758 | | |
759 | | |
760 | | /*-----------------------------------. |
761 | | | Print this symbol's value on YYO. | |
762 | | `-----------------------------------*/ |
763 | | |
764 | | static void |
765 | | yy_symbol_value_print (FILE *yyo, |
766 | | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) |
767 | 0 | { |
768 | 0 | FILE *yyoutput = yyo; |
769 | 0 | YY_USE (yyoutput); |
770 | 0 | YY_USE (yyscanner); |
771 | 0 | if (!yyvaluep) |
772 | 0 | return; |
773 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
774 | 0 | YY_USE (yykind); |
775 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
776 | 0 | } |
777 | | |
778 | | |
779 | | /*---------------------------. |
780 | | | Print this symbol on YYO. | |
781 | | `---------------------------*/ |
782 | | |
783 | | static void |
784 | | yy_symbol_print (FILE *yyo, |
785 | | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) |
786 | 0 | { |
787 | 0 | YYFPRINTF (yyo, "%s %s (", |
788 | 0 | yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); |
789 | |
|
790 | 0 | yy_symbol_value_print (yyo, yykind, yyvaluep, yyscanner); |
791 | 0 | YYFPRINTF (yyo, ")"); |
792 | 0 | } |
793 | | |
794 | | /*------------------------------------------------------------------. |
795 | | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
796 | | | TOP (included). | |
797 | | `------------------------------------------------------------------*/ |
798 | | |
799 | | static void |
800 | | yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
801 | 0 | { |
802 | 0 | YYFPRINTF (stderr, "Stack now"); |
803 | 0 | for (; yybottom <= yytop; yybottom++) |
804 | 0 | { |
805 | 0 | int yybot = *yybottom; |
806 | 0 | YYFPRINTF (stderr, " %d", yybot); |
807 | 0 | } |
808 | 0 | YYFPRINTF (stderr, "\n"); |
809 | 0 | } |
810 | | |
811 | 59.7k | # define YY_STACK_PRINT(Bottom, Top) \ |
812 | 59.7k | do { \ |
813 | 59.7k | if (yydebug) \ |
814 | 59.7k | yy_stack_print ((Bottom), (Top)); \ |
815 | 59.7k | } while (0) |
816 | | |
817 | | |
818 | | /*------------------------------------------------. |
819 | | | Report that the YYRULE is going to be reduced. | |
820 | | `------------------------------------------------*/ |
821 | | |
822 | | static void |
823 | | yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, |
824 | | int yyrule, yyscan_t yyscanner) |
825 | 0 | { |
826 | 0 | int yylno = yyrline[yyrule]; |
827 | 0 | int yynrhs = yyr2[yyrule]; |
828 | 0 | int yyi; |
829 | 0 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
830 | 0 | yyrule - 1, yylno); |
831 | | /* The symbols being reduced. */ |
832 | 0 | for (yyi = 0; yyi < yynrhs; yyi++) |
833 | 0 | { |
834 | 0 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
835 | 0 | yy_symbol_print (stderr, |
836 | 0 | YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), |
837 | 0 | &yyvsp[(yyi + 1) - (yynrhs)], yyscanner); |
838 | 0 | YYFPRINTF (stderr, "\n"); |
839 | 0 | } |
840 | 0 | } |
841 | | |
842 | 37.5k | # define YY_REDUCE_PRINT(Rule) \ |
843 | 37.5k | do { \ |
844 | 37.5k | if (yydebug) \ |
845 | 37.5k | yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \ |
846 | 37.5k | } while (0) |
847 | | |
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 */ |
857 | | |
858 | | |
859 | | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
860 | | #ifndef YYINITDEPTH |
861 | 746 | # define YYINITDEPTH 200 |
862 | | #endif |
863 | | |
864 | | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
865 | | if the built-in stack extension method is used). |
866 | | |
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. */ |
870 | | |
871 | | #ifndef YYMAXDEPTH |
872 | | # define YYMAXDEPTH 10000 |
873 | | #endif |
874 | | |
875 | | |
876 | | /* Context of a parse error. */ |
877 | | typedef struct |
878 | | { |
879 | | yy_state_t *yyssp; |
880 | | yysymbol_kind_t yytoken; |
881 | | } yypcontext_t; |
882 | | |
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) |
892 | 233 | { |
893 | | /* Actual size of YYARG. */ |
894 | 233 | int yycount = 0; |
895 | 233 | int yyn = yypact[+*yyctx->yyssp]; |
896 | 233 | if (!yypact_value_is_default (yyn)) |
897 | 233 | { |
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 | 233 | int yyxbegin = yyn < 0 ? -yyn : 0; |
902 | | /* Stay within bounds of both yycheck and yytname. */ |
903 | 233 | int yychecklim = YYLAST - yyn + 1; |
904 | 233 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
905 | 233 | int yyx; |
906 | 4.02k | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
907 | 3.96k | if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror |
908 | 0 | && !yytable_value_is_error (yytable[yyx + yyn])) |
909 | 938 | { |
910 | 938 | if (!yyarg) |
911 | 0 | ++yycount; |
912 | 938 | else if (yycount == yyargn) |
913 | 172 | return 0; |
914 | 766 | else |
915 | 766 | yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); |
916 | 938 | } |
917 | 233 | } |
918 | 61 | if (yyarg && yycount == 0 && 0 < yyargn) |
919 | 0 | yyarg[0] = YYSYMBOL_YYEMPTY; |
920 | 61 | return yycount; |
921 | 233 | } |
922 | | |
923 | | |
924 | | |
925 | | |
926 | | #ifndef yystrlen |
927 | | # if defined __GLIBC__ && defined _STRING_H |
928 | 371 | # 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) |
933 | | { |
934 | | YYPTRDIFF_T yylen; |
935 | | for (yylen = 0; yystr[yylen]; yylen++) |
936 | | continue; |
937 | | return yylen; |
938 | | } |
939 | | # endif |
940 | | #endif |
941 | | |
942 | | #ifndef yystpcpy |
943 | | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
944 | 138 | # 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) |
950 | | { |
951 | | char *yyd = yydest; |
952 | | const char *yys = yysrc; |
953 | | |
954 | | while ((*yyd++ = *yys++) != '\0') |
955 | | continue; |
956 | | |
957 | | return yyd - 1; |
958 | | } |
959 | | # endif |
960 | | #endif |
961 | | |
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) |
972 | 622 | { |
973 | 622 | if (*yystr == '"') |
974 | 346 | { |
975 | 346 | YYPTRDIFF_T yyn = 0; |
976 | 346 | char const *yyp = yystr; |
977 | 346 | for (;;) |
978 | 4.15k | switch (*++yyp) |
979 | 4.15k | { |
980 | 0 | case '\'': |
981 | 0 | case ',': |
982 | 0 | goto do_not_strip_quotes; |
983 | | |
984 | 0 | case '\\': |
985 | 0 | if (*++yyp != '\\') |
986 | 0 | goto do_not_strip_quotes; |
987 | 0 | else |
988 | 0 | goto append; |
989 | | |
990 | 0 | append: |
991 | 3.80k | default: |
992 | 3.80k | if (yyres) |
993 | 1.90k | yyres[yyn] = *yyp; |
994 | 3.80k | yyn++; |
995 | 3.80k | break; |
996 | | |
997 | 346 | case '"': |
998 | 346 | if (yyres) |
999 | 173 | yyres[yyn] = '\0'; |
1000 | 346 | return yyn; |
1001 | 4.15k | } |
1002 | 0 | do_not_strip_quotes: ; |
1003 | 0 | } |
1004 | | |
1005 | 276 | if (yyres) |
1006 | 138 | return yystpcpy (yyres, yystr) - yyres; |
1007 | 138 | else |
1008 | 138 | return yystrlen (yystr); |
1009 | 276 | } |
1010 | | #endif |
1011 | | |
1012 | | |
1013 | | static int |
1014 | | yy_syntax_error_arguments (const yypcontext_t *yyctx, |
1015 | | yysymbol_kind_t yyarg[], int yyargn) |
1016 | 233 | { |
1017 | | /* Actual size of YYARG. */ |
1018 | 233 | 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. |
1041 | | */ |
1042 | 233 | if (yyctx->yytoken != YYSYMBOL_YYEMPTY) |
1043 | 233 | { |
1044 | 233 | int yyn; |
1045 | 233 | if (yyarg) |
1046 | 233 | yyarg[yycount] = yyctx->yytoken; |
1047 | 233 | ++yycount; |
1048 | 233 | yyn = yypcontext_expected_tokens (yyctx, |
1049 | 233 | yyarg ? yyarg + 1 : yyarg, yyargn - 1); |
1050 | 233 | if (yyn == YYENOMEM) |
1051 | 0 | return YYENOMEM; |
1052 | 233 | else |
1053 | 233 | yycount += yyn; |
1054 | 233 | } |
1055 | 233 | return yycount; |
1056 | 233 | } |
1057 | | |
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. |
1061 | | |
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) |
1069 | 233 | { |
1070 | 233 | enum { YYARGS_MAX = 5 }; |
1071 | | /* Internationalized format string. */ |
1072 | 233 | const char *yyformat = YY_NULLPTR; |
1073 | | /* Arguments of yyformat: reported tokens (one for the "unexpected", |
1074 | | one per "expected"). */ |
1075 | 233 | yysymbol_kind_t yyarg[YYARGS_MAX]; |
1076 | | /* Cumulated lengths of YYARG. */ |
1077 | 233 | YYPTRDIFF_T yysize = 0; |
1078 | | |
1079 | | /* Actual size of YYARG. */ |
1080 | 233 | int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); |
1081 | 233 | if (yycount == YYENOMEM) |
1082 | 0 | return YYENOMEM; |
1083 | | |
1084 | 233 | switch (yycount) |
1085 | 233 | { |
1086 | 0 | #define YYCASE_(N, S) \ |
1087 | 233 | case N: \ |
1088 | 233 | yyformat = S; \ |
1089 | 233 | break |
1090 | 0 | default: /* Avoid compiler warnings. */ |
1091 | 0 | YYCASE_(0, YY_("syntax error")); |
1092 | 172 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
1093 | 44 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
1094 | 17 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
1095 | 0 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
1096 | 233 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
1097 | 233 | #undef YYCASE_ |
1098 | 233 | } |
1099 | | |
1100 | | /* Compute error message size. Don't count the "%s"s, but reserve |
1101 | | room for the terminator. */ |
1102 | 233 | yysize = yystrlen (yyformat) - 2 * yycount + 1; |
1103 | 233 | { |
1104 | 233 | int yyi; |
1105 | 544 | for (yyi = 0; yyi < yycount; ++yyi) |
1106 | 311 | { |
1107 | 311 | YYPTRDIFF_T yysize1 |
1108 | 311 | = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); |
1109 | 311 | if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
1110 | 311 | yysize = yysize1; |
1111 | 0 | else |
1112 | 0 | return YYENOMEM; |
1113 | 311 | } |
1114 | 233 | } |
1115 | | |
1116 | 233 | if (*yymsg_alloc < yysize) |
1117 | 0 | { |
1118 | 0 | *yymsg_alloc = 2 * yysize; |
1119 | 0 | if (! (yysize <= *yymsg_alloc |
1120 | 0 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
1121 | 0 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
1122 | 0 | return -1; |
1123 | 0 | } |
1124 | | |
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. */ |
1128 | 233 | { |
1129 | 233 | char *yyp = *yymsg; |
1130 | 233 | int yyi = 0; |
1131 | 7.16k | while ((*yyp = *yyformat) != '\0') |
1132 | 6.93k | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
1133 | 311 | { |
1134 | 311 | yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); |
1135 | 311 | yyformat += 2; |
1136 | 311 | } |
1137 | 6.62k | else |
1138 | 6.62k | { |
1139 | 6.62k | ++yyp; |
1140 | 6.62k | ++yyformat; |
1141 | 6.62k | } |
1142 | 233 | } |
1143 | 233 | return 0; |
1144 | 233 | } |
1145 | | |
1146 | | |
1147 | | /*-----------------------------------------------. |
1148 | | | Release the memory associated to this symbol. | |
1149 | | `-----------------------------------------------*/ |
1150 | | |
1151 | | static void |
1152 | | yydestruct (const char *yymsg, |
1153 | | yysymbol_kind_t yykind, YYSTYPE *yyvaluep, yyscan_t yyscanner) |
1154 | 3.79k | { |
1155 | 3.79k | YY_USE (yyvaluep); |
1156 | 3.79k | YY_USE (yyscanner); |
1157 | 3.79k | if (!yymsg) |
1158 | 0 | yymsg = "Deleting"; |
1159 | 3.79k | YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); |
1160 | | |
1161 | 3.79k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1162 | 3.79k | YY_USE (yykind); |
1163 | 3.79k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1164 | 3.79k | } |
1165 | | |
1166 | | |
1167 | | |
1168 | | |
1169 | | |
1170 | | |
1171 | | /*----------. |
1172 | | | yyparse. | |
1173 | | `----------*/ |
1174 | | |
1175 | | int |
1176 | | yyparse (yyscan_t yyscanner) |
1177 | 746 | { |
1178 | | /* Lookahead token kind. */ |
1179 | 746 | int yychar; |
1180 | | |
1181 | | |
1182 | | /* The semantic value of the lookahead symbol. */ |
1183 | | /* Default value used for initialization, for pacifying older GCCs |
1184 | | or non-GCC compilers. */ |
1185 | 746 | YY_INITIAL_VALUE (static YYSTYPE yyval_default;) |
1186 | 746 | YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); |
1187 | | |
1188 | | /* Number of syntax errors so far. */ |
1189 | 746 | int yynerrs = 0; |
1190 | | |
1191 | 746 | yy_state_fast_t yystate = 0; |
1192 | | /* Number of tokens to shift before error messages enabled. */ |
1193 | 746 | int yyerrstatus = 0; |
1194 | | |
1195 | | /* Refer to the stacks through separate pointers, to allow yyoverflow |
1196 | | to reallocate them elsewhere. */ |
1197 | | |
1198 | | /* Their size. */ |
1199 | 746 | YYPTRDIFF_T yystacksize = YYINITDEPTH; |
1200 | | |
1201 | | /* The state stack: array, bottom, top. */ |
1202 | 746 | yy_state_t yyssa[YYINITDEPTH]; |
1203 | 746 | yy_state_t *yyss = yyssa; |
1204 | 746 | yy_state_t *yyssp = yyss; |
1205 | | |
1206 | | /* The semantic value stack: array, bottom, top. */ |
1207 | 746 | YYSTYPE yyvsa[YYINITDEPTH]; |
1208 | 746 | YYSTYPE *yyvs = yyvsa; |
1209 | 746 | YYSTYPE *yyvsp = yyvs; |
1210 | | |
1211 | 746 | int yyn; |
1212 | | /* The return value of yyparse. */ |
1213 | 746 | int yyresult; |
1214 | | /* Lookahead symbol kind. */ |
1215 | 746 | yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; |
1216 | | /* The variables used to return semantic value and location from the |
1217 | | action routines. */ |
1218 | 746 | YYSTYPE yyval; |
1219 | | |
1220 | | /* Buffer for error messages, and its allocated size. */ |
1221 | 746 | char yymsgbuf[128]; |
1222 | 746 | char *yymsg = yymsgbuf; |
1223 | 746 | YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; |
1224 | | |
1225 | 41.7k | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
1226 | | |
1227 | | /* The number of symbols on the RHS of the reduced rule. |
1228 | | Keep to zero when no symbol should be popped. */ |
1229 | 746 | int yylen = 0; |
1230 | | |
1231 | 746 | YYDPRINTF ((stderr, "Starting parse\n")); |
1232 | | |
1233 | 746 | yychar = YYEMPTY; /* Cause a token to be read. */ |
1234 | | |
1235 | 746 | goto yysetstate; |
1236 | | |
1237 | | |
1238 | | /*------------------------------------------------------------. |
1239 | | | yynewstate -- push a new state, which is found in yystate. | |
1240 | | `------------------------------------------------------------*/ |
1241 | 55.8k | 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 | 55.8k | yyssp++; |
1245 | | |
1246 | | |
1247 | | /*--------------------------------------------------------------------. |
1248 | | | yysetstate -- set current state (the top of the stack) to yystate. | |
1249 | | `--------------------------------------------------------------------*/ |
1250 | 56.5k | yysetstate: |
1251 | 56.5k | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1252 | 56.5k | YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
1253 | 56.5k | YY_IGNORE_USELESS_CAST_BEGIN |
1254 | 56.5k | *yyssp = YY_CAST (yy_state_t, yystate); |
1255 | 56.5k | YY_IGNORE_USELESS_CAST_END |
1256 | 56.5k | YY_STACK_PRINT (yyss, yyssp); |
1257 | | |
1258 | 56.5k | if (yyss + yystacksize - 1 <= yyssp) |
1259 | 1 | #if !defined yyoverflow && !defined YYSTACK_RELOCATE |
1260 | 1 | YYNOMEM; |
1261 | | #else |
1262 | | { |
1263 | | /* Get the current used size of the three stacks, in elements. */ |
1264 | | YYPTRDIFF_T yysize = yyssp - yyss + 1; |
1265 | | |
1266 | | # if defined yyoverflow |
1267 | | { |
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; |
1273 | | |
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; |
1284 | | } |
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; |
1292 | | |
1293 | | { |
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); |
1305 | | } |
1306 | | # endif |
1307 | | |
1308 | | yyssp = yyss + yysize - 1; |
1309 | | yyvsp = yyvs + yysize - 1; |
1310 | | |
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 |
1315 | | |
1316 | | if (yyss + yystacksize - 1 <= yyssp) |
1317 | | YYABORT; |
1318 | | } |
1319 | | #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
1320 | | |
1321 | | |
1322 | 56.5k | if (yystate == YYFINAL) |
1323 | 429 | YYACCEPT; |
1324 | | |
1325 | 56.1k | goto yybackup; |
1326 | | |
1327 | | |
1328 | | /*-----------. |
1329 | | | yybackup. | |
1330 | | `-----------*/ |
1331 | 56.1k | yybackup: |
1332 | | /* Do appropriate processing given the current state. Read a |
1333 | | lookahead token if we need one and don't already have one. */ |
1334 | | |
1335 | | /* First try to decide what to do without reference to lookahead token. */ |
1336 | 56.1k | yyn = yypact[yystate]; |
1337 | 56.1k | if (yypact_value_is_default (yyn)) |
1338 | 22.8k | goto yydefault; |
1339 | | |
1340 | | /* Not known => get a lookahead token if don't already have one. */ |
1341 | | |
1342 | | /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ |
1343 | 33.3k | if (yychar == YYEMPTY) |
1344 | 18.6k | { |
1345 | 18.6k | YYDPRINTF ((stderr, "Reading a token\n")); |
1346 | 18.6k | yychar = yylex (&yylval, yyscanner); |
1347 | 18.6k | } |
1348 | | |
1349 | 33.3k | if (yychar <= YYEOF) |
1350 | 3.17k | { |
1351 | 3.17k | yychar = YYEOF; |
1352 | 3.17k | yytoken = YYSYMBOL_YYEOF; |
1353 | 3.17k | YYDPRINTF ((stderr, "Now at end of input.\n")); |
1354 | 3.17k | } |
1355 | 30.1k | else if (yychar == YYerror) |
1356 | 0 | { |
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 | 0 | yychar = YYUNDEF; |
1362 | 0 | yytoken = YYSYMBOL_YYerror; |
1363 | 0 | goto yyerrlab1; |
1364 | 0 | } |
1365 | 30.1k | else |
1366 | 30.1k | { |
1367 | 30.1k | yytoken = YYTRANSLATE (yychar); |
1368 | 30.1k | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
1369 | 30.1k | } |
1370 | | |
1371 | | /* If the proper action on seeing token YYTOKEN is to reduce or to |
1372 | | detect an error, take that action. */ |
1373 | 33.3k | yyn += yytoken; |
1374 | 33.3k | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
1375 | 14.9k | goto yydefault; |
1376 | 18.3k | yyn = yytable[yyn]; |
1377 | 18.3k | if (yyn <= 0) |
1378 | 0 | { |
1379 | 0 | if (yytable_value_is_error (yyn)) |
1380 | 0 | goto yyerrlab; |
1381 | 0 | yyn = -yyn; |
1382 | 0 | goto yyreduce; |
1383 | 0 | } |
1384 | | |
1385 | | /* Count tokens shifted since error; after three, turn off error |
1386 | | status. */ |
1387 | 18.3k | if (yyerrstatus) |
1388 | 0 | yyerrstatus--; |
1389 | | |
1390 | | /* Shift the lookahead token. */ |
1391 | 18.3k | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1392 | 18.3k | yystate = yyn; |
1393 | 18.3k | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1394 | 18.3k | *++yyvsp = yylval; |
1395 | 18.3k | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1396 | | |
1397 | | /* Discard the shifted token. */ |
1398 | 18.3k | yychar = YYEMPTY; |
1399 | 18.3k | goto yynewstate; |
1400 | | |
1401 | | |
1402 | | /*-----------------------------------------------------------. |
1403 | | | yydefault -- do the default action for the current state. | |
1404 | | `-----------------------------------------------------------*/ |
1405 | 37.7k | yydefault: |
1406 | 37.7k | yyn = yydefact[yystate]; |
1407 | 37.7k | if (yyn == 0) |
1408 | 233 | goto yyerrlab; |
1409 | 37.5k | goto yyreduce; |
1410 | | |
1411 | | |
1412 | | /*-----------------------------. |
1413 | | | yyreduce -- do a reduction. | |
1414 | | `-----------------------------*/ |
1415 | 37.5k | yyreduce: |
1416 | | /* yyn is the number of a rule to reduce with. */ |
1417 | 37.5k | yylen = yyr2[yyn]; |
1418 | | |
1419 | | /* If YYLEN is nonzero, implement the default value of the action: |
1420 | | '$$ = $1'. |
1421 | | |
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 | 37.5k | yyval = yyvsp[1-yylen]; |
1428 | | |
1429 | | |
1430 | 37.5k | YY_REDUCE_PRINT (yyn); |
1431 | 37.5k | switch (yyn) |
1432 | 37.5k | { |
1433 | 473 | case 2: /* start: exp */ |
1434 | 473 | #line 87 "cmExprParser.y" |
1435 | 473 | { |
1436 | 473 | cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); |
1437 | 473 | } |
1438 | 473 | #line 1439 "cmExprParser.cxx" |
1439 | 473 | break; |
1440 | | |
1441 | 901 | case 3: /* exp: bitwiseor */ |
1442 | 901 | #line 92 "cmExprParser.y" |
1443 | 901 | { |
1444 | 901 | (yyval.Number) = (yyvsp[0].Number); |
1445 | 901 | } |
1446 | 901 | #line 1447 "cmExprParser.cxx" |
1447 | 901 | break; |
1448 | | |
1449 | 540 | case 4: /* exp: exp exp_OR bitwiseor */ |
1450 | 540 | #line 95 "cmExprParser.y" |
1451 | 540 | { |
1452 | 540 | (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); |
1453 | 540 | } |
1454 | 540 | #line 1455 "cmExprParser.cxx" |
1455 | 540 | break; |
1456 | | |
1457 | 1.51k | case 5: /* bitwiseor: bitwisexor */ |
1458 | 1.51k | #line 100 "cmExprParser.y" |
1459 | 1.51k | { |
1460 | 1.51k | (yyval.Number) = (yyvsp[0].Number); |
1461 | 1.51k | } |
1462 | 1.51k | #line 1463 "cmExprParser.cxx" |
1463 | 1.51k | break; |
1464 | | |
1465 | 503 | case 6: /* bitwiseor: bitwiseor exp_XOR bitwisexor */ |
1466 | 503 | #line 103 "cmExprParser.y" |
1467 | 503 | { |
1468 | 503 | (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); |
1469 | 503 | } |
1470 | 503 | #line 1471 "cmExprParser.cxx" |
1471 | 503 | break; |
1472 | | |
1473 | 2.02k | case 7: /* bitwisexor: bitwiseand */ |
1474 | 2.02k | #line 108 "cmExprParser.y" |
1475 | 2.02k | { |
1476 | 2.02k | (yyval.Number) = (yyvsp[0].Number); |
1477 | 2.02k | } |
1478 | 2.02k | #line 1479 "cmExprParser.cxx" |
1479 | 2.02k | break; |
1480 | | |
1481 | 497 | case 8: /* bitwisexor: bitwisexor exp_AND bitwiseand */ |
1482 | 497 | #line 111 "cmExprParser.y" |
1483 | 497 | { |
1484 | 497 | (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); |
1485 | 497 | } |
1486 | 497 | #line 1487 "cmExprParser.cxx" |
1487 | 497 | break; |
1488 | | |
1489 | 2.53k | case 9: /* bitwiseand: shift */ |
1490 | 2.53k | #line 116 "cmExprParser.y" |
1491 | 2.53k | { |
1492 | 2.53k | (yyval.Number) = (yyvsp[0].Number); |
1493 | 2.53k | } |
1494 | 2.53k | #line 1495 "cmExprParser.cxx" |
1495 | 2.53k | break; |
1496 | | |
1497 | 311 | case 10: /* bitwiseand: bitwiseand exp_SHIFTLEFT shift */ |
1498 | 311 | #line 119 "cmExprParser.y" |
1499 | 311 | { |
1500 | 311 | (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); |
1501 | 311 | } |
1502 | 311 | #line 1503 "cmExprParser.cxx" |
1503 | 311 | break; |
1504 | | |
1505 | 234 | case 11: /* bitwiseand: bitwiseand exp_SHIFTRIGHT shift */ |
1506 | 234 | #line 122 "cmExprParser.y" |
1507 | 234 | { |
1508 | 234 | (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); |
1509 | 234 | } |
1510 | 234 | #line 1511 "cmExprParser.cxx" |
1511 | 234 | break; |
1512 | | |
1513 | 3.15k | case 12: /* shift: term */ |
1514 | 3.15k | #line 127 "cmExprParser.y" |
1515 | 3.15k | { |
1516 | 3.15k | (yyval.Number) = (yyvsp[0].Number); |
1517 | 3.15k | } |
1518 | 3.15k | #line 1519 "cmExprParser.cxx" |
1519 | 3.15k | break; |
1520 | | |
1521 | 931 | case 13: /* shift: shift exp_PLUS term */ |
1522 | 931 | #line 130 "cmExprParser.y" |
1523 | 931 | { |
1524 | 931 | (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); |
1525 | 931 | } |
1526 | 931 | #line 1527 "cmExprParser.cxx" |
1527 | 931 | break; |
1528 | | |
1529 | 1.10k | case 14: /* shift: shift exp_MINUS term */ |
1530 | 1.10k | #line 133 "cmExprParser.y" |
1531 | 1.10k | { |
1532 | 1.10k | (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); |
1533 | 1.10k | } |
1534 | 1.10k | #line 1535 "cmExprParser.cxx" |
1535 | 1.10k | break; |
1536 | | |
1537 | 5.22k | case 15: /* term: unary */ |
1538 | 5.22k | #line 138 "cmExprParser.y" |
1539 | 5.22k | { |
1540 | 5.22k | (yyval.Number) = (yyvsp[0].Number); |
1541 | 5.22k | } |
1542 | 5.22k | #line 1543 "cmExprParser.cxx" |
1543 | 5.22k | break; |
1544 | | |
1545 | 439 | case 16: /* term: term exp_TIMES unary */ |
1546 | 439 | #line 141 "cmExprParser.y" |
1547 | 439 | { |
1548 | 439 | (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); |
1549 | 439 | } |
1550 | 439 | #line 1551 "cmExprParser.cxx" |
1551 | 439 | break; |
1552 | | |
1553 | 395 | case 17: /* term: term exp_DIVIDE unary */ |
1554 | 395 | #line 144 "cmExprParser.y" |
1555 | 395 | { |
1556 | 395 | if (yyvsp[0].Number == 0) { |
1557 | 4 | throw std::overflow_error("divide by zero"); |
1558 | 4 | } |
1559 | 391 | (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); |
1560 | 391 | } |
1561 | 0 | #line 1562 "cmExprParser.cxx" |
1562 | 0 | break; |
1563 | | |
1564 | 605 | case 18: /* term: term exp_MOD unary */ |
1565 | 605 | #line 150 "cmExprParser.y" |
1566 | 605 | { |
1567 | 605 | if (yyvsp[0].Number == 0) { |
1568 | 2 | throw std::overflow_error("modulo by zero"); |
1569 | 2 | } |
1570 | 603 | (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); |
1571 | 603 | } |
1572 | 0 | #line 1573 "cmExprParser.cxx" |
1573 | 0 | break; |
1574 | | |
1575 | 6.66k | case 19: /* unary: factor */ |
1576 | 6.66k | #line 158 "cmExprParser.y" |
1577 | 6.66k | { |
1578 | 6.66k | (yyval.Number) = (yyvsp[0].Number); |
1579 | 6.66k | } |
1580 | 6.66k | #line 1581 "cmExprParser.cxx" |
1581 | 6.66k | break; |
1582 | | |
1583 | 984 | case 20: /* unary: exp_PLUS unary */ |
1584 | 984 | #line 161 "cmExprParser.y" |
1585 | 984 | { |
1586 | 984 | (yyval.Number) = + (yyvsp[0].Number); |
1587 | 984 | } |
1588 | 984 | #line 1589 "cmExprParser.cxx" |
1589 | 984 | break; |
1590 | | |
1591 | 1.37k | case 21: /* unary: exp_MINUS unary */ |
1592 | 1.37k | #line 164 "cmExprParser.y" |
1593 | 1.37k | { |
1594 | 1.37k | (yyval.Number) = - (yyvsp[0].Number); |
1595 | 1.37k | } |
1596 | 1.37k | #line 1597 "cmExprParser.cxx" |
1597 | 1.37k | break; |
1598 | | |
1599 | 465 | case 22: /* unary: exp_NOT unary */ |
1600 | 465 | #line 167 "cmExprParser.y" |
1601 | 465 | { |
1602 | 465 | (yyval.Number) = ~ (yyvsp[0].Number); |
1603 | 465 | } |
1604 | 465 | #line 1605 "cmExprParser.cxx" |
1605 | 465 | break; |
1606 | | |
1607 | 6.29k | case 23: /* factor: exp_NUMBER */ |
1608 | 6.29k | #line 172 "cmExprParser.y" |
1609 | 6.29k | { |
1610 | 6.29k | (yyval.Number) = (yyvsp[0].Number); |
1611 | 6.29k | } |
1612 | 6.29k | #line 1613 "cmExprParser.cxx" |
1613 | 6.29k | break; |
1614 | | |
1615 | 368 | case 24: /* factor: exp_OPENPARENT exp exp_CLOSEPARENT */ |
1616 | 368 | #line 175 "cmExprParser.y" |
1617 | 368 | { |
1618 | 368 | (yyval.Number) = (yyvsp[-1].Number); |
1619 | 368 | } |
1620 | 368 | #line 1621 "cmExprParser.cxx" |
1621 | 368 | break; |
1622 | | |
1623 | | |
1624 | 0 | #line 1625 "cmExprParser.cxx" |
1625 | | |
1626 | 0 | default: break; |
1627 | 37.5k | } |
1628 | | /* User semantic actions sometimes alter yychar, and that requires |
1629 | | that yytoken be updated with the new translation. We take the |
1630 | | approach of translating immediately before every use of yytoken. |
1631 | | One alternative is translating here after every semantic action, |
1632 | | but that translation would be missed if the semantic action invokes |
1633 | | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
1634 | | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
1635 | | incorrect destructor might then be invoked immediately. In the |
1636 | | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
1637 | | to an incorrect destructor call or verbose syntax error message |
1638 | | before the lookahead is translated. */ |
1639 | 37.5k | YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); |
1640 | | |
1641 | 37.5k | YYPOPSTACK (yylen); |
1642 | 37.5k | yylen = 0; |
1643 | | |
1644 | 37.5k | *++yyvsp = yyval; |
1645 | | |
1646 | | /* Now 'shift' the result of the reduction. Determine what state |
1647 | | that goes to, based on the state we popped back to and the rule |
1648 | | number reduced by. */ |
1649 | 37.5k | { |
1650 | 37.5k | const int yylhs = yyr1[yyn] - YYNTOKENS; |
1651 | 37.5k | const int yyi = yypgoto[yylhs] + *yyssp; |
1652 | 37.5k | yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
1653 | 37.5k | ? yytable[yyi] |
1654 | 37.5k | : yydefgoto[yylhs]); |
1655 | 37.5k | } |
1656 | | |
1657 | 37.5k | goto yynewstate; |
1658 | | |
1659 | | |
1660 | | /*--------------------------------------. |
1661 | | | yyerrlab -- here on detecting error. | |
1662 | | `--------------------------------------*/ |
1663 | 233 | yyerrlab: |
1664 | | /* Make sure we have latest lookahead translation. See comments at |
1665 | | user semantic actions for why this is necessary. */ |
1666 | 233 | yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); |
1667 | | /* If not already recovering from an error, report this error. */ |
1668 | 233 | if (!yyerrstatus) |
1669 | 233 | { |
1670 | 233 | ++yynerrs; |
1671 | 233 | { |
1672 | 233 | yypcontext_t yyctx |
1673 | 233 | = {yyssp, yytoken}; |
1674 | 233 | char const *yymsgp = YY_("syntax error"); |
1675 | 233 | int yysyntax_error_status; |
1676 | 233 | yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); |
1677 | 233 | if (yysyntax_error_status == 0) |
1678 | 233 | yymsgp = yymsg; |
1679 | 0 | else if (yysyntax_error_status == -1) |
1680 | 0 | { |
1681 | 0 | if (yymsg != yymsgbuf) |
1682 | 0 | YYSTACK_FREE (yymsg); |
1683 | 0 | yymsg = YY_CAST (char *, |
1684 | 0 | YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); |
1685 | 0 | if (yymsg) |
1686 | 0 | { |
1687 | 0 | yysyntax_error_status |
1688 | 0 | = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); |
1689 | 0 | yymsgp = yymsg; |
1690 | 0 | } |
1691 | 0 | else |
1692 | 0 | { |
1693 | 0 | yymsg = yymsgbuf; |
1694 | 0 | yymsg_alloc = sizeof yymsgbuf; |
1695 | 0 | yysyntax_error_status = YYENOMEM; |
1696 | 0 | } |
1697 | 0 | } |
1698 | 233 | yyerror (yyscanner, yymsgp); |
1699 | 233 | if (yysyntax_error_status == YYENOMEM) |
1700 | 0 | YYNOMEM; |
1701 | 233 | } |
1702 | 233 | } |
1703 | | |
1704 | 233 | if (yyerrstatus == 3) |
1705 | 0 | { |
1706 | | /* If just tried and failed to reuse lookahead token after an |
1707 | | error, discard it. */ |
1708 | |
|
1709 | 0 | if (yychar <= YYEOF) |
1710 | 0 | { |
1711 | | /* Return failure if at end of input. */ |
1712 | 0 | if (yychar == YYEOF) |
1713 | 0 | YYABORT; |
1714 | 0 | } |
1715 | 0 | else |
1716 | 0 | { |
1717 | 0 | yydestruct ("Error: discarding", |
1718 | 0 | yytoken, &yylval, yyscanner); |
1719 | 0 | yychar = YYEMPTY; |
1720 | 0 | } |
1721 | 0 | } |
1722 | | |
1723 | | /* Else will try to reuse lookahead token after shifting the error |
1724 | | token. */ |
1725 | 233 | goto yyerrlab1; |
1726 | | |
1727 | | |
1728 | | /*---------------------------------------------------. |
1729 | | | yyerrorlab -- error raised explicitly by YYERROR. | |
1730 | | `---------------------------------------------------*/ |
1731 | 233 | yyerrorlab: |
1732 | | /* Pacify compilers when the user code never invokes YYERROR and the |
1733 | | label yyerrorlab therefore never appears in user code. */ |
1734 | 0 | if (0) |
1735 | 0 | YYERROR; |
1736 | 0 | ++yynerrs; |
1737 | | |
1738 | | /* Do not reclaim the symbols of the rule whose action triggered |
1739 | | this YYERROR. */ |
1740 | 0 | YYPOPSTACK (yylen); |
1741 | 0 | yylen = 0; |
1742 | 0 | YY_STACK_PRINT (yyss, yyssp); |
1743 | 0 | yystate = *yyssp; |
1744 | 0 | goto yyerrlab1; |
1745 | | |
1746 | | |
1747 | | /*-------------------------------------------------------------. |
1748 | | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
1749 | | `-------------------------------------------------------------*/ |
1750 | 233 | yyerrlab1: |
1751 | 233 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
1752 | | |
1753 | | /* Pop stack until we find a state that shifts the error token. */ |
1754 | 233 | for (;;) |
1755 | 2.73k | { |
1756 | 2.73k | yyn = yypact[yystate]; |
1757 | 2.73k | if (!yypact_value_is_default (yyn)) |
1758 | 2.73k | { |
1759 | 2.73k | yyn += YYSYMBOL_YYerror; |
1760 | 2.73k | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) |
1761 | 0 | { |
1762 | 0 | yyn = yytable[yyn]; |
1763 | 0 | if (0 < yyn) |
1764 | 0 | break; |
1765 | 0 | } |
1766 | 2.73k | } |
1767 | | |
1768 | | /* Pop the current state because it cannot handle the error token. */ |
1769 | 2.73k | if (yyssp == yyss) |
1770 | 233 | YYABORT; |
1771 | | |
1772 | | |
1773 | 2.50k | yydestruct ("Error: popping", |
1774 | 2.50k | YY_ACCESSING_SYMBOL (yystate), yyvsp, yyscanner); |
1775 | 2.50k | YYPOPSTACK (1); |
1776 | 2.50k | yystate = *yyssp; |
1777 | 2.50k | YY_STACK_PRINT (yyss, yyssp); |
1778 | 2.50k | } |
1779 | | |
1780 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1781 | 0 | *++yyvsp = yylval; |
1782 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1783 | | |
1784 | | |
1785 | | /* Shift the error token. */ |
1786 | 0 | YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); |
1787 | |
|
1788 | 0 | yystate = yyn; |
1789 | 0 | goto yynewstate; |
1790 | | |
1791 | | |
1792 | | /*-------------------------------------. |
1793 | | | yyacceptlab -- YYACCEPT comes here. | |
1794 | | `-------------------------------------*/ |
1795 | 429 | yyacceptlab: |
1796 | 429 | yyresult = 0; |
1797 | 429 | goto yyreturnlab; |
1798 | | |
1799 | | |
1800 | | /*-----------------------------------. |
1801 | | | yyabortlab -- YYABORT comes here. | |
1802 | | `-----------------------------------*/ |
1803 | 233 | yyabortlab: |
1804 | 233 | yyresult = 1; |
1805 | 233 | goto yyreturnlab; |
1806 | | |
1807 | | |
1808 | | /*-----------------------------------------------------------. |
1809 | | | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | |
1810 | | `-----------------------------------------------------------*/ |
1811 | 1 | yyexhaustedlab: |
1812 | 1 | yyerror (yyscanner, YY_("memory exhausted")); |
1813 | 1 | yyresult = 2; |
1814 | 1 | goto yyreturnlab; |
1815 | | |
1816 | | |
1817 | | /*----------------------------------------------------------. |
1818 | | | yyreturnlab -- parsing is finished, clean up and return. | |
1819 | | `----------------------------------------------------------*/ |
1820 | 663 | yyreturnlab: |
1821 | 663 | if (yychar != YYEMPTY) |
1822 | 233 | { |
1823 | | /* Make sure we have latest lookahead translation. See comments at |
1824 | | user semantic actions for why this is necessary. */ |
1825 | 233 | yytoken = YYTRANSLATE (yychar); |
1826 | 233 | yydestruct ("Cleanup: discarding lookahead", |
1827 | 233 | yytoken, &yylval, yyscanner); |
1828 | 233 | } |
1829 | | /* Do not reclaim the symbols of the rule whose action triggered |
1830 | | this YYABORT or YYACCEPT. */ |
1831 | 663 | YYPOPSTACK (yylen); |
1832 | 663 | YY_STACK_PRINT (yyss, yyssp); |
1833 | 1.72k | while (yyssp != yyss) |
1834 | 1.05k | { |
1835 | 1.05k | yydestruct ("Cleanup: popping", |
1836 | 1.05k | YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yyscanner); |
1837 | 1.05k | YYPOPSTACK (1); |
1838 | 1.05k | } |
1839 | 663 | #ifndef yyoverflow |
1840 | 663 | if (yyss != yyssa) |
1841 | 0 | YYSTACK_FREE (yyss); |
1842 | 663 | #endif |
1843 | 663 | if (yymsg != yymsgbuf) |
1844 | 0 | YYSTACK_FREE (yymsg); |
1845 | 663 | return yyresult; |
1846 | 233 | } |
1847 | | |
1848 | | #line 180 "cmExprParser.y" |
1849 | | |
1850 | | /* End of grammar */ |
1851 | | |
1852 | | /*--------------------------------------------------------------------------*/ |
1853 | | void cmExpr_yyerror(yyscan_t yyscanner, const char* message) |
1854 | 234 | { |
1855 | 234 | cmExpr_yyget_extra(yyscanner)->Error(message); |
1856 | 234 | } |