]> git.saurik.com Git - bison.git/blame - src/bison.simple
* src/bison.simple: Don't hard code the skeleton line and filename.
[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
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. */
208static const char yytranslate[] =
209{
210 %%translate
211};
212
213#if YYDEBUG
214static const short yyprhs[] =
215{
216 %%prhs
217};
218
219static const short yyrhs[] =
220{
221 %%rhs
222};
223
224/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
225static const short yyrline[] =
226{
227 %%rline
228};
229#endif
230
c527b2d4 231#if (YYDEBUG) || YYERROR_VERBOSE
e8cb70b9
PB
232/* YYTNME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
233static const char *const yytname[] =
a8289c62
RA
234{
235 %%tname
236};
237#endif
238
239/* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */
240static const short yytoknum[] =
241{
242 %%toknum
243};
244
245/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
246static const short yyr1[] =
247{
248 %%r1
249};
250
251/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
252static 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. */
260static const short yydefact[] =
261{
262 %%defact
263};
264
265static const short yydefgoto[] =
266{
267 %%defgoto
268};
269
270static const short yypact[] =
271{
272 %%pact
273};
274
275static const short yypgoto[] =
276{
277 %%pgoto
278};
279
280static const short yytable[] =
281{
282 %%table
283};
284
285static const short yycheck[] =
286{
287 %%check
288};
289
7093d0f5
AD
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
b7575ffe
PE
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
7093d0f5
AD
307#endif
308#if ! defined (YYSIZE_T)
309# define YYSIZE_T unsigned int
310#endif
311
10fa2066 312#define yyerrok (yyerrstatus = 0)
17da6427 313#define yyclearin (yychar = YYEMPTY)
10fa2066
RS
314#define YYEMPTY -2
315#define YYEOF 0
a8289c62 316
70ddf897 317#define YYACCEPT goto yyacceptlab
a8289c62 318#define YYABORT goto yyabortlab
10fa2066 319#define YYERROR goto yyerrlab1
a8289c62 320
71da9eea
AD
321/* Like YYERROR except do call yyerror. This remains here temporarily
322 to ease the transition to the new meaning of YYERROR, for GCC.
10fa2066 323 Once GCC version 2 has supplanted version 1, this can go. */
a8289c62 324
10fa2066 325#define YYFAIL goto yyerrlab
a8289c62 326
10fa2066 327#define YYRECOVERING() (!!yyerrstatus)
a8289c62 328
69b4e0c5 329#define YYBACKUP(Token, Value) \
10fa2066 330do \
17da6427 331 if (yychar == YYEMPTY && yylen == 1) \
71da9eea 332 { \
17da6427
PB
333 yychar = (Token); \
334 yylval = (Value); \
335 yychar1 = YYTRANSLATE (yychar); \
10fa2066
RS
336 YYPOPSTACK; \
337 goto yybackup; \
338 } \
339 else \
71da9eea 340 { \
17da6427 341 yyerror ("syntax error: cannot back up"); \
71da9eea
AD
342 YYERROR; \
343 } \
10fa2066
RS
344while (0)
345
346#define YYTERROR 1
347#define YYERRCODE 256
348
3abcd459
AD
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
ca96bc2d
MA
357# define YYLLOC_DEFAULT(Current, Rhs, N) \
358 Current.last_line = Rhs[N].last_line; \
359 Current.last_column = Rhs[N].last_column;
3abcd459
AD
360#endif
361
3abcd459 362/* YYLEX -- calling `yylex' with the right arguments. */
553e2b22
AD
363
364#if YYPURE
5af1f549 365# if YYLSP_NEEDED
b07b484a 366# ifdef YYLEX_PARAM
17da6427 367# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
b07b484a 368# else
17da6427 369# define YYLEX yylex (&yylval, &yylloc)
b07b484a 370# endif
71da9eea 371# else /* !YYLSP_NEEDED */
b07b484a 372# ifdef YYLEX_PARAM
17da6427 373# define YYLEX yylex (&yylval, YYLEX_PARAM)
b07b484a 374# else
17da6427 375# define YYLEX yylex (&yylval)
b07b484a 376# endif
71da9eea 377# endif /* !YYLSP_NEEDED */
553e2b22 378#else /* !YYPURE */
17da6427 379# define YYLEX yylex ()
553e2b22
AD
380#endif /* !YYPURE */
381
5a35a6cb 382/* Enable debugging if requested. */
0d533154 383#if YYDEBUG
b7575ffe
PE
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
5a35a6cb
AD
397# define YYDPRINTF(Args) \
398do { \
17da6427 399 if (yydebug) \
b7575ffe 400 YYFPRINTF Args; \
5a35a6cb
AD
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 */
17da6427 406int yydebug;
5a35a6cb
AD
407#else /* !YYDEBUG */
408# define YYDPRINTF(Args)
409#endif /* !YYDEBUG */
410
411/* YYINITDEPTH -- initial size of the parser's stacks. */
10fa2066 412#ifndef YYINITDEPTH
a8289c62 413# define YYINITDEPTH %%initdepth
10fa2066
RS
414#endif
415
5a35a6cb 416/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
600f9b0c
PE
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
10fa2066 423#if YYMAXDEPTH == 0
b07b484a 424# undef YYMAXDEPTH
10fa2066
RS
425#endif
426
427#ifndef YYMAXDEPTH
a8289c62 428# define YYMAXDEPTH %%maxdepth
10fa2066 429#endif
a8289c62 430
10fa2066 431\f
a8289c62 432
7093d0f5
AD
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++ */
10fa2066
RS
437
438/* This is the most reliable way to avoid incompatibilities
439 in available built-in functions on various systems. */
440static void
7093d0f5
AD
441# if defined (__STDC__) || defined (__cplusplus)
442yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
443# else
444yymemcpy (yyto, yyfrom, yycount)
445 char *yyto;
446 const char *yyfrom;
447 YYSIZE_T yycount;
448# endif
10fa2066 449{
7093d0f5
AD
450 register const char *yyf = yyfrom;
451 register char *yyt = yyto;
452 register YYSIZE_T yyi = yycount;
10fa2066 453
7093d0f5
AD
454 while (yyi-- != 0)
455 *yyt++ = *yyf++;
10fa2066 456}
7093d0f5 457# endif
bbb5bcc6 458#endif
a8289c62 459
7093d0f5
AD
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. */
467static YYSIZE_T
468# if defined (__STDC__) || defined (__cplusplus)
469yystrlen (const char *yystr)
470# else
471yystrlen (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. */
491static char *
f11966ff
PE
492# if defined (__STDC__) || defined (__cplusplus)
493yystpcpy (char *yydest, const char *yysrc)
494# else
7093d0f5
AD
495yystpcpy (yydest, yysrc)
496 char *yydest;
497 const char *yysrc;
7093d0f5
AD
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
10fa2066 513\f
a8289c62 514
b658bf92
RS
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
b07b484a
AD
522# ifdef __cplusplus
523# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
524# define YYPARSE_PARAM_DECL
71da9eea 525# else /* !__cplusplus */
b07b484a
AD
526# define YYPARSE_PARAM_ARG YYPARSE_PARAM
527# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
71da9eea
AD
528# endif /* !__cplusplus */
529#else /* !YYPARSE_PARAM */
b07b484a
AD
530# define YYPARSE_PARAM_ARG
531# define YYPARSE_PARAM_DECL
71da9eea 532#endif /* !YYPARSE_PARAM */
b658bf92 533
1b181651
PE
534/* Prevent warning if -Wstrict-prototypes. */
535#ifdef __GNUC__
b07b484a 536# ifdef YYPARSE_PARAM
17da6427 537int yyparse (void *);
b07b484a 538# else
17da6427 539int yyparse (void);
b07b484a 540# endif
1b181651
PE
541#endif
542
a35f64ea
AD
543/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
544 variables are global, or local to YYPARSE. */
545
7093d0f5 546#define YY_DECL_NON_LSP_VARIABLES \
a35f64ea 547/* The lookahead symbol. */ \
17da6427 548int yychar; \
a35f64ea 549 \
e8cb70b9 550/* The semantic value of the lookahead symbol. */ \
17da6427 551YYSTYPE yylval; \
a35f64ea
AD
552 \
553/* Number of parse errors so far. */ \
17da6427 554int yynerrs;
a35f64ea
AD
555
556#if YYLSP_NEEDED
557# define YY_DECL_VARIABLES \
7093d0f5 558YY_DECL_NON_LSP_VARIABLES \
a35f64ea
AD
559 \
560/* Location data for the lookahead symbol. */ \
561YYLTYPE yylloc;
562#else
563# define YY_DECL_VARIABLES \
7093d0f5 564YY_DECL_NON_LSP_VARIABLES
a35f64ea
AD
565#endif
566
e8cb70b9 567/* If nonreentrant, generate the variables here. */
a35f64ea
AD
568
569#if !YYPURE
570YY_DECL_VARIABLES
571#endif /* !YYPURE */
572
10fa2066 573int
17da6427 574yyparse (YYPARSE_PARAM_ARG)
b658bf92 575 YYPARSE_PARAM_DECL
10fa2066 576{
e8cb70b9 577 /* If reentrant, generate the variables here. */
a35f64ea
AD
578#if YYPURE
579 YY_DECL_VARIABLES
580#endif /* !YYPURE */
581
10fa2066
RS
582 register int yystate;
583 register int yyn;
600f9b0c 584 int yyresult;
b07b484a
AD
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;
10fa2066 589
bb10be54
AD
590 /* Three stacks and their tools:
591 `yyss': related to states,
e9e4c321 592 `yyvs': related to semantic values,
bb10be54
AD
593 `yyls': related to locations.
594
595 Refer to the stacks thru separate pointers, to allow yyoverflow
596 to reallocate them elsewhere. */
597
e8cb70b9 598 /* The state stack. */
b07b484a 599 short yyssa[YYINITDEPTH];
bb10be54
AD
600 short *yyss = yyssa;
601 register short *yyssp;
602
b07b484a
AD
603 /* The semantic value stack. */
604 YYSTYPE yyvsa[YYINITDEPTH];
b07b484a 605 YYSTYPE *yyvs = yyvsa;
bb10be54 606 register YYSTYPE *yyvsp;
10fa2066 607
5af1f549 608#if YYLSP_NEEDED
b07b484a
AD
609 /* The location stack. */
610 YYLTYPE yylsa[YYINITDEPTH];
10fa2066
RS
611 YYLTYPE *yyls = yylsa;
612 YYLTYPE *yylsp;
bb10be54 613#endif
10fa2066 614
5af1f549 615#if YYLSP_NEEDED
b07b484a 616# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
10fa2066 617#else
b07b484a 618# define YYPOPSTACK (yyvsp--, yyssp--)
10fa2066
RS
619#endif
620
7093d0f5 621 YYSIZE_T yystacksize = YYINITDEPTH;
10fa2066 622
6666f98f
AD
623 /* The variables used to return semantic value and location from the
624 action routines. */
bb10be54 625 YYSTYPE yyval;
7093d0f5 626#if YYLSP_NEEDED
6666f98f 627 YYLTYPE yyloc;
7093d0f5 628#endif
10fa2066 629
6666f98f 630 /* When reducing, the number of symbols on the RHS of the reduced
e8cb70b9 631 rule. */
10fa2066
RS
632 int yylen;
633
b7575ffe 634 YYDPRINTF ((YYSTDERR, "Starting parse\n"));
10fa2066
RS
635
636 yystate = 0;
637 yyerrstatus = 0;
17da6427
PB
638 yynerrs = 0;
639 yychar = YYEMPTY; /* Cause a token to be read. */
10fa2066
RS
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
cbd89906 646 yyssp = yyss;
10fa2066 647 yyvsp = yyvs;
5af1f549 648#if YYLSP_NEEDED
10fa2066
RS
649 yylsp = yyls;
650#endif
cbd89906 651 goto yysetstate;
10fa2066 652
71da9eea
AD
653/*------------------------------------------------------------.
654| yynewstate -- Push a new state, which is found in yystate. |
655`------------------------------------------------------------*/
342b8b6e 656 yynewstate:
71da9eea
AD
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 */
cbd89906
PE
660 yyssp++;
661
342b8b6e 662 yysetstate:
cbd89906 663 *yyssp = yystate;
10fa2066
RS
664
665 if (yyssp >= yyss + yystacksize - 1)
666 {
10fa2066 667 /* Get the current used size of the three stacks, in elements. */
7093d0f5 668 YYSIZE_T yysize = yyssp - yyss + 1;
10fa2066
RS
669
670#ifdef yyoverflow
3d76b07d
AD
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. */
5af1f549 680# if YYLSP_NEEDED
3d76b07d
AD
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",
7093d0f5
AD
685 &yyss1, yysize * sizeof (*yyssp),
686 &yyvs1, yysize * sizeof (*yyvsp),
687 &yyls1, yysize * sizeof (*yylsp),
3d76b07d
AD
688 &yystacksize);
689 yyls = yyls1;
b07b484a 690# else
3d76b07d 691 yyoverflow ("parser stack overflow",
7093d0f5
AD
692 &yyss1, yysize * sizeof (*yyssp),
693 &yyvs1, yysize * sizeof (*yyvsp),
3d76b07d 694 &yystacksize);
b07b484a 695# endif
3d76b07d
AD
696 yyss = yyss1;
697 yyvs = yyvs1;
698 }
10fa2066
RS
699#else /* no yyoverflow */
700 /* Extend the stack our own way. */
701 if (yystacksize >= YYMAXDEPTH)
600f9b0c 702 goto yyoverflowlab;
10fa2066
RS
703 yystacksize *= 2;
704 if (yystacksize > YYMAXDEPTH)
705 yystacksize = YYMAXDEPTH;
e9e4c321 706
600f9b0c
PE
707 {
708 short *yyss1 = yyss;
2729e106
PE
709 union yyalloc *yyptr =
710 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
600f9b0c
PE
711 if (! yyptr)
712 goto yyoverflowlab;
713 YYSTACK_RELOCATE (short, yyss);
714 YYSTACK_RELOCATE (YYSTYPE, yyvs);
5af1f549 715# if YYLSP_NEEDED
600f9b0c 716 YYSTACK_RELOCATE (YYLTYPE, yyls);
b07b484a 717# endif
600f9b0c
PE
718# undef YYSTACK_RELOCATE
719 if (yyss1 != yyssa)
720 YYSTACK_FREE (yyss1);
721 }
10fa2066
RS
722#endif /* no yyoverflow */
723
7093d0f5
AD
724 yyssp = yyss + yysize - 1;
725 yyvsp = yyvs + yysize - 1;
5af1f549 726#if YYLSP_NEEDED
7093d0f5 727 yylsp = yyls + yysize - 1;
10fa2066
RS
728#endif
729
b7575ffe 730 YYDPRINTF ((YYSTDERR, "Stack size increased to %lu\n",
600f9b0c 731 (unsigned long int) yystacksize));
10fa2066
RS
732
733 if (yyssp >= yyss + yystacksize - 1)
734 YYABORT;
735 }
736
b7575ffe 737 YYDPRINTF ((YYSTDERR, "Entering state %d\n", yystate));
10fa2066
RS
738
739 goto yybackup;
71da9eea 740
71da9eea
AD
741/*-----------.
742| yybackup. |
743`-----------*/
744yybackup:
10fa2066
RS
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
17da6427 761 if (yychar == YYEMPTY)
10fa2066 762 {
b7575ffe 763 YYDPRINTF ((YYSTDERR, "Reading a token: "));
17da6427 764 yychar = YYLEX;
10fa2066
RS
765 }
766
e8cb70b9 767 /* Convert token to internal form (in yychar1) for indexing tables with. */
10fa2066 768
17da6427 769 if (yychar <= 0) /* This means end of input. */
10fa2066
RS
770 {
771 yychar1 = 0;
17da6427 772 yychar = YYEOF; /* Don't call YYLEX any more. */
10fa2066 773
b7575ffe 774 YYDPRINTF ((YYSTDERR, "Now at end of input.\n"));
10fa2066
RS
775 }
776 else
777 {
17da6427 778 yychar1 = YYTRANSLATE (yychar);
10fa2066 779
0d533154
AD
780#if YYDEBUG
781 /* We have to keep this `#if YYDEBUG', since we use variables
782 which are defined only if `YYDEBUG' is set. */
17da6427 783 if (yydebug)
10fa2066 784 {
b7575ffe
PE
785 YYFPRINTF (YYSTDERR, "Next token is %d (%s",
786 yychar, yytname[yychar1]);
0d533154
AD
787 /* Give the individual parser a way to print the precise
788 meaning of a token, for further debugging info. */
b07b484a 789# ifdef YYPRINT
b7575ffe 790 YYPRINT (YYSTDERR, yychar, yylval);
b07b484a 791# endif
b7575ffe 792 YYFPRINTF (YYSTDERR, ")\n");
10fa2066 793 }
0d533154 794#endif
10fa2066
RS
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. */
b7575ffe
PE
824 YYDPRINTF ((YYSTDERR, "Shifting token %d (%s), ",
825 yychar, yytname[yychar1]));
10fa2066
RS
826
827 /* Discard the token being shifted unless it is eof. */
17da6427
PB
828 if (yychar != YYEOF)
829 yychar = YYEMPTY;
10fa2066 830
17da6427 831 *++yyvsp = yylval;
5af1f549 832#if YYLSP_NEEDED
10fa2066
RS
833 *++yylsp = yylloc;
834#endif
835
71da9eea
AD
836 /* Count tokens shifted since error; after three, turn off error
837 status. */
838 if (yyerrstatus)
839 yyerrstatus--;
10fa2066
RS
840
841 yystate = yyn;
842 goto yynewstate;
843
10fa2066 844
71da9eea
AD
845/*-----------------------------------------------------------.
846| yydefault -- do the default action for the current state. |
847`-----------------------------------------------------------*/
848yydefault:
10fa2066
RS
849 yyn = yydefact[yystate];
850 if (yyn == 0)
851 goto yyerrlab;
71da9eea 852 goto yyreduce;
10fa2066 853
71da9eea
AD
854
855/*-----------------------------.
856| yyreduce -- Do a reduction. |
857`-----------------------------*/
10fa2066 858yyreduce:
71da9eea 859 /* yyn is the number of a rule to reduce with. */
10fa2066 860 yylen = yyr2[yyn];
da9abf43
AD
861
862 /* If YYLEN is nonzero, implement the default value of the action:
573c1d9f 863 `$$ = $1'.
da9abf43
AD
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];
3abcd459 871
5af1f549 872#if YYLSP_NEEDED
3abcd459
AD
873 /* Similarly for the default location. Let the user run additional
874 commands if for instance locations are ranges. */
875 yyloc = yylsp[1-yylen];
ca96bc2d 876 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
6666f98f 877#endif
10fa2066 878
0de741ca
AD
879#if YYDEBUG
880 /* We have to keep this `#if YYDEBUG', since we use variables which
881 are defined only if `YYDEBUG' is set. */
17da6427 882 if (yydebug)
10fa2066 883 {
7093d0f5 884 int yyi;
10fa2066 885
b7575ffe
PE
886 YYFPRINTF (YYSTDERR, "Reducing via rule %d (line %d), ",
887 yyn, yyrline[yyn]);
10fa2066
RS
888
889 /* Print the symbols being reduced, and their result. */
7093d0f5 890 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
b7575ffe
PE
891 YYFPRINTF (YYSTDERR, "%s ", yytname[yyrhs[yyi]]);
892 YYFPRINTF (YYSTDERR, " -> %s\n", yytname[yyr1[yyn]]);
10fa2066
RS
893 }
894#endif
a8289c62
RA
895 switch (yyn)
896 {
3f96f4dc 897%%actions
a8289c62 898 }
897668ee
MA
899
900/* Line %%skeleton-line of %%skeleton. */
f0440388 901#line %%line "%%parser-file-name"
10fa2066
RS
902\f
903 yyvsp -= yylen;
904 yyssp -= yylen;
5af1f549 905#if YYLSP_NEEDED
10fa2066
RS
906 yylsp -= yylen;
907#endif
908
5a35a6cb 909#if YYDEBUG
17da6427 910 if (yydebug)
10fa2066 911 {
7093d0f5 912 short *yyssp1 = yyss - 1;
b7575ffe 913 YYFPRINTF (YYSTDERR, "state stack now");
7093d0f5 914 while (yyssp1 != yyssp)
b7575ffe
PE
915 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
916 YYFPRINTF (YYSTDERR, "\n");
10fa2066 917 }
5a35a6cb 918#endif
10fa2066
RS
919
920 *++yyvsp = yyval;
5af1f549 921#if YYLSP_NEEDED
6666f98f 922 *++yylsp = yyloc;
10fa2066
RS
923#endif
924
41aca2e0
AD
925 /* Now `shift' the result of the reduction. Determine what state
926 that goes to, based on the state we popped back to and the rule
927 number reduced by. */
10fa2066
RS
928
929 yyn = yyr1[yyn];
930
931 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
932 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
933 yystate = yytable[yystate];
934 else
935 yystate = yydefgoto[yyn - YYNTBASE];
936
937 goto yynewstate;
938
10fa2066 939
71da9eea
AD
940/*------------------------------------.
941| yyerrlab -- here on detecting error |
942`------------------------------------*/
943yyerrlab:
944 /* If not already recovering from an error, report this error. */
945 if (!yyerrstatus)
10fa2066 946 {
17da6427 947 ++yynerrs;
10fa2066 948
8850be4b 949#if YYERROR_VERBOSE
10fa2066
RS
950 yyn = yypact[yystate];
951
952 if (yyn > YYFLAG && yyn < YYLAST)
953 {
7093d0f5
AD
954 YYSIZE_T yysize = 0;
955 char *yymsg;
956 int yyx, yycount;
10fa2066 957
7093d0f5
AD
958 yycount = 0;
959 /* Start YYX at -YYN if negative to avoid negative indexes in
f0473484 960 YYCHECK. */
7093d0f5
AD
961 for (yyx = yyn < 0 ? -yyn : 0;
962 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
963 if (yycheck[yyx + yyn] == yyx)
964 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
965 yysize += yystrlen ("parse error, unexpected ") + 1;
966 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
967 yymsg = (char *) YYSTACK_ALLOC (yysize);
968 if (yymsg != 0)
10fa2066 969 {
7093d0f5
AD
970 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
971 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
10fa2066 972
7093d0f5 973 if (yycount < 5)
10fa2066 974 {
7093d0f5
AD
975 yycount = 0;
976 for (yyx = yyn < 0 ? -yyn : 0;
977 yyx < (int) (sizeof (yytname) / sizeof (char *));
978 yyx++)
979 if (yycheck[yyx + yyn] == yyx)
10fa2066 980 {
7093d0f5
AD
981 const char *yyq = ! yycount ? ", expecting " : " or ";
982 yyp = yystpcpy (yyp, yyq);
983 yyp = yystpcpy (yyp, yytname[yyx]);
984 yycount++;
10fa2066
RS
985 }
986 }
7093d0f5
AD
987 yyerror (yymsg);
988 YYSTACK_FREE (yymsg);
989 }
990 else
991 yyerror ("parse error; also virtual memory exhausted");
a8289c62 992 }
10fa2066 993 else
b7575ffe 994#endif /* YYERROR_VERBOSE */
17da6427 995 yyerror ("parse error");
10fa2066 996 }
10fa2066 997 goto yyerrlab1;
10fa2066 998
71da9eea 999
e8cb70b9
PB
1000/*----------------------------------------------------.
1001| yyerrlab1 -- error raised explicitly by an action. |
1002`----------------------------------------------------*/
71da9eea 1003yyerrlab1:
10fa2066
RS
1004 if (yyerrstatus == 3)
1005 {
71da9eea
AD
1006 /* If just tried and failed to reuse lookahead token after an
1007 error, discard it. */
10fa2066 1008
e8cb70b9 1009 /* Return failure if at end of input. */
17da6427 1010 if (yychar == YYEOF)
10fa2066 1011 YYABORT;
b7575ffe 1012 YYDPRINTF ((YYSTDERR, "Discarding token %d (%s).\n",
17da6427
PB
1013 yychar, yytname[yychar1]));
1014 yychar = YYEMPTY;
10fa2066
RS
1015 }
1016
71da9eea
AD
1017 /* Else will try to reuse lookahead token after shifting the error
1018 token. */
10fa2066 1019
e8cb70b9 1020 yyerrstatus = 3; /* Each real token shifted decrements this. */
10fa2066
RS
1021
1022 goto yyerrhandle;
1023
10fa2066 1024
71da9eea
AD
1025/*-------------------------------------------------------------------.
1026| yyerrdefault -- current state does not do anything special for the |
1027| error token. |
1028`-------------------------------------------------------------------*/
1029yyerrdefault:
10fa2066
RS
1030#if 0
1031 /* This is wrong; only states that explicitly want error tokens
1032 should shift them. */
71da9eea
AD
1033
1034 /* If its default is to accept any token, ok. Otherwise pop it. */
1035 yyn = yydefact[yystate];
1036 if (yyn)
1037 goto yydefault;
10fa2066
RS
1038#endif
1039
10fa2066 1040
71da9eea
AD
1041/*---------------------------------------------------------------.
1042| yyerrpop -- pop the current state because it cannot handle the |
e8cb70b9 1043| error token. |
71da9eea
AD
1044`---------------------------------------------------------------*/
1045yyerrpop:
1046 if (yyssp == yyss)
1047 YYABORT;
10fa2066
RS
1048 yyvsp--;
1049 yystate = *--yyssp;
5af1f549 1050#if YYLSP_NEEDED
10fa2066
RS
1051 yylsp--;
1052#endif
1053
5a35a6cb 1054#if YYDEBUG
17da6427 1055 if (yydebug)
10fa2066 1056 {
7093d0f5 1057 short *yyssp1 = yyss - 1;
b7575ffe 1058 YYFPRINTF (YYSTDERR, "Error: state stack now");
7093d0f5 1059 while (yyssp1 != yyssp)
b7575ffe
PE
1060 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
1061 YYFPRINTF (YYSTDERR, "\n");
10fa2066 1062 }
5a35a6cb 1063#endif
10fa2066 1064
71da9eea
AD
1065/*--------------.
1066| yyerrhandle. |
1067`--------------*/
1068yyerrhandle:
10fa2066
RS
1069 yyn = yypact[yystate];
1070 if (yyn == YYFLAG)
1071 goto yyerrdefault;
1072
1073 yyn += YYTERROR;
1074 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1075 goto yyerrdefault;
1076
1077 yyn = yytable[yyn];
1078 if (yyn < 0)
1079 {
1080 if (yyn == YYFLAG)
1081 goto yyerrpop;
1082 yyn = -yyn;
1083 goto yyreduce;
1084 }
1085 else if (yyn == 0)
1086 goto yyerrpop;
1087
1088 if (yyn == YYFINAL)
1089 YYACCEPT;
1090
b7575ffe 1091 YYDPRINTF ((YYSTDERR, "Shifting error token, "));
10fa2066 1092
17da6427 1093 *++yyvsp = yylval;
5af1f549 1094#if YYLSP_NEEDED
10fa2066
RS
1095 *++yylsp = yylloc;
1096#endif
1097
1098 yystate = yyn;
1099 goto yynewstate;
70ddf897 1100
71da9eea
AD
1101
1102/*-------------------------------------.
1103| yyacceptlab -- YYACCEPT comes here. |
1104`-------------------------------------*/
1105yyacceptlab:
600f9b0c
PE
1106 yyresult = 0;
1107 goto yyreturn;
71da9eea
AD
1108
1109/*-----------------------------------.
1110| yyabortlab -- YYABORT comes here. |
1111`-----------------------------------*/
1112yyabortlab:
600f9b0c
PE
1113 yyresult = 1;
1114 goto yyreturn;
1115
1116/*---------------------------------------------.
1117| yyoverflowab -- parser overflow comes here. |
1118`---------------------------------------------*/
1119yyoverflowlab:
1120 yyerror ("parser stack overflow");
1121 yyresult = 2;
1122 /* Fall through. */
1123
1124yyreturn:
1125#ifndef yyoverflow
1126 if (yyss != yyssa)
1127 YYSTACK_FREE (yyss);
70ddf897 1128#endif
600f9b0c 1129 return yyresult;
10fa2066 1130}
ff48177d 1131
63c2d5de 1132%%epilogue