]> git.saurik.com Git - bison.git/blob - src/bison.simple
Some actions of web2c.y are improperly triggered.
[bison.git] / src / bison.simple
1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2 #line
3 /* Skeleton output parser for bison,
4 Copyright (C) 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 /* All symbols defined below should begin with yy or YY, to avoid
32 infringing on user name space. This should be done even for local
33 variables, as they might otherwise be expanded by user macros.
34 There are some unavoidable exceptions within include files to
35 define necessary library symbols; they are noted "INFRINGES ON
36 USER NAME SPACE" below. */
37
38 #ifdef __cplusplus
39 # define YYSTD(x) std::x
40 #else
41 # define YYSTD(x) x
42 #endif
43
44 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
45
46 /* The parser invokes alloca or malloc; define the necessary symbols. */
47
48 # if YYSTACK_USE_ALLOCA
49 # define YYSTACK_ALLOC alloca
50 # define YYSIZE_T YYSTD (size_t)
51 # else
52 # ifndef YYSTACK_USE_ALLOCA
53 # if defined (alloca) || defined (_ALLOCA_H)
54 # define YYSTACK_ALLOC alloca
55 # define YYSIZE_T YYSTD (size_t)
56 # else
57 # if defined (__GNUC__) || defined (_AIX) || defined (__hpux)
58 # define YYSTACK_ALLOC __builtin_alloca
59 # endif
60 # ifndef __GNUC__
61 # ifdef _AIX
62 # pragma alloca
63 # endif
64 # if defined (__sgi) || defined (__sparc__) || defined (__sparc) || defined (__sun)
65 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
66 # define YYSTACK_ALLOC alloca
67 # define YYSIZE_T YYSTD (size_t)
68 # endif
69 # endif
70 # endif
71 # endif
72 # endif
73
74 # ifdef YYSTACK_ALLOC
75 /* Pacify GCC's `empty if-body' warning. */
76 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
77 # else
78 # ifdef __cplusplus
79 # include <cstdlib> /* INFRINGES ON USER NAME SPACE */
80 # define YYSIZE_T std::size_t
81 # else
82 # ifdef __STDC__
83 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
84 # define YYSIZE_T size_t
85 # endif
86 # endif
87 # define YYSTACK_ALLOC YYSTD (malloc)
88 # define YYSTACK_FREE YYSTD (free)
89 # endif
90
91 /* A type that is properly aligned for any stack member. */
92 union yyalloc
93 {
94 short yyss;
95 YYSTYPE yyvs;
96 # if YYLSP_NEEDED
97 YYLTYPE yyls;
98 # endif
99 };
100
101 /* The size of the maximum gap between one aligned stack and the next. */
102 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
103
104 /* The size of an array large to enough to hold all stacks, each with
105 N elements. */
106 # if YYLSP_NEEDED
107 # define YYSTACK_BYTES(N) \
108 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
109 + 2 * YYSTACK_GAP_MAX)
110 # else
111 # define YYSTACK_BYTES(N) \
112 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
113 + YYSTACK_GAP_MAX)
114 # endif
115
116 /* Relocate the TYPE STACK from its old location to the new one. The
117 local variables YYSIZE and YYSTACKSIZE give the old and new number of
118 elements in the stack, and YYPTR gives the new location of the
119 stack. Advance YYPTR to a properly aligned location for the next
120 stack. */
121 # define YYSTACK_RELOCATE(Type, Stack) \
122 do \
123 { \
124 YYSIZE_T yynewbytes; \
125 yymemcpy ((char *) yyptr, (char *) (Stack), \
126 yysize * (YYSIZE_T) sizeof (Type)); \
127 Stack = &yyptr->Stack; \
128 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
129 yyptr += yynewbytes / sizeof (*yyptr); \
130 } \
131 while (0)
132
133 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
134
135
136 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
137 # define YYSIZE_T __SIZE_TYPE__
138 #endif
139 #if ! defined (YYSIZE_T) && defined (size_t)
140 # define YYSIZE_T size_t
141 #endif
142 #if ! defined (YYSIZE_T)
143 # ifdef __cplusplus
144 # include <cstddef> /* INFRINGES ON USER NAME SPACE */
145 # define YYSIZE_T std::size_t
146 # else
147 # ifdef __STDC__
148 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
149 # define YYSIZE_T size_t
150 # endif
151 # endif
152 #endif
153 #if ! defined (YYSIZE_T)
154 # define YYSIZE_T unsigned int
155 #endif
156
157 #define yyerrok (yyerrstatus = 0)
158 #define yyclearin (yychar = YYEMPTY)
159 #define YYEMPTY -2
160 #define YYEOF 0
161 #define YYACCEPT goto yyacceptlab
162 #define YYABORT goto yyabortlab
163 #define YYERROR goto yyerrlab1
164 /* Like YYERROR except do call yyerror. This remains here temporarily
165 to ease the transition to the new meaning of YYERROR, for GCC.
166 Once GCC version 2 has supplanted version 1, this can go. */
167 #define YYFAIL goto yyerrlab
168 #define YYRECOVERING() (!!yyerrstatus)
169 #define YYBACKUP(Token, Value) \
170 do \
171 if (yychar == YYEMPTY && yylen == 1) \
172 { \
173 yychar = (Token); \
174 yylval = (Value); \
175 yychar1 = YYTRANSLATE (yychar); \
176 YYPOPSTACK; \
177 goto yybackup; \
178 } \
179 else \
180 { \
181 yyerror ("syntax error: cannot back up"); \
182 YYERROR; \
183 } \
184 while (0)
185
186 #define YYTERROR 1
187 #define YYERRCODE 256
188
189
190 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
191 are run).
192
193 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
194 first token. By default, to implement support for ranges, extend
195 its range to the last symbol. */
196
197 #ifndef YYLLOC_DEFAULT
198 # define YYLLOC_DEFAULT(Current, Rhs, N) \
199 Current.last_line = Rhs[N].last_line; \
200 Current.last_column = Rhs[N].last_column;
201 #endif
202
203
204 /* YYLEX -- calling `yylex' with the right arguments. */
205
206 #if YYPURE
207 # if YYLSP_NEEDED
208 # ifdef YYLEX_PARAM
209 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
210 # else
211 # define YYLEX yylex (&yylval, &yylloc)
212 # endif
213 # else /* !YYLSP_NEEDED */
214 # ifdef YYLEX_PARAM
215 # define YYLEX yylex (&yylval, YYLEX_PARAM)
216 # else
217 # define YYLEX yylex (&yylval)
218 # endif
219 # endif /* !YYLSP_NEEDED */
220 #else /* !YYPURE */
221 # define YYLEX yylex ()
222 #endif /* !YYPURE */
223
224
225 /* Enable debugging if requested. */
226 #if YYDEBUG
227
228 # ifndef YYFPRINTF
229 # ifdef __cplusplus
230 # include <cstdio.h> /* INFRINGES ON USER NAME SPACE */
231 # else
232 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
233 # endif
234 # define YYFPRINTF YYSTD (fprintf)
235 # define YYSTDERR YYSTD (stderr)
236 # endif
237
238 # define YYDPRINTF(Args) \
239 do { \
240 if (yydebug) \
241 YYFPRINTF Args; \
242 } while (0)
243 /* Nonzero means print parse trace. [The following comment makes no
244 sense to me. Could someone clarify it? --akim] Since this is
245 uninitialized, it does not stop multiple parsers from coexisting.
246 */
247 int yydebug;
248 #else /* !YYDEBUG */
249 # define YYDPRINTF(Args)
250 #endif /* !YYDEBUG */
251
252 /* YYINITDEPTH -- initial size of the parser's stacks. */
253 #ifndef YYINITDEPTH
254 # define YYINITDEPTH 200
255 #endif
256
257 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
258 if the built-in stack extension method is used).
259
260 Do not make this value too large; the results are undefined if
261 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
262 evaluated with infinite-precision integer arithmetic. */
263
264 #if YYMAXDEPTH == 0
265 # undef YYMAXDEPTH
266 #endif
267
268 #ifndef YYMAXDEPTH
269 # define YYMAXDEPTH 10000
270 #endif
271 \f
272 #if ! defined (yyoverflow) && ! defined (yymemcpy)
273 # if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
274 # define yymemcpy __builtin_memcpy
275 # else /* not GNU C or C++ */
276
277 /* This is the most reliable way to avoid incompatibilities
278 in available built-in functions on various systems. */
279 static void
280 # if defined (__STDC__) || defined (__cplusplus)
281 yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
282 # else
283 yymemcpy (yyto, yyfrom, yycount)
284 char *yyto;
285 const char *yyfrom;
286 YYSIZE_T yycount;
287 # endif
288 {
289 register const char *yyf = yyfrom;
290 register char *yyt = yyto;
291 register YYSIZE_T yyi = yycount;
292
293 while (yyi-- != 0)
294 *yyt++ = *yyf++;
295 }
296 # endif
297 #endif
298
299 #ifdef YYERROR_VERBOSE
300
301 # ifndef yystrlen
302 # if defined (__GLIBC__) && defined (_STRING_H)
303 # define yystrlen strlen
304 # else
305 /* Return the length of YYSTR. */
306 static YYSIZE_T
307 # if defined (__STDC__) || defined (__cplusplus)
308 yystrlen (const char *yystr)
309 # else
310 yystrlen (yystr)
311 const char *yystr;
312 # endif
313 {
314 register const char *yys = yystr;
315
316 while (*yys++ != '\0')
317 continue;
318
319 return yys - yystr - 1;
320 }
321 # endif
322 # endif
323
324 # ifndef yystpcpy
325 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
326 # define yystpcpy stpcpy
327 # else
328 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
329 YYDEST. */
330 static char *
331 # if defined (__STDC__) || defined (__cplusplus)
332 yystpcpy (char *yydest, const char *yysrc)
333 # else
334 yystpcpy (yydest, yysrc)
335 char *yydest;
336 const char *yysrc;
337 # endif
338 {
339 register char *yyd = yydest;
340 register const char *yys = yysrc;
341
342 while ((*yyd++ = *yys++) != '\0')
343 continue;
344
345 return yyd - 1;
346 }
347 # endif
348 # endif
349 #endif
350 \f
351 #line
352
353 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
354 into yyparse. The argument should have type void *.
355 It should actually point to an object.
356 Grammar actions can access the variable by casting it
357 to the proper pointer type. */
358
359 #ifdef YYPARSE_PARAM
360 # ifdef __cplusplus
361 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
362 # define YYPARSE_PARAM_DECL
363 # else /* !__cplusplus */
364 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
365 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
366 # endif /* !__cplusplus */
367 #else /* !YYPARSE_PARAM */
368 # define YYPARSE_PARAM_ARG
369 # define YYPARSE_PARAM_DECL
370 #endif /* !YYPARSE_PARAM */
371
372 /* Prevent warning if -Wstrict-prototypes. */
373 #ifdef __GNUC__
374 # ifdef YYPARSE_PARAM
375 int yyparse (void *);
376 # else
377 int yyparse (void);
378 # endif
379 #endif
380
381 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
382 variables are global, or local to YYPARSE. */
383
384 #define YY_DECL_NON_LSP_VARIABLES \
385 /* The lookahead symbol. */ \
386 int yychar; \
387 \
388 /* The semantic value of the lookahead symbol. */ \
389 YYSTYPE yylval; \
390 \
391 /* Number of parse errors so far. */ \
392 int yynerrs;
393
394 #if YYLSP_NEEDED
395 # define YY_DECL_VARIABLES \
396 YY_DECL_NON_LSP_VARIABLES \
397 \
398 /* Location data for the lookahead symbol. */ \
399 YYLTYPE yylloc;
400 #else
401 # define YY_DECL_VARIABLES \
402 YY_DECL_NON_LSP_VARIABLES
403 #endif
404
405
406 /* If nonreentrant, generate the variables here. */
407
408 #if !YYPURE
409 YY_DECL_VARIABLES
410 #endif /* !YYPURE */
411
412 int
413 yyparse (YYPARSE_PARAM_ARG)
414 YYPARSE_PARAM_DECL
415 {
416 /* If reentrant, generate the variables here. */
417 #if YYPURE
418 YY_DECL_VARIABLES
419 #endif /* !YYPURE */
420
421 register int yystate;
422 register int yyn;
423 int yyresult;
424 /* Number of tokens to shift before error messages enabled. */
425 int yyerrstatus;
426 /* Lookahead token as an internal (translated) token number. */
427 int yychar1 = 0;
428
429 /* Three stacks and their tools:
430 `yyss': related to states,
431 `yyvs': related to semantic values,
432 `yyls': related to locations.
433
434 Refer to the stacks thru separate pointers, to allow yyoverflow
435 to reallocate them elsewhere. */
436
437 /* The state stack. */
438 short yyssa[YYINITDEPTH];
439 short *yyss = yyssa;
440 register short *yyssp;
441
442 /* The semantic value stack. */
443 YYSTYPE yyvsa[YYINITDEPTH];
444 YYSTYPE *yyvs = yyvsa;
445 register YYSTYPE *yyvsp;
446
447 #if YYLSP_NEEDED
448 /* The location stack. */
449 YYLTYPE yylsa[YYINITDEPTH];
450 YYLTYPE *yyls = yylsa;
451 YYLTYPE *yylsp;
452 #endif
453
454 #if YYLSP_NEEDED
455 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
456 #else
457 # define YYPOPSTACK (yyvsp--, yyssp--)
458 #endif
459
460 YYSIZE_T yystacksize = YYINITDEPTH;
461
462
463 /* The variables used to return semantic value and location from the
464 action routines. */
465 YYSTYPE yyval;
466 #if YYLSP_NEEDED
467 YYLTYPE yyloc;
468 #endif
469
470 /* When reducing, the number of symbols on the RHS of the reduced
471 rule. */
472 int yylen;
473
474 YYDPRINTF ((YYSTDERR, "Starting parse\n"));
475
476 yystate = 0;
477 yyerrstatus = 0;
478 yynerrs = 0;
479 yychar = YYEMPTY; /* Cause a token to be read. */
480
481 /* Initialize stack pointers.
482 Waste one element of value and location stack
483 so that they stay on the same level as the state stack.
484 The wasted elements are never initialized. */
485
486 yyssp = yyss;
487 yyvsp = yyvs;
488 #if YYLSP_NEEDED
489 yylsp = yyls;
490 #endif
491 goto yysetstate;
492
493 /*------------------------------------------------------------.
494 | yynewstate -- Push a new state, which is found in yystate. |
495 `------------------------------------------------------------*/
496 yynewstate:
497 /* In all cases, when you get here, the value and location stacks
498 have just been pushed. so pushing a state here evens the stacks.
499 */
500 yyssp++;
501
502 yysetstate:
503 *yyssp = yystate;
504
505 if (yyssp >= yyss + yystacksize - 1)
506 {
507 /* Get the current used size of the three stacks, in elements. */
508 YYSIZE_T yysize = yyssp - yyss + 1;
509
510 #ifdef yyoverflow
511 {
512 /* Give user a chance to reallocate the stack. Use copies of
513 these so that the &'s don't force the real ones into
514 memory. */
515 YYSTYPE *yyvs1 = yyvs;
516 short *yyss1 = yyss;
517
518 /* Each stack pointer address is followed by the size of the
519 data in use in that stack, in bytes. */
520 # if YYLSP_NEEDED
521 YYLTYPE *yyls1 = yyls;
522 /* This used to be a conditional around just the two extra args,
523 but that might be undefined if yyoverflow is a macro. */
524 yyoverflow ("parser stack overflow",
525 &yyss1, yysize * sizeof (*yyssp),
526 &yyvs1, yysize * sizeof (*yyvsp),
527 &yyls1, yysize * sizeof (*yylsp),
528 &yystacksize);
529 yyls = yyls1;
530 # else
531 yyoverflow ("parser stack overflow",
532 &yyss1, yysize * sizeof (*yyssp),
533 &yyvs1, yysize * sizeof (*yyvsp),
534 &yystacksize);
535 # endif
536 yyss = yyss1;
537 yyvs = yyvs1;
538 }
539 #else /* no yyoverflow */
540 /* Extend the stack our own way. */
541 if (yystacksize >= YYMAXDEPTH)
542 goto yyoverflowlab;
543 yystacksize *= 2;
544 if (yystacksize > YYMAXDEPTH)
545 yystacksize = YYMAXDEPTH;
546
547 {
548 short *yyss1 = yyss;
549 union yyalloc *yyptr =
550 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
551 if (! yyptr)
552 goto yyoverflowlab;
553 YYSTACK_RELOCATE (short, yyss);
554 YYSTACK_RELOCATE (YYSTYPE, yyvs);
555 # if YYLSP_NEEDED
556 YYSTACK_RELOCATE (YYLTYPE, yyls);
557 # endif
558 # undef YYSTACK_RELOCATE
559 if (yyss1 != yyssa)
560 YYSTACK_FREE (yyss1);
561 }
562 #endif /* no yyoverflow */
563
564 yyssp = yyss + yysize - 1;
565 yyvsp = yyvs + yysize - 1;
566 #if YYLSP_NEEDED
567 yylsp = yyls + yysize - 1;
568 #endif
569
570 YYDPRINTF ((YYSTDERR, "Stack size increased to %lu\n",
571 (unsigned long int) yystacksize));
572
573 if (yyssp >= yyss + yystacksize - 1)
574 YYABORT;
575 }
576
577 YYDPRINTF ((YYSTDERR, "Entering state %d\n", yystate));
578
579 goto yybackup;
580
581
582 /*-----------.
583 | yybackup. |
584 `-----------*/
585 yybackup:
586
587 /* Do appropriate processing given the current state. */
588 /* Read a lookahead token if we need one and don't already have one. */
589 /* yyresume: */
590
591 /* First try to decide what to do without reference to lookahead token. */
592
593 yyn = yypact[yystate];
594 if (yyn == YYFLAG)
595 goto yydefault;
596
597 /* Not known => get a lookahead token if don't already have one. */
598
599 /* yychar is either YYEMPTY or YYEOF
600 or a valid token in external form. */
601
602 if (yychar == YYEMPTY)
603 {
604 YYDPRINTF ((YYSTDERR, "Reading a token: "));
605 yychar = YYLEX;
606 }
607
608 /* Convert token to internal form (in yychar1) for indexing tables with */
609
610 if (yychar <= 0) /* This means end of input. */
611 {
612 yychar1 = 0;
613 yychar = YYEOF; /* Don't call YYLEX any more */
614
615 YYDPRINTF ((YYSTDERR, "Now at end of input.\n"));
616 }
617 else
618 {
619 yychar1 = YYTRANSLATE (yychar);
620
621 #if YYDEBUG
622 /* We have to keep this `#if YYDEBUG', since we use variables
623 which are defined only if `YYDEBUG' is set. */
624 if (yydebug)
625 {
626 YYFPRINTF (YYSTDERR, "Next token is %d (%s",
627 yychar, yytname[yychar1]);
628 /* Give the individual parser a way to print the precise
629 meaning of a token, for further debugging info. */
630 # ifdef YYPRINT
631 YYPRINT (YYSTDERR, yychar, yylval);
632 # endif
633 YYFPRINTF (YYSTDERR, ")\n");
634 }
635 #endif
636 }
637
638 yyn += yychar1;
639 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
640 goto yydefault;
641
642 yyn = yytable[yyn];
643
644 /* yyn is what to do for this token type in this state.
645 Negative => reduce, -yyn is rule number.
646 Positive => shift, yyn is new state.
647 New state is final state => don't bother to shift,
648 just return success.
649 0, or most negative number => error. */
650
651 if (yyn < 0)
652 {
653 if (yyn == YYFLAG)
654 goto yyerrlab;
655 yyn = -yyn;
656 goto yyreduce;
657 }
658 else if (yyn == 0)
659 goto yyerrlab;
660
661 if (yyn == YYFINAL)
662 YYACCEPT;
663
664 /* Shift the lookahead token. */
665 YYDPRINTF ((YYSTDERR, "Shifting token %d (%s), ",
666 yychar, yytname[yychar1]));
667
668 /* Discard the token being shifted unless it is eof. */
669 if (yychar != YYEOF)
670 yychar = YYEMPTY;
671
672 *++yyvsp = yylval;
673 #if YYLSP_NEEDED
674 *++yylsp = yylloc;
675 #endif
676
677 /* Count tokens shifted since error; after three, turn off error
678 status. */
679 if (yyerrstatus)
680 yyerrstatus--;
681
682 yystate = yyn;
683 goto yynewstate;
684
685
686 /*-----------------------------------------------------------.
687 | yydefault -- do the default action for the current state. |
688 `-----------------------------------------------------------*/
689 yydefault:
690 yyn = yydefact[yystate];
691 if (yyn == 0)
692 goto yyerrlab;
693 goto yyreduce;
694
695
696 /*-----------------------------.
697 | yyreduce -- Do a reduction. |
698 `-----------------------------*/
699 yyreduce:
700 /* yyn is the number of a rule to reduce with. */
701 yylen = yyr2[yyn];
702
703 /* If YYLEN is nonzero, implement the default value of the action:
704 `$$ = $1'.
705
706 Otherwise, the following line sets YYVAL to the semantic value of
707 the lookahead token. This behavior is undocumented and Bison
708 users should not rely upon it. Assigning to YYVAL
709 unconditionally makes the parser a bit smaller, and it avoids a
710 GCC warning that YYVAL may be used uninitialized. */
711 yyval = yyvsp[1-yylen];
712
713 #if YYLSP_NEEDED
714 /* Similarly for the default location. Let the user run additional
715 commands if for instance locations are ranges. */
716 yyloc = yylsp[1-yylen];
717 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
718 #endif
719
720 #if YYDEBUG
721 /* We have to keep this `#if YYDEBUG', since we use variables which
722 are defined only if `YYDEBUG' is set. */
723 if (yydebug)
724 {
725 int yyi;
726
727 YYFPRINTF (YYSTDERR, "Reducing via rule %d (line %d), ",
728 yyn, yyrline[yyn]);
729
730 /* Print the symbols being reduced, and their result. */
731 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
732 YYFPRINTF (YYSTDERR, "%s ", yytname[yyrhs[yyi]]);
733 YYFPRINTF (YYSTDERR, " -> %s\n", yytname[yyr1[yyn]]);
734 }
735 #endif
736 %% actions /* The action file replaces this line. */
737 #line
738 \f
739 yyvsp -= yylen;
740 yyssp -= yylen;
741 #if YYLSP_NEEDED
742 yylsp -= yylen;
743 #endif
744
745 #if YYDEBUG
746 if (yydebug)
747 {
748 short *yyssp1 = yyss - 1;
749 YYFPRINTF (YYSTDERR, "state stack now");
750 while (yyssp1 != yyssp)
751 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
752 YYFPRINTF (YYSTDERR, "\n");
753 }
754 #endif
755
756 *++yyvsp = yyval;
757 #if YYLSP_NEEDED
758 *++yylsp = yyloc;
759 #endif
760
761 /* Now `shift' the result of the reduction. Determine what state
762 that goes to, based on the state we popped back to and the rule
763 number reduced by. */
764
765 yyn = yyr1[yyn];
766
767 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
768 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
769 yystate = yytable[yystate];
770 else
771 yystate = yydefgoto[yyn - YYNTBASE];
772
773 goto yynewstate;
774
775
776 /*------------------------------------.
777 | yyerrlab -- here on detecting error |
778 `------------------------------------*/
779 yyerrlab:
780 /* If not already recovering from an error, report this error. */
781 if (!yyerrstatus)
782 {
783 ++yynerrs;
784
785 #ifdef YYERROR_VERBOSE
786 yyn = yypact[yystate];
787
788 if (yyn > YYFLAG && yyn < YYLAST)
789 {
790 YYSIZE_T yysize = 0;
791 char *yymsg;
792 int yyx, yycount;
793
794 yycount = 0;
795 /* Start YYX at -YYN if negative to avoid negative indexes in
796 YYCHECK. */
797 for (yyx = yyn < 0 ? -yyn : 0;
798 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
799 if (yycheck[yyx + yyn] == yyx)
800 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
801 yysize += yystrlen ("parse error, unexpected ") + 1;
802 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
803 yymsg = (char *) YYSTACK_ALLOC (yysize);
804 if (yymsg != 0)
805 {
806 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
807 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
808
809 if (yycount < 5)
810 {
811 yycount = 0;
812 for (yyx = yyn < 0 ? -yyn : 0;
813 yyx < (int) (sizeof (yytname) / sizeof (char *));
814 yyx++)
815 if (yycheck[yyx + yyn] == yyx)
816 {
817 const char *yyq = ! yycount ? ", expecting " : " or ";
818 yyp = yystpcpy (yyp, yyq);
819 yyp = yystpcpy (yyp, yytname[yyx]);
820 yycount++;
821 }
822 }
823 yyerror (yymsg);
824 YYSTACK_FREE (yymsg);
825 }
826 else
827 yyerror ("parse error; also virtual memory exhausted");
828 }
829 else
830 #endif /* defined (YYERROR_VERBOSE) */
831 yyerror ("parse error");
832 }
833 goto yyerrlab1;
834
835
836 /*--------------------------------------------------.
837 | yyerrlab1 -- error raised explicitly by an action |
838 `--------------------------------------------------*/
839 yyerrlab1:
840 if (yyerrstatus == 3)
841 {
842 /* If just tried and failed to reuse lookahead token after an
843 error, discard it. */
844
845 /* return failure if at end of input */
846 if (yychar == YYEOF)
847 YYABORT;
848 YYDPRINTF ((YYSTDERR, "Discarding token %d (%s).\n",
849 yychar, yytname[yychar1]));
850 yychar = YYEMPTY;
851 }
852
853 /* Else will try to reuse lookahead token after shifting the error
854 token. */
855
856 yyerrstatus = 3; /* Each real token shifted decrements this */
857
858 goto yyerrhandle;
859
860
861 /*-------------------------------------------------------------------.
862 | yyerrdefault -- current state does not do anything special for the |
863 | error token. |
864 `-------------------------------------------------------------------*/
865 yyerrdefault:
866 #if 0
867 /* This is wrong; only states that explicitly want error tokens
868 should shift them. */
869
870 /* If its default is to accept any token, ok. Otherwise pop it. */
871 yyn = yydefact[yystate];
872 if (yyn)
873 goto yydefault;
874 #endif
875
876
877 /*---------------------------------------------------------------.
878 | yyerrpop -- pop the current state because it cannot handle the |
879 | error token |
880 `---------------------------------------------------------------*/
881 yyerrpop:
882 if (yyssp == yyss)
883 YYABORT;
884 yyvsp--;
885 yystate = *--yyssp;
886 #if YYLSP_NEEDED
887 yylsp--;
888 #endif
889
890 #if YYDEBUG
891 if (yydebug)
892 {
893 short *yyssp1 = yyss - 1;
894 YYFPRINTF (YYSTDERR, "Error: state stack now");
895 while (yyssp1 != yyssp)
896 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
897 YYFPRINTF (YYSTDERR, "\n");
898 }
899 #endif
900
901 /*--------------.
902 | yyerrhandle. |
903 `--------------*/
904 yyerrhandle:
905 yyn = yypact[yystate];
906 if (yyn == YYFLAG)
907 goto yyerrdefault;
908
909 yyn += YYTERROR;
910 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
911 goto yyerrdefault;
912
913 yyn = yytable[yyn];
914 if (yyn < 0)
915 {
916 if (yyn == YYFLAG)
917 goto yyerrpop;
918 yyn = -yyn;
919 goto yyreduce;
920 }
921 else if (yyn == 0)
922 goto yyerrpop;
923
924 if (yyn == YYFINAL)
925 YYACCEPT;
926
927 YYDPRINTF ((YYSTDERR, "Shifting error token, "));
928
929 *++yyvsp = yylval;
930 #if YYLSP_NEEDED
931 *++yylsp = yylloc;
932 #endif
933
934 yystate = yyn;
935 goto yynewstate;
936
937
938 /*-------------------------------------.
939 | yyacceptlab -- YYACCEPT comes here. |
940 `-------------------------------------*/
941 yyacceptlab:
942 yyresult = 0;
943 goto yyreturn;
944
945 /*-----------------------------------.
946 | yyabortlab -- YYABORT comes here. |
947 `-----------------------------------*/
948 yyabortlab:
949 yyresult = 1;
950 goto yyreturn;
951
952 /*---------------------------------------------.
953 | yyoverflowab -- parser overflow comes here. |
954 `---------------------------------------------*/
955 yyoverflowlab:
956 yyerror ("parser stack overflow");
957 yyresult = 2;
958 /* Fall through. */
959
960 yyreturn:
961 #ifndef yyoverflow
962 if (yyss != yyssa)
963 YYSTACK_FREE (yyss);
964 #endif
965 return yyresult;
966 }