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