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