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