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