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