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