]> git.saurik.com Git - bison.git/blame - src/bison.simple
* src/reader.c (parse_braces): Don't fetch the next char, the
[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
7ea5e977 399# include <cstdio> /* INFRINGES ON USER NAME SPACE */
b7575ffe
PE
400# else
401# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
b7575ffe 402# endif
0d8a7363 403# define YYFPRINTF YYSTD (fprintf)
b7575ffe
PE
404# endif
405
5a35a6cb
AD
406# define YYDPRINTF(Args) \
407do { \
17da6427 408 if (yydebug) \
b7575ffe 409 YYFPRINTF Args; \
5a35a6cb
AD
410} while (0)
411/* Nonzero means print parse trace. [The following comment makes no
412 sense to me. Could someone clarify it? --akim] Since this is
413 uninitialized, it does not stop multiple parsers from coexisting.
414 */
17da6427 415int yydebug;
5a35a6cb
AD
416#else /* !YYDEBUG */
417# define YYDPRINTF(Args)
418#endif /* !YYDEBUG */
419
420/* YYINITDEPTH -- initial size of the parser's stacks. */
10fa2066 421#ifndef YYINITDEPTH
9b3add5b 422# define YYINITDEPTH %%{initdepth}
10fa2066
RS
423#endif
424
5a35a6cb 425/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
600f9b0c
PE
426 if the built-in stack extension method is used).
427
428 Do not make this value too large; the results are undefined if
429 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
430 evaluated with infinite-precision integer arithmetic. */
431
10fa2066 432#if YYMAXDEPTH == 0
b07b484a 433# undef YYMAXDEPTH
10fa2066
RS
434#endif
435
436#ifndef YYMAXDEPTH
9b3add5b 437# define YYMAXDEPTH %%{maxdepth}
10fa2066 438#endif
a8289c62 439
10fa2066 440\f
a8289c62 441
7093d0f5
AD
442#if ! defined (yyoverflow) && ! defined (yymemcpy)
443# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
444# define yymemcpy __builtin_memcpy
445# else /* not GNU C or C++ */
10fa2066
RS
446
447/* This is the most reliable way to avoid incompatibilities
448 in available built-in functions on various systems. */
449static void
7093d0f5
AD
450# if defined (__STDC__) || defined (__cplusplus)
451yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
452# else
453yymemcpy (yyto, yyfrom, yycount)
454 char *yyto;
455 const char *yyfrom;
456 YYSIZE_T yycount;
457# endif
10fa2066 458{
7093d0f5
AD
459 register const char *yyf = yyfrom;
460 register char *yyt = yyto;
461 register YYSIZE_T yyi = yycount;
10fa2066 462
7093d0f5
AD
463 while (yyi-- != 0)
464 *yyt++ = *yyf++;
10fa2066 465}
7093d0f5 466# endif
bbb5bcc6 467#endif
a8289c62 468
7093d0f5
AD
469#if YYERROR_VERBOSE
470
471# ifndef yystrlen
472# if defined (__GLIBC__) && defined (_STRING_H)
473# define yystrlen strlen
474# else
475/* Return the length of YYSTR. */
476static YYSIZE_T
477# if defined (__STDC__) || defined (__cplusplus)
478yystrlen (const char *yystr)
479# else
480yystrlen (yystr)
481 const char *yystr;
482# endif
483{
484 register const char *yys = yystr;
485
486 while (*yys++ != '\0')
487 continue;
488
489 return yys - yystr - 1;
490}
491# endif
492# endif
493
494# ifndef yystpcpy
495# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
496# define yystpcpy stpcpy
497# else
498/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
499 YYDEST. */
500static char *
f11966ff
PE
501# if defined (__STDC__) || defined (__cplusplus)
502yystpcpy (char *yydest, const char *yysrc)
503# else
7093d0f5
AD
504yystpcpy (yydest, yysrc)
505 char *yydest;
506 const char *yysrc;
7093d0f5
AD
507# endif
508{
509 register char *yyd = yydest;
510 register const char *yys = yysrc;
511
512 while ((*yyd++ = *yys++) != '\0')
513 continue;
514
515 return yyd - 1;
516}
517# endif
518# endif
519
520#endif /* !YYERROR_VERBOSE */
521
10fa2066 522\f
a8289c62 523
b658bf92
RS
524/* The user can define YYPARSE_PARAM as the name of an argument to be passed
525 into yyparse. The argument should have type void *.
526 It should actually point to an object.
527 Grammar actions can access the variable by casting it
528 to the proper pointer type. */
529
530#ifdef YYPARSE_PARAM
b07b484a
AD
531# ifdef __cplusplus
532# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
533# define YYPARSE_PARAM_DECL
71da9eea 534# else /* !__cplusplus */
b07b484a
AD
535# define YYPARSE_PARAM_ARG YYPARSE_PARAM
536# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
71da9eea
AD
537# endif /* !__cplusplus */
538#else /* !YYPARSE_PARAM */
b07b484a
AD
539# define YYPARSE_PARAM_ARG
540# define YYPARSE_PARAM_DECL
71da9eea 541#endif /* !YYPARSE_PARAM */
b658bf92 542
1b181651
PE
543/* Prevent warning if -Wstrict-prototypes. */
544#ifdef __GNUC__
b07b484a 545# ifdef YYPARSE_PARAM
17da6427 546int yyparse (void *);
b07b484a 547# else
17da6427 548int yyparse (void);
b07b484a 549# endif
1b181651
PE
550#endif
551
a35f64ea
AD
552/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
553 variables are global, or local to YYPARSE. */
554
7093d0f5 555#define YY_DECL_NON_LSP_VARIABLES \
a35f64ea 556/* The lookahead symbol. */ \
17da6427 557int yychar; \
a35f64ea 558 \
e8cb70b9 559/* The semantic value of the lookahead symbol. */ \
17da6427 560YYSTYPE yylval; \
a35f64ea
AD
561 \
562/* Number of parse errors so far. */ \
17da6427 563int yynerrs;
a35f64ea
AD
564
565#if YYLSP_NEEDED
566# define YY_DECL_VARIABLES \
7093d0f5 567YY_DECL_NON_LSP_VARIABLES \
a35f64ea
AD
568 \
569/* Location data for the lookahead symbol. */ \
570YYLTYPE yylloc;
571#else
572# define YY_DECL_VARIABLES \
7093d0f5 573YY_DECL_NON_LSP_VARIABLES
a35f64ea
AD
574#endif
575
e8cb70b9 576/* If nonreentrant, generate the variables here. */
a35f64ea
AD
577
578#if !YYPURE
579YY_DECL_VARIABLES
580#endif /* !YYPURE */
581
10fa2066 582int
17da6427 583yyparse (YYPARSE_PARAM_ARG)
b658bf92 584 YYPARSE_PARAM_DECL
10fa2066 585{
e8cb70b9 586 /* If reentrant, generate the variables here. */
a35f64ea
AD
587#if YYPURE
588 YY_DECL_VARIABLES
589#endif /* !YYPURE */
590
10fa2066
RS
591 register int yystate;
592 register int yyn;
600f9b0c 593 int yyresult;
b07b484a
AD
594 /* Number of tokens to shift before error messages enabled. */
595 int yyerrstatus;
596 /* Lookahead token as an internal (translated) token number. */
597 int yychar1 = 0;
10fa2066 598
bb10be54
AD
599 /* Three stacks and their tools:
600 `yyss': related to states,
e9e4c321 601 `yyvs': related to semantic values,
bb10be54
AD
602 `yyls': related to locations.
603
604 Refer to the stacks thru separate pointers, to allow yyoverflow
605 to reallocate them elsewhere. */
606
e8cb70b9 607 /* The state stack. */
b07b484a 608 short yyssa[YYINITDEPTH];
bb10be54
AD
609 short *yyss = yyssa;
610 register short *yyssp;
611
b07b484a
AD
612 /* The semantic value stack. */
613 YYSTYPE yyvsa[YYINITDEPTH];
b07b484a 614 YYSTYPE *yyvs = yyvsa;
bb10be54 615 register YYSTYPE *yyvsp;
10fa2066 616
5af1f549 617#if YYLSP_NEEDED
b07b484a
AD
618 /* The location stack. */
619 YYLTYPE yylsa[YYINITDEPTH];
10fa2066
RS
620 YYLTYPE *yyls = yylsa;
621 YYLTYPE *yylsp;
bb10be54 622#endif
10fa2066 623
5af1f549 624#if YYLSP_NEEDED
b07b484a 625# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
10fa2066 626#else
b07b484a 627# define YYPOPSTACK (yyvsp--, yyssp--)
10fa2066
RS
628#endif
629
7093d0f5 630 YYSIZE_T yystacksize = YYINITDEPTH;
10fa2066 631
6666f98f
AD
632 /* The variables used to return semantic value and location from the
633 action routines. */
bb10be54 634 YYSTYPE yyval;
7093d0f5 635#if YYLSP_NEEDED
6666f98f 636 YYLTYPE yyloc;
7093d0f5 637#endif
10fa2066 638
6666f98f 639 /* When reducing, the number of symbols on the RHS of the reduced
e8cb70b9 640 rule. */
10fa2066
RS
641 int yylen;
642
7ea5e977 643 YYDPRINTF ((stderr, "Starting parse\n"));
10fa2066
RS
644
645 yystate = 0;
646 yyerrstatus = 0;
17da6427
PB
647 yynerrs = 0;
648 yychar = YYEMPTY; /* Cause a token to be read. */
10fa2066
RS
649
650 /* Initialize stack pointers.
651 Waste one element of value and location stack
652 so that they stay on the same level as the state stack.
653 The wasted elements are never initialized. */
654
cbd89906 655 yyssp = yyss;
10fa2066 656 yyvsp = yyvs;
5af1f549 657#if YYLSP_NEEDED
10fa2066
RS
658 yylsp = yyls;
659#endif
cbd89906 660 goto yysetstate;
10fa2066 661
71da9eea
AD
662/*------------------------------------------------------------.
663| yynewstate -- Push a new state, which is found in yystate. |
664`------------------------------------------------------------*/
342b8b6e 665 yynewstate:
71da9eea
AD
666 /* In all cases, when you get here, the value and location stacks
667 have just been pushed. so pushing a state here evens the stacks.
668 */
cbd89906
PE
669 yyssp++;
670
342b8b6e 671 yysetstate:
cbd89906 672 *yyssp = yystate;
10fa2066
RS
673
674 if (yyssp >= yyss + yystacksize - 1)
675 {
10fa2066 676 /* Get the current used size of the three stacks, in elements. */
7093d0f5 677 YYSIZE_T yysize = yyssp - yyss + 1;
10fa2066
RS
678
679#ifdef yyoverflow
3d76b07d
AD
680 {
681 /* Give user a chance to reallocate the stack. Use copies of
682 these so that the &'s don't force the real ones into
683 memory. */
684 YYSTYPE *yyvs1 = yyvs;
685 short *yyss1 = yyss;
686
687 /* Each stack pointer address is followed by the size of the
688 data in use in that stack, in bytes. */
5af1f549 689# if YYLSP_NEEDED
3d76b07d
AD
690 YYLTYPE *yyls1 = yyls;
691 /* This used to be a conditional around just the two extra args,
692 but that might be undefined if yyoverflow is a macro. */
693 yyoverflow ("parser stack overflow",
7093d0f5
AD
694 &yyss1, yysize * sizeof (*yyssp),
695 &yyvs1, yysize * sizeof (*yyvsp),
696 &yyls1, yysize * sizeof (*yylsp),
3d76b07d
AD
697 &yystacksize);
698 yyls = yyls1;
b07b484a 699# else
3d76b07d 700 yyoverflow ("parser stack overflow",
7093d0f5
AD
701 &yyss1, yysize * sizeof (*yyssp),
702 &yyvs1, yysize * sizeof (*yyvsp),
3d76b07d 703 &yystacksize);
b07b484a 704# endif
3d76b07d
AD
705 yyss = yyss1;
706 yyvs = yyvs1;
707 }
10fa2066
RS
708#else /* no yyoverflow */
709 /* Extend the stack our own way. */
710 if (yystacksize >= YYMAXDEPTH)
600f9b0c 711 goto yyoverflowlab;
10fa2066
RS
712 yystacksize *= 2;
713 if (yystacksize > YYMAXDEPTH)
714 yystacksize = YYMAXDEPTH;
e9e4c321 715
600f9b0c
PE
716 {
717 short *yyss1 = yyss;
2729e106
PE
718 union yyalloc *yyptr =
719 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
600f9b0c
PE
720 if (! yyptr)
721 goto yyoverflowlab;
722 YYSTACK_RELOCATE (short, yyss);
723 YYSTACK_RELOCATE (YYSTYPE, yyvs);
5af1f549 724# if YYLSP_NEEDED
600f9b0c 725 YYSTACK_RELOCATE (YYLTYPE, yyls);
b07b484a 726# endif
600f9b0c
PE
727# undef YYSTACK_RELOCATE
728 if (yyss1 != yyssa)
729 YYSTACK_FREE (yyss1);
730 }
10fa2066
RS
731#endif /* no yyoverflow */
732
7093d0f5
AD
733 yyssp = yyss + yysize - 1;
734 yyvsp = yyvs + yysize - 1;
5af1f549 735#if YYLSP_NEEDED
7093d0f5 736 yylsp = yyls + yysize - 1;
10fa2066
RS
737#endif
738
7ea5e977 739 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
600f9b0c 740 (unsigned long int) yystacksize));
10fa2066
RS
741
742 if (yyssp >= yyss + yystacksize - 1)
743 YYABORT;
744 }
745
7ea5e977 746 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
10fa2066
RS
747
748 goto yybackup;
71da9eea 749
71da9eea
AD
750/*-----------.
751| yybackup. |
752`-----------*/
753yybackup:
10fa2066
RS
754
755/* Do appropriate processing given the current state. */
756/* Read a lookahead token if we need one and don't already have one. */
757/* yyresume: */
758
759 /* First try to decide what to do without reference to lookahead token. */
760
761 yyn = yypact[yystate];
762 if (yyn == YYFLAG)
763 goto yydefault;
764
765 /* Not known => get a lookahead token if don't already have one. */
766
767 /* yychar is either YYEMPTY or YYEOF
768 or a valid token in external form. */
769
17da6427 770 if (yychar == YYEMPTY)
10fa2066 771 {
7ea5e977 772 YYDPRINTF ((stderr, "Reading a token: "));
17da6427 773 yychar = YYLEX;
10fa2066
RS
774 }
775
e8cb70b9 776 /* Convert token to internal form (in yychar1) for indexing tables with. */
10fa2066 777
17da6427 778 if (yychar <= 0) /* This means end of input. */
10fa2066
RS
779 {
780 yychar1 = 0;
17da6427 781 yychar = YYEOF; /* Don't call YYLEX any more. */
10fa2066 782
7ea5e977 783 YYDPRINTF ((stderr, "Now at end of input.\n"));
10fa2066
RS
784 }
785 else
786 {
17da6427 787 yychar1 = YYTRANSLATE (yychar);
10fa2066 788
0d533154
AD
789#if YYDEBUG
790 /* We have to keep this `#if YYDEBUG', since we use variables
791 which are defined only if `YYDEBUG' is set. */
17da6427 792 if (yydebug)
10fa2066 793 {
7ea5e977 794 YYFPRINTF (stderr, "Next token is %d (%s",
b7575ffe 795 yychar, yytname[yychar1]);
0d533154
AD
796 /* Give the individual parser a way to print the precise
797 meaning of a token, for further debugging info. */
b07b484a 798# ifdef YYPRINT
7ea5e977 799 YYPRINT (stderr, yychar, yylval);
b07b484a 800# endif
7ea5e977 801 YYFPRINTF (stderr, ")\n");
10fa2066 802 }
0d533154 803#endif
10fa2066
RS
804 }
805
806 yyn += yychar1;
807 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
808 goto yydefault;
809
810 yyn = yytable[yyn];
811
812 /* yyn is what to do for this token type in this state.
813 Negative => reduce, -yyn is rule number.
814 Positive => shift, yyn is new state.
815 New state is final state => don't bother to shift,
816 just return success.
817 0, or most negative number => error. */
818
819 if (yyn < 0)
820 {
821 if (yyn == YYFLAG)
822 goto yyerrlab;
823 yyn = -yyn;
824 goto yyreduce;
825 }
826 else if (yyn == 0)
827 goto yyerrlab;
828
829 if (yyn == YYFINAL)
830 YYACCEPT;
831
832 /* Shift the lookahead token. */
7ea5e977 833 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
b7575ffe 834 yychar, yytname[yychar1]));
10fa2066
RS
835
836 /* Discard the token being shifted unless it is eof. */
17da6427
PB
837 if (yychar != YYEOF)
838 yychar = YYEMPTY;
10fa2066 839
17da6427 840 *++yyvsp = yylval;
5af1f549 841#if YYLSP_NEEDED
10fa2066
RS
842 *++yylsp = yylloc;
843#endif
844
71da9eea
AD
845 /* Count tokens shifted since error; after three, turn off error
846 status. */
847 if (yyerrstatus)
848 yyerrstatus--;
10fa2066
RS
849
850 yystate = yyn;
851 goto yynewstate;
852
10fa2066 853
71da9eea
AD
854/*-----------------------------------------------------------.
855| yydefault -- do the default action for the current state. |
856`-----------------------------------------------------------*/
857yydefault:
10fa2066
RS
858 yyn = yydefact[yystate];
859 if (yyn == 0)
860 goto yyerrlab;
71da9eea 861 goto yyreduce;
10fa2066 862
71da9eea
AD
863
864/*-----------------------------.
865| yyreduce -- Do a reduction. |
866`-----------------------------*/
10fa2066 867yyreduce:
71da9eea 868 /* yyn is the number of a rule to reduce with. */
10fa2066 869 yylen = yyr2[yyn];
da9abf43
AD
870
871 /* If YYLEN is nonzero, implement the default value of the action:
573c1d9f 872 `$$ = $1'.
da9abf43
AD
873
874 Otherwise, the following line sets YYVAL to the semantic value of
875 the lookahead token. This behavior is undocumented and Bison
876 users should not rely upon it. Assigning to YYVAL
877 unconditionally makes the parser a bit smaller, and it avoids a
878 GCC warning that YYVAL may be used uninitialized. */
879 yyval = yyvsp[1-yylen];
3abcd459 880
5af1f549 881#if YYLSP_NEEDED
3abcd459
AD
882 /* Similarly for the default location. Let the user run additional
883 commands if for instance locations are ranges. */
884 yyloc = yylsp[1-yylen];
ca96bc2d 885 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
6666f98f 886#endif
10fa2066 887
0de741ca
AD
888#if YYDEBUG
889 /* We have to keep this `#if YYDEBUG', since we use variables which
890 are defined only if `YYDEBUG' is set. */
17da6427 891 if (yydebug)
10fa2066 892 {
7093d0f5 893 int yyi;
10fa2066 894
7ea5e977 895 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
3db472b9 896 yyn - 1, yyrline[yyn]);
10fa2066
RS
897
898 /* Print the symbols being reduced, and their result. */
3db472b9 899 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
7ea5e977
AD
900 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
901 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
10fa2066
RS
902 }
903#endif
a8289c62
RA
904 switch (yyn)
905 {
9b3add5b 906 %%{actions}
a8289c62 907 }
897668ee 908
9b3add5b
RA
909/* Line %%{skeleton-line} of %%{skeleton}. */
910#line %%{line} "%%{parser-file-name}"
10fa2066
RS
911\f
912 yyvsp -= yylen;
913 yyssp -= yylen;
5af1f549 914#if YYLSP_NEEDED
10fa2066
RS
915 yylsp -= yylen;
916#endif
917
5a35a6cb 918#if YYDEBUG
17da6427 919 if (yydebug)
10fa2066 920 {
7093d0f5 921 short *yyssp1 = yyss - 1;
7ea5e977 922 YYFPRINTF (stderr, "state stack now");
7093d0f5 923 while (yyssp1 != yyssp)
7ea5e977
AD
924 YYFPRINTF (stderr, " %d", *++yyssp1);
925 YYFPRINTF (stderr, "\n");
10fa2066 926 }
5a35a6cb 927#endif
10fa2066
RS
928
929 *++yyvsp = yyval;
5af1f549 930#if YYLSP_NEEDED
6666f98f 931 *++yylsp = yyloc;
10fa2066
RS
932#endif
933
41aca2e0
AD
934 /* Now `shift' the result of the reduction. Determine what state
935 that goes to, based on the state we popped back to and the rule
936 number reduced by. */
10fa2066
RS
937
938 yyn = yyr1[yyn];
939
7742ddeb 940 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
10fa2066
RS
941 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
942 yystate = yytable[yystate];
943 else
7742ddeb 944 yystate = yydefgoto[yyn - YYNTOKENS];
10fa2066
RS
945
946 goto yynewstate;
947
10fa2066 948
71da9eea
AD
949/*------------------------------------.
950| yyerrlab -- here on detecting error |
951`------------------------------------*/
952yyerrlab:
953 /* If not already recovering from an error, report this error. */
954 if (!yyerrstatus)
10fa2066 955 {
17da6427 956 ++yynerrs;
10fa2066 957
8850be4b 958#if YYERROR_VERBOSE
10fa2066
RS
959 yyn = yypact[yystate];
960
961 if (yyn > YYFLAG && yyn < YYLAST)
962 {
7093d0f5
AD
963 YYSIZE_T yysize = 0;
964 char *yymsg;
965 int yyx, yycount;
10fa2066 966
7093d0f5
AD
967 yycount = 0;
968 /* Start YYX at -YYN if negative to avoid negative indexes in
f0473484 969 YYCHECK. */
7093d0f5
AD
970 for (yyx = yyn < 0 ? -yyn : 0;
971 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
972 if (yycheck[yyx + yyn] == yyx)
973 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
974 yysize += yystrlen ("parse error, unexpected ") + 1;
975 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
976 yymsg = (char *) YYSTACK_ALLOC (yysize);
977 if (yymsg != 0)
10fa2066 978 {
7093d0f5
AD
979 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
980 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
10fa2066 981
7093d0f5 982 if (yycount < 5)
10fa2066 983 {
7093d0f5
AD
984 yycount = 0;
985 for (yyx = yyn < 0 ? -yyn : 0;
986 yyx < (int) (sizeof (yytname) / sizeof (char *));
987 yyx++)
988 if (yycheck[yyx + yyn] == yyx)
10fa2066 989 {
7093d0f5
AD
990 const char *yyq = ! yycount ? ", expecting " : " or ";
991 yyp = yystpcpy (yyp, yyq);
992 yyp = yystpcpy (yyp, yytname[yyx]);
993 yycount++;
10fa2066
RS
994 }
995 }
7093d0f5
AD
996 yyerror (yymsg);
997 YYSTACK_FREE (yymsg);
998 }
999 else
1000 yyerror ("parse error; also virtual memory exhausted");
a8289c62 1001 }
10fa2066 1002 else
b7575ffe 1003#endif /* YYERROR_VERBOSE */
17da6427 1004 yyerror ("parse error");
10fa2066 1005 }
10fa2066 1006 goto yyerrlab1;
10fa2066 1007
71da9eea 1008
e8cb70b9
PB
1009/*----------------------------------------------------.
1010| yyerrlab1 -- error raised explicitly by an action. |
1011`----------------------------------------------------*/
71da9eea 1012yyerrlab1:
10fa2066
RS
1013 if (yyerrstatus == 3)
1014 {
71da9eea
AD
1015 /* If just tried and failed to reuse lookahead token after an
1016 error, discard it. */
10fa2066 1017
e8cb70b9 1018 /* Return failure if at end of input. */
17da6427 1019 if (yychar == YYEOF)
10fa2066 1020 YYABORT;
7ea5e977 1021 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
17da6427
PB
1022 yychar, yytname[yychar1]));
1023 yychar = YYEMPTY;
10fa2066
RS
1024 }
1025
71da9eea
AD
1026 /* Else will try to reuse lookahead token after shifting the error
1027 token. */
10fa2066 1028
e8cb70b9 1029 yyerrstatus = 3; /* Each real token shifted decrements this. */
10fa2066
RS
1030
1031 goto yyerrhandle;
1032
10fa2066 1033
71da9eea
AD
1034/*-------------------------------------------------------------------.
1035| yyerrdefault -- current state does not do anything special for the |
1036| error token. |
1037`-------------------------------------------------------------------*/
1038yyerrdefault:
10fa2066
RS
1039#if 0
1040 /* This is wrong; only states that explicitly want error tokens
1041 should shift them. */
71da9eea
AD
1042
1043 /* If its default is to accept any token, ok. Otherwise pop it. */
1044 yyn = yydefact[yystate];
1045 if (yyn)
1046 goto yydefault;
10fa2066
RS
1047#endif
1048
10fa2066 1049
71da9eea
AD
1050/*---------------------------------------------------------------.
1051| yyerrpop -- pop the current state because it cannot handle the |
e8cb70b9 1052| error token. |
71da9eea
AD
1053`---------------------------------------------------------------*/
1054yyerrpop:
1055 if (yyssp == yyss)
1056 YYABORT;
10fa2066
RS
1057 yyvsp--;
1058 yystate = *--yyssp;
5af1f549 1059#if YYLSP_NEEDED
10fa2066
RS
1060 yylsp--;
1061#endif
1062
5a35a6cb 1063#if YYDEBUG
17da6427 1064 if (yydebug)
10fa2066 1065 {
7093d0f5 1066 short *yyssp1 = yyss - 1;
7ea5e977 1067 YYFPRINTF (stderr, "Error: state stack now");
7093d0f5 1068 while (yyssp1 != yyssp)
7ea5e977
AD
1069 YYFPRINTF (stderr, " %d", *++yyssp1);
1070 YYFPRINTF (stderr, "\n");
10fa2066 1071 }
5a35a6cb 1072#endif
10fa2066 1073
71da9eea
AD
1074/*--------------.
1075| yyerrhandle. |
1076`--------------*/
1077yyerrhandle:
10fa2066
RS
1078 yyn = yypact[yystate];
1079 if (yyn == YYFLAG)
1080 goto yyerrdefault;
1081
1082 yyn += YYTERROR;
1083 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1084 goto yyerrdefault;
1085
1086 yyn = yytable[yyn];
1087 if (yyn < 0)
1088 {
1089 if (yyn == YYFLAG)
1090 goto yyerrpop;
1091 yyn = -yyn;
1092 goto yyreduce;
1093 }
1094 else if (yyn == 0)
1095 goto yyerrpop;
1096
1097 if (yyn == YYFINAL)
1098 YYACCEPT;
1099
7ea5e977 1100 YYDPRINTF ((stderr, "Shifting error token, "));
10fa2066 1101
17da6427 1102 *++yyvsp = yylval;
5af1f549 1103#if YYLSP_NEEDED
10fa2066
RS
1104 *++yylsp = yylloc;
1105#endif
1106
1107 yystate = yyn;
1108 goto yynewstate;
70ddf897 1109
71da9eea
AD
1110
1111/*-------------------------------------.
1112| yyacceptlab -- YYACCEPT comes here. |
1113`-------------------------------------*/
1114yyacceptlab:
600f9b0c
PE
1115 yyresult = 0;
1116 goto yyreturn;
71da9eea
AD
1117
1118/*-----------------------------------.
1119| yyabortlab -- YYABORT comes here. |
1120`-----------------------------------*/
1121yyabortlab:
600f9b0c
PE
1122 yyresult = 1;
1123 goto yyreturn;
1124
1125/*---------------------------------------------.
1126| yyoverflowab -- parser overflow comes here. |
1127`---------------------------------------------*/
1128yyoverflowlab:
1129 yyerror ("parser stack overflow");
1130 yyresult = 2;
1131 /* Fall through. */
1132
1133yyreturn:
1134#ifndef yyoverflow
1135 if (yyss != yyssa)
1136 YYSTACK_FREE (yyss);
70ddf897 1137#endif
600f9b0c 1138 return yyresult;
10fa2066 1139}
ff48177d 1140
9b3add5b 1141%%{epilogue}