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