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