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