]> git.saurik.com Git - bison.git/blame - src/bison.simple
* src/print.c, src/print_graph.c (escape): New.
[bison.git] / src / bison.simple
CommitLineData
a8289c62
RA
1/* -*- C -*- */
2
3/* A Bison parser, made from %%filename
4 by GNU bison %%version. */
5
10fa2066 6/* Skeleton output parser for bison,
fabd3b43 7 Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
10fa2066
RS
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
21b14802 11 the Free Software Foundation; either version 2, or (at your option)
10fa2066
RS
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
c49a8e71
JT
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
10fa2066 23
c71f8bba
RS
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
cfeaeb52 27 in version 1.24 of Bison. */
10fa2066 28
71da9eea
AD
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. */
444fbf65 33
7093d0f5
AD
34/* Identify Bison output. */
35#define YYBISON 1
fd51e5ff 36
7093d0f5
AD
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. */
a79986b8
MA
49#ifdef YYERROR_VERBOSE
50# undef YYERROR_VERBOSE
51# define YYERROR_VERBOSE 1
52#else
53# define YYERROR_VERBOSE %%error-verbose
54#endif
a8289c62 55
17da6427
PB
56/* If name_prefix is specify substitute the variables and functions
57 names. */
58#define yyparse %%prefix##parse
fd51e5ff 59#define yylex %%prefix##lex
17da6427 60#define yyerror %%prefix##error
fd51e5ff
AD
61#define yylval %%prefix##lval
62#define yychar %%prefix##char
17da6427
PB
63#define yydebug %%prefix##debug
64#define yynerrs %%prefix##nerrs
65
fd51e5ff
AD
66#ifndef YYSTYPE
67typedef %%stype yystype;
68# define YYSTYPE yystype
69#endif
70
71#ifndef YYLTYPE
72typedef 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
7093d0f5 82/* Copy the user declarations. */
7093d0f5
AD
83%%prologue
84
897668ee 85/* Line %%skeleton-line of %%skeleton. */
f0440388 86#line %%line "%%parser-file-name"
7093d0f5
AD
87
88#include <stdio.h>
89
7093d0f5
AD
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
b7575ffe 94 define necessary library symbols; they are noted "INFRINGES ON
7093d0f5
AD
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
b7575ffe
PE
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
7093d0f5
AD
143# endif
144# endif
145
600f9b0c
PE
146/* A type that is properly aligned for any stack member. */
147union yyalloc
148{
2729e106
PE
149 short yyss;
150 YYSTYPE yyvs;
7093d0f5 151# if YYLSP_NEEDED
2729e106 152 YYLTYPE yyls;
7093d0f5 153# endif
600f9b0c
PE
154};
155
156/* The size of the maximum gap between one aligned stack and the next. */
7093d0f5 157# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
600f9b0c
PE
158
159/* The size of an array large to enough to hold all stacks, each with
160 N elements. */
7093d0f5
AD
161# if YYLSP_NEEDED
162# define YYSTACK_BYTES(N) \
600f9b0c
PE
163 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
164 + 2 * YYSTACK_GAP_MAX)
7093d0f5
AD
165# else
166# define YYSTACK_BYTES(N) \
600f9b0c
PE
167 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
168 + YYSTACK_GAP_MAX)
7093d0f5 169# endif
600f9b0c
PE
170
171/* Relocate the TYPE STACK from its old location to the new one. The
7093d0f5 172 local variables YYSIZE and YYSTACKSIZE give the old and new number of
600f9b0c
PE
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. */
7093d0f5
AD
176# define YYSTACK_RELOCATE(Type, Stack) \
177 do \
178 { \
179 YYSIZE_T yynewbytes; \
2729e106 180 yymemcpy ((char *) yyptr, (char *) (Stack), \
7093d0f5 181 yysize * (YYSIZE_T) sizeof (Type)); \
2729e106 182 Stack = &yyptr->Stack; \
7093d0f5 183 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
2729e106 184 yyptr += yynewbytes / sizeof (*yyptr); \
7093d0f5
AD
185 } \
186 while (0)
187
188#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
8850be4b 189
e8cb70b9 190/* Tokens. */
a8289c62
RA
191%%tokendef
192
7742ddeb
AD
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. */
a8289c62
RA
209#define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym)
210
7742ddeb 211/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
a8289c62
RA
212static const char yytranslate[] =
213{
214 %%translate
215};
216
217#if YYDEBUG
7742ddeb
AD
218/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
219 YYRHS. */
a8289c62
RA
220static const short yyprhs[] =
221{
222 %%prhs
223};
224
7742ddeb 225/* YYRHS -- A `0'-separated list of the rules' RHS. */
a8289c62
RA
226static const short yyrhs[] =
227{
228 %%rhs
229};
230
231/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
232static const short yyrline[] =
233{
234 %%rline
235};
236#endif
237
c527b2d4 238#if (YYDEBUG) || YYERROR_VERBOSE
7742ddeb
AD
239/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
240 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
e8cb70b9 241static const char *const yytname[] =
a8289c62
RA
242{
243 %%tname
244};
245#endif
246
247/* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */
248static const short yytoknum[] =
249{
250 %%toknum
251};
252
253/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
254static const short yyr1[] =
255{
256 %%r1
257};
258
259/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
260static 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. */
268static const short yydefact[] =
269{
270 %%defact
271};
272
7742ddeb 273/* YYPGOTO[NTERM-NUM]. */
a8289c62
RA
274static const short yydefgoto[] =
275{
276 %%defgoto
277};
278
7742ddeb
AD
279/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
280 STATE-NUM. */
a8289c62
RA
281static const short yypact[] =
282{
283 %%pact
284};
285
7742ddeb 286/* YYPGOTO[NTERM-NUM]. */
a8289c62
RA
287static const short yypgoto[] =
288{
289 %%pgoto
290};
291
7742ddeb
AD
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. */
a8289c62
RA
295static const short yytable[] =
296{
297 %%table
298};
299
300static const short yycheck[] =
301{
302 %%check
303};
304
7093d0f5
AD
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
b7575ffe
PE
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
7093d0f5
AD
322#endif
323#if ! defined (YYSIZE_T)
324# define YYSIZE_T unsigned int
325#endif
326
10fa2066 327#define yyerrok (yyerrstatus = 0)
17da6427 328#define yyclearin (yychar = YYEMPTY)
10fa2066
RS
329#define YYEMPTY -2
330#define YYEOF 0
a8289c62 331
70ddf897 332#define YYACCEPT goto yyacceptlab
a8289c62 333#define YYABORT goto yyabortlab
10fa2066 334#define YYERROR goto yyerrlab1
a8289c62 335
71da9eea
AD
336/* Like YYERROR except do call yyerror. This remains here temporarily
337 to ease the transition to the new meaning of YYERROR, for GCC.
10fa2066 338 Once GCC version 2 has supplanted version 1, this can go. */
a8289c62 339
10fa2066 340#define YYFAIL goto yyerrlab
a8289c62 341
10fa2066 342#define YYRECOVERING() (!!yyerrstatus)
a8289c62 343
69b4e0c5 344#define YYBACKUP(Token, Value) \
10fa2066 345do \
17da6427 346 if (yychar == YYEMPTY && yylen == 1) \
71da9eea 347 { \
17da6427 348 yychar = (Token); \
7742ddeb 349 yylval = (Value); \
17da6427 350 yychar1 = YYTRANSLATE (yychar); \
10fa2066
RS
351 YYPOPSTACK; \
352 goto yybackup; \
353 } \
354 else \
71da9eea 355 { \
7742ddeb 356 yyerror ("syntax error: cannot back up"); \
71da9eea
AD
357 YYERROR; \
358 } \
10fa2066
RS
359while (0)
360
361#define YYTERROR 1
362#define YYERRCODE 256
363
3abcd459
AD
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
ca96bc2d
MA
372# define YYLLOC_DEFAULT(Current, Rhs, N) \
373 Current.last_line = Rhs[N].last_line; \
374 Current.last_column = Rhs[N].last_column;
3abcd459
AD
375#endif
376
3abcd459 377/* YYLEX -- calling `yylex' with the right arguments. */
553e2b22
AD
378
379#if YYPURE
5af1f549 380# if YYLSP_NEEDED
b07b484a 381# ifdef YYLEX_PARAM
17da6427 382# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
b07b484a 383# else
17da6427 384# define YYLEX yylex (&yylval, &yylloc)
b07b484a 385# endif
71da9eea 386# else /* !YYLSP_NEEDED */
b07b484a 387# ifdef YYLEX_PARAM
17da6427 388# define YYLEX yylex (&yylval, YYLEX_PARAM)
b07b484a 389# else
17da6427 390# define YYLEX yylex (&yylval)
b07b484a 391# endif
71da9eea 392# endif /* !YYLSP_NEEDED */
553e2b22 393#else /* !YYPURE */
17da6427 394# define YYLEX yylex ()
553e2b22
AD
395#endif /* !YYPURE */
396
5a35a6cb 397/* Enable debugging if requested. */
0d533154 398#if YYDEBUG
b7575ffe
PE
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
5a35a6cb
AD
412# define YYDPRINTF(Args) \
413do { \
17da6427 414 if (yydebug) \
b7575ffe 415 YYFPRINTF Args; \
5a35a6cb
AD
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 */
17da6427 421int yydebug;
5a35a6cb
AD
422#else /* !YYDEBUG */
423# define YYDPRINTF(Args)
424#endif /* !YYDEBUG */
425
426/* YYINITDEPTH -- initial size of the parser's stacks. */
10fa2066 427#ifndef YYINITDEPTH
a8289c62 428# define YYINITDEPTH %%initdepth
10fa2066
RS
429#endif
430
5a35a6cb 431/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
600f9b0c
PE
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
10fa2066 438#if YYMAXDEPTH == 0
b07b484a 439# undef YYMAXDEPTH
10fa2066
RS
440#endif
441
442#ifndef YYMAXDEPTH
a8289c62 443# define YYMAXDEPTH %%maxdepth
10fa2066 444#endif
a8289c62 445
10fa2066 446\f
a8289c62 447
7093d0f5
AD
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++ */
10fa2066
RS
452
453/* This is the most reliable way to avoid incompatibilities
454 in available built-in functions on various systems. */
455static void
7093d0f5
AD
456# if defined (__STDC__) || defined (__cplusplus)
457yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
458# else
459yymemcpy (yyto, yyfrom, yycount)
460 char *yyto;
461 const char *yyfrom;
462 YYSIZE_T yycount;
463# endif
10fa2066 464{
7093d0f5
AD
465 register const char *yyf = yyfrom;
466 register char *yyt = yyto;
467 register YYSIZE_T yyi = yycount;
10fa2066 468
7093d0f5
AD
469 while (yyi-- != 0)
470 *yyt++ = *yyf++;
10fa2066 471}
7093d0f5 472# endif
bbb5bcc6 473#endif
a8289c62 474
7093d0f5
AD
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. */
482static YYSIZE_T
483# if defined (__STDC__) || defined (__cplusplus)
484yystrlen (const char *yystr)
485# else
486yystrlen (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. */
506static char *
f11966ff
PE
507# if defined (__STDC__) || defined (__cplusplus)
508yystpcpy (char *yydest, const char *yysrc)
509# else
7093d0f5
AD
510yystpcpy (yydest, yysrc)
511 char *yydest;
512 const char *yysrc;
7093d0f5
AD
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
10fa2066 528\f
a8289c62 529
b658bf92
RS
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
b07b484a
AD
537# ifdef __cplusplus
538# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
539# define YYPARSE_PARAM_DECL
71da9eea 540# else /* !__cplusplus */
b07b484a
AD
541# define YYPARSE_PARAM_ARG YYPARSE_PARAM
542# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
71da9eea
AD
543# endif /* !__cplusplus */
544#else /* !YYPARSE_PARAM */
b07b484a
AD
545# define YYPARSE_PARAM_ARG
546# define YYPARSE_PARAM_DECL
71da9eea 547#endif /* !YYPARSE_PARAM */
b658bf92 548
1b181651
PE
549/* Prevent warning if -Wstrict-prototypes. */
550#ifdef __GNUC__
b07b484a 551# ifdef YYPARSE_PARAM
17da6427 552int yyparse (void *);
b07b484a 553# else
17da6427 554int yyparse (void);
b07b484a 555# endif
1b181651
PE
556#endif
557
a35f64ea
AD
558/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
559 variables are global, or local to YYPARSE. */
560
7093d0f5 561#define YY_DECL_NON_LSP_VARIABLES \
a35f64ea 562/* The lookahead symbol. */ \
17da6427 563int yychar; \
a35f64ea 564 \
e8cb70b9 565/* The semantic value of the lookahead symbol. */ \
17da6427 566YYSTYPE yylval; \
a35f64ea
AD
567 \
568/* Number of parse errors so far. */ \
17da6427 569int yynerrs;
a35f64ea
AD
570
571#if YYLSP_NEEDED
572# define YY_DECL_VARIABLES \
7093d0f5 573YY_DECL_NON_LSP_VARIABLES \
a35f64ea
AD
574 \
575/* Location data for the lookahead symbol. */ \
576YYLTYPE yylloc;
577#else
578# define YY_DECL_VARIABLES \
7093d0f5 579YY_DECL_NON_LSP_VARIABLES
a35f64ea
AD
580#endif
581
e8cb70b9 582/* If nonreentrant, generate the variables here. */
a35f64ea
AD
583
584#if !YYPURE
585YY_DECL_VARIABLES
586#endif /* !YYPURE */
587
10fa2066 588int
17da6427 589yyparse (YYPARSE_PARAM_ARG)
b658bf92 590 YYPARSE_PARAM_DECL
10fa2066 591{
e8cb70b9 592 /* If reentrant, generate the variables here. */
a35f64ea
AD
593#if YYPURE
594 YY_DECL_VARIABLES
595#endif /* !YYPURE */
596
10fa2066
RS
597 register int yystate;
598 register int yyn;
600f9b0c 599 int yyresult;
b07b484a
AD
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;
10fa2066 604
bb10be54
AD
605 /* Three stacks and their tools:
606 `yyss': related to states,
e9e4c321 607 `yyvs': related to semantic values,
bb10be54
AD
608 `yyls': related to locations.
609
610 Refer to the stacks thru separate pointers, to allow yyoverflow
611 to reallocate them elsewhere. */
612
e8cb70b9 613 /* The state stack. */
b07b484a 614 short yyssa[YYINITDEPTH];
bb10be54
AD
615 short *yyss = yyssa;
616 register short *yyssp;
617
b07b484a
AD
618 /* The semantic value stack. */
619 YYSTYPE yyvsa[YYINITDEPTH];
b07b484a 620 YYSTYPE *yyvs = yyvsa;
bb10be54 621 register YYSTYPE *yyvsp;
10fa2066 622
5af1f549 623#if YYLSP_NEEDED
b07b484a
AD
624 /* The location stack. */
625 YYLTYPE yylsa[YYINITDEPTH];
10fa2066
RS
626 YYLTYPE *yyls = yylsa;
627 YYLTYPE *yylsp;
bb10be54 628#endif
10fa2066 629
5af1f549 630#if YYLSP_NEEDED
b07b484a 631# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
10fa2066 632#else
b07b484a 633# define YYPOPSTACK (yyvsp--, yyssp--)
10fa2066
RS
634#endif
635
7093d0f5 636 YYSIZE_T yystacksize = YYINITDEPTH;
10fa2066 637
6666f98f
AD
638 /* The variables used to return semantic value and location from the
639 action routines. */
bb10be54 640 YYSTYPE yyval;
7093d0f5 641#if YYLSP_NEEDED
6666f98f 642 YYLTYPE yyloc;
7093d0f5 643#endif
10fa2066 644
6666f98f 645 /* When reducing, the number of symbols on the RHS of the reduced
e8cb70b9 646 rule. */
10fa2066
RS
647 int yylen;
648
b7575ffe 649 YYDPRINTF ((YYSTDERR, "Starting parse\n"));
10fa2066
RS
650
651 yystate = 0;
652 yyerrstatus = 0;
17da6427
PB
653 yynerrs = 0;
654 yychar = YYEMPTY; /* Cause a token to be read. */
10fa2066
RS
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
cbd89906 661 yyssp = yyss;
10fa2066 662 yyvsp = yyvs;
5af1f549 663#if YYLSP_NEEDED
10fa2066
RS
664 yylsp = yyls;
665#endif
cbd89906 666 goto yysetstate;
10fa2066 667
71da9eea
AD
668/*------------------------------------------------------------.
669| yynewstate -- Push a new state, which is found in yystate. |
670`------------------------------------------------------------*/
342b8b6e 671 yynewstate:
71da9eea
AD
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 */
cbd89906
PE
675 yyssp++;
676
342b8b6e 677 yysetstate:
cbd89906 678 *yyssp = yystate;
10fa2066
RS
679
680 if (yyssp >= yyss + yystacksize - 1)
681 {
10fa2066 682 /* Get the current used size of the three stacks, in elements. */
7093d0f5 683 YYSIZE_T yysize = yyssp - yyss + 1;
10fa2066
RS
684
685#ifdef yyoverflow
3d76b07d
AD
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. */
5af1f549 695# if YYLSP_NEEDED
3d76b07d
AD
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",
7093d0f5
AD
700 &yyss1, yysize * sizeof (*yyssp),
701 &yyvs1, yysize * sizeof (*yyvsp),
702 &yyls1, yysize * sizeof (*yylsp),
3d76b07d
AD
703 &yystacksize);
704 yyls = yyls1;
b07b484a 705# else
3d76b07d 706 yyoverflow ("parser stack overflow",
7093d0f5
AD
707 &yyss1, yysize * sizeof (*yyssp),
708 &yyvs1, yysize * sizeof (*yyvsp),
3d76b07d 709 &yystacksize);
b07b484a 710# endif
3d76b07d
AD
711 yyss = yyss1;
712 yyvs = yyvs1;
713 }
10fa2066
RS
714#else /* no yyoverflow */
715 /* Extend the stack our own way. */
716 if (yystacksize >= YYMAXDEPTH)
600f9b0c 717 goto yyoverflowlab;
10fa2066
RS
718 yystacksize *= 2;
719 if (yystacksize > YYMAXDEPTH)
720 yystacksize = YYMAXDEPTH;
e9e4c321 721
600f9b0c
PE
722 {
723 short *yyss1 = yyss;
2729e106
PE
724 union yyalloc *yyptr =
725 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
600f9b0c
PE
726 if (! yyptr)
727 goto yyoverflowlab;
728 YYSTACK_RELOCATE (short, yyss);
729 YYSTACK_RELOCATE (YYSTYPE, yyvs);
5af1f549 730# if YYLSP_NEEDED
600f9b0c 731 YYSTACK_RELOCATE (YYLTYPE, yyls);
b07b484a 732# endif
600f9b0c
PE
733# undef YYSTACK_RELOCATE
734 if (yyss1 != yyssa)
735 YYSTACK_FREE (yyss1);
736 }
10fa2066
RS
737#endif /* no yyoverflow */
738
7093d0f5
AD
739 yyssp = yyss + yysize - 1;
740 yyvsp = yyvs + yysize - 1;
5af1f549 741#if YYLSP_NEEDED
7093d0f5 742 yylsp = yyls + yysize - 1;
10fa2066
RS
743#endif
744
b7575ffe 745 YYDPRINTF ((YYSTDERR, "Stack size increased to %lu\n",
600f9b0c 746 (unsigned long int) yystacksize));
10fa2066
RS
747
748 if (yyssp >= yyss + yystacksize - 1)
749 YYABORT;
750 }
751
b7575ffe 752 YYDPRINTF ((YYSTDERR, "Entering state %d\n", yystate));
10fa2066
RS
753
754 goto yybackup;
71da9eea 755
71da9eea
AD
756/*-----------.
757| yybackup. |
758`-----------*/
759yybackup:
10fa2066
RS
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
17da6427 776 if (yychar == YYEMPTY)
10fa2066 777 {
b7575ffe 778 YYDPRINTF ((YYSTDERR, "Reading a token: "));
17da6427 779 yychar = YYLEX;
10fa2066
RS
780 }
781
e8cb70b9 782 /* Convert token to internal form (in yychar1) for indexing tables with. */
10fa2066 783
17da6427 784 if (yychar <= 0) /* This means end of input. */
10fa2066
RS
785 {
786 yychar1 = 0;
17da6427 787 yychar = YYEOF; /* Don't call YYLEX any more. */
10fa2066 788
b7575ffe 789 YYDPRINTF ((YYSTDERR, "Now at end of input.\n"));
10fa2066
RS
790 }
791 else
792 {
17da6427 793 yychar1 = YYTRANSLATE (yychar);
10fa2066 794
0d533154
AD
795#if YYDEBUG
796 /* We have to keep this `#if YYDEBUG', since we use variables
797 which are defined only if `YYDEBUG' is set. */
17da6427 798 if (yydebug)
10fa2066 799 {
b7575ffe
PE
800 YYFPRINTF (YYSTDERR, "Next token is %d (%s",
801 yychar, yytname[yychar1]);
0d533154
AD
802 /* Give the individual parser a way to print the precise
803 meaning of a token, for further debugging info. */
b07b484a 804# ifdef YYPRINT
b7575ffe 805 YYPRINT (YYSTDERR, yychar, yylval);
b07b484a 806# endif
b7575ffe 807 YYFPRINTF (YYSTDERR, ")\n");
10fa2066 808 }
0d533154 809#endif
10fa2066
RS
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. */
b7575ffe
PE
839 YYDPRINTF ((YYSTDERR, "Shifting token %d (%s), ",
840 yychar, yytname[yychar1]));
10fa2066
RS
841
842 /* Discard the token being shifted unless it is eof. */
17da6427
PB
843 if (yychar != YYEOF)
844 yychar = YYEMPTY;
10fa2066 845
17da6427 846 *++yyvsp = yylval;
5af1f549 847#if YYLSP_NEEDED
10fa2066
RS
848 *++yylsp = yylloc;
849#endif
850
71da9eea
AD
851 /* Count tokens shifted since error; after three, turn off error
852 status. */
853 if (yyerrstatus)
854 yyerrstatus--;
10fa2066
RS
855
856 yystate = yyn;
857 goto yynewstate;
858
10fa2066 859
71da9eea
AD
860/*-----------------------------------------------------------.
861| yydefault -- do the default action for the current state. |
862`-----------------------------------------------------------*/
863yydefault:
10fa2066
RS
864 yyn = yydefact[yystate];
865 if (yyn == 0)
866 goto yyerrlab;
71da9eea 867 goto yyreduce;
10fa2066 868
71da9eea
AD
869
870/*-----------------------------.
871| yyreduce -- Do a reduction. |
872`-----------------------------*/
10fa2066 873yyreduce:
71da9eea 874 /* yyn is the number of a rule to reduce with. */
10fa2066 875 yylen = yyr2[yyn];
da9abf43
AD
876
877 /* If YYLEN is nonzero, implement the default value of the action:
573c1d9f 878 `$$ = $1'.
da9abf43
AD
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];
3abcd459 886
5af1f549 887#if YYLSP_NEEDED
3abcd459
AD
888 /* Similarly for the default location. Let the user run additional
889 commands if for instance locations are ranges. */
890 yyloc = yylsp[1-yylen];
ca96bc2d 891 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
6666f98f 892#endif
10fa2066 893
0de741ca
AD
894#if YYDEBUG
895 /* We have to keep this `#if YYDEBUG', since we use variables which
896 are defined only if `YYDEBUG' is set. */
17da6427 897 if (yydebug)
10fa2066 898 {
7093d0f5 899 int yyi;
10fa2066 900
b7575ffe
PE
901 YYFPRINTF (YYSTDERR, "Reducing via rule %d (line %d), ",
902 yyn, yyrline[yyn]);
10fa2066
RS
903
904 /* Print the symbols being reduced, and their result. */
7093d0f5 905 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
b7575ffe
PE
906 YYFPRINTF (YYSTDERR, "%s ", yytname[yyrhs[yyi]]);
907 YYFPRINTF (YYSTDERR, " -> %s\n", yytname[yyr1[yyn]]);
10fa2066
RS
908 }
909#endif
a8289c62
RA
910 switch (yyn)
911 {
3f96f4dc 912%%actions
a8289c62 913 }
897668ee
MA
914
915/* Line %%skeleton-line of %%skeleton. */
f0440388 916#line %%line "%%parser-file-name"
10fa2066
RS
917\f
918 yyvsp -= yylen;
919 yyssp -= yylen;
5af1f549 920#if YYLSP_NEEDED
10fa2066
RS
921 yylsp -= yylen;
922#endif
923
5a35a6cb 924#if YYDEBUG
17da6427 925 if (yydebug)
10fa2066 926 {
7093d0f5 927 short *yyssp1 = yyss - 1;
b7575ffe 928 YYFPRINTF (YYSTDERR, "state stack now");
7093d0f5 929 while (yyssp1 != yyssp)
b7575ffe
PE
930 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
931 YYFPRINTF (YYSTDERR, "\n");
10fa2066 932 }
5a35a6cb 933#endif
10fa2066
RS
934
935 *++yyvsp = yyval;
5af1f549 936#if YYLSP_NEEDED
6666f98f 937 *++yylsp = yyloc;
10fa2066
RS
938#endif
939
41aca2e0
AD
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. */
10fa2066
RS
943
944 yyn = yyr1[yyn];
945
7742ddeb 946 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
10fa2066
RS
947 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
948 yystate = yytable[yystate];
949 else
7742ddeb 950 yystate = yydefgoto[yyn - YYNTOKENS];
10fa2066
RS
951
952 goto yynewstate;
953
10fa2066 954
71da9eea
AD
955/*------------------------------------.
956| yyerrlab -- here on detecting error |
957`------------------------------------*/
958yyerrlab:
959 /* If not already recovering from an error, report this error. */
960 if (!yyerrstatus)
10fa2066 961 {
17da6427 962 ++yynerrs;
10fa2066 963
8850be4b 964#if YYERROR_VERBOSE
10fa2066
RS
965 yyn = yypact[yystate];
966
967 if (yyn > YYFLAG && yyn < YYLAST)
968 {
7093d0f5
AD
969 YYSIZE_T yysize = 0;
970 char *yymsg;
971 int yyx, yycount;
10fa2066 972
7093d0f5
AD
973 yycount = 0;
974 /* Start YYX at -YYN if negative to avoid negative indexes in
f0473484 975 YYCHECK. */
7093d0f5
AD
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)
10fa2066 984 {
7093d0f5
AD
985 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
986 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
10fa2066 987
7093d0f5 988 if (yycount < 5)
10fa2066 989 {
7093d0f5
AD
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)
10fa2066 995 {
7093d0f5
AD
996 const char *yyq = ! yycount ? ", expecting " : " or ";
997 yyp = yystpcpy (yyp, yyq);
998 yyp = yystpcpy (yyp, yytname[yyx]);
999 yycount++;
10fa2066
RS
1000 }
1001 }
7093d0f5
AD
1002 yyerror (yymsg);
1003 YYSTACK_FREE (yymsg);
1004 }
1005 else
1006 yyerror ("parse error; also virtual memory exhausted");
a8289c62 1007 }
10fa2066 1008 else
b7575ffe 1009#endif /* YYERROR_VERBOSE */
17da6427 1010 yyerror ("parse error");
10fa2066 1011 }
10fa2066 1012 goto yyerrlab1;
10fa2066 1013
71da9eea 1014
e8cb70b9
PB
1015/*----------------------------------------------------.
1016| yyerrlab1 -- error raised explicitly by an action. |
1017`----------------------------------------------------*/
71da9eea 1018yyerrlab1:
10fa2066
RS
1019 if (yyerrstatus == 3)
1020 {
71da9eea
AD
1021 /* If just tried and failed to reuse lookahead token after an
1022 error, discard it. */
10fa2066 1023
e8cb70b9 1024 /* Return failure if at end of input. */
17da6427 1025 if (yychar == YYEOF)
10fa2066 1026 YYABORT;
b7575ffe 1027 YYDPRINTF ((YYSTDERR, "Discarding token %d (%s).\n",
17da6427
PB
1028 yychar, yytname[yychar1]));
1029 yychar = YYEMPTY;
10fa2066
RS
1030 }
1031
71da9eea
AD
1032 /* Else will try to reuse lookahead token after shifting the error
1033 token. */
10fa2066 1034
e8cb70b9 1035 yyerrstatus = 3; /* Each real token shifted decrements this. */
10fa2066
RS
1036
1037 goto yyerrhandle;
1038
10fa2066 1039
71da9eea
AD
1040/*-------------------------------------------------------------------.
1041| yyerrdefault -- current state does not do anything special for the |
1042| error token. |
1043`-------------------------------------------------------------------*/
1044yyerrdefault:
10fa2066
RS
1045#if 0
1046 /* This is wrong; only states that explicitly want error tokens
1047 should shift them. */
71da9eea
AD
1048
1049 /* If its default is to accept any token, ok. Otherwise pop it. */
1050 yyn = yydefact[yystate];
1051 if (yyn)
1052 goto yydefault;
10fa2066
RS
1053#endif
1054
10fa2066 1055
71da9eea
AD
1056/*---------------------------------------------------------------.
1057| yyerrpop -- pop the current state because it cannot handle the |
e8cb70b9 1058| error token. |
71da9eea
AD
1059`---------------------------------------------------------------*/
1060yyerrpop:
1061 if (yyssp == yyss)
1062 YYABORT;
10fa2066
RS
1063 yyvsp--;
1064 yystate = *--yyssp;
5af1f549 1065#if YYLSP_NEEDED
10fa2066
RS
1066 yylsp--;
1067#endif
1068
5a35a6cb 1069#if YYDEBUG
17da6427 1070 if (yydebug)
10fa2066 1071 {
7093d0f5 1072 short *yyssp1 = yyss - 1;
b7575ffe 1073 YYFPRINTF (YYSTDERR, "Error: state stack now");
7093d0f5 1074 while (yyssp1 != yyssp)
b7575ffe
PE
1075 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
1076 YYFPRINTF (YYSTDERR, "\n");
10fa2066 1077 }
5a35a6cb 1078#endif
10fa2066 1079
71da9eea
AD
1080/*--------------.
1081| yyerrhandle. |
1082`--------------*/
1083yyerrhandle:
10fa2066
RS
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
b7575ffe 1106 YYDPRINTF ((YYSTDERR, "Shifting error token, "));
10fa2066 1107
17da6427 1108 *++yyvsp = yylval;
5af1f549 1109#if YYLSP_NEEDED
10fa2066
RS
1110 *++yylsp = yylloc;
1111#endif
1112
1113 yystate = yyn;
1114 goto yynewstate;
70ddf897 1115
71da9eea
AD
1116
1117/*-------------------------------------.
1118| yyacceptlab -- YYACCEPT comes here. |
1119`-------------------------------------*/
1120yyacceptlab:
600f9b0c
PE
1121 yyresult = 0;
1122 goto yyreturn;
71da9eea
AD
1123
1124/*-----------------------------------.
1125| yyabortlab -- YYABORT comes here. |
1126`-----------------------------------*/
1127yyabortlab:
600f9b0c
PE
1128 yyresult = 1;
1129 goto yyreturn;
1130
1131/*---------------------------------------------.
1132| yyoverflowab -- parser overflow comes here. |
1133`---------------------------------------------*/
1134yyoverflowlab:
1135 yyerror ("parser stack overflow");
1136 yyresult = 2;
1137 /* Fall through. */
1138
1139yyreturn:
1140#ifndef yyoverflow
1141 if (yyss != yyssa)
1142 YYSTACK_FREE (yyss);
70ddf897 1143#endif
600f9b0c 1144 return yyresult;
10fa2066 1145}
ff48177d 1146
63c2d5de 1147%%epilogue