]>
Commit | Line | Data |
---|---|---|
10fa2066 RS |
1 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
2 | #line 3 "bison.simple" | |
3 | ||
4 | /* Skeleton output parser for bison, | |
21b14802 | 5 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. |
10fa2066 RS |
6 | |
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
21b14802 | 9 | the Free Software Foundation; either version 2, or (at your option) |
10fa2066 RS |
10 | any later version. |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
20 | ||
c71f8bba RS |
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 | |
cfeaeb52 | 24 | in version 1.24 of Bison. */ |
10fa2066 | 25 | |
444fbf65 RS |
26 | /* This is the parser code that is written into each bison parser |
27 | when the %semantic_parser declaration is not specified in the grammar. | |
28 | It was written by Richard Stallman by simplifying the hairy parser | |
29 | used when %semantic_parser is specified. */ | |
30 | ||
10fa2066 RS |
31 | #ifndef alloca |
32 | #ifdef __GNUC__ | |
33 | #define alloca __builtin_alloca | |
34 | #else /* not GNU C. */ | |
b6287af6 | 35 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) |
10fa2066 RS |
36 | #include <alloca.h> |
37 | #else /* not sparc */ | |
db245ba8 RS |
38 | /* This used to test MSDOS, but that is a bad idea |
39 | since that is in the user namespace. */ | |
32d5c018 | 40 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) |
10fa2066 | 41 | #include <malloc.h> |
32d5c018 | 42 | #else /* not MSDOS, or __TURBOC__ */ |
10fa2066 RS |
43 | #if defined(_AIX) |
44 | #include <malloc.h> | |
45 | #pragma alloca | |
32d5c018 | 46 | #else /* not MSDOS, or __TURBOC__, or _AIX */ |
3054a9cd RS |
47 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9 and 10. */ |
48 | #define alloca __builtin_alloca | |
10fa2066 RS |
49 | #endif /* __hpux */ |
50 | #endif /* not _AIX */ | |
32d5c018 | 51 | #endif /* not MSDOS, or __TURBOC__ */ |
10fa2066 RS |
52 | #endif /* not sparc. */ |
53 | #endif /* not GNU C. */ | |
54 | #endif /* alloca not defined. */ | |
55 | ||
10fa2066 RS |
56 | /* Note: there must be only one dollar sign in this file. |
57 | It is replaced by the list of actions, each action | |
58 | as one case of the switch. */ | |
59 | ||
60 | #define yyerrok (yyerrstatus = 0) | |
61 | #define yyclearin (yychar = YYEMPTY) | |
62 | #define YYEMPTY -2 | |
63 | #define YYEOF 0 | |
64 | #define YYACCEPT return(0) | |
65 | #define YYABORT return(1) | |
66 | #define YYERROR goto yyerrlab1 | |
67 | /* Like YYERROR except do call yyerror. | |
68 | This remains here temporarily to ease the | |
69 | transition to the new meaning of YYERROR, for GCC. | |
70 | Once GCC version 2 has supplanted version 1, this can go. */ | |
71 | #define YYFAIL goto yyerrlab | |
72 | #define YYRECOVERING() (!!yyerrstatus) | |
73 | #define YYBACKUP(token, value) \ | |
74 | do \ | |
75 | if (yychar == YYEMPTY && yylen == 1) \ | |
76 | { yychar = (token), yylval = (value); \ | |
77 | yychar1 = YYTRANSLATE (yychar); \ | |
78 | YYPOPSTACK; \ | |
79 | goto yybackup; \ | |
80 | } \ | |
81 | else \ | |
82 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ | |
83 | while (0) | |
84 | ||
85 | #define YYTERROR 1 | |
86 | #define YYERRCODE 256 | |
87 | ||
88 | #ifndef YYPURE | |
89 | #define YYLEX yylex() | |
90 | #endif | |
91 | ||
92 | #ifdef YYPURE | |
93 | #ifdef YYLSP_NEEDED | |
e425e872 RS |
94 | #ifdef YYLEX_PARAM |
95 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | |
96 | #else | |
10fa2066 | 97 | #define YYLEX yylex(&yylval, &yylloc) |
e425e872 RS |
98 | #endif |
99 | #else /* not YYLSP_NEEDED */ | |
100 | #ifdef YYLEX_PARAM | |
101 | #define YYLEX yylex(&yylval, YYLEX_PARAM) | |
10fa2066 RS |
102 | #else |
103 | #define YYLEX yylex(&yylval) | |
104 | #endif | |
e425e872 | 105 | #endif /* not YYLSP_NEEDED */ |
10fa2066 RS |
106 | #endif |
107 | ||
108 | /* If nonreentrant, generate the variables here */ | |
109 | ||
110 | #ifndef YYPURE | |
111 | ||
112 | int yychar; /* the lookahead symbol */ | |
113 | YYSTYPE yylval; /* the semantic value of the */ | |
114 | /* lookahead symbol */ | |
115 | ||
116 | #ifdef YYLSP_NEEDED | |
117 | YYLTYPE yylloc; /* location data for the lookahead */ | |
118 | /* symbol */ | |
119 | #endif | |
120 | ||
121 | int yynerrs; /* number of parse errors so far */ | |
122 | #endif /* not YYPURE */ | |
123 | ||
124 | #if YYDEBUG != 0 | |
125 | int yydebug; /* nonzero means print parse trace */ | |
126 | /* Since this is uninitialized, it does not stop multiple parsers | |
127 | from coexisting. */ | |
128 | #endif | |
129 | ||
130 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ | |
131 | ||
132 | #ifndef YYINITDEPTH | |
133 | #define YYINITDEPTH 200 | |
134 | #endif | |
135 | ||
136 | /* YYMAXDEPTH is the maximum size the stacks can grow to | |
137 | (effective only if the built-in stack extension method is used). */ | |
138 | ||
139 | #if YYMAXDEPTH == 0 | |
140 | #undef YYMAXDEPTH | |
141 | #endif | |
142 | ||
143 | #ifndef YYMAXDEPTH | |
144 | #define YYMAXDEPTH 10000 | |
145 | #endif | |
10fa2066 | 146 | \f |
5e02f2ad RS |
147 | /* Define __yy_memcpy. Note that the size argument |
148 | should be passed with type unsigned int, because that is what the non-GCC | |
149 | definitions require. With GCC, __builtin_memcpy takes an arg | |
150 | of type size_t, but it can handle unsigned int. */ | |
151 | ||
10fa2066 | 152 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
c245d0d3 | 153 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) |
10fa2066 RS |
154 | #else /* not GNU C or C++ */ |
155 | #ifndef __cplusplus | |
156 | ||
157 | /* This is the most reliable way to avoid incompatibilities | |
158 | in available built-in functions on various systems. */ | |
159 | static void | |
c245d0d3 | 160 | __yy_memcpy (to, from, count) |
10fa2066 | 161 | char *to; |
c245d0d3 | 162 | char *from; |
5e02f2ad | 163 | unsigned int count; |
10fa2066 RS |
164 | { |
165 | register char *f = from; | |
166 | register char *t = to; | |
167 | register int i = count; | |
168 | ||
169 | while (i-- > 0) | |
170 | *t++ = *f++; | |
171 | } | |
172 | ||
173 | #else /* __cplusplus */ | |
174 | ||
175 | /* This is the most reliable way to avoid incompatibilities | |
176 | in available built-in functions on various systems. */ | |
177 | static void | |
5e02f2ad | 178 | __yy_memcpy (char *to, char *from, unsigned int count) |
10fa2066 | 179 | { |
10fa2066 | 180 | register char *t = to; |
4cf401b2 | 181 | register char *f = from; |
10fa2066 RS |
182 | register int i = count; |
183 | ||
184 | while (i-- > 0) | |
185 | *t++ = *f++; | |
186 | } | |
187 | ||
188 | #endif | |
189 | #endif | |
190 | \f | |
a8a7082e | 191 | #line 196 "bison.simple" |
b658bf92 RS |
192 | |
193 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
194 | into yyparse. The argument should have type void *. | |
195 | It should actually point to an object. | |
196 | Grammar actions can access the variable by casting it | |
197 | to the proper pointer type. */ | |
198 | ||
199 | #ifdef YYPARSE_PARAM | |
30f5b1cc RS |
200 | #ifdef __cplusplus |
201 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
202 | #define YYPARSE_PARAM_DECL | |
203 | #else /* not __cplusplus */ | |
204 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
b658bf92 | 205 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
30f5b1cc RS |
206 | #endif /* not __cplusplus */ |
207 | #else /* not YYPARSE_PARAM */ | |
208 | #define YYPARSE_PARAM_ARG | |
21b3ea15 | 209 | #define YYPARSE_PARAM_DECL |
30f5b1cc | 210 | #endif /* not YYPARSE_PARAM */ |
b658bf92 | 211 | |
1b181651 PE |
212 | /* Prevent warning if -Wstrict-prototypes. */ |
213 | #ifdef __GNUC__ | |
214 | #ifdef YYPARSE_PARAM | |
215 | int yyparse (void *); | |
216 | #else | |
217 | int yyparse (void); | |
218 | #endif | |
219 | #endif | |
220 | ||
10fa2066 | 221 | int |
30f5b1cc | 222 | yyparse(YYPARSE_PARAM_ARG) |
b658bf92 | 223 | YYPARSE_PARAM_DECL |
10fa2066 RS |
224 | { |
225 | register int yystate; | |
226 | register int yyn; | |
227 | register short *yyssp; | |
228 | register YYSTYPE *yyvsp; | |
229 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ | |
c6c88451 | 230 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ |
10fa2066 RS |
231 | |
232 | short yyssa[YYINITDEPTH]; /* the state stack */ | |
233 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ | |
234 | ||
235 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ | |
236 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ | |
237 | ||
238 | #ifdef YYLSP_NEEDED | |
239 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ | |
240 | YYLTYPE *yyls = yylsa; | |
241 | YYLTYPE *yylsp; | |
242 | ||
243 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
244 | #else | |
245 | #define YYPOPSTACK (yyvsp--, yyssp--) | |
246 | #endif | |
247 | ||
248 | int yystacksize = YYINITDEPTH; | |
249 | ||
250 | #ifdef YYPURE | |
251 | int yychar; | |
252 | YYSTYPE yylval; | |
253 | int yynerrs; | |
254 | #ifdef YYLSP_NEEDED | |
255 | YYLTYPE yylloc; | |
256 | #endif | |
257 | #endif | |
258 | ||
259 | YYSTYPE yyval; /* the variable used to return */ | |
260 | /* semantic values from the action */ | |
261 | /* routines */ | |
262 | ||
263 | int yylen; | |
264 | ||
265 | #if YYDEBUG != 0 | |
266 | if (yydebug) | |
267 | fprintf(stderr, "Starting parse\n"); | |
268 | #endif | |
269 | ||
270 | yystate = 0; | |
271 | yyerrstatus = 0; | |
272 | yynerrs = 0; | |
273 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
274 | ||
275 | /* Initialize stack pointers. | |
276 | Waste one element of value and location stack | |
277 | so that they stay on the same level as the state stack. | |
278 | The wasted elements are never initialized. */ | |
279 | ||
280 | yyssp = yyss - 1; | |
281 | yyvsp = yyvs; | |
282 | #ifdef YYLSP_NEEDED | |
283 | yylsp = yyls; | |
284 | #endif | |
285 | ||
286 | /* Push a new state, which is found in yystate . */ | |
287 | /* In all cases, when you get here, the value and location stacks | |
288 | have just been pushed. so pushing a state here evens the stacks. */ | |
289 | yynewstate: | |
290 | ||
291 | *++yyssp = yystate; | |
292 | ||
293 | if (yyssp >= yyss + yystacksize - 1) | |
294 | { | |
295 | /* Give user a chance to reallocate the stack */ | |
296 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | |
297 | YYSTYPE *yyvs1 = yyvs; | |
298 | short *yyss1 = yyss; | |
299 | #ifdef YYLSP_NEEDED | |
300 | YYLTYPE *yyls1 = yyls; | |
301 | #endif | |
302 | ||
303 | /* Get the current used size of the three stacks, in elements. */ | |
304 | int size = yyssp - yyss + 1; | |
305 | ||
306 | #ifdef yyoverflow | |
307 | /* Each stack pointer address is followed by the size of | |
308 | the data in use in that stack, in bytes. */ | |
be4bf877 RS |
309 | #ifdef YYLSP_NEEDED |
310 | /* This used to be a conditional around just the two extra args, | |
311 | but that might be undefined if yyoverflow is a macro. */ | |
10fa2066 RS |
312 | yyoverflow("parser stack overflow", |
313 | &yyss1, size * sizeof (*yyssp), | |
314 | &yyvs1, size * sizeof (*yyvsp), | |
10fa2066 | 315 | &yyls1, size * sizeof (*yylsp), |
10fa2066 | 316 | &yystacksize); |
be4bf877 RS |
317 | #else |
318 | yyoverflow("parser stack overflow", | |
319 | &yyss1, size * sizeof (*yyssp), | |
320 | &yyvs1, size * sizeof (*yyvsp), | |
321 | &yystacksize); | |
322 | #endif | |
10fa2066 RS |
323 | |
324 | yyss = yyss1; yyvs = yyvs1; | |
325 | #ifdef YYLSP_NEEDED | |
326 | yyls = yyls1; | |
327 | #endif | |
328 | #else /* no yyoverflow */ | |
329 | /* Extend the stack our own way. */ | |
330 | if (yystacksize >= YYMAXDEPTH) | |
331 | { | |
332 | yyerror("parser stack overflow"); | |
333 | return 2; | |
334 | } | |
335 | yystacksize *= 2; | |
336 | if (yystacksize > YYMAXDEPTH) | |
337 | yystacksize = YYMAXDEPTH; | |
338 | yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); | |
5e02f2ad RS |
339 | __yy_memcpy ((char *)yyss, (char *)yyss1, |
340 | size * (unsigned int) sizeof (*yyssp)); | |
10fa2066 | 341 | yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); |
5e02f2ad RS |
342 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, |
343 | size * (unsigned int) sizeof (*yyvsp)); | |
10fa2066 RS |
344 | #ifdef YYLSP_NEEDED |
345 | yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); | |
5e02f2ad RS |
346 | __yy_memcpy ((char *)yyls, (char *)yyls1, |
347 | size * (unsigned int) sizeof (*yylsp)); | |
10fa2066 RS |
348 | #endif |
349 | #endif /* no yyoverflow */ | |
350 | ||
351 | yyssp = yyss + size - 1; | |
352 | yyvsp = yyvs + size - 1; | |
353 | #ifdef YYLSP_NEEDED | |
354 | yylsp = yyls + size - 1; | |
355 | #endif | |
356 | ||
357 | #if YYDEBUG != 0 | |
358 | if (yydebug) | |
359 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | |
360 | #endif | |
361 | ||
362 | if (yyssp >= yyss + yystacksize - 1) | |
363 | YYABORT; | |
364 | } | |
365 | ||
366 | #if YYDEBUG != 0 | |
367 | if (yydebug) | |
368 | fprintf(stderr, "Entering state %d\n", yystate); | |
369 | #endif | |
370 | ||
371 | goto yybackup; | |
372 | yybackup: | |
373 | ||
374 | /* Do appropriate processing given the current state. */ | |
375 | /* Read a lookahead token if we need one and don't already have one. */ | |
376 | /* yyresume: */ | |
377 | ||
378 | /* First try to decide what to do without reference to lookahead token. */ | |
379 | ||
380 | yyn = yypact[yystate]; | |
381 | if (yyn == YYFLAG) | |
382 | goto yydefault; | |
383 | ||
384 | /* Not known => get a lookahead token if don't already have one. */ | |
385 | ||
386 | /* yychar is either YYEMPTY or YYEOF | |
387 | or a valid token in external form. */ | |
388 | ||
389 | if (yychar == YYEMPTY) | |
390 | { | |
391 | #if YYDEBUG != 0 | |
392 | if (yydebug) | |
393 | fprintf(stderr, "Reading a token: "); | |
394 | #endif | |
395 | yychar = YYLEX; | |
396 | } | |
397 | ||
398 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
399 | ||
400 | if (yychar <= 0) /* This means end of input. */ | |
401 | { | |
402 | yychar1 = 0; | |
403 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
404 | ||
405 | #if YYDEBUG != 0 | |
406 | if (yydebug) | |
407 | fprintf(stderr, "Now at end of input.\n"); | |
408 | #endif | |
409 | } | |
410 | else | |
411 | { | |
412 | yychar1 = YYTRANSLATE(yychar); | |
413 | ||
414 | #if YYDEBUG != 0 | |
415 | if (yydebug) | |
416 | { | |
417 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
418 | /* Give the individual parser a way to print the precise meaning | |
419 | of a token, for further debugging info. */ | |
420 | #ifdef YYPRINT | |
421 | YYPRINT (stderr, yychar, yylval); | |
422 | #endif | |
423 | fprintf (stderr, ")\n"); | |
424 | } | |
425 | #endif | |
426 | } | |
427 | ||
428 | yyn += yychar1; | |
429 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
430 | goto yydefault; | |
431 | ||
432 | yyn = yytable[yyn]; | |
433 | ||
434 | /* yyn is what to do for this token type in this state. | |
435 | Negative => reduce, -yyn is rule number. | |
436 | Positive => shift, yyn is new state. | |
437 | New state is final state => don't bother to shift, | |
438 | just return success. | |
439 | 0, or most negative number => error. */ | |
440 | ||
441 | if (yyn < 0) | |
442 | { | |
443 | if (yyn == YYFLAG) | |
444 | goto yyerrlab; | |
445 | yyn = -yyn; | |
446 | goto yyreduce; | |
447 | } | |
448 | else if (yyn == 0) | |
449 | goto yyerrlab; | |
450 | ||
451 | if (yyn == YYFINAL) | |
452 | YYACCEPT; | |
453 | ||
454 | /* Shift the lookahead token. */ | |
455 | ||
456 | #if YYDEBUG != 0 | |
457 | if (yydebug) | |
458 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | |
459 | #endif | |
460 | ||
461 | /* Discard the token being shifted unless it is eof. */ | |
462 | if (yychar != YYEOF) | |
463 | yychar = YYEMPTY; | |
464 | ||
465 | *++yyvsp = yylval; | |
466 | #ifdef YYLSP_NEEDED | |
467 | *++yylsp = yylloc; | |
468 | #endif | |
469 | ||
470 | /* count tokens shifted since error; after three, turn off error status. */ | |
471 | if (yyerrstatus) yyerrstatus--; | |
472 | ||
473 | yystate = yyn; | |
474 | goto yynewstate; | |
475 | ||
476 | /* Do the default action for the current state. */ | |
477 | yydefault: | |
478 | ||
479 | yyn = yydefact[yystate]; | |
480 | if (yyn == 0) | |
481 | goto yyerrlab; | |
482 | ||
483 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | |
484 | yyreduce: | |
485 | yylen = yyr2[yyn]; | |
fb75fa82 RS |
486 | if (yylen > 0) |
487 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | |
10fa2066 RS |
488 | |
489 | #if YYDEBUG != 0 | |
490 | if (yydebug) | |
491 | { | |
492 | int i; | |
493 | ||
494 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
495 | yyn, yyrline[yyn]); | |
496 | ||
497 | /* Print the symbols being reduced, and their result. */ | |
498 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
499 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
500 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
501 | } | |
502 | #endif | |
503 | ||
504 | $ /* the action file gets copied in in place of this dollarsign */ | |
a8a7082e | 505 | #line 498 "bison.simple" |
10fa2066 RS |
506 | \f |
507 | yyvsp -= yylen; | |
508 | yyssp -= yylen; | |
509 | #ifdef YYLSP_NEEDED | |
510 | yylsp -= yylen; | |
511 | #endif | |
512 | ||
513 | #if YYDEBUG != 0 | |
514 | if (yydebug) | |
515 | { | |
516 | short *ssp1 = yyss - 1; | |
517 | fprintf (stderr, "state stack now"); | |
518 | while (ssp1 != yyssp) | |
519 | fprintf (stderr, " %d", *++ssp1); | |
520 | fprintf (stderr, "\n"); | |
521 | } | |
522 | #endif | |
523 | ||
524 | *++yyvsp = yyval; | |
525 | ||
526 | #ifdef YYLSP_NEEDED | |
527 | yylsp++; | |
528 | if (yylen == 0) | |
529 | { | |
530 | yylsp->first_line = yylloc.first_line; | |
531 | yylsp->first_column = yylloc.first_column; | |
532 | yylsp->last_line = (yylsp-1)->last_line; | |
533 | yylsp->last_column = (yylsp-1)->last_column; | |
534 | yylsp->text = 0; | |
535 | } | |
536 | else | |
537 | { | |
538 | yylsp->last_line = (yylsp+yylen-1)->last_line; | |
539 | yylsp->last_column = (yylsp+yylen-1)->last_column; | |
540 | } | |
541 | #endif | |
542 | ||
543 | /* Now "shift" the result of the reduction. | |
544 | Determine what state that goes to, | |
545 | based on the state we popped back to | |
546 | and the rule number reduced by. */ | |
547 | ||
548 | yyn = yyr1[yyn]; | |
549 | ||
550 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
551 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
552 | yystate = yytable[yystate]; | |
553 | else | |
554 | yystate = yydefgoto[yyn - YYNTBASE]; | |
555 | ||
556 | goto yynewstate; | |
557 | ||
558 | yyerrlab: /* here on detecting error */ | |
559 | ||
560 | if (! yyerrstatus) | |
561 | /* If not already recovering from an error, report this error. */ | |
562 | { | |
563 | ++yynerrs; | |
564 | ||
565 | #ifdef YYERROR_VERBOSE | |
566 | yyn = yypact[yystate]; | |
567 | ||
568 | if (yyn > YYFLAG && yyn < YYLAST) | |
569 | { | |
570 | int size = 0; | |
571 | char *msg; | |
572 | int x, count; | |
573 | ||
574 | count = 0; | |
575 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
576 | for (x = (yyn < 0 ? -yyn : 0); | |
577 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
578 | if (yycheck[x + yyn] == x) | |
579 | size += strlen(yytname[x]) + 15, count++; | |
580 | msg = (char *) malloc(size + 15); | |
581 | if (msg != 0) | |
582 | { | |
583 | strcpy(msg, "parse error"); | |
584 | ||
585 | if (count < 5) | |
586 | { | |
587 | count = 0; | |
588 | for (x = (yyn < 0 ? -yyn : 0); | |
589 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
590 | if (yycheck[x + yyn] == x) | |
591 | { | |
592 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | |
593 | strcat(msg, yytname[x]); | |
594 | strcat(msg, "'"); | |
595 | count++; | |
596 | } | |
597 | } | |
598 | yyerror(msg); | |
599 | free(msg); | |
600 | } | |
601 | else | |
602 | yyerror ("parse error; also virtual memory exceeded"); | |
603 | } | |
604 | else | |
605 | #endif /* YYERROR_VERBOSE */ | |
606 | yyerror("parse error"); | |
607 | } | |
608 | ||
609 | goto yyerrlab1; | |
610 | yyerrlab1: /* here on error raised explicitly by an action */ | |
611 | ||
612 | if (yyerrstatus == 3) | |
613 | { | |
614 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | |
615 | ||
616 | /* return failure if at end of input */ | |
617 | if (yychar == YYEOF) | |
618 | YYABORT; | |
619 | ||
620 | #if YYDEBUG != 0 | |
621 | if (yydebug) | |
622 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | |
623 | #endif | |
624 | ||
625 | yychar = YYEMPTY; | |
626 | } | |
627 | ||
628 | /* Else will try to reuse lookahead token | |
629 | after shifting the error token. */ | |
630 | ||
631 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
632 | ||
633 | goto yyerrhandle; | |
634 | ||
635 | yyerrdefault: /* current state does not do anything special for the error token. */ | |
636 | ||
637 | #if 0 | |
638 | /* This is wrong; only states that explicitly want error tokens | |
639 | should shift them. */ | |
640 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | |
641 | if (yyn) goto yydefault; | |
642 | #endif | |
643 | ||
644 | yyerrpop: /* pop the current state because it cannot handle the error token */ | |
645 | ||
646 | if (yyssp == yyss) YYABORT; | |
647 | yyvsp--; | |
648 | yystate = *--yyssp; | |
649 | #ifdef YYLSP_NEEDED | |
650 | yylsp--; | |
651 | #endif | |
652 | ||
653 | #if YYDEBUG != 0 | |
654 | if (yydebug) | |
655 | { | |
656 | short *ssp1 = yyss - 1; | |
657 | fprintf (stderr, "Error: state stack now"); | |
658 | while (ssp1 != yyssp) | |
659 | fprintf (stderr, " %d", *++ssp1); | |
660 | fprintf (stderr, "\n"); | |
661 | } | |
662 | #endif | |
663 | ||
664 | yyerrhandle: | |
665 | ||
666 | yyn = yypact[yystate]; | |
667 | if (yyn == YYFLAG) | |
668 | goto yyerrdefault; | |
669 | ||
670 | yyn += YYTERROR; | |
671 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
672 | goto yyerrdefault; | |
673 | ||
674 | yyn = yytable[yyn]; | |
675 | if (yyn < 0) | |
676 | { | |
677 | if (yyn == YYFLAG) | |
678 | goto yyerrpop; | |
679 | yyn = -yyn; | |
680 | goto yyreduce; | |
681 | } | |
682 | else if (yyn == 0) | |
683 | goto yyerrpop; | |
684 | ||
685 | if (yyn == YYFINAL) | |
686 | YYACCEPT; | |
687 | ||
688 | #if YYDEBUG != 0 | |
689 | if (yydebug) | |
690 | fprintf(stderr, "Shifting error token, "); | |
691 | #endif | |
692 | ||
693 | *++yyvsp = yylval; | |
694 | #ifdef YYLSP_NEEDED | |
695 | *++yylsp = yylloc; | |
696 | #endif | |
697 | ||
698 | yystate = yyn; | |
699 | goto yynewstate; | |
700 | } |