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