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