]>
Commit | Line | Data |
---|---|---|
1 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
2 | #line 3 "bison.simple" | |
3 | ||
4 | /* Skeleton output parser for bison, | |
5 | Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman | |
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 | |
9 | the Free Software Foundation; either version 1, or (at your option) | |
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 | ||
21 | ||
22 | #ifndef alloca | |
23 | #ifdef __GNUC__ | |
24 | #define alloca __builtin_alloca | |
25 | #else /* not GNU C. */ | |
26 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) | |
27 | #include <alloca.h> | |
28 | #else /* not sparc */ | |
29 | #if defined (MSDOS) && !defined (__TURBOC__) | |
30 | #include <malloc.h> | |
31 | #else /* not MSDOS, or __TURBOC__ */ | |
32 | #if defined(_AIX) | |
33 | #include <malloc.h> | |
34 | #pragma alloca | |
35 | #else /* not MSDOS, __TURBOC__, or _AIX */ | |
36 | #ifdef __hpux | |
37 | #ifdef __cplusplus | |
38 | extern "C" { | |
39 | void *alloca (unsigned int); | |
40 | }; | |
41 | #else /* not __cplusplus */ | |
42 | void *alloca (); | |
43 | #endif /* not __cplusplus */ | |
44 | #endif /* __hpux */ | |
45 | #endif /* not _AIX */ | |
46 | #endif /* not MSDOS, or __TURBOC__ */ | |
47 | #endif /* not sparc. */ | |
48 | #endif /* not GNU C. */ | |
49 | #endif /* alloca not defined. */ | |
50 | ||
51 | /* This is the parser code that is written into each bison parser | |
52 | when the %semantic_parser declaration is not specified in the grammar. | |
53 | It was written by Richard Stallman by simplifying the hairy parser | |
54 | used when %semantic_parser is specified. */ | |
55 | ||
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 | |
94 | #ifdef YYLEX_PARAM | |
95 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | |
96 | #else | |
97 | #define YYLEX yylex(&yylval, &yylloc) | |
98 | #endif | |
99 | #else /* not YYLSP_NEEDED */ | |
100 | #ifdef YYLEX_PARAM | |
101 | #define YYLEX yylex(&yylval, YYLEX_PARAM) | |
102 | #else | |
103 | #define YYLEX yylex(&yylval) | |
104 | #endif | |
105 | #endif /* not YYLSP_NEEDED */ | |
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 | |
146 | ||
147 | /* Prevent warning if -Wstrict-prototypes. */ | |
148 | #ifdef __GNUC__ | |
149 | int yyparse (void); | |
150 | #endif | |
151 | \f | |
152 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ | |
153 | #define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) | |
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 | |
160 | __yy_bcopy (from, to, count) | |
161 | char *from; | |
162 | char *to; | |
163 | int count; | |
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 | |
178 | __yy_bcopy (char *from, char *to, int count) | |
179 | { | |
180 | register char *f = from; | |
181 | register char *t = to; | |
182 | register int i = count; | |
183 | ||
184 | while (i-- > 0) | |
185 | *t++ = *f++; | |
186 | } | |
187 | ||
188 | #endif | |
189 | #endif | |
190 | \f | |
191 | #line 192 "bison.simple" | |
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 | |
200 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
201 | #else | |
202 | #define YYPARSE_PARAM | |
203 | #define YYPARSE_PARAM_DECL | |
204 | #endif | |
205 | ||
206 | int | |
207 | yyparse(YYPARSE_PARAM) | |
208 | YYPARSE_PARAM_DECL | |
209 | { | |
210 | register int yystate; | |
211 | register int yyn; | |
212 | register short *yyssp; | |
213 | register YYSTYPE *yyvsp; | |
214 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ | |
215 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ | |
216 | ||
217 | short yyssa[YYINITDEPTH]; /* the state stack */ | |
218 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ | |
219 | ||
220 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ | |
221 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ | |
222 | ||
223 | #ifdef YYLSP_NEEDED | |
224 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ | |
225 | YYLTYPE *yyls = yylsa; | |
226 | YYLTYPE *yylsp; | |
227 | ||
228 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
229 | #else | |
230 | #define YYPOPSTACK (yyvsp--, yyssp--) | |
231 | #endif | |
232 | ||
233 | int yystacksize = YYINITDEPTH; | |
234 | ||
235 | #ifdef YYPURE | |
236 | int yychar; | |
237 | YYSTYPE yylval; | |
238 | int yynerrs; | |
239 | #ifdef YYLSP_NEEDED | |
240 | YYLTYPE yylloc; | |
241 | #endif | |
242 | #endif | |
243 | ||
244 | YYSTYPE yyval; /* the variable used to return */ | |
245 | /* semantic values from the action */ | |
246 | /* routines */ | |
247 | ||
248 | int yylen; | |
249 | ||
250 | #if YYDEBUG != 0 | |
251 | if (yydebug) | |
252 | fprintf(stderr, "Starting parse\n"); | |
253 | #endif | |
254 | ||
255 | yystate = 0; | |
256 | yyerrstatus = 0; | |
257 | yynerrs = 0; | |
258 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
259 | ||
260 | /* Initialize stack pointers. | |
261 | Waste one element of value and location stack | |
262 | so that they stay on the same level as the state stack. | |
263 | The wasted elements are never initialized. */ | |
264 | ||
265 | yyssp = yyss - 1; | |
266 | yyvsp = yyvs; | |
267 | #ifdef YYLSP_NEEDED | |
268 | yylsp = yyls; | |
269 | #endif | |
270 | ||
271 | /* Push a new state, which is found in yystate . */ | |
272 | /* In all cases, when you get here, the value and location stacks | |
273 | have just been pushed. so pushing a state here evens the stacks. */ | |
274 | yynewstate: | |
275 | ||
276 | *++yyssp = yystate; | |
277 | ||
278 | if (yyssp >= yyss + yystacksize - 1) | |
279 | { | |
280 | /* Give user a chance to reallocate the stack */ | |
281 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | |
282 | YYSTYPE *yyvs1 = yyvs; | |
283 | short *yyss1 = yyss; | |
284 | #ifdef YYLSP_NEEDED | |
285 | YYLTYPE *yyls1 = yyls; | |
286 | #endif | |
287 | ||
288 | /* Get the current used size of the three stacks, in elements. */ | |
289 | int size = yyssp - yyss + 1; | |
290 | ||
291 | #ifdef yyoverflow | |
292 | /* Each stack pointer address is followed by the size of | |
293 | the data in use in that stack, in bytes. */ | |
294 | #ifdef YYLSP_NEEDED | |
295 | /* This used to be a conditional around just the two extra args, | |
296 | but that might be undefined if yyoverflow is a macro. */ | |
297 | yyoverflow("parser stack overflow", | |
298 | &yyss1, size * sizeof (*yyssp), | |
299 | &yyvs1, size * sizeof (*yyvsp), | |
300 | &yyls1, size * sizeof (*yylsp), | |
301 | &yystacksize); | |
302 | #else | |
303 | yyoverflow("parser stack overflow", | |
304 | &yyss1, size * sizeof (*yyssp), | |
305 | &yyvs1, size * sizeof (*yyvsp), | |
306 | &yystacksize); | |
307 | #endif | |
308 | ||
309 | yyss = yyss1; yyvs = yyvs1; | |
310 | #ifdef YYLSP_NEEDED | |
311 | yyls = yyls1; | |
312 | #endif | |
313 | #else /* no yyoverflow */ | |
314 | /* Extend the stack our own way. */ | |
315 | if (yystacksize >= YYMAXDEPTH) | |
316 | { | |
317 | yyerror("parser stack overflow"); | |
318 | return 2; | |
319 | } | |
320 | yystacksize *= 2; | |
321 | if (yystacksize > YYMAXDEPTH) | |
322 | yystacksize = YYMAXDEPTH; | |
323 | yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); | |
324 | __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); | |
325 | yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); | |
326 | __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); | |
327 | #ifdef YYLSP_NEEDED | |
328 | yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); | |
329 | __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); | |
330 | #endif | |
331 | #endif /* no yyoverflow */ | |
332 | ||
333 | yyssp = yyss + size - 1; | |
334 | yyvsp = yyvs + size - 1; | |
335 | #ifdef YYLSP_NEEDED | |
336 | yylsp = yyls + size - 1; | |
337 | #endif | |
338 | ||
339 | #if YYDEBUG != 0 | |
340 | if (yydebug) | |
341 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | |
342 | #endif | |
343 | ||
344 | if (yyssp >= yyss + yystacksize - 1) | |
345 | YYABORT; | |
346 | } | |
347 | ||
348 | #if YYDEBUG != 0 | |
349 | if (yydebug) | |
350 | fprintf(stderr, "Entering state %d\n", yystate); | |
351 | #endif | |
352 | ||
353 | goto yybackup; | |
354 | yybackup: | |
355 | ||
356 | /* Do appropriate processing given the current state. */ | |
357 | /* Read a lookahead token if we need one and don't already have one. */ | |
358 | /* yyresume: */ | |
359 | ||
360 | /* First try to decide what to do without reference to lookahead token. */ | |
361 | ||
362 | yyn = yypact[yystate]; | |
363 | if (yyn == YYFLAG) | |
364 | goto yydefault; | |
365 | ||
366 | /* Not known => get a lookahead token if don't already have one. */ | |
367 | ||
368 | /* yychar is either YYEMPTY or YYEOF | |
369 | or a valid token in external form. */ | |
370 | ||
371 | if (yychar == YYEMPTY) | |
372 | { | |
373 | #if YYDEBUG != 0 | |
374 | if (yydebug) | |
375 | fprintf(stderr, "Reading a token: "); | |
376 | #endif | |
377 | yychar = YYLEX; | |
378 | } | |
379 | ||
380 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
381 | ||
382 | if (yychar <= 0) /* This means end of input. */ | |
383 | { | |
384 | yychar1 = 0; | |
385 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
386 | ||
387 | #if YYDEBUG != 0 | |
388 | if (yydebug) | |
389 | fprintf(stderr, "Now at end of input.\n"); | |
390 | #endif | |
391 | } | |
392 | else | |
393 | { | |
394 | yychar1 = YYTRANSLATE(yychar); | |
395 | ||
396 | #if YYDEBUG != 0 | |
397 | if (yydebug) | |
398 | { | |
399 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
400 | /* Give the individual parser a way to print the precise meaning | |
401 | of a token, for further debugging info. */ | |
402 | #ifdef YYPRINT | |
403 | YYPRINT (stderr, yychar, yylval); | |
404 | #endif | |
405 | fprintf (stderr, ")\n"); | |
406 | } | |
407 | #endif | |
408 | } | |
409 | ||
410 | yyn += yychar1; | |
411 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
412 | goto yydefault; | |
413 | ||
414 | yyn = yytable[yyn]; | |
415 | ||
416 | /* yyn is what to do for this token type in this state. | |
417 | Negative => reduce, -yyn is rule number. | |
418 | Positive => shift, yyn is new state. | |
419 | New state is final state => don't bother to shift, | |
420 | just return success. | |
421 | 0, or most negative number => error. */ | |
422 | ||
423 | if (yyn < 0) | |
424 | { | |
425 | if (yyn == YYFLAG) | |
426 | goto yyerrlab; | |
427 | yyn = -yyn; | |
428 | goto yyreduce; | |
429 | } | |
430 | else if (yyn == 0) | |
431 | goto yyerrlab; | |
432 | ||
433 | if (yyn == YYFINAL) | |
434 | YYACCEPT; | |
435 | ||
436 | /* Shift the lookahead token. */ | |
437 | ||
438 | #if YYDEBUG != 0 | |
439 | if (yydebug) | |
440 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | |
441 | #endif | |
442 | ||
443 | /* Discard the token being shifted unless it is eof. */ | |
444 | if (yychar != YYEOF) | |
445 | yychar = YYEMPTY; | |
446 | ||
447 | *++yyvsp = yylval; | |
448 | #ifdef YYLSP_NEEDED | |
449 | *++yylsp = yylloc; | |
450 | #endif | |
451 | ||
452 | /* count tokens shifted since error; after three, turn off error status. */ | |
453 | if (yyerrstatus) yyerrstatus--; | |
454 | ||
455 | yystate = yyn; | |
456 | goto yynewstate; | |
457 | ||
458 | /* Do the default action for the current state. */ | |
459 | yydefault: | |
460 | ||
461 | yyn = yydefact[yystate]; | |
462 | if (yyn == 0) | |
463 | goto yyerrlab; | |
464 | ||
465 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | |
466 | yyreduce: | |
467 | yylen = yyr2[yyn]; | |
468 | if (yylen > 0) | |
469 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | |
470 | ||
471 | #if YYDEBUG != 0 | |
472 | if (yydebug) | |
473 | { | |
474 | int i; | |
475 | ||
476 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
477 | yyn, yyrline[yyn]); | |
478 | ||
479 | /* Print the symbols being reduced, and their result. */ | |
480 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
481 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
482 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
483 | } | |
484 | #endif | |
485 | ||
486 | $ /* the action file gets copied in in place of this dollarsign */ | |
487 | #line 487 "bison.simple" | |
488 | \f | |
489 | yyvsp -= yylen; | |
490 | yyssp -= yylen; | |
491 | #ifdef YYLSP_NEEDED | |
492 | yylsp -= yylen; | |
493 | #endif | |
494 | ||
495 | #if YYDEBUG != 0 | |
496 | if (yydebug) | |
497 | { | |
498 | short *ssp1 = yyss - 1; | |
499 | fprintf (stderr, "state stack now"); | |
500 | while (ssp1 != yyssp) | |
501 | fprintf (stderr, " %d", *++ssp1); | |
502 | fprintf (stderr, "\n"); | |
503 | } | |
504 | #endif | |
505 | ||
506 | *++yyvsp = yyval; | |
507 | ||
508 | #ifdef YYLSP_NEEDED | |
509 | yylsp++; | |
510 | if (yylen == 0) | |
511 | { | |
512 | yylsp->first_line = yylloc.first_line; | |
513 | yylsp->first_column = yylloc.first_column; | |
514 | yylsp->last_line = (yylsp-1)->last_line; | |
515 | yylsp->last_column = (yylsp-1)->last_column; | |
516 | yylsp->text = 0; | |
517 | } | |
518 | else | |
519 | { | |
520 | yylsp->last_line = (yylsp+yylen-1)->last_line; | |
521 | yylsp->last_column = (yylsp+yylen-1)->last_column; | |
522 | } | |
523 | #endif | |
524 | ||
525 | /* Now "shift" the result of the reduction. | |
526 | Determine what state that goes to, | |
527 | based on the state we popped back to | |
528 | and the rule number reduced by. */ | |
529 | ||
530 | yyn = yyr1[yyn]; | |
531 | ||
532 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
533 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
534 | yystate = yytable[yystate]; | |
535 | else | |
536 | yystate = yydefgoto[yyn - YYNTBASE]; | |
537 | ||
538 | goto yynewstate; | |
539 | ||
540 | yyerrlab: /* here on detecting error */ | |
541 | ||
542 | if (! yyerrstatus) | |
543 | /* If not already recovering from an error, report this error. */ | |
544 | { | |
545 | ++yynerrs; | |
546 | ||
547 | #ifdef YYERROR_VERBOSE | |
548 | yyn = yypact[yystate]; | |
549 | ||
550 | if (yyn > YYFLAG && yyn < YYLAST) | |
551 | { | |
552 | int size = 0; | |
553 | char *msg; | |
554 | int x, count; | |
555 | ||
556 | count = 0; | |
557 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
558 | for (x = (yyn < 0 ? -yyn : 0); | |
559 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
560 | if (yycheck[x + yyn] == x) | |
561 | size += strlen(yytname[x]) + 15, count++; | |
562 | msg = (char *) malloc(size + 15); | |
563 | if (msg != 0) | |
564 | { | |
565 | strcpy(msg, "parse error"); | |
566 | ||
567 | if (count < 5) | |
568 | { | |
569 | count = 0; | |
570 | for (x = (yyn < 0 ? -yyn : 0); | |
571 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
572 | if (yycheck[x + yyn] == x) | |
573 | { | |
574 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | |
575 | strcat(msg, yytname[x]); | |
576 | strcat(msg, "'"); | |
577 | count++; | |
578 | } | |
579 | } | |
580 | yyerror(msg); | |
581 | free(msg); | |
582 | } | |
583 | else | |
584 | yyerror ("parse error; also virtual memory exceeded"); | |
585 | } | |
586 | else | |
587 | #endif /* YYERROR_VERBOSE */ | |
588 | yyerror("parse error"); | |
589 | } | |
590 | ||
591 | goto yyerrlab1; | |
592 | yyerrlab1: /* here on error raised explicitly by an action */ | |
593 | ||
594 | if (yyerrstatus == 3) | |
595 | { | |
596 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | |
597 | ||
598 | /* return failure if at end of input */ | |
599 | if (yychar == YYEOF) | |
600 | YYABORT; | |
601 | ||
602 | #if YYDEBUG != 0 | |
603 | if (yydebug) | |
604 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | |
605 | #endif | |
606 | ||
607 | yychar = YYEMPTY; | |
608 | } | |
609 | ||
610 | /* Else will try to reuse lookahead token | |
611 | after shifting the error token. */ | |
612 | ||
613 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
614 | ||
615 | goto yyerrhandle; | |
616 | ||
617 | yyerrdefault: /* current state does not do anything special for the error token. */ | |
618 | ||
619 | #if 0 | |
620 | /* This is wrong; only states that explicitly want error tokens | |
621 | should shift them. */ | |
622 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | |
623 | if (yyn) goto yydefault; | |
624 | #endif | |
625 | ||
626 | yyerrpop: /* pop the current state because it cannot handle the error token */ | |
627 | ||
628 | if (yyssp == yyss) YYABORT; | |
629 | yyvsp--; | |
630 | yystate = *--yyssp; | |
631 | #ifdef YYLSP_NEEDED | |
632 | yylsp--; | |
633 | #endif | |
634 | ||
635 | #if YYDEBUG != 0 | |
636 | if (yydebug) | |
637 | { | |
638 | short *ssp1 = yyss - 1; | |
639 | fprintf (stderr, "Error: state stack now"); | |
640 | while (ssp1 != yyssp) | |
641 | fprintf (stderr, " %d", *++ssp1); | |
642 | fprintf (stderr, "\n"); | |
643 | } | |
644 | #endif | |
645 | ||
646 | yyerrhandle: | |
647 | ||
648 | yyn = yypact[yystate]; | |
649 | if (yyn == YYFLAG) | |
650 | goto yyerrdefault; | |
651 | ||
652 | yyn += YYTERROR; | |
653 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
654 | goto yyerrdefault; | |
655 | ||
656 | yyn = yytable[yyn]; | |
657 | if (yyn < 0) | |
658 | { | |
659 | if (yyn == YYFLAG) | |
660 | goto yyerrpop; | |
661 | yyn = -yyn; | |
662 | goto yyreduce; | |
663 | } | |
664 | else if (yyn == 0) | |
665 | goto yyerrpop; | |
666 | ||
667 | if (yyn == YYFINAL) | |
668 | YYACCEPT; | |
669 | ||
670 | #if YYDEBUG != 0 | |
671 | if (yydebug) | |
672 | fprintf(stderr, "Shifting error token, "); | |
673 | #endif | |
674 | ||
675 | *++yyvsp = yylval; | |
676 | #ifdef YYLSP_NEEDED | |
677 | *++yylsp = yylloc; | |
678 | #endif | |
679 | ||
680 | yystate = yyn; | |
681 | goto yynewstate; | |
682 | } |