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