1 :
2 : /* A Bison parser, made by GNU Bison 2.4.1. */
3 :
4 : /* Skeleton implementation for Bison's Yacc-like parsers in C
5 :
6 : Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 : Free Software Foundation, Inc.
8 :
9 : This program is free software: you can redistribute it and/or modify
10 : it under the terms of the GNU General Public License as published by
11 : the Free Software Foundation, either version 3 of the License, or
12 : (at your option) any later version.
13 :
14 : This program is distributed in the hope that it will be useful,
15 : but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : GNU General Public License for more details.
18 :
19 : You should have received a copy of the GNU General Public License
20 : along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 :
22 : /* As a special exception, you may create a larger work that contains
23 : part or all of the Bison parser skeleton and distribute that work
24 : under terms of your choice, so long as that work isn't itself a
25 : parser generator using the skeleton or a modified version thereof
26 : as a parser skeleton. Alternatively, if you modify or redistribute
27 : the parser skeleton itself, you may (at your option) remove this
28 : special exception, which will cause the skeleton and the resulting
29 : Bison output files to be licensed under the GNU General Public
30 : License without this special exception.
31 :
32 : This special exception was added by the Free Software Foundation in
33 : version 2.2 of Bison. */
34 :
35 : /* C LALR(1) parser skeleton written by Richard Stallman, by
36 : simplifying the original so-called "semantic" parser. */
37 :
38 : /* All symbols defined below should begin with yy or YY, to avoid
39 : infringing on user name space. This should be done even for local
40 : variables, as they might otherwise be expanded by user macros.
41 : There are some unavoidable exceptions within include files to
42 : define necessary library symbols; they are noted "INFRINGES ON
43 : USER NAME SPACE" below. */
44 :
45 : /* Identify Bison output. */
46 : #define YYBISON 1
47 :
48 : /* Bison version. */
49 : #define YYBISON_VERSION "2.4.1"
50 :
51 : /* Skeleton name. */
52 : #define YYSKELETON_NAME "yacc.c"
53 :
54 : /* Pure parsers. */
55 : #define YYPURE 1
56 :
57 : /* Push parsers. */
58 : #define YYPUSH 0
59 :
60 : /* Pull parsers. */
61 : #define YYPULL 1
62 :
63 : /* Using locations. */
64 : #define YYLSP_NEEDED 0
65 :
66 : /* Substitute the variable and function names. */
67 : #define yyparse ods_formulaparse
68 : #define yylex ods_formulalex
69 : #define yyerror ods_formulaerror
70 : #define yylval ods_formulalval
71 : #define yychar ods_formulachar
72 : #define yydebug ods_formuladebug
73 : #define yynerrs ods_formulanerrs
74 :
75 :
76 : /* Copy the first part of user declarations. */
77 :
78 : /* Line 189 of yacc.c */
79 : #line 1 "ods_formula_parser.y"
80 :
81 : /******************************************************************************
82 : * $Id: ods_formula_parser.cpp 23831 2012-01-30 23:12:23Z rouault $
83 : *
84 : * Component: OGR ODS Formula Engine
85 : * Purpose: expression and select parser grammar.
86 : * Requires Bison 2.4.0 or newer to process. Use "make parser" target.
87 : * Author: Even Rouault, even dot rouault at mines dash paris dot org
88 : *
89 : ******************************************************************************
90 : * Copyright (C) 2010 Frank Warmerdam <warmerdam@pobox.com>
91 : * Copyright (c) 2012, Even Rouault <even dot rouault at mines dash paris dot org>
92 : *
93 : * Permission is hereby granted, free of charge, to any person obtaining a
94 : * copy of this software and associated documentation files (the "Software"),
95 : * to deal in the Software without restriction, including without limitation
96 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
97 : * and/or sell copies of the Software, and to permit persons to whom the
98 : * Software is furnished to do so, subject to the following conditions:
99 : *
100 : * The above copyright notice and this permission notice shall be included
101 : * in all copies or substantial portions of the Software.
102 : *
103 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
104 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
105 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
106 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
107 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
108 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
109 : * DEALINGS IN THE SOFTWARE.
110 : ****************************************************************************/
111 :
112 : #include "cpl_conv.h"
113 : #include "cpl_string.h"
114 : #include "ods_formula.h"
115 :
116 : #define YYSTYPE ods_formula_node*
117 :
118 : /* Defining YYSTYPE_IS_TRIVIAL is needed because the parser is generated as a C++ file. */
119 : /* See http://www.gnu.org/s/bison/manual/html_node/Memory-Management.html that suggests */
120 : /* increase YYINITDEPTH instead, but this will consume memory. */
121 : /* Setting YYSTYPE_IS_TRIVIAL overcomes this limitation, but might be fragile because */
122 : /* it appears to be a non documented feature of Bison */
123 : #define YYSTYPE_IS_TRIVIAL 1
124 :
125 : static void ods_formulaerror( ods_formula_parse_context *context, const char *msg )
126 : {
127 : CPLError( CE_Failure, CPLE_AppDefined,
128 : "Formula Parsing Error: %s", msg );
129 : }
130 :
131 :
132 :
133 : /* Line 189 of yacc.c */
134 : #line 135 "ods_formula_parser.cpp"
135 :
136 : /* Enabling traces. */
137 : #ifndef YYDEBUG
138 : # define YYDEBUG 0
139 : #endif
140 :
141 : /* Enabling verbose error messages. */
142 : #ifdef YYERROR_VERBOSE
143 : # undef YYERROR_VERBOSE
144 : # define YYERROR_VERBOSE 1
145 : #else
146 : # define YYERROR_VERBOSE 0
147 : #endif
148 :
149 : /* Enabling the token table. */
150 : #ifndef YYTOKEN_TABLE
151 : # define YYTOKEN_TABLE 0
152 : #endif
153 :
154 :
155 : /* Tokens. */
156 : #ifndef YYTOKENTYPE
157 : # define YYTOKENTYPE
158 : /* Put the tokens into the symbol table, so that GDB and other debuggers
159 : know about them. */
160 : enum yytokentype {
161 : ODST_NUMBER = 258,
162 : ODST_STRING = 259,
163 : ODST_IDENTIFIER = 260,
164 : ODST_FUNCTION_NO_ARG = 261,
165 : ODST_FUNCTION_SINGLE_ARG = 262,
166 : ODST_FUNCTION_TWO_ARG = 263,
167 : ODST_FUNCTION_THREE_ARG = 264,
168 : ODST_FUNCTION_ARG_LIST = 265,
169 : ODST_START = 266,
170 : ODST_NOT = 267,
171 : ODST_OR = 268,
172 : ODST_AND = 269,
173 : ODST_IF = 270,
174 : ODST_UMINUS = 271
175 : };
176 : #endif
177 :
178 :
179 :
180 : #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
181 : typedef int YYSTYPE;
182 : # define YYSTYPE_IS_TRIVIAL 1
183 : # define yystype YYSTYPE /* obsolescent; will be withdrawn */
184 : # define YYSTYPE_IS_DECLARED 1
185 : #endif
186 :
187 :
188 : /* Copy the second part of user declarations. */
189 :
190 :
191 : /* Line 264 of yacc.c */
192 : #line 193 "ods_formula_parser.cpp"
193 :
194 : #ifdef short
195 : # undef short
196 : #endif
197 :
198 : #ifdef YYTYPE_UINT8
199 : typedef YYTYPE_UINT8 yytype_uint8;
200 : #else
201 : typedef unsigned char yytype_uint8;
202 : #endif
203 :
204 : #ifdef YYTYPE_INT8
205 : typedef YYTYPE_INT8 yytype_int8;
206 : #elif (defined __STDC__ || defined __C99__FUNC__ \
207 : || defined __cplusplus || defined _MSC_VER)
208 : typedef signed char yytype_int8;
209 : #else
210 : typedef short int yytype_int8;
211 : #endif
212 :
213 : #ifdef YYTYPE_UINT16
214 : typedef YYTYPE_UINT16 yytype_uint16;
215 : #else
216 : typedef unsigned short int yytype_uint16;
217 : #endif
218 :
219 : #ifdef YYTYPE_INT16
220 : typedef YYTYPE_INT16 yytype_int16;
221 : #else
222 : typedef short int yytype_int16;
223 : #endif
224 :
225 : #ifndef YYSIZE_T
226 : # ifdef __SIZE_TYPE__
227 : # define YYSIZE_T __SIZE_TYPE__
228 : # elif defined size_t
229 : # define YYSIZE_T size_t
230 : # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
231 : || defined __cplusplus || defined _MSC_VER)
232 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
233 : # define YYSIZE_T size_t
234 : # else
235 : # define YYSIZE_T unsigned int
236 : # endif
237 : #endif
238 :
239 : #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
240 :
241 : #ifndef YY_
242 : # if YYENABLE_NLS
243 : # if ENABLE_NLS
244 : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
245 : # define YY_(msgid) dgettext ("bison-runtime", msgid)
246 : # endif
247 : # endif
248 : # ifndef YY_
249 : # define YY_(msgid) msgid
250 : # endif
251 : #endif
252 :
253 : /* Suppress unused-variable warnings by "using" E. */
254 : #if ! defined lint || defined __GNUC__
255 : # define YYUSE(e) ((void) (e))
256 : #else
257 : # define YYUSE(e) /* empty */
258 : #endif
259 :
260 : /* Identity function, used to suppress warnings about constant conditions. */
261 : #ifndef lint
262 : # define YYID(n) (n)
263 : #else
264 : #if (defined __STDC__ || defined __C99__FUNC__ \
265 : || defined __cplusplus || defined _MSC_VER)
266 : static int
267 : YYID (int yyi)
268 : #else
269 : static int
270 : YYID (yyi)
271 : int yyi;
272 : #endif
273 : {
274 : return yyi;
275 : }
276 : #endif
277 :
278 : #if ! defined yyoverflow || YYERROR_VERBOSE
279 :
280 : /* The parser invokes alloca or malloc; define the necessary symbols. */
281 :
282 : # ifdef YYSTACK_USE_ALLOCA
283 : # if YYSTACK_USE_ALLOCA
284 : # ifdef __GNUC__
285 : # define YYSTACK_ALLOC __builtin_alloca
286 : # elif defined __BUILTIN_VA_ARG_INCR
287 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
288 : # elif defined _AIX
289 : # define YYSTACK_ALLOC __alloca
290 : # elif defined _MSC_VER
291 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
292 : # define alloca _alloca
293 : # else
294 : # define YYSTACK_ALLOC alloca
295 : # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
296 : || defined __cplusplus || defined _MSC_VER)
297 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
298 : # ifndef _STDLIB_H
299 : # define _STDLIB_H 1
300 : # endif
301 : # endif
302 : # endif
303 : # endif
304 : # endif
305 :
306 : # ifdef YYSTACK_ALLOC
307 : /* Pacify GCC's `empty if-body' warning. */
308 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
309 : # ifndef YYSTACK_ALLOC_MAXIMUM
310 : /* The OS might guarantee only one guard page at the bottom of the stack,
311 : and a page size can be as small as 4096 bytes. So we cannot safely
312 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
313 : to allow for a few compiler-allocated temporary stack slots. */
314 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
315 : # endif
316 : # else
317 : # define YYSTACK_ALLOC YYMALLOC
318 : # define YYSTACK_FREE YYFREE
319 : # ifndef YYSTACK_ALLOC_MAXIMUM
320 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
321 : # endif
322 : # if (defined __cplusplus && ! defined _STDLIB_H \
323 : && ! ((defined YYMALLOC || defined malloc) \
324 : && (defined YYFREE || defined free)))
325 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
326 : # ifndef _STDLIB_H
327 : # define _STDLIB_H 1
328 : # endif
329 : # endif
330 : # ifndef YYMALLOC
331 : # define YYMALLOC malloc
332 : # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
333 : || defined __cplusplus || defined _MSC_VER)
334 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
335 : # endif
336 : # endif
337 : # ifndef YYFREE
338 : # define YYFREE free
339 : # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
340 : || defined __cplusplus || defined _MSC_VER)
341 : void free (void *); /* INFRINGES ON USER NAME SPACE */
342 : # endif
343 : # endif
344 : # endif
345 : #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
346 :
347 :
348 : #if (! defined yyoverflow \
349 : && (! defined __cplusplus \
350 : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
351 :
352 : /* A type that is properly aligned for any stack member. */
353 : union yyalloc
354 : {
355 : yytype_int16 yyss_alloc;
356 : YYSTYPE yyvs_alloc;
357 : };
358 :
359 : /* The size of the maximum gap between one aligned stack and the next. */
360 : # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
361 :
362 : /* The size of an array large to enough to hold all stacks, each with
363 : N elements. */
364 : # define YYSTACK_BYTES(N) \
365 : ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
366 : + YYSTACK_GAP_MAXIMUM)
367 :
368 : /* Copy COUNT objects from FROM to TO. The source and destination do
369 : not overlap. */
370 : # ifndef YYCOPY
371 : # if defined __GNUC__ && 1 < __GNUC__
372 : # define YYCOPY(To, From, Count) \
373 : __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
374 : # else
375 : # define YYCOPY(To, From, Count) \
376 : do \
377 : { \
378 : YYSIZE_T yyi; \
379 : for (yyi = 0; yyi < (Count); yyi++) \
380 : (To)[yyi] = (From)[yyi]; \
381 : } \
382 : while (YYID (0))
383 : # endif
384 : # endif
385 :
386 : /* Relocate STACK from its old location to the new one. The
387 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
388 : elements in the stack, and YYPTR gives the new location of the
389 : stack. Advance YYPTR to a properly aligned location for the next
390 : stack. */
391 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
392 : do \
393 : { \
394 : YYSIZE_T yynewbytes; \
395 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
396 : Stack = &yyptr->Stack_alloc; \
397 : yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
398 : yyptr += yynewbytes / sizeof (*yyptr); \
399 : } \
400 : while (YYID (0))
401 :
402 : #endif
403 :
404 : /* YYFINAL -- State number of the termination state. */
405 : #define YYFINAL 18
406 : /* YYLAST -- Last index in YYTABLE. */
407 : #define YYLAST 333
408 :
409 : /* YYNTOKENS -- Number of terminals. */
410 : #define YYNTOKENS 34
411 : /* YYNNTS -- Number of nonterminals. */
412 : #define YYNNTS 7
413 : /* YYNRULES -- Number of rules. */
414 : #define YYNRULES 41
415 : /* YYNRULES -- Number of states. */
416 : #define YYNSTATES 108
417 :
418 : /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
419 : #define YYUNDEFTOK 2
420 : #define YYMAXUTOK 271
421 :
422 : #define YYTRANSLATE(YYX) \
423 : ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
424 :
425 : /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
426 : static const yytype_uint8 yytranslate[] =
427 : {
428 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 : 2, 2, 2, 30, 2, 2, 2, 21, 18, 2,
432 : 25, 26, 19, 16, 23, 17, 2, 20, 2, 2,
433 : 2, 2, 2, 2, 2, 2, 2, 2, 33, 24,
434 : 28, 27, 29, 2, 2, 2, 2, 2, 2, 2,
435 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 : 2, 31, 2, 32, 2, 2, 2, 2, 2, 2,
438 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
454 : 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
455 : 15, 22
456 : };
457 :
458 : #if YYDEBUG
459 : /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
460 : YYRHS. */
461 : static const yytype_uint8 yyprhs[] =
462 : {
463 : 0, 0, 3, 6, 8, 10, 12, 14, 18, 23,
464 : 30, 39, 44, 49, 54, 61, 70, 75, 79, 83,
465 : 88, 93, 97, 101, 106, 111, 116, 121, 124, 128,
466 : 132, 136, 140, 144, 148, 152, 156, 158, 162, 164,
467 : 168, 170
468 : };
469 :
470 : /* YYRHS -- A `-1'-separated list of the rules' RHS. */
471 : static const yytype_int8 yyrhs[] =
472 : {
473 : 35, 0, -1, 11, 37, -1, 23, -1, 24, -1,
474 : 3, -1, 4, -1, 6, 25, 26, -1, 7, 25,
475 : 37, 26, -1, 8, 25, 37, 36, 37, 26, -1,
476 : 9, 25, 37, 36, 37, 36, 37, 26, -1, 14,
477 : 25, 38, 26, -1, 13, 25, 38, 26, -1, 12,
478 : 25, 37, 26, -1, 15, 25, 37, 36, 37, 26,
479 : -1, 15, 25, 37, 36, 37, 36, 37, 26, -1,
480 : 10, 25, 39, 26, -1, 25, 37, 26, -1, 37,
481 : 27, 37, -1, 37, 28, 29, 37, -1, 37, 30,
482 : 27, 37, -1, 37, 28, 37, -1, 37, 29, 37,
483 : -1, 37, 28, 27, 37, -1, 37, 27, 28, 37,
484 : -1, 37, 27, 29, 37, -1, 37, 29, 27, 37,
485 : -1, 17, 37, -1, 37, 16, 37, -1, 37, 17,
486 : 37, -1, 37, 18, 37, -1, 37, 19, 37, -1,
487 : 37, 20, 37, -1, 37, 21, 37, -1, 31, 5,
488 : 32, -1, 37, 36, 38, -1, 37, -1, 37, 36,
489 : 39, -1, 37, -1, 40, 36, 39, -1, 40, -1,
490 : 31, 5, 33, 5, 32, -1
491 : };
492 :
493 : /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
494 : static const yytype_uint16 yyrline[] =
495 : {
496 : 0, 88, 88, 93, 93, 97, 102, 107, 112, 118,
497 : 125, 133, 140, 147, 153, 160, 168, 175, 180, 187,
498 : 194, 201, 208, 215, 222, 229, 236, 243, 259, 266,
499 : 273, 280, 287, 294, 301, 308, 314, 321, 327, 332,
500 : 338, 345
501 : };
502 : #endif
503 :
504 : #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
505 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
506 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
507 : static const char *const yytname[] =
508 : {
509 : "$end", "error", "$undefined", "ODST_NUMBER", "ODST_STRING",
510 : "ODST_IDENTIFIER", "ODST_FUNCTION_NO_ARG", "ODST_FUNCTION_SINGLE_ARG",
511 : "ODST_FUNCTION_TWO_ARG", "ODST_FUNCTION_THREE_ARG",
512 : "ODST_FUNCTION_ARG_LIST", "ODST_START", "ODST_NOT", "ODST_OR",
513 : "ODST_AND", "ODST_IF", "'+'", "'-'", "'&'", "'*'", "'/'", "'%'",
514 : "ODST_UMINUS", "','", "';'", "'('", "')'", "'='", "'<'", "'>'", "'!'",
515 : "'['", "']'", "':'", "$accept", "input", "comma", "value_expr",
516 : "value_expr_list", "value_expr_and_cell_range_list", "cell_range", 0
517 : };
518 : #endif
519 :
520 : # ifdef YYPRINT
521 : /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
522 : token YYLEX-NUM. */
523 : static const yytype_uint16 yytoknum[] =
524 : {
525 : 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
526 : 265, 266, 267, 268, 269, 270, 43, 45, 38, 42,
527 : 47, 37, 271, 44, 59, 40, 41, 61, 60, 62,
528 : 33, 91, 93, 58
529 : };
530 : # endif
531 :
532 : /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
533 : static const yytype_uint8 yyr1[] =
534 : {
535 : 0, 34, 35, 36, 36, 37, 37, 37, 37, 37,
536 : 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
537 : 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
538 : 37, 37, 37, 37, 37, 38, 38, 39, 39, 39,
539 : 39, 40
540 : };
541 :
542 : /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
543 : static const yytype_uint8 yyr2[] =
544 : {
545 : 0, 2, 2, 1, 1, 1, 1, 3, 4, 6,
546 : 8, 4, 4, 4, 6, 8, 4, 3, 3, 4,
547 : 4, 3, 3, 4, 4, 4, 4, 2, 3, 3,
548 : 3, 3, 3, 3, 3, 3, 1, 3, 1, 3,
549 : 1, 5
550 : };
551 :
552 : /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
553 : STATE-NUM when YYTABLE doesn't specify something else to do. Zero
554 : means the default is an error. */
555 : static const yytype_uint8 yydefact[] =
556 : {
557 : 0, 0, 0, 5, 6, 0, 0, 0, 0, 0,
558 : 0, 0, 0, 0, 0, 0, 0, 2, 1, 0,
559 : 0, 0, 0, 0, 0, 0, 0, 0, 27, 0,
560 : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
561 : 0, 7, 0, 0, 0, 0, 38, 0, 40, 0,
562 : 36, 0, 0, 0, 17, 34, 28, 29, 30, 31,
563 : 32, 33, 0, 0, 18, 0, 0, 21, 0, 22,
564 : 0, 8, 3, 4, 0, 0, 0, 0, 16, 0,
565 : 13, 0, 12, 11, 0, 24, 25, 23, 19, 26,
566 : 20, 0, 0, 0, 37, 39, 35, 0, 9, 0,
567 : 0, 14, 0, 0, 41, 0, 10, 15
568 : };
569 :
570 : /* YYDEFGOTO[NTERM-NUM]. */
571 : static const yytype_int8 yydefgoto[] =
572 : {
573 : -1, 2, 74, 46, 51, 47, 48
574 : };
575 :
576 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
577 : STATE-NUM. */
578 : #define YYPACT_NINF -75
579 : static const yytype_int16 yypact[] =
580 : {
581 : -4, 162, 12, -75, -75, -3, 4, 14, 21, 32,
582 : 33, 34, 35, 38, 162, 162, 44, 303, -75, 40,
583 : 162, 162, 162, 182, 162, 162, 162, 162, -12, 213,
584 : 36, 162, 162, 162, 162, 162, 162, 78, 107, 136,
585 : 43, -75, 228, 24, 24, 66, 24, 46, -14, 243,
586 : 24, 49, 50, 24, -75, -75, 181, 181, 181, -12,
587 : -12, -12, 162, 162, 303, 162, 162, 303, 162, 303,
588 : 162, -75, -75, -75, 162, 162, -5, 182, -75, 182,
589 : -75, 162, -75, -75, 162, 303, 303, 303, 303, 303,
590 : 303, 258, 24, 72, -75, -75, -75, 198, -75, 162,
591 : 47, -75, 162, 273, -75, 288, -75, -75
592 : };
593 :
594 : /* YYPGOTO[NTERM-NUM]. */
595 : static const yytype_int8 yypgoto[] =
596 : {
597 : -75, -75, -42, -1, -25, -74, -75
598 : };
599 :
600 : /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
601 : positive, shift that token. If negative, reduce the rule which
602 : number is the opposite. If zero, do what YYDEFACT says.
603 : If YYTABLE_NINF, syntax error. */
604 : #define YYTABLE_NINF -1
605 : static const yytype_uint8 yytable[] =
606 : {
607 : 17, 52, 75, 94, 77, 95, 79, 1, 81, 72,
608 : 73, 84, 18, 28, 29, 37, 38, 39, 40, 42,
609 : 43, 44, 19, 49, 50, 50, 53, 55, 93, 20,
610 : 56, 57, 58, 59, 60, 61, 64, 67, 69, 21,
611 : 31, 32, 33, 34, 35, 36, 22, 72, 73, 30,
612 : 99, 37, 38, 39, 40, 102, 96, 23, 24, 25,
613 : 26, 85, 86, 27, 87, 88, 41, 89, 55, 90,
614 : 70, 76, 78, 91, 92, 82, 83, 100, 0, 104,
615 : 50, 3, 4, 97, 5, 6, 7, 8, 9, 0,
616 : 10, 11, 12, 13, 0, 14, 0, 0, 103, 0,
617 : 0, 105, 0, 15, 0, 0, 62, 63, 0, 16,
618 : 3, 4, 0, 5, 6, 7, 8, 9, 0, 10,
619 : 11, 12, 13, 0, 14, 0, 0, 0, 0, 0,
620 : 0, 0, 15, 0, 65, 0, 66, 0, 16, 3,
621 : 4, 0, 5, 6, 7, 8, 9, 0, 10, 11,
622 : 12, 13, 0, 14, 0, 0, 0, 0, 0, 0,
623 : 0, 15, 0, 68, 0, 3, 4, 16, 5, 6,
624 : 7, 8, 9, 0, 10, 11, 12, 13, 0, 14,
625 : 0, 0, 0, 0, 0, 3, 4, 15, 5, 6,
626 : 7, 8, 9, 16, 10, 11, 12, 13, 0, 14,
627 : 34, 35, 36, 0, 0, 0, 0, 15, 37, 38,
628 : 39, 40, 0, 45, 31, 32, 33, 34, 35, 36,
629 : 0, 72, 73, 0, 101, 37, 38, 39, 40, 31,
630 : 32, 33, 34, 35, 36, 0, 0, 0, 0, 54,
631 : 37, 38, 39, 40, 31, 32, 33, 34, 35, 36,
632 : 0, 0, 0, 0, 71, 37, 38, 39, 40, 31,
633 : 32, 33, 34, 35, 36, 0, 0, 0, 0, 80,
634 : 37, 38, 39, 40, 31, 32, 33, 34, 35, 36,
635 : 0, 0, 0, 0, 98, 37, 38, 39, 40, 31,
636 : 32, 33, 34, 35, 36, 0, 0, 0, 0, 106,
637 : 37, 38, 39, 40, 31, 32, 33, 34, 35, 36,
638 : 0, 0, 0, 0, 107, 37, 38, 39, 40, 31,
639 : 32, 33, 34, 35, 36, 0, 0, 0, 0, 0,
640 : 37, 38, 39, 40
641 : };
642 :
643 : static const yytype_int8 yycheck[] =
644 : {
645 : 1, 26, 44, 77, 46, 79, 48, 11, 50, 23,
646 : 24, 53, 0, 14, 15, 27, 28, 29, 30, 20,
647 : 21, 22, 25, 24, 25, 26, 27, 32, 33, 25,
648 : 31, 32, 33, 34, 35, 36, 37, 38, 39, 25,
649 : 16, 17, 18, 19, 20, 21, 25, 23, 24, 5,
650 : 92, 27, 28, 29, 30, 97, 81, 25, 25, 25,
651 : 25, 62, 63, 25, 65, 66, 26, 68, 32, 70,
652 : 27, 5, 26, 74, 75, 26, 26, 5, -1, 32,
653 : 81, 3, 4, 84, 6, 7, 8, 9, 10, -1,
654 : 12, 13, 14, 15, -1, 17, -1, -1, 99, -1,
655 : -1, 102, -1, 25, -1, -1, 28, 29, -1, 31,
656 : 3, 4, -1, 6, 7, 8, 9, 10, -1, 12,
657 : 13, 14, 15, -1, 17, -1, -1, -1, -1, -1,
658 : -1, -1, 25, -1, 27, -1, 29, -1, 31, 3,
659 : 4, -1, 6, 7, 8, 9, 10, -1, 12, 13,
660 : 14, 15, -1, 17, -1, -1, -1, -1, -1, -1,
661 : -1, 25, -1, 27, -1, 3, 4, 31, 6, 7,
662 : 8, 9, 10, -1, 12, 13, 14, 15, -1, 17,
663 : -1, -1, -1, -1, -1, 3, 4, 25, 6, 7,
664 : 8, 9, 10, 31, 12, 13, 14, 15, -1, 17,
665 : 19, 20, 21, -1, -1, -1, -1, 25, 27, 28,
666 : 29, 30, -1, 31, 16, 17, 18, 19, 20, 21,
667 : -1, 23, 24, -1, 26, 27, 28, 29, 30, 16,
668 : 17, 18, 19, 20, 21, -1, -1, -1, -1, 26,
669 : 27, 28, 29, 30, 16, 17, 18, 19, 20, 21,
670 : -1, -1, -1, -1, 26, 27, 28, 29, 30, 16,
671 : 17, 18, 19, 20, 21, -1, -1, -1, -1, 26,
672 : 27, 28, 29, 30, 16, 17, 18, 19, 20, 21,
673 : -1, -1, -1, -1, 26, 27, 28, 29, 30, 16,
674 : 17, 18, 19, 20, 21, -1, -1, -1, -1, 26,
675 : 27, 28, 29, 30, 16, 17, 18, 19, 20, 21,
676 : -1, -1, -1, -1, 26, 27, 28, 29, 30, 16,
677 : 17, 18, 19, 20, 21, -1, -1, -1, -1, -1,
678 : 27, 28, 29, 30
679 : };
680 :
681 : /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
682 : symbol of state STATE-NUM. */
683 : static const yytype_uint8 yystos[] =
684 : {
685 : 0, 11, 35, 3, 4, 6, 7, 8, 9, 10,
686 : 12, 13, 14, 15, 17, 25, 31, 37, 0, 25,
687 : 25, 25, 25, 25, 25, 25, 25, 25, 37, 37,
688 : 5, 16, 17, 18, 19, 20, 21, 27, 28, 29,
689 : 30, 26, 37, 37, 37, 31, 37, 39, 40, 37,
690 : 37, 38, 38, 37, 26, 32, 37, 37, 37, 37,
691 : 37, 37, 28, 29, 37, 27, 29, 37, 27, 37,
692 : 27, 26, 23, 24, 36, 36, 5, 36, 26, 36,
693 : 26, 36, 26, 26, 36, 37, 37, 37, 37, 37,
694 : 37, 37, 37, 33, 39, 39, 38, 37, 26, 36,
695 : 5, 26, 36, 37, 32, 37, 26, 26
696 : };
697 :
698 : #define yyerrok (yyerrstatus = 0)
699 : #define yyclearin (yychar = YYEMPTY)
700 : #define YYEMPTY (-2)
701 : #define YYEOF 0
702 :
703 : #define YYACCEPT goto yyacceptlab
704 : #define YYABORT goto yyabortlab
705 : #define YYERROR goto yyerrorlab
706 :
707 :
708 : /* Like YYERROR except do call yyerror. This remains here temporarily
709 : to ease the transition to the new meaning of YYERROR, for GCC.
710 : Once GCC version 2 has supplanted version 1, this can go. */
711 :
712 : #define YYFAIL goto yyerrlab
713 :
714 : #define YYRECOVERING() (!!yyerrstatus)
715 :
716 : #define YYBACKUP(Token, Value) \
717 : do \
718 : if (yychar == YYEMPTY && yylen == 1) \
719 : { \
720 : yychar = (Token); \
721 : yylval = (Value); \
722 : yytoken = YYTRANSLATE (yychar); \
723 : YYPOPSTACK (1); \
724 : goto yybackup; \
725 : } \
726 : else \
727 : { \
728 : yyerror (context, YY_("syntax error: cannot back up")); \
729 : YYERROR; \
730 : } \
731 : while (YYID (0))
732 :
733 :
734 : #define YYTERROR 1
735 : #define YYERRCODE 256
736 :
737 :
738 : /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
739 : If N is 0, then set CURRENT to the empty location which ends
740 : the previous symbol: RHS[0] (always defined). */
741 :
742 : #define YYRHSLOC(Rhs, K) ((Rhs)[K])
743 : #ifndef YYLLOC_DEFAULT
744 : # define YYLLOC_DEFAULT(Current, Rhs, N) \
745 : do \
746 : if (YYID (N)) \
747 : { \
748 : (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
749 : (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
750 : (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
751 : (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
752 : } \
753 : else \
754 : { \
755 : (Current).first_line = (Current).last_line = \
756 : YYRHSLOC (Rhs, 0).last_line; \
757 : (Current).first_column = (Current).last_column = \
758 : YYRHSLOC (Rhs, 0).last_column; \
759 : } \
760 : while (YYID (0))
761 : #endif
762 :
763 :
764 : /* YY_LOCATION_PRINT -- Print the location on the stream.
765 : This macro was not mandated originally: define only if we know
766 : we won't break user code: when these are the locations we know. */
767 :
768 : #ifndef YY_LOCATION_PRINT
769 : # if YYLTYPE_IS_TRIVIAL
770 : # define YY_LOCATION_PRINT(File, Loc) \
771 : fprintf (File, "%d.%d-%d.%d", \
772 : (Loc).first_line, (Loc).first_column, \
773 : (Loc).last_line, (Loc).last_column)
774 : # else
775 : # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
776 : # endif
777 : #endif
778 :
779 :
780 : /* YYLEX -- calling `yylex' with the right arguments. */
781 :
782 : #ifdef YYLEX_PARAM
783 : # define YYLEX yylex (&yylval, YYLEX_PARAM)
784 : #else
785 : # define YYLEX yylex (&yylval, context)
786 : #endif
787 :
788 : /* Enable debugging if requested. */
789 : #if YYDEBUG
790 :
791 : # ifndef YYFPRINTF
792 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
793 : # define YYFPRINTF fprintf
794 : # endif
795 :
796 : # define YYDPRINTF(Args) \
797 : do { \
798 : if (yydebug) \
799 : YYFPRINTF Args; \
800 : } while (YYID (0))
801 :
802 : # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
803 : do { \
804 : if (yydebug) \
805 : { \
806 : YYFPRINTF (stderr, "%s ", Title); \
807 : yy_symbol_print (stderr, \
808 : Type, Value, context); \
809 : YYFPRINTF (stderr, "\n"); \
810 : } \
811 : } while (YYID (0))
812 :
813 :
814 : /*--------------------------------.
815 : | Print this symbol on YYOUTPUT. |
816 : `--------------------------------*/
817 :
818 : /*ARGSUSED*/
819 : #if (defined __STDC__ || defined __C99__FUNC__ \
820 : || defined __cplusplus || defined _MSC_VER)
821 : static void
822 : yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, ods_formula_parse_context *context)
823 : #else
824 : static void
825 : yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
826 : FILE *yyoutput;
827 : int yytype;
828 : YYSTYPE const * const yyvaluep;
829 : ods_formula_parse_context *context;
830 : #endif
831 : {
832 : if (!yyvaluep)
833 : return;
834 : YYUSE (context);
835 : # ifdef YYPRINT
836 : if (yytype < YYNTOKENS)
837 : YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
838 : # else
839 : YYUSE (yyoutput);
840 : # endif
841 : switch (yytype)
842 : {
843 : default:
844 : break;
845 : }
846 : }
847 :
848 :
849 : /*--------------------------------.
850 : | Print this symbol on YYOUTPUT. |
851 : `--------------------------------*/
852 :
853 : #if (defined __STDC__ || defined __C99__FUNC__ \
854 : || defined __cplusplus || defined _MSC_VER)
855 : static void
856 : yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, ods_formula_parse_context *context)
857 : #else
858 : static void
859 : yy_symbol_print (yyoutput, yytype, yyvaluep, context)
860 : FILE *yyoutput;
861 : int yytype;
862 : YYSTYPE const * const yyvaluep;
863 : ods_formula_parse_context *context;
864 : #endif
865 : {
866 : if (yytype < YYNTOKENS)
867 : YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
868 : else
869 : YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
870 :
871 : yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
872 : YYFPRINTF (yyoutput, ")");
873 : }
874 :
875 : /*------------------------------------------------------------------.
876 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
877 : | TOP (included). |
878 : `------------------------------------------------------------------*/
879 :
880 : #if (defined __STDC__ || defined __C99__FUNC__ \
881 : || defined __cplusplus || defined _MSC_VER)
882 : static void
883 : yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
884 : #else
885 : static void
886 : yy_stack_print (yybottom, yytop)
887 : yytype_int16 *yybottom;
888 : yytype_int16 *yytop;
889 : #endif
890 : {
891 : YYFPRINTF (stderr, "Stack now");
892 : for (; yybottom <= yytop; yybottom++)
893 : {
894 : int yybot = *yybottom;
895 : YYFPRINTF (stderr, " %d", yybot);
896 : }
897 : YYFPRINTF (stderr, "\n");
898 : }
899 :
900 : # define YY_STACK_PRINT(Bottom, Top) \
901 : do { \
902 : if (yydebug) \
903 : yy_stack_print ((Bottom), (Top)); \
904 : } while (YYID (0))
905 :
906 :
907 : /*------------------------------------------------.
908 : | Report that the YYRULE is going to be reduced. |
909 : `------------------------------------------------*/
910 :
911 : #if (defined __STDC__ || defined __C99__FUNC__ \
912 : || defined __cplusplus || defined _MSC_VER)
913 : static void
914 : yy_reduce_print (YYSTYPE *yyvsp, int yyrule, ods_formula_parse_context *context)
915 : #else
916 : static void
917 : yy_reduce_print (yyvsp, yyrule, context)
918 : YYSTYPE *yyvsp;
919 : int yyrule;
920 : ods_formula_parse_context *context;
921 : #endif
922 : {
923 : int yynrhs = yyr2[yyrule];
924 : int yyi;
925 : unsigned long int yylno = yyrline[yyrule];
926 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
927 : yyrule - 1, yylno);
928 : /* The symbols being reduced. */
929 : for (yyi = 0; yyi < yynrhs; yyi++)
930 : {
931 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
932 : yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
933 : &(yyvsp[(yyi + 1) - (yynrhs)])
934 : , context);
935 : YYFPRINTF (stderr, "\n");
936 : }
937 : }
938 :
939 : # define YY_REDUCE_PRINT(Rule) \
940 : do { \
941 : if (yydebug) \
942 : yy_reduce_print (yyvsp, Rule, context); \
943 : } while (YYID (0))
944 :
945 : /* Nonzero means print parse trace. It is left uninitialized so that
946 : multiple parsers can coexist. */
947 : int yydebug;
948 : #else /* !YYDEBUG */
949 : # define YYDPRINTF(Args)
950 : # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
951 : # define YY_STACK_PRINT(Bottom, Top)
952 : # define YY_REDUCE_PRINT(Rule)
953 : #endif /* !YYDEBUG */
954 :
955 :
956 : /* YYINITDEPTH -- initial size of the parser's stacks. */
957 : #ifndef YYINITDEPTH
958 : # define YYINITDEPTH 200
959 : #endif
960 :
961 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
962 : if the built-in stack extension method is used).
963 :
964 : Do not make this value too large; the results are undefined if
965 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
966 : evaluated with infinite-precision integer arithmetic. */
967 :
968 : #ifndef YYMAXDEPTH
969 : # define YYMAXDEPTH 10000
970 : #endif
971 :
972 :
973 :
974 : #if YYERROR_VERBOSE
975 :
976 : # ifndef yystrlen
977 : # if defined __GLIBC__ && defined _STRING_H
978 : # define yystrlen strlen
979 : # else
980 : /* Return the length of YYSTR. */
981 : #if (defined __STDC__ || defined __C99__FUNC__ \
982 : || defined __cplusplus || defined _MSC_VER)
983 : static YYSIZE_T
984 : yystrlen (const char *yystr)
985 : #else
986 : static YYSIZE_T
987 : yystrlen (yystr)
988 : const char *yystr;
989 : #endif
990 : {
991 : YYSIZE_T yylen;
992 : for (yylen = 0; yystr[yylen]; yylen++)
993 : continue;
994 : return yylen;
995 : }
996 : # endif
997 : # endif
998 :
999 : # ifndef yystpcpy
1000 : # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1001 : # define yystpcpy stpcpy
1002 : # else
1003 : /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1004 : YYDEST. */
1005 : #if (defined __STDC__ || defined __C99__FUNC__ \
1006 : || defined __cplusplus || defined _MSC_VER)
1007 : static char *
1008 : yystpcpy (char *yydest, const char *yysrc)
1009 : #else
1010 : static char *
1011 : yystpcpy (yydest, yysrc)
1012 : char *yydest;
1013 : const char *yysrc;
1014 : #endif
1015 : {
1016 : char *yyd = yydest;
1017 : const char *yys = yysrc;
1018 :
1019 : while ((*yyd++ = *yys++) != '\0')
1020 : continue;
1021 :
1022 : return yyd - 1;
1023 : }
1024 : # endif
1025 : # endif
1026 :
1027 : # ifndef yytnamerr
1028 : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1029 : quotes and backslashes, so that it's suitable for yyerror. The
1030 : heuristic is that double-quoting is unnecessary unless the string
1031 : contains an apostrophe, a comma, or backslash (other than
1032 : backslash-backslash). YYSTR is taken from yytname. If YYRES is
1033 : null, do not copy; instead, return the length of what the result
1034 : would have been. */
1035 : static YYSIZE_T
1036 : yytnamerr (char *yyres, const char *yystr)
1037 : {
1038 : if (*yystr == '"')
1039 : {
1040 : YYSIZE_T yyn = 0;
1041 : char const *yyp = yystr;
1042 :
1043 : for (;;)
1044 : switch (*++yyp)
1045 : {
1046 : case '\'':
1047 : case ',':
1048 : goto do_not_strip_quotes;
1049 :
1050 : case '\\':
1051 : if (*++yyp != '\\')
1052 : goto do_not_strip_quotes;
1053 : /* Fall through. */
1054 : default:
1055 : if (yyres)
1056 : yyres[yyn] = *yyp;
1057 : yyn++;
1058 : break;
1059 :
1060 : case '"':
1061 : if (yyres)
1062 : yyres[yyn] = '\0';
1063 : return yyn;
1064 : }
1065 : do_not_strip_quotes: ;
1066 : }
1067 :
1068 : if (! yyres)
1069 : return yystrlen (yystr);
1070 :
1071 : return yystpcpy (yyres, yystr) - yyres;
1072 : }
1073 : # endif
1074 :
1075 : /* Copy into YYRESULT an error message about the unexpected token
1076 : YYCHAR while in state YYSTATE. Return the number of bytes copied,
1077 : including the terminating null byte. If YYRESULT is null, do not
1078 : copy anything; just return the number of bytes that would be
1079 : copied. As a special case, return 0 if an ordinary "syntax error"
1080 : message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1081 : size calculation. */
1082 : static YYSIZE_T
1083 : yysyntax_error (char *yyresult, int yystate, int yychar)
1084 : {
1085 : int yyn = yypact[yystate];
1086 :
1087 : if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1088 : return 0;
1089 : else
1090 : {
1091 : int yytype = YYTRANSLATE (yychar);
1092 : YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1093 : YYSIZE_T yysize = yysize0;
1094 : YYSIZE_T yysize1;
1095 : int yysize_overflow = 0;
1096 : enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1097 : char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1098 : int yyx;
1099 :
1100 : # if 0
1101 : /* This is so xgettext sees the translatable formats that are
1102 : constructed on the fly. */
1103 : YY_("syntax error, unexpected %s");
1104 : YY_("syntax error, unexpected %s, expecting %s");
1105 : YY_("syntax error, unexpected %s, expecting %s or %s");
1106 : YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1107 : YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1108 : # endif
1109 : char *yyfmt;
1110 : char const *yyf;
1111 : static char const yyunexpected[] = "syntax error, unexpected %s";
1112 : static char const yyexpecting[] = ", expecting %s";
1113 : static char const yyor[] = " or %s";
1114 : char yyformat[sizeof yyunexpected
1115 : + sizeof yyexpecting - 1
1116 : + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1117 : * (sizeof yyor - 1))];
1118 : char const *yyprefix = yyexpecting;
1119 :
1120 : /* Start YYX at -YYN if negative to avoid negative indexes in
1121 : YYCHECK. */
1122 : int yyxbegin = yyn < 0 ? -yyn : 0;
1123 :
1124 : /* Stay within bounds of both yycheck and yytname. */
1125 : int yychecklim = YYLAST - yyn + 1;
1126 : int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1127 : int yycount = 1;
1128 :
1129 : yyarg[0] = yytname[yytype];
1130 : yyfmt = yystpcpy (yyformat, yyunexpected);
1131 :
1132 : for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1133 : if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1134 : {
1135 : if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1136 : {
1137 : yycount = 1;
1138 : yysize = yysize0;
1139 : yyformat[sizeof yyunexpected - 1] = '\0';
1140 : break;
1141 : }
1142 : yyarg[yycount++] = yytname[yyx];
1143 : yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1144 : yysize_overflow |= (yysize1 < yysize);
1145 : yysize = yysize1;
1146 : yyfmt = yystpcpy (yyfmt, yyprefix);
1147 : yyprefix = yyor;
1148 : }
1149 :
1150 : yyf = YY_(yyformat);
1151 : yysize1 = yysize + yystrlen (yyf);
1152 : yysize_overflow |= (yysize1 < yysize);
1153 : yysize = yysize1;
1154 :
1155 : if (yysize_overflow)
1156 : return YYSIZE_MAXIMUM;
1157 :
1158 : if (yyresult)
1159 : {
1160 : /* Avoid sprintf, as that infringes on the user's name space.
1161 : Don't have undefined behavior even if the translation
1162 : produced a string with the wrong number of "%s"s. */
1163 : char *yyp = yyresult;
1164 : int yyi = 0;
1165 : while ((*yyp = *yyf) != '\0')
1166 : {
1167 : if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1168 : {
1169 : yyp += yytnamerr (yyp, yyarg[yyi++]);
1170 : yyf += 2;
1171 : }
1172 : else
1173 : {
1174 : yyp++;
1175 : yyf++;
1176 : }
1177 : }
1178 : }
1179 : return yysize;
1180 : }
1181 : }
1182 : #endif /* YYERROR_VERBOSE */
1183 :
1184 :
1185 : /*-----------------------------------------------.
1186 : | Release the memory associated to this symbol. |
1187 : `-----------------------------------------------*/
1188 :
1189 : /*ARGSUSED*/
1190 : #if (defined __STDC__ || defined __C99__FUNC__ \
1191 : || defined __cplusplus || defined _MSC_VER)
1192 : static void
1193 232 : yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, ods_formula_parse_context *context)
1194 : #else
1195 : static void
1196 : yydestruct (yymsg, yytype, yyvaluep, context)
1197 : const char *yymsg;
1198 : int yytype;
1199 : YYSTYPE *yyvaluep;
1200 : ods_formula_parse_context *context;
1201 : #endif
1202 : {
1203 : YYUSE (yyvaluep);
1204 : YYUSE (context);
1205 :
1206 232 : if (!yymsg)
1207 0 : yymsg = "Deleting";
1208 : YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1209 :
1210 232 : switch (yytype)
1211 : {
1212 : case 3: /* "ODST_NUMBER" */
1213 :
1214 : /* Line 1000 of yacc.c */
1215 : #line 82 "ods_formula_parser.y"
1216 : { delete (*yyvaluep); };
1217 :
1218 : /* Line 1000 of yacc.c */
1219 : #line 1220 "ods_formula_parser.cpp"
1220 0 : break;
1221 : case 4: /* "ODST_STRING" */
1222 :
1223 : /* Line 1000 of yacc.c */
1224 : #line 82 "ods_formula_parser.y"
1225 : { delete (*yyvaluep); };
1226 :
1227 : /* Line 1000 of yacc.c */
1228 : #line 1229 "ods_formula_parser.cpp"
1229 0 : break;
1230 : case 5: /* "ODST_IDENTIFIER" */
1231 :
1232 : /* Line 1000 of yacc.c */
1233 : #line 82 "ods_formula_parser.y"
1234 : { delete (*yyvaluep); };
1235 :
1236 : /* Line 1000 of yacc.c */
1237 : #line 1238 "ods_formula_parser.cpp"
1238 0 : break;
1239 : case 6: /* "ODST_FUNCTION_NO_ARG" */
1240 :
1241 : /* Line 1000 of yacc.c */
1242 : #line 82 "ods_formula_parser.y"
1243 : { delete (*yyvaluep); };
1244 :
1245 : /* Line 1000 of yacc.c */
1246 : #line 1247 "ods_formula_parser.cpp"
1247 0 : break;
1248 : case 7: /* "ODST_FUNCTION_SINGLE_ARG" */
1249 :
1250 : /* Line 1000 of yacc.c */
1251 : #line 82 "ods_formula_parser.y"
1252 : { delete (*yyvaluep); };
1253 :
1254 : /* Line 1000 of yacc.c */
1255 : #line 1256 "ods_formula_parser.cpp"
1256 0 : break;
1257 : case 8: /* "ODST_FUNCTION_TWO_ARG" */
1258 :
1259 : /* Line 1000 of yacc.c */
1260 : #line 82 "ods_formula_parser.y"
1261 : { delete (*yyvaluep); };
1262 :
1263 : /* Line 1000 of yacc.c */
1264 : #line 1265 "ods_formula_parser.cpp"
1265 0 : break;
1266 : case 9: /* "ODST_FUNCTION_THREE_ARG" */
1267 :
1268 : /* Line 1000 of yacc.c */
1269 : #line 82 "ods_formula_parser.y"
1270 : { delete (*yyvaluep); };
1271 :
1272 : /* Line 1000 of yacc.c */
1273 : #line 1274 "ods_formula_parser.cpp"
1274 0 : break;
1275 : case 10: /* "ODST_FUNCTION_ARG_LIST" */
1276 :
1277 : /* Line 1000 of yacc.c */
1278 : #line 82 "ods_formula_parser.y"
1279 : { delete (*yyvaluep); };
1280 :
1281 : /* Line 1000 of yacc.c */
1282 : #line 1283 "ods_formula_parser.cpp"
1283 0 : break;
1284 : case 37: /* "value_expr" */
1285 :
1286 : /* Line 1000 of yacc.c */
1287 : #line 83 "ods_formula_parser.y"
1288 : { delete (*yyvaluep); };
1289 :
1290 : /* Line 1000 of yacc.c */
1291 : #line 1292 "ods_formula_parser.cpp"
1292 0 : break;
1293 : case 38: /* "value_expr_list" */
1294 :
1295 : /* Line 1000 of yacc.c */
1296 : #line 83 "ods_formula_parser.y"
1297 : { delete (*yyvaluep); };
1298 :
1299 : /* Line 1000 of yacc.c */
1300 : #line 1301 "ods_formula_parser.cpp"
1301 0 : break;
1302 : case 39: /* "value_expr_and_cell_range_list" */
1303 :
1304 : /* Line 1000 of yacc.c */
1305 : #line 83 "ods_formula_parser.y"
1306 : { delete (*yyvaluep); };
1307 :
1308 : /* Line 1000 of yacc.c */
1309 : #line 1310 "ods_formula_parser.cpp"
1310 0 : break;
1311 : case 40: /* "cell_range" */
1312 :
1313 : /* Line 1000 of yacc.c */
1314 : #line 83 "ods_formula_parser.y"
1315 : { delete (*yyvaluep); };
1316 :
1317 : /* Line 1000 of yacc.c */
1318 : #line 1319 "ods_formula_parser.cpp"
1319 : break;
1320 :
1321 : default:
1322 : break;
1323 : }
1324 232 : }
1325 :
1326 : /* Prevent warnings from -Wmissing-prototypes. */
1327 : #ifdef YYPARSE_PARAM
1328 : #if defined __STDC__ || defined __cplusplus
1329 : int yyparse (void *YYPARSE_PARAM);
1330 : #else
1331 : int yyparse ();
1332 : #endif
1333 : #else /* ! YYPARSE_PARAM */
1334 : #if defined __STDC__ || defined __cplusplus
1335 : int yyparse (ods_formula_parse_context *context);
1336 : #else
1337 : int yyparse ();
1338 : #endif
1339 : #endif /* ! YYPARSE_PARAM */
1340 :
1341 :
1342 :
1343 :
1344 :
1345 : /*-------------------------.
1346 : | yyparse or yypush_parse. |
1347 : `-------------------------*/
1348 :
1349 : #ifdef YYPARSE_PARAM
1350 : #if (defined __STDC__ || defined __C99__FUNC__ \
1351 : || defined __cplusplus || defined _MSC_VER)
1352 : int
1353 : yyparse (void *YYPARSE_PARAM)
1354 : #else
1355 : int
1356 : yyparse (YYPARSE_PARAM)
1357 : void *YYPARSE_PARAM;
1358 : #endif
1359 : #else /* ! YYPARSE_PARAM */
1360 : #if (defined __STDC__ || defined __C99__FUNC__ \
1361 : || defined __cplusplus || defined _MSC_VER)
1362 : int
1363 116 : yyparse (ods_formula_parse_context *context)
1364 : #else
1365 : int
1366 : yyparse (context)
1367 : ods_formula_parse_context *context;
1368 : #endif
1369 : #endif
1370 : {
1371 : /* The lookahead symbol. */
1372 : int yychar;
1373 :
1374 : /* The semantic value of the lookahead symbol. */
1375 : YYSTYPE yylval;
1376 :
1377 : /* Number of syntax errors so far. */
1378 : int yynerrs;
1379 :
1380 : int yystate;
1381 : /* Number of tokens to shift before error messages enabled. */
1382 : int yyerrstatus;
1383 :
1384 : /* The stacks and their tools:
1385 : `yyss': related to states.
1386 : `yyvs': related to semantic values.
1387 :
1388 : Refer to the stacks thru separate pointers, to allow yyoverflow
1389 : to reallocate them elsewhere. */
1390 :
1391 : /* The state stack. */
1392 116 : yytype_int16 yyssa[YYINITDEPTH]; /* workaround bug with gcc 4.1 -O2 */ memset(yyssa, 0, sizeof(yyssa));
1393 : yytype_int16 *yyss;
1394 : yytype_int16 *yyssp;
1395 :
1396 : /* The semantic value stack. */
1397 : YYSTYPE yyvsa[YYINITDEPTH];
1398 : YYSTYPE *yyvs;
1399 : YYSTYPE *yyvsp;
1400 :
1401 : YYSIZE_T yystacksize;
1402 :
1403 : int yyn;
1404 : int yyresult;
1405 : /* Lookahead token as an internal (translated) token number. */
1406 : int yytoken;
1407 : /* The variables used to return semantic value and location from the
1408 : action routines. */
1409 : YYSTYPE yyval;
1410 :
1411 : #if YYERROR_VERBOSE
1412 : /* Buffer for error messages, and its allocated size. */
1413 : char yymsgbuf[128];
1414 : char *yymsg = yymsgbuf;
1415 : YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1416 : #endif
1417 :
1418 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1419 :
1420 : /* The number of symbols on the RHS of the reduced rule.
1421 : Keep to zero when no symbol should be popped. */
1422 116 : int yylen = 0;
1423 :
1424 116 : yytoken = 0;
1425 116 : yyss = yyssa;
1426 116 : yyvs = yyvsa;
1427 116 : yystacksize = YYINITDEPTH;
1428 :
1429 : YYDPRINTF ((stderr, "Starting parse\n"));
1430 :
1431 116 : yystate = 0;
1432 116 : yyerrstatus = 0;
1433 116 : yynerrs = 0;
1434 116 : yychar = YYEMPTY; /* Cause a token to be read. */
1435 :
1436 : /* Initialize stack pointers.
1437 : Waste one element of value and location stack
1438 : so that they stay on the same level as the state stack.
1439 : The wasted elements are never initialized. */
1440 116 : yyssp = yyss;
1441 116 : yyvsp = yyvs;
1442 :
1443 116 : goto yysetstate;
1444 :
1445 : /*------------------------------------------------------------.
1446 : | yynewstate -- Push a new state, which is found in yystate. |
1447 : `------------------------------------------------------------*/
1448 : yynewstate:
1449 : /* In all cases, when you get here, the value and location stacks
1450 : have just been pushed. So pushing a state here evens the stacks. */
1451 1340 : yyssp++;
1452 :
1453 : yysetstate:
1454 1456 : *yyssp = yystate;
1455 :
1456 1456 : if (yyss + yystacksize - 1 <= yyssp)
1457 : {
1458 : /* Get the current used size of the three stacks, in elements. */
1459 0 : YYSIZE_T yysize = yyssp - yyss + 1;
1460 :
1461 : #ifdef yyoverflow
1462 : {
1463 : /* Give user a chance to reallocate the stack. Use copies of
1464 : these so that the &'s don't force the real ones into
1465 : memory. */
1466 : YYSTYPE *yyvs1 = yyvs;
1467 : yytype_int16 *yyss1 = yyss;
1468 :
1469 : /* Each stack pointer address is followed by the size of the
1470 : data in use in that stack, in bytes. This used to be a
1471 : conditional around just the two extra args, but that might
1472 : be undefined if yyoverflow is a macro. */
1473 : yyoverflow (YY_("memory exhausted"),
1474 : &yyss1, yysize * sizeof (*yyssp),
1475 : &yyvs1, yysize * sizeof (*yyvsp),
1476 : &yystacksize);
1477 :
1478 : yyss = yyss1;
1479 : yyvs = yyvs1;
1480 : }
1481 : #else /* no yyoverflow */
1482 : # ifndef YYSTACK_RELOCATE
1483 : goto yyexhaustedlab;
1484 : # else
1485 : /* Extend the stack our own way. */
1486 0 : if (YYMAXDEPTH <= yystacksize)
1487 0 : goto yyexhaustedlab;
1488 0 : yystacksize *= 2;
1489 0 : if (YYMAXDEPTH < yystacksize)
1490 0 : yystacksize = YYMAXDEPTH;
1491 :
1492 : {
1493 0 : yytype_int16 *yyss1 = yyss;
1494 : union yyalloc *yyptr =
1495 0 : (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1496 0 : if (! yyptr)
1497 0 : goto yyexhaustedlab;
1498 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
1499 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1500 : # undef YYSTACK_RELOCATE
1501 0 : if (yyss1 != yyssa)
1502 0 : YYSTACK_FREE (yyss1);
1503 : }
1504 : # endif
1505 : #endif /* no yyoverflow */
1506 :
1507 0 : yyssp = yyss + yysize - 1;
1508 0 : yyvsp = yyvs + yysize - 1;
1509 :
1510 : YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1511 : (unsigned long int) yystacksize));
1512 :
1513 0 : if (yyss + yystacksize - 1 <= yyssp)
1514 0 : YYABORT;
1515 : }
1516 :
1517 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1518 :
1519 1456 : if (yystate == YYFINAL)
1520 116 : YYACCEPT;
1521 :
1522 : goto yybackup;
1523 :
1524 : /*-----------.
1525 : | yybackup. |
1526 : `-----------*/
1527 : yybackup:
1528 :
1529 : /* Do appropriate processing given the current state. Read a
1530 : lookahead token if we need one and don't already have one. */
1531 :
1532 : /* First try to decide what to do without reference to lookahead token. */
1533 1340 : yyn = yypact[yystate];
1534 1340 : if (yyn == YYPACT_NINF)
1535 319 : goto yydefault;
1536 :
1537 : /* Not known => get a lookahead token if don't already have one. */
1538 :
1539 : /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1540 1021 : if (yychar == YYEMPTY)
1541 : {
1542 : YYDPRINTF ((stderr, "Reading a token: "));
1543 818 : yychar = YYLEX;
1544 : }
1545 :
1546 1021 : if (yychar <= YYEOF)
1547 : {
1548 297 : yychar = yytoken = YYEOF;
1549 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1550 : }
1551 : else
1552 : {
1553 724 : yytoken = YYTRANSLATE (yychar);
1554 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1555 : }
1556 :
1557 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1558 : detect an error, take that action. */
1559 1021 : yyn += yytoken;
1560 1021 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1561 : goto yydefault;
1562 818 : yyn = yytable[yyn];
1563 818 : if (yyn <= 0)
1564 : {
1565 0 : if (yyn == 0 || yyn == YYTABLE_NINF)
1566 : goto yyerrlab;
1567 0 : yyn = -yyn;
1568 0 : goto yyreduce;
1569 : }
1570 :
1571 : /* Count tokens shifted since error; after three, turn off error
1572 : status. */
1573 818 : if (yyerrstatus)
1574 0 : yyerrstatus--;
1575 :
1576 : /* Shift the lookahead token. */
1577 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1578 :
1579 : /* Discard the shifted token. */
1580 818 : yychar = YYEMPTY;
1581 :
1582 818 : yystate = yyn;
1583 818 : *++yyvsp = yylval;
1584 :
1585 818 : goto yynewstate;
1586 :
1587 :
1588 : /*-----------------------------------------------------------.
1589 : | yydefault -- do the default action for the current state. |
1590 : `-----------------------------------------------------------*/
1591 : yydefault:
1592 522 : yyn = yydefact[yystate];
1593 522 : if (yyn == 0)
1594 0 : goto yyerrlab;
1595 : goto yyreduce;
1596 :
1597 :
1598 : /*-----------------------------.
1599 : | yyreduce -- Do a reduction. |
1600 : `-----------------------------*/
1601 : yyreduce:
1602 : /* yyn is the number of a rule to reduce with. */
1603 522 : yylen = yyr2[yyn];
1604 :
1605 : /* If YYLEN is nonzero, implement the default value of the action:
1606 : `$$ = $1'.
1607 :
1608 : Otherwise, the following line sets YYVAL to garbage.
1609 : This behavior is undocumented and Bison
1610 : users should not rely upon it. Assigning to YYVAL
1611 : unconditionally makes the parser a bit smaller, and it avoids a
1612 : GCC warning that YYVAL may be used uninitialized. */
1613 522 : yyval = yyvsp[1-yylen];
1614 :
1615 :
1616 : YY_REDUCE_PRINT (yyn);
1617 522 : switch (yyn)
1618 : {
1619 : case 2:
1620 :
1621 : /* Line 1455 of yacc.c */
1622 : #line 89 "ods_formula_parser.y"
1623 : {
1624 : context->poRoot = (yyvsp[(2) - (2)]);
1625 : ;}
1626 : break;
1627 :
1628 : case 5:
1629 :
1630 : /* Line 1455 of yacc.c */
1631 : #line 98 "ods_formula_parser.y"
1632 : {
1633 : (yyval) = (yyvsp[(1) - (1)]);
1634 : ;}
1635 : break;
1636 :
1637 : case 6:
1638 :
1639 : /* Line 1455 of yacc.c */
1640 : #line 103 "ods_formula_parser.y"
1641 : {
1642 : (yyval) = (yyvsp[(1) - (1)]);
1643 : ;}
1644 : break;
1645 :
1646 : case 7:
1647 :
1648 : /* Line 1455 of yacc.c */
1649 : #line 108 "ods_formula_parser.y"
1650 : {
1651 : (yyval) = (yyvsp[(1) - (3)]);
1652 : ;}
1653 : break;
1654 :
1655 : case 8:
1656 :
1657 : /* Line 1455 of yacc.c */
1658 : #line 113 "ods_formula_parser.y"
1659 : {
1660 : (yyval) = (yyvsp[(1) - (4)]);
1661 : (yyval)->PushSubExpression( (yyvsp[(3) - (4)]) );
1662 : ;}
1663 : break;
1664 :
1665 : case 9:
1666 :
1667 : /* Line 1455 of yacc.c */
1668 : #line 119 "ods_formula_parser.y"
1669 : {
1670 : (yyval) = (yyvsp[(1) - (6)]);
1671 : (yyval)->PushSubExpression( (yyvsp[(3) - (6)]) );
1672 : (yyval)->PushSubExpression( (yyvsp[(5) - (6)]) );
1673 : ;}
1674 : break;
1675 :
1676 : case 10:
1677 :
1678 : /* Line 1455 of yacc.c */
1679 : #line 126 "ods_formula_parser.y"
1680 : {
1681 : (yyval) = (yyvsp[(1) - (8)]);
1682 : (yyval)->PushSubExpression( (yyvsp[(3) - (8)]) );
1683 : (yyval)->PushSubExpression( (yyvsp[(5) - (8)]) );
1684 : (yyval)->PushSubExpression( (yyvsp[(7) - (8)]) );
1685 : ;}
1686 : break;
1687 :
1688 : case 11:
1689 :
1690 : /* Line 1455 of yacc.c */
1691 : #line 134 "ods_formula_parser.y"
1692 : {
1693 : (yyval) = new ods_formula_node( ODS_AND );
1694 : (yyvsp[(3) - (4)])->ReverseSubExpressions();
1695 : (yyval)->PushSubExpression( (yyvsp[(3) - (4)]) );
1696 : ;}
1697 : break;
1698 :
1699 : case 12:
1700 :
1701 : /* Line 1455 of yacc.c */
1702 : #line 141 "ods_formula_parser.y"
1703 : {
1704 : (yyval) = new ods_formula_node( ODS_OR );
1705 : (yyvsp[(3) - (4)])->ReverseSubExpressions();
1706 : (yyval)->PushSubExpression( (yyvsp[(3) - (4)]) );
1707 : ;}
1708 : break;
1709 :
1710 : case 13:
1711 :
1712 : /* Line 1455 of yacc.c */
1713 : #line 148 "ods_formula_parser.y"
1714 : {
1715 : (yyval) = new ods_formula_node( ODS_NOT );
1716 : (yyval)->PushSubExpression( (yyvsp[(3) - (4)]) );
1717 : ;}
1718 : break;
1719 :
1720 : case 14:
1721 :
1722 : /* Line 1455 of yacc.c */
1723 : #line 154 "ods_formula_parser.y"
1724 : {
1725 : (yyval) = new ods_formula_node( ODS_IF );
1726 : (yyval)->PushSubExpression( (yyvsp[(3) - (6)]) );
1727 : (yyval)->PushSubExpression( (yyvsp[(5) - (6)]) );
1728 : ;}
1729 : break;
1730 :
1731 : case 15:
1732 :
1733 : /* Line 1455 of yacc.c */
1734 : #line 161 "ods_formula_parser.y"
1735 : {
1736 : (yyval) = new ods_formula_node( ODS_IF );
1737 : (yyval)->PushSubExpression( (yyvsp[(3) - (8)]) );
1738 : (yyval)->PushSubExpression( (yyvsp[(5) - (8)]) );
1739 : (yyval)->PushSubExpression( (yyvsp[(7) - (8)]) );
1740 : ;}
1741 : break;
1742 :
1743 : case 16:
1744 :
1745 : /* Line 1455 of yacc.c */
1746 : #line 169 "ods_formula_parser.y"
1747 : {
1748 : (yyval) = (yyvsp[(1) - (4)]);
1749 : (yyvsp[(3) - (4)])->ReverseSubExpressions();
1750 : (yyval)->PushSubExpression( (yyvsp[(3) - (4)]) );
1751 : ;}
1752 : break;
1753 :
1754 : case 17:
1755 :
1756 : /* Line 1455 of yacc.c */
1757 : #line 176 "ods_formula_parser.y"
1758 : {
1759 : (yyval) = (yyvsp[(2) - (3)]);
1760 : ;}
1761 : break;
1762 :
1763 : case 18:
1764 :
1765 : /* Line 1455 of yacc.c */
1766 : #line 181 "ods_formula_parser.y"
1767 : {
1768 : (yyval) = new ods_formula_node( ODS_EQ );
1769 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1770 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1771 : ;}
1772 : break;
1773 :
1774 : case 19:
1775 :
1776 : /* Line 1455 of yacc.c */
1777 : #line 188 "ods_formula_parser.y"
1778 : {
1779 : (yyval) = new ods_formula_node( ODS_NE );
1780 : (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
1781 : (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
1782 : ;}
1783 : break;
1784 :
1785 : case 20:
1786 :
1787 : /* Line 1455 of yacc.c */
1788 : #line 195 "ods_formula_parser.y"
1789 : {
1790 : (yyval) = new ods_formula_node( ODS_NE );
1791 : (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
1792 : (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
1793 : ;}
1794 : break;
1795 :
1796 : case 21:
1797 :
1798 : /* Line 1455 of yacc.c */
1799 : #line 202 "ods_formula_parser.y"
1800 : {
1801 : (yyval) = new ods_formula_node( ODS_LT );
1802 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1803 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1804 : ;}
1805 : break;
1806 :
1807 : case 22:
1808 :
1809 : /* Line 1455 of yacc.c */
1810 : #line 209 "ods_formula_parser.y"
1811 : {
1812 : (yyval) = new ods_formula_node( ODS_GT );
1813 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1814 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1815 : ;}
1816 : break;
1817 :
1818 : case 23:
1819 :
1820 : /* Line 1455 of yacc.c */
1821 : #line 216 "ods_formula_parser.y"
1822 : {
1823 : (yyval) = new ods_formula_node( ODS_LE );
1824 : (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
1825 : (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
1826 : ;}
1827 : break;
1828 :
1829 : case 24:
1830 :
1831 : /* Line 1455 of yacc.c */
1832 : #line 223 "ods_formula_parser.y"
1833 : {
1834 : (yyval) = new ods_formula_node( ODS_LE );
1835 : (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
1836 : (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
1837 : ;}
1838 : break;
1839 :
1840 : case 25:
1841 :
1842 : /* Line 1455 of yacc.c */
1843 : #line 230 "ods_formula_parser.y"
1844 : {
1845 : (yyval) = new ods_formula_node( ODS_LE );
1846 : (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
1847 : (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
1848 : ;}
1849 : break;
1850 :
1851 : case 26:
1852 :
1853 : /* Line 1455 of yacc.c */
1854 : #line 237 "ods_formula_parser.y"
1855 : {
1856 : (yyval) = new ods_formula_node( ODS_GE );
1857 : (yyval)->PushSubExpression( (yyvsp[(1) - (4)]) );
1858 : (yyval)->PushSubExpression( (yyvsp[(4) - (4)]) );
1859 : ;}
1860 : break;
1861 :
1862 : case 27:
1863 :
1864 : /* Line 1455 of yacc.c */
1865 : #line 244 "ods_formula_parser.y"
1866 : {
1867 : if ((yyvsp[(2) - (2)])->eNodeType == SNT_CONSTANT)
1868 : {
1869 : (yyval) = (yyvsp[(2) - (2)]);
1870 : (yyval)->int_value *= -1;
1871 : (yyval)->float_value *= -1;
1872 : }
1873 : else
1874 : {
1875 : (yyval) = new ods_formula_node( ODS_MULTIPLY );
1876 : (yyval)->PushSubExpression( new ods_formula_node(-1) );
1877 : (yyval)->PushSubExpression( (yyvsp[(2) - (2)]) );
1878 : }
1879 : ;}
1880 : break;
1881 :
1882 : case 28:
1883 :
1884 : /* Line 1455 of yacc.c */
1885 : #line 260 "ods_formula_parser.y"
1886 : {
1887 : (yyval) = new ods_formula_node( ODS_ADD );
1888 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1889 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1890 : ;}
1891 : break;
1892 :
1893 : case 29:
1894 :
1895 : /* Line 1455 of yacc.c */
1896 : #line 267 "ods_formula_parser.y"
1897 : {
1898 : (yyval) = new ods_formula_node( ODS_SUBTRACT );
1899 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1900 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1901 : ;}
1902 : break;
1903 :
1904 : case 30:
1905 :
1906 : /* Line 1455 of yacc.c */
1907 : #line 274 "ods_formula_parser.y"
1908 : {
1909 : (yyval) = new ods_formula_node( ODS_CONCAT );
1910 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1911 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1912 : ;}
1913 : break;
1914 :
1915 : case 31:
1916 :
1917 : /* Line 1455 of yacc.c */
1918 : #line 281 "ods_formula_parser.y"
1919 : {
1920 : (yyval) = new ods_formula_node( ODS_MULTIPLY );
1921 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1922 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1923 : ;}
1924 : break;
1925 :
1926 : case 32:
1927 :
1928 : /* Line 1455 of yacc.c */
1929 : #line 288 "ods_formula_parser.y"
1930 : {
1931 : (yyval) = new ods_formula_node( ODS_DIVIDE );
1932 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1933 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1934 : ;}
1935 : break;
1936 :
1937 : case 33:
1938 :
1939 : /* Line 1455 of yacc.c */
1940 : #line 295 "ods_formula_parser.y"
1941 : {
1942 : (yyval) = new ods_formula_node( ODS_MODULUS );
1943 : (yyval)->PushSubExpression( (yyvsp[(1) - (3)]) );
1944 : (yyval)->PushSubExpression( (yyvsp[(3) - (3)]) );
1945 : ;}
1946 : break;
1947 :
1948 : case 34:
1949 :
1950 : /* Line 1455 of yacc.c */
1951 : #line 302 "ods_formula_parser.y"
1952 : {
1953 : (yyval) = new ods_formula_node( ODS_CELL );
1954 : (yyval)->PushSubExpression( (yyvsp[(2) - (3)]) );
1955 : ;}
1956 : break;
1957 :
1958 : case 35:
1959 :
1960 : /* Line 1455 of yacc.c */
1961 : #line 309 "ods_formula_parser.y"
1962 : {
1963 : (yyval) = (yyvsp[(3) - (3)]);
1964 : (yyvsp[(3) - (3)])->PushSubExpression( (yyvsp[(1) - (3)]) );
1965 : ;}
1966 : break;
1967 :
1968 : case 36:
1969 :
1970 : /* Line 1455 of yacc.c */
1971 : #line 315 "ods_formula_parser.y"
1972 : {
1973 : (yyval) = new ods_formula_node( ODS_LIST );
1974 : (yyval)->PushSubExpression( (yyvsp[(1) - (1)]) );
1975 : ;}
1976 : break;
1977 :
1978 : case 37:
1979 :
1980 : /* Line 1455 of yacc.c */
1981 : #line 322 "ods_formula_parser.y"
1982 : {
1983 : (yyval) = (yyvsp[(3) - (3)]);
1984 : (yyvsp[(3) - (3)])->PushSubExpression( (yyvsp[(1) - (3)]) );
1985 : ;}
1986 : break;
1987 :
1988 : case 38:
1989 :
1990 : /* Line 1455 of yacc.c */
1991 : #line 328 "ods_formula_parser.y"
1992 : {
1993 : (yyval) = new ods_formula_node( ODS_LIST );
1994 : (yyval)->PushSubExpression( (yyvsp[(1) - (1)]) );
1995 : ;}
1996 : break;
1997 :
1998 : case 39:
1999 :
2000 : /* Line 1455 of yacc.c */
2001 : #line 333 "ods_formula_parser.y"
2002 : {
2003 : (yyval) = (yyvsp[(3) - (3)]);
2004 : (yyvsp[(3) - (3)])->PushSubExpression( (yyvsp[(1) - (3)]) );
2005 : ;}
2006 : break;
2007 :
2008 : case 40:
2009 :
2010 : /* Line 1455 of yacc.c */
2011 : #line 339 "ods_formula_parser.y"
2012 : {
2013 : (yyval) = new ods_formula_node( ODS_LIST );
2014 : (yyval)->PushSubExpression( (yyvsp[(1) - (1)]) );
2015 : ;}
2016 : break;
2017 :
2018 : case 41:
2019 :
2020 : /* Line 1455 of yacc.c */
2021 : #line 346 "ods_formula_parser.y"
2022 : {
2023 : (yyval) = new ods_formula_node( ODS_CELL_RANGE );
2024 : (yyval)->PushSubExpression( (yyvsp[(2) - (5)]) );
2025 : (yyval)->PushSubExpression( (yyvsp[(4) - (5)]) );
2026 : ;}
2027 : break;
2028 :
2029 :
2030 :
2031 : /* Line 1455 of yacc.c */
2032 : #line 2033 "ods_formula_parser.cpp"
2033 : default: break;
2034 : }
2035 : YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2036 :
2037 522 : YYPOPSTACK (yylen);
2038 522 : yylen = 0;
2039 : YY_STACK_PRINT (yyss, yyssp);
2040 :
2041 522 : *++yyvsp = yyval;
2042 :
2043 : /* Now `shift' the result of the reduction. Determine what state
2044 : that goes to, based on the state we popped back to and the rule
2045 : number reduced by. */
2046 :
2047 522 : yyn = yyr1[yyn];
2048 :
2049 522 : yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2050 904 : if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2051 382 : yystate = yytable[yystate];
2052 : else
2053 140 : yystate = yydefgoto[yyn - YYNTOKENS];
2054 :
2055 522 : goto yynewstate;
2056 :
2057 :
2058 : /*------------------------------------.
2059 : | yyerrlab -- here on detecting error |
2060 : `------------------------------------*/
2061 : yyerrlab:
2062 : /* If not already recovering from an error, report this error. */
2063 0 : if (!yyerrstatus)
2064 : {
2065 0 : ++yynerrs;
2066 : #if ! YYERROR_VERBOSE
2067 0 : yyerror (context, YY_("syntax error"));
2068 : #else
2069 : {
2070 : YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2071 : if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2072 : {
2073 : YYSIZE_T yyalloc = 2 * yysize;
2074 : if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2075 : yyalloc = YYSTACK_ALLOC_MAXIMUM;
2076 : if (yymsg != yymsgbuf)
2077 : YYSTACK_FREE (yymsg);
2078 : yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2079 : if (yymsg)
2080 : yymsg_alloc = yyalloc;
2081 : else
2082 : {
2083 : yymsg = yymsgbuf;
2084 : yymsg_alloc = sizeof yymsgbuf;
2085 : }
2086 : }
2087 :
2088 : if (0 < yysize && yysize <= yymsg_alloc)
2089 : {
2090 : (void) yysyntax_error (yymsg, yystate, yychar);
2091 : yyerror (context, yymsg);
2092 : }
2093 : else
2094 : {
2095 : yyerror (context, YY_("syntax error"));
2096 : if (yysize != 0)
2097 : goto yyexhaustedlab;
2098 : }
2099 : }
2100 : #endif
2101 : }
2102 :
2103 :
2104 :
2105 0 : if (yyerrstatus == 3)
2106 : {
2107 : /* If just tried and failed to reuse lookahead token after an
2108 : error, discard it. */
2109 :
2110 0 : if (yychar <= YYEOF)
2111 : {
2112 : /* Return failure if at end of input. */
2113 0 : if (yychar == YYEOF)
2114 0 : YYABORT;
2115 : }
2116 : else
2117 : {
2118 : yydestruct ("Error: discarding",
2119 0 : yytoken, &yylval, context);
2120 0 : yychar = YYEMPTY;
2121 : }
2122 : }
2123 :
2124 : /* Else will try to reuse lookahead token after shifting the error
2125 : token. */
2126 0 : goto yyerrlab1;
2127 :
2128 :
2129 : /*---------------------------------------------------.
2130 : | yyerrorlab -- error raised explicitly by YYERROR. |
2131 : `---------------------------------------------------*/
2132 : yyerrorlab:
2133 :
2134 : /* Pacify compilers like GCC when the user code never invokes
2135 : YYERROR and the label yyerrorlab therefore never appears in user
2136 : code. */
2137 : if (/*CONSTCOND*/ 0)
2138 : goto yyerrorlab;
2139 :
2140 : /* Do not reclaim the symbols of the rule which action triggered
2141 : this YYERROR. */
2142 : YYPOPSTACK (yylen);
2143 : yylen = 0;
2144 : YY_STACK_PRINT (yyss, yyssp);
2145 : yystate = *yyssp;
2146 : goto yyerrlab1;
2147 :
2148 :
2149 : /*-------------------------------------------------------------.
2150 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
2151 : `-------------------------------------------------------------*/
2152 : yyerrlab1:
2153 0 : yyerrstatus = 3; /* Each real token shifted decrements this. */
2154 :
2155 0 : for (;;)
2156 : {
2157 0 : yyn = yypact[yystate];
2158 0 : if (yyn != YYPACT_NINF)
2159 : {
2160 0 : yyn += YYTERROR;
2161 0 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2162 : {
2163 0 : yyn = yytable[yyn];
2164 0 : if (0 < yyn)
2165 : break;
2166 : }
2167 : }
2168 :
2169 : /* Pop the current state because it cannot handle the error token. */
2170 0 : if (yyssp == yyss)
2171 0 : YYABORT;
2172 :
2173 :
2174 : yydestruct ("Error: popping",
2175 0 : yystos[yystate], yyvsp, context);
2176 0 : YYPOPSTACK (1);
2177 0 : yystate = *yyssp;
2178 : YY_STACK_PRINT (yyss, yyssp);
2179 : }
2180 :
2181 0 : *++yyvsp = yylval;
2182 :
2183 :
2184 : /* Shift the error token. */
2185 : YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2186 :
2187 0 : yystate = yyn;
2188 0 : goto yynewstate;
2189 :
2190 :
2191 : /*-------------------------------------.
2192 : | yyacceptlab -- YYACCEPT comes here. |
2193 : `-------------------------------------*/
2194 : yyacceptlab:
2195 116 : yyresult = 0;
2196 116 : goto yyreturn;
2197 :
2198 : /*-----------------------------------.
2199 : | yyabortlab -- YYABORT comes here. |
2200 : `-----------------------------------*/
2201 : yyabortlab:
2202 0 : yyresult = 1;
2203 0 : goto yyreturn;
2204 :
2205 : #if !defined(yyoverflow) || YYERROR_VERBOSE
2206 : /*-------------------------------------------------.
2207 : | yyexhaustedlab -- memory exhaustion comes here. |
2208 : `-------------------------------------------------*/
2209 : yyexhaustedlab:
2210 0 : yyerror (context, YY_("memory exhausted"));
2211 0 : yyresult = 2;
2212 : /* Fall through. */
2213 : #endif
2214 :
2215 : yyreturn:
2216 116 : if (yychar != YYEMPTY)
2217 : yydestruct ("Cleanup: discarding lookahead",
2218 0 : yytoken, &yylval, context);
2219 : /* Do not reclaim the symbols of the rule which action triggered
2220 : this YYABORT or YYACCEPT. */
2221 116 : YYPOPSTACK (yylen);
2222 : YY_STACK_PRINT (yyss, yyssp);
2223 464 : while (yyssp != yyss)
2224 : {
2225 : yydestruct ("Cleanup: popping",
2226 232 : yystos[*yyssp], yyvsp, context);
2227 232 : YYPOPSTACK (1);
2228 : }
2229 : #ifndef yyoverflow
2230 116 : if (yyss != yyssa)
2231 0 : YYSTACK_FREE (yyss);
2232 : #endif
2233 : #if YYERROR_VERBOSE
2234 : if (yymsg != yymsgbuf)
2235 : YYSTACK_FREE (yymsg);
2236 : #endif
2237 : /* Make sure YYID is used. */
2238 116 : return YYID (yyresult);
2239 : }
2240 :
2241 :
2242 :
|