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