Debian Codegraph @

src/App/Expression.tab.c

raw
1 // clang-format off
2 /* A Bison parser, made by GNU Bison 3.8.2. */
3
4 /* Bison implementation for Yacc-like parsers in C
5
6 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
7 Inc.
8
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <https://www.gnu.org/licenses/>. */
21
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
31
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
37
38 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
39 especially those whose name start with YY_ or yy_. They are
40 private implementation details that can be changed or removed. */
41
42 /* All symbols defined below should begin with yy or YY, to avoid
43 infringing on user name space. This should be done even for local
44 variables, as they might otherwise be expanded by user macros.
45 There are some unavoidable exceptions within include files to
46 define necessary library symbols; they are noted "INFRINGES ON
47 USER NAME SPACE" below. */
48
49 /* Identify Bison output, and Bison version. */
50 #define YYBISON 30802
51
52 /* Bison version string. */
53 #define YYBISON_VERSION "3.8.2"
54
55 /* Skeleton name. */
56 #define YYSKELETON_NAME "yacc.c"
57
58 /* Pure parsers. */
59 #define YYPURE 0
60
61 /* Push parsers. */
62 #define YYPUSH 0
63
64 /* Pull parsers. */
65 #define YYPULL 1
66
67
68
69
70 /* First part of user prologue. */
71 #line 26 "Expression.y"
72
73 #define YYSTYPE App::ExpressionParser::semantic_type
74
75 std::stack<FunctionExpression::Function> functions; /**< Function identifier */
76
77 #define yyparse ExpressionParser_yyparse
78 #define yyerror ExpressionParser_yyerror
79
80 #line 80 "Expression.tab.c"
81
82 # ifndef YY_CAST
83 # ifdef __cplusplus
84 # define YY_CAST(Type, Val) static_cast<Type> (Val)
85 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
86 # else
87 # define YY_CAST(Type, Val) ((Type) (Val))
88 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
89 # endif
90 # endif
91 # ifndef YY_NULLPTR
92 # if defined __cplusplus
93 # if 201103L <= __cplusplus
94 # define YY_NULLPTR nullptr
95 # else
96 # define YY_NULLPTR 0
97 # endif
98 # else
99 # define YY_NULLPTR ((void*)0)
100 # endif
101 # endif
102
103 #include "Expression.tab.h"
104 /* Symbol kind. */
105 enum yysymbol_kind_t
106 {
107 YYSYMBOL_YYEMPTY = -2,
108 YYSYMBOL_YYEOF = 0, /* "end of file" */
109 YYSYMBOL_YYerror = 1, /* error */
110 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
111 YYSYMBOL_FUNC = 3, /* FUNC */
112 YYSYMBOL_ONE = 4, /* ONE */
113 YYSYMBOL_NUM = 5, /* NUM */
114 YYSYMBOL_IDENTIFIER = 6, /* IDENTIFIER */
115 YYSYMBOL_UNIT = 7, /* UNIT */
116 YYSYMBOL_USUNIT = 8, /* USUNIT */
117 YYSYMBOL_INTEGER = 9, /* INTEGER */
118 YYSYMBOL_CONSTANT = 10, /* CONSTANT */
119 YYSYMBOL_CELLADDRESS = 11, /* CELLADDRESS */
120 YYSYMBOL_EQ = 12, /* EQ */
121 YYSYMBOL_NEQ = 13, /* NEQ */
122 YYSYMBOL_LT = 14, /* LT */
123 YYSYMBOL_GT = 15, /* GT */
124 YYSYMBOL_GTE = 16, /* GTE */
125 YYSYMBOL_LTE = 17, /* LTE */
126 YYSYMBOL_STRING = 18, /* STRING */
127 YYSYMBOL_MINUSSIGN = 19, /* MINUSSIGN */
128 YYSYMBOL_PROPERTY_REF = 20, /* PROPERTY_REF */
129 YYSYMBOL_DOCUMENT = 21, /* DOCUMENT */
130 YYSYMBOL_OBJECT = 22, /* OBJECT */
131 YYSYMBOL_EXPONENT = 23, /* EXPONENT */
132 YYSYMBOL_24_ = 24, /* '?' */
133 YYSYMBOL_25_ = 25, /* ':' */
134 YYSYMBOL_26_ = 26, /* '+' */
135 YYSYMBOL_27_ = 27, /* '*' */
136 YYSYMBOL_28_ = 28, /* '/' */
137 YYSYMBOL_29_ = 29, /* '%' */
138 YYSYMBOL_NUM_AND_UNIT = 30, /* NUM_AND_UNIT */
139 YYSYMBOL_31_ = 31, /* '^' */
140 YYSYMBOL_NEG = 32, /* NEG */
141 YYSYMBOL_POS = 33, /* POS */
142 YYSYMBOL_34_ = 34, /* ')' */
143 YYSYMBOL_35_ = 35, /* '(' */
144 YYSYMBOL_36_ = 36, /* ',' */
145 YYSYMBOL_37_ = 37, /* ';' */
146 YYSYMBOL_38_ = 38, /* '.' */
147 YYSYMBOL_39_ = 39, /* '#' */
148 YYSYMBOL_40_ = 40, /* '[' */
149 YYSYMBOL_41_ = 41, /* ']' */
150 YYSYMBOL_YYACCEPT = 42, /* $accept */
151 YYSYMBOL_input = 43, /* input */
152 YYSYMBOL_unit_num = 44, /* unit_num */
153 YYSYMBOL_exp = 45, /* exp */
154 YYSYMBOL_num = 46, /* num */
155 YYSYMBOL_args = 47, /* args */
156 YYSYMBOL_range = 48, /* range */
157 YYSYMBOL_us_building_unit = 49, /* us_building_unit */
158 YYSYMBOL_other_unit = 50, /* other_unit */
159 YYSYMBOL_unit_exp = 51, /* unit_exp */
160 YYSYMBOL_integer = 52, /* integer */
161 YYSYMBOL_id_or_cell = 53, /* id_or_cell */
162 YYSYMBOL_identifier = 54, /* identifier */
163 YYSYMBOL_iden = 55, /* iden */
164 YYSYMBOL_indexer = 56, /* indexer */
165 YYSYMBOL_indexable = 57, /* indexable */
166 YYSYMBOL_document = 58, /* document */
167 YYSYMBOL_object = 59 /* object */
168 };
169 typedef enum yysymbol_kind_t yysymbol_kind_t;
170
171
172
173
174 #ifdef short
175 # undef short
176 #endif
177
178 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
179 <limits.h> and (if available) <stdint.h> are included
180 so that the code can choose integer types of a good width. */
181
182 #ifndef __PTRDIFF_MAX__
183 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
184 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
185 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
186 # define YY_STDINT_H
187 # endif
188 #endif
189
190 /* Narrow types that promote to a signed type and that can represent a
191 signed or unsigned integer of at least N bits. In tables they can
192 save space and decrease cache pressure. Promoting to a signed type
193 helps avoid bugs in integer arithmetic. */
194
195 #ifdef __INT_LEAST8_MAX__
196 typedef __INT_LEAST8_TYPE__ yytype_int8;
197 #elif defined YY_STDINT_H
198 typedef int_least8_t yytype_int8;
199 #else
200 typedef signed char yytype_int8;
201 #endif
202
203 #ifdef __INT_LEAST16_MAX__
204 typedef __INT_LEAST16_TYPE__ yytype_int16;
205 #elif defined YY_STDINT_H
206 typedef int_least16_t yytype_int16;
207 #else
208 typedef short yytype_int16;
209 #endif
210
211 /* Work around bug in HP-UX 11.23, which defines these macros
212 incorrectly for preprocessor constants. This workaround can likely
213 be removed in 2023, as HPE has promised support for HP-UX 11.23
214 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
215 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
216 #ifdef __hpux
217 # undef UINT_LEAST8_MAX
218 # undef UINT_LEAST16_MAX
219 # define UINT_LEAST8_MAX 255
220 # define UINT_LEAST16_MAX 65535
221 #endif
222
223 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
224 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
225 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
226 && UINT_LEAST8_MAX <= INT_MAX)
227 typedef uint_least8_t yytype_uint8;
228 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
229 typedef unsigned char yytype_uint8;
230 #else
231 typedef short yytype_uint8;
232 #endif
233
234 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
235 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
236 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
237 && UINT_LEAST16_MAX <= INT_MAX)
238 typedef uint_least16_t yytype_uint16;
239 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
240 typedef unsigned short yytype_uint16;
241 #else
242 typedef int yytype_uint16;
243 #endif
244
245 #ifndef YYPTRDIFF_T
246 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
247 # define YYPTRDIFF_T __PTRDIFF_TYPE__
248 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
249 # elif defined PTRDIFF_MAX
250 # ifndef ptrdiff_t
251 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
252 # endif
253 # define YYPTRDIFF_T ptrdiff_t
254 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
255 # else
256 # define YYPTRDIFF_T long
257 # define YYPTRDIFF_MAXIMUM LONG_MAX
258 # endif
259 #endif
260
261 #ifndef YYSIZE_T
262 # ifdef __SIZE_TYPE__
263 # define YYSIZE_T __SIZE_TYPE__
264 # elif defined size_t
265 # define YYSIZE_T size_t
266 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
267 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
268 # define YYSIZE_T size_t
269 # else
270 # define YYSIZE_T unsigned
271 # endif
272 #endif
273
274 #define YYSIZE_MAXIMUM \
275 YY_CAST (YYPTRDIFF_T, \
276 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
277 ? YYPTRDIFF_MAXIMUM \
278 : YY_CAST (YYSIZE_T, -1)))
279
280 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
281
282
283 /* Stored state numbers (used for stacks). */
284 typedef yytype_uint8 yy_state_t;
285
286 /* State numbers in computations. */
287 typedef int yy_state_fast_t;
288
289 #ifndef YY_
290 # if defined YYENABLE_NLS && YYENABLE_NLS
291 # if ENABLE_NLS
292 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
293 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
294 # endif
295 # endif
296 # ifndef YY_
297 # define YY_(Msgid) Msgid
298 # endif
299 #endif
300
301
302 #ifndef YY_ATTRIBUTE_PURE
303 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
304 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
305 # else
306 # define YY_ATTRIBUTE_PURE
307 # endif
308 #endif
309
310 #ifndef YY_ATTRIBUTE_UNUSED
311 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
312 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
313 # else
314 # define YY_ATTRIBUTE_UNUSED
315 # endif
316 #endif
317
318 /* Suppress unused-variable warnings by "using" E. */
319 #if ! defined lint || defined __GNUC__
320 # define YY_USE(E) ((void) (E))
321 #else
322 # define YY_USE(E) /* empty */
323 #endif
324
325 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
326 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
327 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
328 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
329 _Pragma ("GCC diagnostic push") \
330 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
331 # else
332 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
333 _Pragma ("GCC diagnostic push") \
334 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
335 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
336 # endif
337 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
338 _Pragma ("GCC diagnostic pop")
339 #else
340 # define YY_INITIAL_VALUE(Value) Value
341 #endif
342 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
343 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
344 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
345 #endif
346 #ifndef YY_INITIAL_VALUE
347 # define YY_INITIAL_VALUE(Value) /* Nothing. */
348 #endif
349
350 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
351 # define YY_IGNORE_USELESS_CAST_BEGIN \
352 _Pragma ("GCC diagnostic push") \
353 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
354 # define YY_IGNORE_USELESS_CAST_END \
355 _Pragma ("GCC diagnostic pop")
356 #endif
357 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
358 # define YY_IGNORE_USELESS_CAST_BEGIN
359 # define YY_IGNORE_USELESS_CAST_END
360 #endif
361
362
363 #define YY_ASSERT(E) ((void) (0 && (E)))
364
365 #if !defined yyoverflow
366
367 /* The parser invokes alloca or malloc; define the necessary symbols. */
368
369 # ifdef YYSTACK_USE_ALLOCA
370 # if YYSTACK_USE_ALLOCA
371 # ifdef __GNUC__
372 # define YYSTACK_ALLOC __builtin_alloca
373 # elif defined __BUILTIN_VA_ARG_INCR
374 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
375 # elif defined _AIX
376 # define YYSTACK_ALLOC __alloca
377 # elif defined _MSC_VER
378 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
379 # define alloca _alloca
380 # else
381 # define YYSTACK_ALLOC alloca
382 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
383 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
384 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
385 # ifndef EXIT_SUCCESS
386 # define EXIT_SUCCESS 0
387 # endif
388 # endif
389 # endif
390 # endif
391 # endif
392
393 # ifdef YYSTACK_ALLOC
394 /* Pacify GCC's 'empty if-body' warning. */
395 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
396 # ifndef YYSTACK_ALLOC_MAXIMUM
397 /* The OS might guarantee only one guard page at the bottom of the stack,
398 and a page size can be as small as 4096 bytes. So we cannot safely
399 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
400 to allow for a few compiler-allocated temporary stack slots. */
401 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
402 # endif
403 # else
404 # define YYSTACK_ALLOC YYMALLOC
405 # define YYSTACK_FREE YYFREE
406 # ifndef YYSTACK_ALLOC_MAXIMUM
407 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
408 # endif
409 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
410 && ! ((defined YYMALLOC || defined malloc) \
411 && (defined YYFREE || defined free)))
412 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
413 # ifndef EXIT_SUCCESS
414 # define EXIT_SUCCESS 0
415 # endif
416 # endif
417 # ifndef YYMALLOC
418 # define YYMALLOC malloc
419 # if ! defined malloc && ! defined EXIT_SUCCESS
420 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
421 # endif
422 # endif
423 # ifndef YYFREE
424 # define YYFREE free
425 # if ! defined free && ! defined EXIT_SUCCESS
426 void free (void *); /* INFRINGES ON USER NAME SPACE */
427 # endif
428 # endif
429 # endif
430 #endif /* !defined yyoverflow */
431
432 #if (! defined yyoverflow \
433 && (! defined __cplusplus \
434 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
435
436 /* A type that is properly aligned for any stack member. */
437 union yyalloc
438 {
439 yy_state_t yyss_alloc;
440 YYSTYPE yyvs_alloc;
441 };
442
443 /* The size of the maximum gap between one aligned stack and the next. */
444 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
445
446 /* The size of an array large to enough to hold all stacks, each with
447 N elements. */
448 # define YYSTACK_BYTES(N) \
449 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
450 + YYSTACK_GAP_MAXIMUM)
451
452 # define YYCOPY_NEEDED 1
453
454 /* Relocate STACK from its old location to the new one. The
455 local variables YYSIZE and YYSTACKSIZE give the old and new number of
456 elements in the stack, and YYPTR gives the new location of the
457 stack. Advance YYPTR to a properly aligned location for the next
458 stack. */
459 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
460 do \
461 { \
462 YYPTRDIFF_T yynewbytes; \
463 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
464 Stack = &yyptr->Stack_alloc; \
465 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
466 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
467 } \
468 while (0)
469
470 #endif
471
472 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
473 /* Copy COUNT objects from SRC to DST. The source and destination do
474 not overlap. */
475 # ifndef YYCOPY
476 # if defined __GNUC__ && 1 < __GNUC__
477 # define YYCOPY(Dst, Src, Count) \
478 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
479 # else
480 # define YYCOPY(Dst, Src, Count) \
481 do \
482 { \
483 YYPTRDIFF_T yyi; \
484 for (yyi = 0; yyi < (Count); yyi++) \
485 (Dst)[yyi] = (Src)[yyi]; \
486 } \
487 while (0)
488 # endif
489 # endif
490 #endif /* !YYCOPY_NEEDED */
491
492 /* YYFINAL -- State number of the termination state. */
493 #define YYFINAL 40
494 /* YYLAST -- Last index in YYTABLE. */
495 #define YYLAST 432
496
497 /* YYNTOKENS -- Number of terminals. */
498 #define YYNTOKENS 42
499 /* YYNNTS -- Number of nonterminals. */
500 #define YYNNTS 18
501 /* YYNRULES -- Number of rules. */
502 #define YYNRULES 76
503 /* YYNSTATES -- Number of states. */
504 #define YYNSTATES 140
505
506 /* YYMAXUTOK -- Last valid token kind. */
507 #define YYMAXUTOK 281
508
509
510 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
511 as returned by yylex, with out-of-bounds checking. */
512 #define YYTRANSLATE(YYX) \
513 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
514 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
515 : YYSYMBOL_YYUNDEF)
516
517 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
518 as returned by yylex. */
519 static const yytype_int8 yytranslate[] =
520 {
521 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 39, 2, 29, 2, 2,
525 35, 34, 27, 26, 36, 2, 38, 28, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 25, 37,
527 2, 2, 2, 24, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 40, 2, 41, 31, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 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, 1, 2, 3, 4,
547 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
548 15, 16, 17, 18, 19, 20, 21, 22, 23, 30,
549 32, 33
550 };
551
552 #if YYDEBUG
553 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
554 static const yytype_uint8 yyrline[] =
555 {
556 0, 81, 81, 82, 85, 86, 89, 90, 91, 92,
557 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
558 103, 104, 105, 106, 107, 108, 109, 110, 111, 114,
559 115, 116, 117, 119, 120, 121, 122, 123, 124, 127,
560 131, 132, 134, 135, 136, 137, 138, 139, 140, 143,
561 144, 148, 149, 153, 154, 158, 163, 168, 174, 181,
562 188, 195, 199, 200, 201, 202, 203, 204, 205, 206,
563 210, 211, 212, 216, 217, 221, 222
564 };
565 #endif
566
567 /** Accessing symbol of state STATE. */
568 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
569
570 #if YYDEBUG || 0
571 /* The user-facing name of the symbol whose (internal) number is
572 YYSYMBOL. No bounds checking. */
573 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
574
575 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
576 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
577 static const char *const yytname[] =
578 {
579 "\"end of file\"", "error", "\"invalid token\"", "FUNC", "ONE", "NUM",
580 "IDENTIFIER", "UNIT", "USUNIT", "INTEGER", "CONSTANT", "CELLADDRESS",
581 "EQ", "NEQ", "LT", "GT", "GTE", "LTE", "STRING", "MINUSSIGN",
582 "PROPERTY_REF", "DOCUMENT", "OBJECT", "EXPONENT", "'?'", "':'", "'+'",
583 "'*'", "'/'", "'%'", "NUM_AND_UNIT", "'^'", "NEG", "POS", "')'", "'('",
584 "','", "';'", "'.'", "'#'", "'['", "']'", "$accept", "input", "unit_num",
585 "exp", "num", "args", "range", "us_building_unit", "other_unit",
586 "unit_exp", "integer", "id_or_cell", "identifier", "iden", "indexer",
587 "indexable", "document", "object", YY_NULLPTR
588 };
589
590 static const char *
591 yysymbol_name (yysymbol_kind_t yysymbol)
592 {
593 return yytname[yysymbol];
594 }
595 #endif
596
597 #define YYPACT_NINF (-32)
598
599 #define yypact_value_is_default(Yyn) \
600 ((Yyn) == YYPACT_NINF)
601
602 #define YYTABLE_NINF (-77)
603
604 #define yytable_value_is_error(Yyn) \
605 0
606
607 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
608 STATE-NUM. */
609 static const yytype_int16 yypact[] =
610 {
611 100, 203, -32, -32, -31, -32, -32, -32, -32, -32,
612 90, 203, 203, 100, 34, 17, -32, 401, 7, -32,
613 -32, 93, -10, -19, 19, 16, -5, 49, 203, 401,
614 78, -32, -9, -32, -32, 358, -4, -32, 64, -32,
615 -32, 203, 203, 203, 203, 203, 203, 203, 203, 203,
616 203, 100, 203, 203, 7, 84, 6, 7, 7, 3,
617 156, -32, 107, 119, -32, 44, 52, -32, 203, 203,
618 25, -32, -32, 25, 20, 20, 20, 20, 20, 20,
619 68, 381, 68, 59, 59, 6, 59, -32, 122, 6,
620 6, -32, -32, 57, -32, 167, 218, -32, -32, -32,
621 -32, 94, 96, -32, 401, -32, 401, -32, -32, -32,
622 203, -32, -32, 203, 238, 0, -32, 80, 25, 401,
623 278, 203, -32, 203, -32, 258, 98, -32, -32, -32,
624 298, 318, 203, -32, 25, -32, -32, 338, -32, -32
625 };
626
627 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
628 Performed when YYTABLE does not specify something else to do. Zero
629 means the default is an error. */
630 static const yytype_int8 yydefact[] =
631 {
632 0, 0, 29, 30, 51, 41, 40, 31, 32, 52,
633 8, 0, 0, 0, 0, 0, 7, 2, 6, 43,
634 42, 3, 53, 9, 54, 25, 0, 0, 0, 33,
635 0, 34, 53, 10, 11, 0, 0, 51, 0, 56,
636 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
637 0, 0, 0, 0, 0, 43, 4, 0, 0, 0,
638 0, 70, 0, 0, 71, 0, 0, 26, 0, 0,
639 0, 28, 48, 0, 19, 20, 21, 22, 23, 24,
640 13, 0, 12, 14, 15, 17, 16, 18, 0, 45,
641 44, 50, 49, 0, 46, 0, 0, 61, 72, 75,
642 76, 0, 0, 58, 35, 37, 36, 38, 39, 55,
643 0, 5, 47, 0, 0, 0, 62, 0, 0, 27,
644 0, 0, 64, 0, 63, 0, 0, 59, 57, 65,
645 0, 0, 0, 66, 0, 68, 67, 0, 60, 69
646 };
647
648 /* YYPGOTO[NTERM-NUM]. */
649 static const yytype_int8 yypgoto[] =
650 {
651 -32, -32, -32, 32, 76, -32, 54, -17, -32, 2,
652 46, -1, -32, -32, 112, -32, -32, 75
653 };
654
655 /* YYDEFGOTO[NTERM-NUM]. */
656 static const yytype_int8 yydefgoto[] =
657 {
658 0, 15, 16, 35, 18, 30, 31, 19, 20, 36,
659 94, 22, 23, 24, 61, 25, 26, 27
660 };
661
662 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
663 positive, shift that token. If negative, reduce the rule whose
664 number is the opposite. If YYTABLE_NINF, syntax error. */
665 static const yytype_int16 yytable[] =
666 {
667 32, 55, 21, 1, 2, 3, 4, 91, -74, 7,
668 8, 9, 92, 39, 5, 6, 70, 40, 10, 11,
669 56, 60, 93, 57, 58, 123, 12, 59, -76, -76,
670 72, 37, 17, 29, 65, 28, 9, 59, 14, 47,
671 37, 124, 54, 33, 34, 9, 49, 50, 51, 52,
672 37, 53, 38, 85, 63, 9, 60, 62, 37, 89,
673 90, 91, 99, 9, 100, 103, 92, 32, 32, 108,
674 102, 111, 109, 74, 75, 76, 77, 78, 79, 80,
675 81, 82, 83, 84, 86, 87, 37, 66, 2, 3,
676 53, 9, 96, 7, 8, 50, 51, 52, 126, 53,
677 104, 106, 73, 1, 2, 3, 4, 5, 6, 7,
678 8, 9, 67, 97, 68, 69, 127, 128, 10, 11,
679 57, 58, 105, 107, 59, 98, 12, 114, -75, -73,
680 6, 88, 117, 138, 118, 13, 134, 64, 14, 112,
681 101, 0, 119, 0, 0, 120, 0, 125, 0, 0,
682 0, 0, 0, 130, 0, 131, 0, 0, 0, 1,
683 2, 3, 4, 0, 137, 7, 8, 9, 0, 0,
684 1, 2, 3, 4, 10, 11, 7, 8, 9, 0,
685 0, 95, 12, 0, 0, 10, 11, 0, 0, 0,
686 0, 28, 113, 12, 14, 0, 0, 0, 0, 0,
687 0, 0, 28, 0, 0, 14, 1, 2, 3, 4,
688 0, 0, 7, 8, 9, 0, 0, 0, 0, 0,
689 0, 10, 11, 0, 0, 0, 0, 0, 0, 12,
690 41, 42, 43, 44, 45, 46, 0, 47, 28, 0,
691 0, 14, 48, 115, 49, 50, 51, 52, 0, 53,
692 41, 42, 43, 44, 45, 46, 0, 47, 0, 116,
693 0, 0, 48, 121, 49, 50, 51, 52, 0, 53,
694 41, 42, 43, 44, 45, 46, 0, 47, 0, 122,
695 0, 0, 48, 132, 49, 50, 51, 52, 0, 53,
696 41, 42, 43, 44, 45, 46, 0, 47, 0, 133,
697 0, 0, 48, 0, 49, 50, 51, 52, 0, 53,
698 41, 42, 43, 44, 45, 46, 0, 47, 0, 129,
699 0, 0, 48, 0, 49, 50, 51, 52, 0, 53,
700 41, 42, 43, 44, 45, 46, 0, 47, 0, 135,
701 0, 0, 48, 0, 49, 50, 51, 52, 0, 53,
702 41, 42, 43, 44, 45, 46, 0, 47, 0, 136,
703 0, 0, 48, 0, 49, 50, 51, 52, 0, 53,
704 41, 42, 43, 44, 45, 46, 0, 47, 0, 139,
705 0, 0, 48, 0, 49, 50, 51, 52, 0, 53,
706 0, 0, 71, 41, 42, 43, 44, 45, 46, 0,
707 47, 0, 0, 0, 0, 48, 110, 49, 50, 51,
708 52, 0, 53, 41, 42, 43, 44, 45, 46, 0,
709 47, 0, 0, 0, 0, 48, 0, 49, 50, 51,
710 52, 0, 53
711 };
712
713 static const yytype_int16 yycheck[] =
714 {
715 1, 18, 0, 3, 4, 5, 6, 4, 39, 9,
716 10, 11, 9, 14, 7, 8, 25, 0, 18, 19,
717 18, 40, 19, 27, 28, 25, 26, 31, 38, 38,
718 34, 6, 0, 1, 39, 35, 11, 31, 38, 19,
719 6, 41, 35, 11, 12, 11, 26, 27, 28, 29,
720 6, 31, 18, 51, 38, 11, 40, 38, 6, 57,
721 58, 4, 18, 11, 65, 66, 9, 68, 69, 70,
722 18, 88, 73, 41, 42, 43, 44, 45, 46, 47,
723 48, 49, 50, 51, 52, 53, 6, 38, 4, 5,
724 31, 11, 60, 9, 10, 27, 28, 29, 18, 31,
725 68, 69, 38, 3, 4, 5, 6, 7, 8, 9,
726 10, 11, 34, 6, 36, 37, 117, 118, 18, 19,
727 27, 28, 68, 69, 31, 6, 26, 95, 38, 39,
728 8, 55, 38, 134, 38, 35, 38, 25, 38, 93,
729 65, -1, 110, -1, -1, 113, -1, 115, -1, -1,
730 -1, -1, -1, 121, -1, 123, -1, -1, -1, 3,
731 4, 5, 6, -1, 132, 9, 10, 11, -1, -1,
732 3, 4, 5, 6, 18, 19, 9, 10, 11, -1,
733 -1, 25, 26, -1, -1, 18, 19, -1, -1, -1,
734 -1, 35, 25, 26, 38, -1, -1, -1, -1, -1,
735 -1, -1, 35, -1, -1, 38, 3, 4, 5, 6,
736 -1, -1, 9, 10, 11, -1, -1, -1, -1, -1,
737 -1, 18, 19, -1, -1, -1, -1, -1, -1, 26,
738 12, 13, 14, 15, 16, 17, -1, 19, 35, -1,
739 -1, 38, 24, 25, 26, 27, 28, 29, -1, 31,
740 12, 13, 14, 15, 16, 17, -1, 19, -1, 41,
741 -1, -1, 24, 25, 26, 27, 28, 29, -1, 31,
742 12, 13, 14, 15, 16, 17, -1, 19, -1, 41,
743 -1, -1, 24, 25, 26, 27, 28, 29, -1, 31,
744 12, 13, 14, 15, 16, 17, -1, 19, -1, 41,
745 -1, -1, 24, -1, 26, 27, 28, 29, -1, 31,
746 12, 13, 14, 15, 16, 17, -1, 19, -1, 41,
747 -1, -1, 24, -1, 26, 27, 28, 29, -1, 31,
748 12, 13, 14, 15, 16, 17, -1, 19, -1, 41,
749 -1, -1, 24, -1, 26, 27, 28, 29, -1, 31,
750 12, 13, 14, 15, 16, 17, -1, 19, -1, 41,
751 -1, -1, 24, -1, 26, 27, 28, 29, -1, 31,
752 12, 13, 14, 15, 16, 17, -1, 19, -1, 41,
753 -1, -1, 24, -1, 26, 27, 28, 29, -1, 31,
754 -1, -1, 34, 12, 13, 14, 15, 16, 17, -1,
755 19, -1, -1, -1, -1, 24, 25, 26, 27, 28,
756 29, -1, 31, 12, 13, 14, 15, 16, 17, -1,
757 19, -1, -1, -1, -1, 24, -1, 26, 27, 28,
758 29, -1, 31
759 };
760
761 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
762 state STATE-NUM. */
763 static const yytype_int8 yystos[] =
764 {
765 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
766 18, 19, 26, 35, 38, 43, 44, 45, 46, 49,
767 50, 51, 53, 54, 55, 57, 58, 59, 35, 45,
768 47, 48, 53, 45, 45, 45, 51, 6, 18, 53,
769 0, 12, 13, 14, 15, 16, 17, 19, 24, 26,
770 27, 28, 29, 31, 35, 49, 51, 27, 28, 31,
771 40, 56, 38, 38, 56, 39, 38, 34, 36, 37,
772 25, 34, 34, 38, 45, 45, 45, 45, 45, 45,
773 45, 45, 45, 45, 45, 51, 45, 45, 46, 51,
774 51, 4, 9, 19, 52, 25, 45, 6, 6, 18,
775 53, 59, 18, 53, 45, 48, 45, 48, 53, 53,
776 25, 49, 52, 25, 45, 25, 41, 38, 38, 45,
777 45, 25, 41, 25, 41, 45, 18, 53, 53, 41,
778 45, 45, 25, 41, 38, 41, 41, 45, 53, 41
779 };
780
781 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
782 static const yytype_int8 yyr1[] =
783 {
784 0, 42, 43, 43, 44, 44, 45, 45, 45, 45,
785 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
786 45, 45, 45, 45, 45, 45, 45, 45, 45, 46,
787 46, 46, 46, 47, 47, 47, 47, 47, 47, 48,
788 49, 50, 51, 51, 51, 51, 51, 51, 51, 52,
789 52, 53, 53, 54, 54, 55, 55, 55, 55, 55,
790 55, 55, 56, 56, 56, 56, 56, 56, 56, 56,
791 57, 57, 57, 58, 58, 59, 59
792 };
793
794 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
795 static const yytype_int8 yyr2[] =
796 {
797 0, 2, 1, 1, 2, 4, 1, 1, 1, 1,
798 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
799 3, 3, 3, 3, 3, 1, 3, 5, 3, 1,
800 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
801 1, 1, 1, 1, 3, 3, 3, 4, 3, 1,
802 1, 1, 1, 1, 1, 4, 2, 5, 3, 5,
803 7, 3, 3, 4, 4, 5, 5, 6, 6, 7,
804 2, 2, 3, 1, 1, 1, 1
805 };
806
807
808 enum { YYENOMEM = -2 };
809
810 #define yyerrok (yyerrstatus = 0)
811 #define yyclearin (yychar = YYEMPTY)
812
813 #define YYACCEPT goto yyacceptlab
814 #define YYABORT goto yyabortlab
815 #define YYERROR goto yyerrorlab
816 #define YYNOMEM goto yyexhaustedlab
817
818
819 #define YYRECOVERING() (!!yyerrstatus)
820
821 #define YYBACKUP(Token, Value) \
822 do \
823 if (yychar == YYEMPTY) \
824 { \
825 yychar = (Token); \
826 yylval = (Value); \
827 YYPOPSTACK (yylen); \
828 yystate = *yyssp; \
829 goto yybackup; \
830 } \
831 else \
832 { \
833 yyerror (YY_("syntax error: cannot back up")); \
834 YYERROR; \
835 } \
836 while (0)
837
838 /* Backward compatibility with an undocumented macro.
839 Use YYerror or YYUNDEF. */
840 #define YYERRCODE YYUNDEF
841
842
843 /* Enable debugging if requested. */
844 #if YYDEBUG
845
846 # ifndef YYFPRINTF
847 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
848 # define YYFPRINTF fprintf
849 # endif
850
851 # define YYDPRINTF(Args) \
852 do { \
853 if (yydebug) \
854 YYFPRINTF Args; \
855 } while (0)
856
857
858
859
860 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
861 do { \
862 if (yydebug) \
863 { \
864 YYFPRINTF (stderr, "%s ", Title); \
865 yy_symbol_print (stderr, \
866 Kind, Value); \
867 YYFPRINTF (stderr, "\n"); \
868 } \
869 } while (0)
870
871
872 /*-----------------------------------.
873 | Print this symbol's value on YYO. |
874 `-----------------------------------*/
875
876 static void
877 yy_symbol_value_print (FILE *yyo,
878 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
879 {
880 FILE *yyoutput = yyo;
881 YY_USE (yyoutput);
882 if (!yyvaluep)
883 return;
884 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
885 YY_USE (yykind);
886 YY_IGNORE_MAYBE_UNINITIALIZED_END
887 }
888
889
890 /*---------------------------.
891 | Print this symbol on YYO. |
892 `---------------------------*/
893
894 static void
895 yy_symbol_print (FILE *yyo,
896 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
897 {
898 YYFPRINTF (yyo, "%s %s (",
899 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
900
901 yy_symbol_value_print (yyo, yykind, yyvaluep);
902 YYFPRINTF (yyo, ")");
903 }
904
905 /*------------------------------------------------------------------.
906 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
907 | TOP (included). |
908 `------------------------------------------------------------------*/
909
910 static void
911 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
912 {
913 YYFPRINTF (stderr, "Stack now");
914 for (; yybottom <= yytop; yybottom++)
915 {
916 int yybot = *yybottom;
917 YYFPRINTF (stderr, " %d", yybot);
918 }
919 YYFPRINTF (stderr, "\n");
920 }
921
922 # define YY_STACK_PRINT(Bottom, Top) \
923 do { \
924 if (yydebug) \
925 yy_stack_print ((Bottom), (Top)); \
926 } while (0)
927
928
929 /*------------------------------------------------.
930 | Report that the YYRULE is going to be reduced. |
931 `------------------------------------------------*/
932
933 static void
934 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
935 int yyrule)
936 {
937 int yylno = yyrline[yyrule];
938 int yynrhs = yyr2[yyrule];
939 int yyi;
940 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
941 yyrule - 1, yylno);
942 /* The symbols being reduced. */
943 for (yyi = 0; yyi < yynrhs; yyi++)
944 {
945 YYFPRINTF (stderr, " $%d = ", yyi + 1);
946 yy_symbol_print (stderr,
947 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
948 &yyvsp[(yyi + 1) - (yynrhs)]);
949 YYFPRINTF (stderr, "\n");
950 }
951 }
952
953 # define YY_REDUCE_PRINT(Rule) \
954 do { \
955 if (yydebug) \
956 yy_reduce_print (yyssp, yyvsp, Rule); \
957 } while (0)
958
959 /* Nonzero means print parse trace. It is left uninitialized so that
960 multiple parsers can coexist. */
961 int yydebug;
962 #else /* !YYDEBUG */
963 # define YYDPRINTF(Args) ((void) 0)
964 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
965 # define YY_STACK_PRINT(Bottom, Top)
966 # define YY_REDUCE_PRINT(Rule)
967 #endif /* !YYDEBUG */
968
969
970 /* YYINITDEPTH -- initial size of the parser's stacks. */
971 #ifndef YYINITDEPTH
972 # define YYINITDEPTH 200
973 #endif
974
975 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
976 if the built-in stack extension method is used).
977
978 Do not make this value too large; the results are undefined if
979 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
980 evaluated with infinite-precision integer arithmetic. */
981
982 #ifndef YYMAXDEPTH
983 # define YYMAXDEPTH 10000
984 #endif
985
986
987
988
989
990
991 /*-----------------------------------------------.
992 | Release the memory associated to this symbol. |
993 `-----------------------------------------------*/
994
995 static void
996 yydestruct (const char *yymsg,
997 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
998 {
999 YY_USE (yyvaluep);
1000 if (!yymsg)
1001 yymsg = "Deleting";
1002 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1003
1004 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1005 switch (yykind)
1006 {
1007 case YYSYMBOL_exp: /* exp */
1008 #line 73 "Expression.y"
1009 { delete ((*yyvaluep).expr); }
1010 #line 1010 "Expression.tab.c"
1011 break;
1012
1013 case YYSYMBOL_num: /* num */
1014 #line 73 "Expression.y"
1015 { delete ((*yyvaluep).expr); }
1016 #line 1016 "Expression.tab.c"
1017 break;
1018
1019 case YYSYMBOL_args: /* args */
1020 #line 75 "Expression.y"
1021 { std::vector<Expression*>::const_iterator i = ((*yyvaluep).arguments).begin(); while (i != ((*yyvaluep).arguments).end()) { delete *i; ++i; } }
1022 #line 1022 "Expression.tab.c"
1023 break;
1024
1025 case YYSYMBOL_range: /* range */
1026 #line 73 "Expression.y"
1027 { delete ((*yyvaluep).expr); }
1028 #line 1028 "Expression.tab.c"
1029 break;
1030
1031 case YYSYMBOL_unit_exp: /* unit_exp */
1032 #line 73 "Expression.y"
1033 { delete ((*yyvaluep).expr); }
1034 #line 1034 "Expression.tab.c"
1035 break;
1036
1037 case YYSYMBOL_indexer: /* indexer */
1038 #line 74 "Expression.y"
1039 { delete ((*yyvaluep).component); }
1040 #line 1040 "Expression.tab.c"
1041 break;
1042
1043 case YYSYMBOL_indexable: /* indexable */
1044 #line 73 "Expression.y"
1045 { delete ((*yyvaluep).expr); }
1046 #line 1046 "Expression.tab.c"
1047 break;
1048
1049 default:
1050 break;
1051 }
1052 YY_IGNORE_MAYBE_UNINITIALIZED_END
1053 }
1054
1055
1056 /* Lookahead token kind. */
1057 int yychar;
1058
1059 /* The semantic value of the lookahead symbol. */
1060 YYSTYPE yylval;
1061 /* Number of syntax errors so far. */
1062 int yynerrs;
1063
1064
1065
1066
1067 /*----------.
1068 | yyparse. |
1069 `----------*/
1070
1071 int
1072 yyparse (void)
1073 {
1074 yy_state_fast_t yystate = 0;
1075 /* Number of tokens to shift before error messages enabled. */
1076 int yyerrstatus = 0;
1077
1078 /* Refer to the stacks through separate pointers, to allow yyoverflow
1079 to reallocate them elsewhere. */
1080
1081 /* Their size. */
1082 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1083
1084 /* The state stack: array, bottom, top. */
1085 yy_state_t yyssa[YYINITDEPTH];
1086 yy_state_t *yyss = yyssa;
1087 yy_state_t *yyssp = yyss;
1088
1089 /* The semantic value stack: array, bottom, top. */
1090 YYSTYPE yyvsa[YYINITDEPTH];
1091 YYSTYPE *yyvs = yyvsa;
1092 YYSTYPE *yyvsp = yyvs;
1093
1094 int yyn;
1095 /* The return value of yyparse. */
1096 int yyresult;
1097 /* Lookahead symbol kind. */
1098 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1099 /* The variables used to return semantic value and location from the
1100 action routines. */
1101 YYSTYPE yyval;
1102
1103
1104
1105 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1106
1107 /* The number of symbols on the RHS of the reduced rule.
1108 Keep to zero when no symbol should be popped. */
1109 int yylen = 0;
1110
1111 YYDPRINTF ((stderr, "Starting parse\n"));
1112
1113 yychar = YYEMPTY; /* Cause a token to be read. */
1114
1115 goto yysetstate;
1116
1117
1118 /*------------------------------------------------------------.
1119 | yynewstate -- push a new state, which is found in yystate. |
1120 `------------------------------------------------------------*/
1121 yynewstate:
1122 /* In all cases, when you get here, the value and location stacks
1123 have just been pushed. So pushing a state here evens the stacks. */
1124 yyssp++;
1125
1126
1127 /*--------------------------------------------------------------------.
1128 | yysetstate -- set current state (the top of the stack) to yystate. |
1129 `--------------------------------------------------------------------*/
1130 yysetstate:
1131 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1132 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1133 YY_IGNORE_USELESS_CAST_BEGIN
1134 *yyssp = YY_CAST (yy_state_t, yystate);
1135 YY_IGNORE_USELESS_CAST_END
1136 YY_STACK_PRINT (yyss, yyssp);
1137
1138 if (yyss + yystacksize - 1 <= yyssp)
1139 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1140 YYNOMEM;
1141 #else
1142 {
1143 /* Get the current used size of the three stacks, in elements. */
1144 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1145
1146 # if defined yyoverflow
1147 {
1148 /* Give user a chance to reallocate the stack. Use copies of
1149 these so that the &'s don't force the real ones into
1150 memory. */
1151 yy_state_t *yyss1 = yyss;
1152 YYSTYPE *yyvs1 = yyvs;
1153
1154 /* Each stack pointer address is followed by the size of the
1155 data in use in that stack, in bytes. This used to be a
1156 conditional around just the two extra args, but that might
1157 be undefined if yyoverflow is a macro. */
1158 yyoverflow (YY_("memory exhausted"),
1159 &yyss1, yysize * YYSIZEOF (*yyssp),
1160 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1161 &yystacksize);
1162 yyss = yyss1;
1163 yyvs = yyvs1;
1164 }
1165 # else /* defined YYSTACK_RELOCATE */
1166 /* Extend the stack our own way. */
1167 if (YYMAXDEPTH <= yystacksize)
1168 YYNOMEM;
1169 yystacksize *= 2;
1170 if (YYMAXDEPTH < yystacksize)
1171 yystacksize = YYMAXDEPTH;
1172
1173 {
1174 yy_state_t *yyss1 = yyss;
1175 union yyalloc *yyptr =
1176 YY_CAST (union yyalloc *,
1177 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1178 if (! yyptr)
1179 YYNOMEM;
1180 YYSTACK_RELOCATE (yyss_alloc, yyss);
1181 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1182 # undef YYSTACK_RELOCATE
1183 if (yyss1 != yyssa)
1184 YYSTACK_FREE (yyss1);
1185 }
1186 # endif
1187
1188 yyssp = yyss + yysize - 1;
1189 yyvsp = yyvs + yysize - 1;
1190
1191 YY_IGNORE_USELESS_CAST_BEGIN
1192 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1193 YY_CAST (long, yystacksize)));
1194 YY_IGNORE_USELESS_CAST_END
1195
1196 if (yyss + yystacksize - 1 <= yyssp)
1197 YYABORT;
1198 }
1199 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1200
1201
1202 if (yystate == YYFINAL)
1203 YYACCEPT;
1204
1205 goto yybackup;
1206
1207
1208 /*-----------.
1209 | yybackup. |
1210 `-----------*/
1211 yybackup:
1212 /* Do appropriate processing given the current state. Read a
1213 lookahead token if we need one and don't already have one. */
1214
1215 /* First try to decide what to do without reference to lookahead token. */
1216 yyn = yypact[yystate];
1217 if (yypact_value_is_default (yyn))
1218 goto yydefault;
1219
1220 /* Not known => get a lookahead token if don't already have one. */
1221
1222 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1223 if (yychar == YYEMPTY)
1224 {
1225 YYDPRINTF ((stderr, "Reading a token\n"));
1226 yychar = yylex ();
1227 }
1228
1229 if (yychar <= YYEOF)
1230 {
1231 yychar = YYEOF;
1232 yytoken = YYSYMBOL_YYEOF;
1233 YYDPRINTF ((stderr, "Now at end of input.\n"));
1234 }
1235 else if (yychar == YYerror)
1236 {
1237 /* The scanner already issued an error message, process directly
1238 to error recovery. But do not keep the error token as
1239 lookahead, it is too special and may lead us to an endless
1240 loop in error recovery. */
1241 yychar = YYUNDEF;
1242 yytoken = YYSYMBOL_YYerror;
1243 goto yyerrlab1;
1244 }
1245 else
1246 {
1247 yytoken = YYTRANSLATE (yychar);
1248 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1249 }
1250
1251 /* If the proper action on seeing token YYTOKEN is to reduce or to
1252 detect an error, take that action. */
1253 yyn += yytoken;
1254 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1255 goto yydefault;
1256 yyn = yytable[yyn];
1257 if (yyn <= 0)
1258 {
1259 if (yytable_value_is_error (yyn))
1260 goto yyerrlab;
1261 yyn = -yyn;
1262 goto yyreduce;
1263 }
1264
1265 /* Count tokens shifted since error; after three, turn off error
1266 status. */
1267 if (yyerrstatus)
1268 yyerrstatus--;
1269
1270 /* Shift the lookahead token. */
1271 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1272 yystate = yyn;
1273 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1274 *++yyvsp = yylval;
1275 YY_IGNORE_MAYBE_UNINITIALIZED_END
1276
1277 /* Discard the shifted token. */
1278 yychar = YYEMPTY;
1279 goto yynewstate;
1280
1281
1282 /*-----------------------------------------------------------.
1283 | yydefault -- do the default action for the current state. |
1284 `-----------------------------------------------------------*/
1285 yydefault:
1286 yyn = yydefact[yystate];
1287 if (yyn == 0)
1288 goto yyerrlab;
1289 goto yyreduce;
1290
1291
1292 /*-----------------------------.
1293 | yyreduce -- do a reduction. |
1294 `-----------------------------*/
1295 yyreduce:
1296 /* yyn is the number of a rule to reduce with. */
1297 yylen = yyr2[yyn];
1298
1299 /* If YYLEN is nonzero, implement the default value of the action:
1300 '$$ = $1'.
1301
1302 Otherwise, the following line sets YYVAL to garbage.
1303 This behavior is undocumented and Bison
1304 users should not rely upon it. Assigning to YYVAL
1305 unconditionally makes the parser a bit smaller, and it avoids a
1306 GCC warning that YYVAL may be used uninitialized. */
1307 yyval = yyvsp[1-yylen];
1308
1309
1310 YY_REDUCE_PRINT (yyn);
1311 switch (yyn)
1312 {
1313 case 2: /* input: exp */
1314 #line 81 "Expression.y"
1315 { ScanResult = (yyvsp[0].expr); valueExpression = true; }
1316 #line 1316 "Expression.tab.c"
1317 break;
1318
1319 case 3: /* input: unit_exp */
1320 #line 82 "Expression.y"
1321 { ScanResult = (yyvsp[0].expr); unitExpression = true; }
1322 #line 1322 "Expression.tab.c"
1323 break;
1324
1325 case 4: /* unit_num: num unit_exp */
1326 #line 85 "Expression.y"
1327 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-1].expr), OperatorExpression::UNIT, (yyvsp[0].expr)); }
1328 #line 1328 "Expression.tab.c"
1329 break;
1330
1331 case 5: /* unit_num: num us_building_unit num us_building_unit */
1332 #line 86 "Expression.y"
1333 { (yyval.expr) = new OperatorExpression(DocumentObject, new OperatorExpression(DocumentObject, (yyvsp[-3].expr), OperatorExpression::UNIT, (yyvsp[-2].expr)), OperatorExpression::ADD, new OperatorExpression(DocumentObject, (yyvsp[-1].expr), OperatorExpression::UNIT, (yyvsp[0].expr)));}
1334 #line 1334 "Expression.tab.c"
1335 break;
1336
1337 case 6: /* exp: num */
1338 #line 89 "Expression.y"
1339 { (yyval.expr) = (yyvsp[0].expr); }
1340 #line 1340 "Expression.tab.c"
1341 break;
1342
1343 case 7: /* exp: unit_num */
1344 #line 90 "Expression.y"
1345 { (yyval.expr) = (yyvsp[0].expr); }
1346 #line 1346 "Expression.tab.c"
1347 break;
1348
1349 case 8: /* exp: STRING */
1350 #line 91 "Expression.y"
1351 { (yyval.expr) = new StringExpression(DocumentObject, (yyvsp[0].string)); }
1352 #line 1352 "Expression.tab.c"
1353 break;
1354
1355 case 9: /* exp: identifier */
1356 #line 92 "Expression.y"
1357 { (yyval.expr) = new VariableExpression(DocumentObject, (yyvsp[0].path)); }
1358 #line 1358 "Expression.tab.c"
1359 break;
1360
1361 case 10: /* exp: MINUSSIGN exp */
1362 #line 93 "Expression.y"
1363 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[0].expr), OperatorExpression::NEG, new NumberExpression(DocumentObject, Quantity(-1))); }
1364 #line 1364 "Expression.tab.c"
1365 break;
1366
1367 case 11: /* exp: '+' exp */
1368 #line 94 "Expression.y"
1369 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[0].expr), OperatorExpression::POS, new NumberExpression(DocumentObject, Quantity(1))); }
1370 #line 1370 "Expression.tab.c"
1371 break;
1372
1373 case 12: /* exp: exp '+' exp */
1374 #line 95 "Expression.y"
1375 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::ADD, (yyvsp[0].expr)); }
1376 #line 1376 "Expression.tab.c"
1377 break;
1378
1379 case 13: /* exp: exp MINUSSIGN exp */
1380 #line 96 "Expression.y"
1381 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::SUB, (yyvsp[0].expr)); }
1382 #line 1382 "Expression.tab.c"
1383 break;
1384
1385 case 14: /* exp: exp '*' exp */
1386 #line 97 "Expression.y"
1387 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::MUL, (yyvsp[0].expr)); }
1388 #line 1388 "Expression.tab.c"
1389 break;
1390
1391 case 15: /* exp: exp '/' exp */
1392 #line 98 "Expression.y"
1393 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::DIV, (yyvsp[0].expr)); }
1394 #line 1394 "Expression.tab.c"
1395 break;
1396
1397 case 16: /* exp: exp '%' exp */
1398 #line 99 "Expression.y"
1399 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::MOD, (yyvsp[0].expr)); }
1400 #line 1400 "Expression.tab.c"
1401 break;
1402
1403 case 17: /* exp: exp '/' unit_exp */
1404 #line 100 "Expression.y"
1405 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::DIV, (yyvsp[0].expr)); }
1406 #line 1406 "Expression.tab.c"
1407 break;
1408
1409 case 18: /* exp: exp '^' exp */
1410 #line 101 "Expression.y"
1411 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::POW, (yyvsp[0].expr)); }
1412 #line 1412 "Expression.tab.c"
1413 break;
1414
1415 case 19: /* exp: exp EQ exp */
1416 #line 102 "Expression.y"
1417 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::EQ, (yyvsp[0].expr)); }
1418 #line 1418 "Expression.tab.c"
1419 break;
1420
1421 case 20: /* exp: exp NEQ exp */
1422 #line 103 "Expression.y"
1423 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::NEQ, (yyvsp[0].expr)); }
1424 #line 1424 "Expression.tab.c"
1425 break;
1426
1427 case 21: /* exp: exp LT exp */
1428 #line 104 "Expression.y"
1429 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::LT, (yyvsp[0].expr)); }
1430 #line 1430 "Expression.tab.c"
1431 break;
1432
1433 case 22: /* exp: exp GT exp */
1434 #line 105 "Expression.y"
1435 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::GT, (yyvsp[0].expr)); }
1436 #line 1436 "Expression.tab.c"
1437 break;
1438
1439 case 23: /* exp: exp GTE exp */
1440 #line 106 "Expression.y"
1441 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::GTE, (yyvsp[0].expr)); }
1442 #line 1442 "Expression.tab.c"
1443 break;
1444
1445 case 24: /* exp: exp LTE exp */
1446 #line 107 "Expression.y"
1447 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::LTE, (yyvsp[0].expr)); }
1448 #line 1448 "Expression.tab.c"
1449 break;
1450
1451 case 25: /* exp: indexable */
1452 #line 108 "Expression.y"
1453 { (yyval.expr) = (yyvsp[0].expr); }
1454 #line 1454 "Expression.tab.c"
1455 break;
1456
1457 case 26: /* exp: FUNC args ')' */
1458 #line 109 "Expression.y"
1459 { (yyval.expr) = new FunctionExpression(DocumentObject, (yyvsp[-2].func).first, std::move((yyvsp[-2].func).second), (yyvsp[-1].arguments));}
1460 #line 1460 "Expression.tab.c"
1461 break;
1462
1463 case 27: /* exp: exp '?' exp ':' exp */
1464 #line 110 "Expression.y"
1465 { (yyval.expr) = new ConditionalExpression(DocumentObject, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
1466 #line 1466 "Expression.tab.c"
1467 break;
1468
1469 case 28: /* exp: '(' exp ')' */
1470 #line 111 "Expression.y"
1471 { (yyval.expr) = (yyvsp[-1].expr); }
1472 #line 1472 "Expression.tab.c"
1473 break;
1474
1475 case 29: /* num: ONE */
1476 #line 114 "Expression.y"
1477 { (yyval.expr) = new NumberExpression(DocumentObject, Quantity((yyvsp[0].fvalue))); }
1478 #line 1478 "Expression.tab.c"
1479 break;
1480
1481 case 30: /* num: NUM */
1482 #line 115 "Expression.y"
1483 { (yyval.expr) = new NumberExpression(DocumentObject, Quantity((yyvsp[0].fvalue))); }
1484 #line 1484 "Expression.tab.c"
1485 break;
1486
1487 case 31: /* num: INTEGER */
1488 #line 116 "Expression.y"
1489 { (yyval.expr) = new NumberExpression(DocumentObject, Quantity((double)(yyvsp[0].ivalue))); }
1490 #line 1490 "Expression.tab.c"
1491 break;
1492
1493 case 32: /* num: CONSTANT */
1494 #line 117 "Expression.y"
1495 { (yyval.expr) = new ConstantExpression(DocumentObject, (yyvsp[0].constant).name, Quantity((yyvsp[0].constant).fvalue)); }
1496 #line 1496 "Expression.tab.c"
1497 break;
1498
1499 case 33: /* args: exp */
1500 #line 119 "Expression.y"
1501 { (yyval.arguments).push_back((yyvsp[0].expr)); }
1502 #line 1502 "Expression.tab.c"
1503 break;
1504
1505 case 34: /* args: range */
1506 #line 120 "Expression.y"
1507 { (yyval.arguments).push_back((yyvsp[0].expr)); }
1508 #line 1508 "Expression.tab.c"
1509 break;
1510
1511 case 35: /* args: args ',' exp */
1512 #line 121 "Expression.y"
1513 { (yyvsp[-2].arguments).push_back((yyvsp[0].expr)); (yyval.arguments) = (yyvsp[-2].arguments); }
1514 #line 1514 "Expression.tab.c"
1515 break;
1516
1517 case 36: /* args: args ';' exp */
1518 #line 122 "Expression.y"
1519 { (yyvsp[-2].arguments).push_back((yyvsp[0].expr)); (yyval.arguments) = (yyvsp[-2].arguments); }
1520 #line 1520 "Expression.tab.c"
1521 break;
1522
1523 case 37: /* args: args ',' range */
1524 #line 123 "Expression.y"
1525 { (yyvsp[-2].arguments).push_back((yyvsp[0].expr)); (yyval.arguments) = (yyvsp[-2].arguments); }
1526 #line 1526 "Expression.tab.c"
1527 break;
1528
1529 case 38: /* args: args ';' range */
1530 #line 124 "Expression.y"
1531 { (yyvsp[-2].arguments).push_back((yyvsp[0].expr)); (yyval.arguments) = (yyvsp[-2].arguments); }
1532 #line 1532 "Expression.tab.c"
1533 break;
1534
1535 case 39: /* range: id_or_cell ':' id_or_cell */
1536 #line 127 "Expression.y"
1537 { (yyval.expr) = new RangeExpression(DocumentObject, (yyvsp[-2].string), (yyvsp[0].string)); }
1538 #line 1538 "Expression.tab.c"
1539 break;
1540
1541 case 40: /* us_building_unit: USUNIT */
1542 #line 131 "Expression.y"
1543 { (yyval.expr) = new UnitExpression(DocumentObject, (yyvsp[0].quantity).scaler, (yyvsp[0].quantity).unitStr ); }
1544 #line 1544 "Expression.tab.c"
1545 break;
1546
1547 case 41: /* other_unit: UNIT */
1548 #line 132 "Expression.y"
1549 { (yyval.expr) = new UnitExpression(DocumentObject, (yyvsp[0].quantity).scaler, (yyvsp[0].quantity).unitStr ); }
1550 #line 1550 "Expression.tab.c"
1551 break;
1552
1553 case 42: /* unit_exp: other_unit */
1554 #line 134 "Expression.y"
1555 { (yyval.expr) = (yyvsp[0].expr); }
1556 #line 1556 "Expression.tab.c"
1557 break;
1558
1559 case 43: /* unit_exp: us_building_unit */
1560 #line 135 "Expression.y"
1561 { (yyval.expr) = (yyvsp[0].expr); }
1562 #line 1562 "Expression.tab.c"
1563 break;
1564
1565 case 44: /* unit_exp: unit_exp '/' unit_exp */
1566 #line 136 "Expression.y"
1567 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::DIV, (yyvsp[0].expr)); }
1568 #line 1568 "Expression.tab.c"
1569 break;
1570
1571 case 45: /* unit_exp: unit_exp '*' unit_exp */
1572 #line 137 "Expression.y"
1573 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::MUL, (yyvsp[0].expr)); }
1574 #line 1574 "Expression.tab.c"
1575 break;
1576
1577 case 46: /* unit_exp: unit_exp '^' integer */
1578 #line 138 "Expression.y"
1579 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::POW, new NumberExpression(DocumentObject, Quantity((double)(yyvsp[0].ivalue)))); }
1580 #line 1580 "Expression.tab.c"
1581 break;
1582
1583 case 47: /* unit_exp: unit_exp '^' MINUSSIGN integer */
1584 #line 139 "Expression.y"
1585 { (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-3].expr), OperatorExpression::POW, new OperatorExpression(DocumentObject, new NumberExpression(DocumentObject, Quantity((double)(yyvsp[0].ivalue))), OperatorExpression::NEG, new NumberExpression(DocumentObject, Quantity(-1)))); }
1586 #line 1586 "Expression.tab.c"
1587 break;
1588
1589 case 48: /* unit_exp: '(' unit_exp ')' */
1590 #line 140 "Expression.y"
1591 { (yyval.expr) = (yyvsp[-1].expr); }
1592 #line 1592 "Expression.tab.c"
1593 break;
1594
1595 case 49: /* integer: INTEGER */
1596 #line 143 "Expression.y"
1597 { (yyval.ivalue) = (yyvsp[0].ivalue); }
1598 #line 1598 "Expression.tab.c"
1599 break;
1600
1601 case 50: /* integer: ONE */
1602 #line 144 "Expression.y"
1603 { (yyval.ivalue) = (yyvsp[0].fvalue); }
1604 #line 1604 "Expression.tab.c"
1605 break;
1606
1607 case 51: /* id_or_cell: IDENTIFIER */
1608 #line 148 "Expression.y"
1609 { (yyval.string) = std::move((yyvsp[0].string)); }
1610 #line 1610 "Expression.tab.c"
1611 break;
1612
1613 case 52: /* id_or_cell: CELLADDRESS */
1614 #line 149 "Expression.y"
1615 { (yyval.string) = std::move((yyvsp[0].string)); }
1616 #line 1616 "Expression.tab.c"
1617 break;
1618
1619 case 53: /* identifier: id_or_cell */
1620 #line 153 "Expression.y"
1621 { (yyval.path) = ObjectIdentifier(DocumentObject); (yyval.path) << ObjectIdentifier::SimpleComponent((yyvsp[0].string)); }
1622 #line 1622 "Expression.tab.c"
1623 break;
1624
1625 case 54: /* identifier: iden */
1626 #line 154 "Expression.y"
1627 { (yyval.path) = std::move((yyvsp[0].path)); }
1628 #line 1628 "Expression.tab.c"
1629 break;
1630
1631 case 55: /* iden: '.' STRING '.' id_or_cell */
1632 #line 158 "Expression.y"
1633 { /* Path to property of a sub-object of the current object*/
1634 (yyval.path) = ObjectIdentifier(DocumentObject,true);
1635 (yyval.path).setDocumentObjectName(DocumentObject,false,ObjectIdentifier::String(std::move((yyvsp[-2].string)),true),true);
1636 (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
1637 }
1638 #line 1638 "Expression.tab.c"
1639 break;
1640
1641 case 56: /* iden: '.' id_or_cell */
1642 #line 163 "Expression.y"
1643 { /* Path to property of the current document object */
1644 (yyval.path) = ObjectIdentifier(DocumentObject,true);
1645 (yyval.path).setDocumentObjectName(DocumentObject);
1646 (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
1647 }
1648 #line 1648 "Expression.tab.c"
1649 break;
1650
1651 case 57: /* iden: object '.' STRING '.' id_or_cell */
1652 #line 168 "Expression.y"
1653 { /* Path to property of a sub-object */
1654 (yyval.path) = ObjectIdentifier(DocumentObject);
1655 (yyval.path).setDocumentObjectName(std::move((yyvsp[-4].string_or_identifier)), true, ObjectIdentifier::String(std::move((yyvsp[-2].string)),true),true);
1656 (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
1657 (yyval.path).resolveAmbiguity();
1658 }
1659 #line 1659 "Expression.tab.c"
1660 break;
1661
1662 case 58: /* iden: object '.' id_or_cell */
1663 #line 174 "Expression.y"
1664 { /* Path to property of a given document object */
1665 (yyval.path) = ObjectIdentifier(DocumentObject);
1666 (yyvsp[-2].string_or_identifier).checkImport(DocumentObject);
1667 (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[-2].string_or_identifier)));
1668 (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
1669 (yyval.path).resolveAmbiguity();
1670 }
1671 #line 1671 "Expression.tab.c"
1672 break;
1673
1674 case 59: /* iden: document '#' object '.' id_or_cell */
1675 #line 181 "Expression.y"
1676 { /* Path to property from an external document, within a named document object */
1677 (yyval.path) = ObjectIdentifier(DocumentObject);
1678 (yyval.path).setDocumentName(std::move((yyvsp[-4].string_or_identifier)), true);
1679 (yyval.path).setDocumentObjectName(std::move((yyvsp[-2].string_or_identifier)), true);
1680 (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
1681 (yyval.path).resolveAmbiguity();
1682 }
1683 #line 1683 "Expression.tab.c"
1684 break;
1685
1686 case 60: /* iden: document '#' object '.' STRING '.' id_or_cell */
1687 #line 189 "Expression.y"
1688 { (yyval.path) = ObjectIdentifier(DocumentObject);
1689 (yyval.path).setDocumentName(std::move((yyvsp[-6].string_or_identifier)), true);
1690 (yyval.path).setDocumentObjectName(std::move((yyvsp[-4].string_or_identifier)), true, ObjectIdentifier::String(std::move((yyvsp[-2].string)),true));
1691 (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
1692 (yyval.path).resolveAmbiguity();
1693 }
1694 #line 1694 "Expression.tab.c"
1695 break;
1696
1697 case 61: /* iden: iden '.' IDENTIFIER */
1698 #line 195 "Expression.y"
1699 { (yyval.path)= std::move((yyvsp[-2].path)); (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string))); }
1700 #line 1700 "Expression.tab.c"
1701 break;
1702
1703 case 62: /* indexer: '[' exp ']' */
1704 #line 199 "Expression.y"
1705 { (yyval.component) = Expression::createComponent((yyvsp[-1].expr)); }
1706 #line 1706 "Expression.tab.c"
1707 break;
1708
1709 case 63: /* indexer: '[' exp ':' ']' */
1710 #line 200 "Expression.y"
1711 { (yyval.component) = Expression::createComponent((yyvsp[-2].expr),0,0,true); }
1712 #line 1712 "Expression.tab.c"
1713 break;
1714
1715 case 64: /* indexer: '[' ':' exp ']' */
1716 #line 201 "Expression.y"
1717 { (yyval.component) = Expression::createComponent(0,(yyvsp[-1].expr)); }
1718 #line 1718 "Expression.tab.c"
1719 break;
1720
1721 case 65: /* indexer: '[' ':' ':' exp ']' */
1722 #line 202 "Expression.y"
1723 { (yyval.component) = Expression::createComponent(0,0,(yyvsp[-1].expr)); }
1724 #line 1724 "Expression.tab.c"
1725 break;
1726
1727 case 66: /* indexer: '[' exp ':' exp ']' */
1728 #line 203 "Expression.y"
1729 { (yyval.component) = Expression::createComponent((yyvsp[-3].expr),(yyvsp[-1].expr));}
1730 #line 1730 "Expression.tab.c"
1731 break;
1732
1733 case 67: /* indexer: '[' exp ':' ':' exp ']' */
1734 #line 204 "Expression.y"
1735 { (yyval.component) = Expression::createComponent((yyvsp[-4].expr),0,(yyvsp[-1].expr)); }
1736 #line 1736 "Expression.tab.c"
1737 break;
1738
1739 case 68: /* indexer: '[' ':' exp ':' exp ']' */
1740 #line 205 "Expression.y"
1741 { (yyval.component) = Expression::createComponent(0,(yyvsp[-3].expr),(yyvsp[-1].expr)); }
1742 #line 1742 "Expression.tab.c"
1743 break;
1744
1745 case 69: /* indexer: '[' exp ':' exp ':' exp ']' */
1746 #line 206 "Expression.y"
1747 { (yyval.component) = Expression::createComponent((yyvsp[-5].expr),(yyvsp[-3].expr),(yyvsp[-1].expr));}
1748 #line 1748 "Expression.tab.c"
1749 break;
1750
1751 case 70: /* indexable: identifier indexer */
1752 #line 210 "Expression.y"
1753 { (yyval.expr) = new VariableExpression(DocumentObject,(yyvsp[-1].path)); (yyval.expr)->addComponent((yyvsp[0].component)); }
1754 #line 1754 "Expression.tab.c"
1755 break;
1756
1757 case 71: /* indexable: indexable indexer */
1758 #line 211 "Expression.y"
1759 { (yyvsp[-1].expr)->addComponent(std::move((yyvsp[0].component))); (yyval.expr) = (yyvsp[-1].expr); }
1760 #line 1760 "Expression.tab.c"
1761 break;
1762
1763 case 72: /* indexable: indexable '.' IDENTIFIER */
1764 #line 212 "Expression.y"
1765 { (yyvsp[-2].expr)->addComponent(Expression::createComponent((yyvsp[0].string))); (yyval.expr) = (yyvsp[-2].expr); }
1766 #line 1766 "Expression.tab.c"
1767 break;
1768
1769 case 73: /* document: STRING */
1770 #line 216 "Expression.y"
1771 { (yyval.string_or_identifier) = ObjectIdentifier::String(std::move((yyvsp[0].string)), true); }
1772 #line 1772 "Expression.tab.c"
1773 break;
1774
1775 case 74: /* document: IDENTIFIER */
1776 #line 217 "Expression.y"
1777 { (yyval.string_or_identifier) = ObjectIdentifier::String(std::move((yyvsp[0].string)), false, true);}
1778 #line 1778 "Expression.tab.c"
1779 break;
1780
1781 case 75: /* object: STRING */
1782 #line 221 "Expression.y"
1783 { (yyval.string_or_identifier) = ObjectIdentifier::String(std::move((yyvsp[0].string)), true); }
1784 #line 1784 "Expression.tab.c"
1785 break;
1786
1787 case 76: /* object: id_or_cell */
1788 #line 222 "Expression.y"
1789 { (yyval.string_or_identifier) = ObjectIdentifier::String(std::move((yyvsp[0].string)), false);}
1790 #line 1790 "Expression.tab.c"
1791 break;
1792
1793
1794 #line 1794 "Expression.tab.c"
1795
1796 default: break;
1797 }
1798 /* User semantic actions sometimes alter yychar, and that requires
1799 that yytoken be updated with the new translation. We take the
1800 approach of translating immediately before every use of yytoken.
1801 One alternative is translating here after every semantic action,
1802 but that translation would be missed if the semantic action invokes
1803 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1804 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1805 incorrect destructor might then be invoked immediately. In the
1806 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1807 to an incorrect destructor call or verbose syntax error message
1808 before the lookahead is translated. */
1809 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1810
1811 YYPOPSTACK (yylen);
1812 yylen = 0;
1813
1814 *++yyvsp = yyval;
1815
1816 /* Now 'shift' the result of the reduction. Determine what state
1817 that goes to, based on the state we popped back to and the rule
1818 number reduced by. */
1819 {
1820 const int yylhs = yyr1[yyn] - YYNTOKENS;
1821 const int yyi = yypgoto[yylhs] + *yyssp;
1822 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1823 ? yytable[yyi]
1824 : yydefgoto[yylhs]);
1825 }
1826
1827 goto yynewstate;
1828
1829
1830 /*--------------------------------------.
1831 | yyerrlab -- here on detecting error. |
1832 `--------------------------------------*/
1833 yyerrlab:
1834 /* Make sure we have latest lookahead translation. See comments at
1835 user semantic actions for why this is necessary. */
1836 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1837 /* If not already recovering from an error, report this error. */
1838 if (!yyerrstatus)
1839 {
1840 ++yynerrs;
1841 yyerror (YY_("syntax error"));
1842 }
1843
1844 if (yyerrstatus == 3)
1845 {
1846 /* If just tried and failed to reuse lookahead token after an
1847 error, discard it. */
1848
1849 if (yychar <= YYEOF)
1850 {
1851 /* Return failure if at end of input. */
1852 if (yychar == YYEOF)
1853 YYABORT;
1854 }
1855 else
1856 {
1857 yydestruct ("Error: discarding",
1858 yytoken, &yylval);
1859 yychar = YYEMPTY;
1860 }
1861 }
1862
1863 /* Else will try to reuse lookahead token after shifting the error
1864 token. */
1865 goto yyerrlab1;
1866
1867
1868 /*---------------------------------------------------.
1869 | yyerrorlab -- error raised explicitly by YYERROR. |
1870 `---------------------------------------------------*/
1871 yyerrorlab:
1872 /* Pacify compilers when the user code never invokes YYERROR and the
1873 label yyerrorlab therefore never appears in user code. */
1874 if (0)
1875 YYERROR;
1876 ++yynerrs;
1877
1878 /* Do not reclaim the symbols of the rule whose action triggered
1879 this YYERROR. */
1880 YYPOPSTACK (yylen);
1881 yylen = 0;
1882 YY_STACK_PRINT (yyss, yyssp);
1883 yystate = *yyssp;
1884 goto yyerrlab1;
1885
1886
1887 /*-------------------------------------------------------------.
1888 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1889 `-------------------------------------------------------------*/
1890 yyerrlab1:
1891 yyerrstatus = 3; /* Each real token shifted decrements this. */
1892
1893 /* Pop stack until we find a state that shifts the error token. */
1894 for (;;)
1895 {
1896 yyn = yypact[yystate];
1897 if (!yypact_value_is_default (yyn))
1898 {
1899 yyn += YYSYMBOL_YYerror;
1900 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1901 {
1902 yyn = yytable[yyn];
1903 if (0 < yyn)
1904 break;
1905 }
1906 }
1907
1908 /* Pop the current state because it cannot handle the error token. */
1909 if (yyssp == yyss)
1910 YYABORT;
1911
1912
1913 yydestruct ("Error: popping",
1914 YY_ACCESSING_SYMBOL (yystate), yyvsp);
1915 YYPOPSTACK (1);
1916 yystate = *yyssp;
1917 YY_STACK_PRINT (yyss, yyssp);
1918 }
1919
1920 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1921 *++yyvsp = yylval;
1922 YY_IGNORE_MAYBE_UNINITIALIZED_END
1923
1924
1925 /* Shift the error token. */
1926 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1927
1928 yystate = yyn;
1929 goto yynewstate;
1930
1931
1932 /*-------------------------------------.
1933 | yyacceptlab -- YYACCEPT comes here. |
1934 `-------------------------------------*/
1935 yyacceptlab:
1936 yyresult = 0;
1937 goto yyreturnlab;
1938
1939
1940 /*-----------------------------------.
1941 | yyabortlab -- YYABORT comes here. |
1942 `-----------------------------------*/
1943 yyabortlab:
1944 yyresult = 1;
1945 goto yyreturnlab;
1946
1947
1948 /*-----------------------------------------------------------.
1949 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1950 `-----------------------------------------------------------*/
1951 yyexhaustedlab:
1952 yyerror (YY_("memory exhausted"));
1953 yyresult = 2;
1954 goto yyreturnlab;
1955
1956
1957 /*----------------------------------------------------------.
1958 | yyreturnlab -- parsing is finished, clean up and return. |
1959 `----------------------------------------------------------*/
1960 yyreturnlab:
1961 if (yychar != YYEMPTY)
1962 {
1963 /* Make sure we have latest lookahead translation. See comments at
1964 user semantic actions for why this is necessary. */
1965 yytoken = YYTRANSLATE (yychar);
1966 yydestruct ("Cleanup: discarding lookahead",
1967 yytoken, &yylval);
1968 }
1969 /* Do not reclaim the symbols of the rule whose action triggered
1970 this YYABORT or YYACCEPT. */
1971 YYPOPSTACK (yylen);
1972 YY_STACK_PRINT (yyss, yyssp);
1973 while (yyssp != yyss)
1974 {
1975 yydestruct ("Cleanup: popping",
1976 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1977 YYPOPSTACK (1);
1978 }
1979 #ifndef yyoverflow
1980 if (yyss != yyssa)
1981 YYSTACK_FREE (yyss);
1982 #endif
1983
1984 return yyresult;
1985 }
1986
1987 #line 225 "Expression.y"
1988