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