]> git.saurik.com Git - bison.git/blame - data/yacc.c
* NEWS (2.3a+): Mention yesterday's state-removal change.
[bison.git] / data / yacc.c
CommitLineData
08af01c2 1 -*- C -*-
a8289c62 2
60491a94 3# Yacc compatible skeleton for Bison
c7a65b99 4
945e396c
JD
5# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
6# 2007 Free Software Foundation, Inc.
60491a94
AD
7
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
0fb669f9
PE
20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21# 02110-1301 USA
60491a94 22
945e396c 23# Handle BISON_USE_PUSH_FOR_PULL for the test suite.
6afc30cc 24b4_use_push_for_pull_if([m4_include(b4_pkgdatadir/[push.c])], [
945e396c 25
0a96ba81 26m4_include(b4_pkgdatadir/[c.m4])
7eb8a0bc 27
66d30cd4
AD
28## ---------------- ##
29## Default values. ##
30## ---------------- ##
31
32# Stack parameters.
33m4_define_default([b4_stack_depth_max], [10000])
34m4_define_default([b4_stack_depth_init], [200])
35
2a8d363a
AD
36
37## ------------------------ ##
38## Pure/impure interfaces. ##
39## ------------------------ ##
40
41
4b367315
AD
42# b4_yacc_pure_if(IF-TRUE, IF-FALSE)
43# ----------------------------------
2a8d363a 44# Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
4b367315 45m4_define([b4_yacc_pure_if],
2a8d363a 46[b4_pure_if([m4_ifset([b4_parse_param],
02650b7f
PE
47 [$1], [$2])],
48 [$2])])
2a8d363a
AD
49
50
93724f13
AD
51# b4_yyerror_args
52# ---------------
2a8d363a 53# Arguments passed to yyerror: user args plus yylloc.
93724f13 54m4_define([b4_yyerror_args],
327afc7c 55[b4_yacc_pure_if([b4_locations_if([&yylloc, ])])dnl
93724f13 56m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
2a8d363a
AD
57
58
59# b4_lex_param
60# ------------
d42f69cd 61# Accumulate in b4_lex_param all the yylex arguments.
2a8d363a 62# b4_lex_param arrives quoted twice, but we want to keep only one level.
21964f43
AD
63m4_define([b4_lex_param],
64m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
327afc7c 65b4_locations_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl
68cdf747 66m4_ifdef([b4_lex_param], b4_lex_param)))
66d30cd4
AD
67
68
f1886bb2
AD
69
70## ------------ ##
71## Data Types. ##
72## ------------ ##
73
74# b4_int_type(MIN, MAX)
75# ---------------------
76# Return the smallest int type able to handle numbers ranging from
d42cf844
PE
77# MIN to MAX (included). Overwrite the version from c.m4, which
78# uses only C89 types, so that the user can override the shorter
79# types, and so that pre-C89 compilers are handled correctly.
f1886bb2 80m4_define([b4_int_type],
d42cf844
PE
81[m4_if(b4_ints_in($@, [0], [255]), [1], [yytype_uint8],
82 b4_ints_in($@, [-128], [127]), [1], [yytype_int8],
f1886bb2 83
d42cf844
PE
84 b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
85 b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
f1886bb2
AD
86
87 m4_eval([0 <= $1]), [1], [unsigned int],
88
02650b7f 89 [int])])
f1886bb2
AD
90
91
66d30cd4
AD
92## ----------------- ##
93## Semantic Values. ##
94## ----------------- ##
95
96
82b6cb3f
AD
97# b4_lhs_value([TYPE])
98# --------------------
99# Expansion of $<TYPE>$.
100m4_define([b4_lhs_value],
bc82c5a5 101[(yyval[]m4_ifval([$1], [.$1]))])
82b6cb3f
AD
102
103
104# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
105# --------------------------------------
106# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
107# symbols on RHS.
108m4_define([b4_rhs_value],
d1ff7a7c 109[(yyvsp@{($2) - ($1)@}m4_ifval([$3], [.$3]))])
82b6cb3f
AD
110
111
58612f1d
AD
112
113## ----------- ##
114## Locations. ##
115## ----------- ##
116
82b6cb3f
AD
117# b4_lhs_location()
118# -----------------
119# Expansion of @$.
120m4_define([b4_lhs_location],
bc82c5a5 121[(yyloc)])
82b6cb3f
AD
122
123
124# b4_rhs_location(RULE-LENGTH, NUM)
125# ---------------------------------
126# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
127# on RHS.
128m4_define([b4_rhs_location],
d1ff7a7c 129[(yylsp@{($2) - ($1)@})])
be2a1a68 130
0d8bed56 131
0d8bed56 132
1ae72863
AD
133## --------------------------------------------------------- ##
134## Defining symbol actions, e.g., printers and destructors. ##
135## --------------------------------------------------------- ##
136
b526ee61
AD
137# We do want M4 expansion after # for CPP macros.
138m4_changecom()
08af01c2
JD
139m4_divert_push(0)dnl
140@output(b4_parser_file_name@)
327afc7c 141b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],dnl '
6e93d810 142 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[
af3412cd
PE
143
144/* C LALR(1) parser skeleton written by Richard Stallman, by
145 simplifying the original so-called "semantic" parser. */
444fbf65 146
cf44a9ae
PE
147/* All symbols defined below should begin with yy or YY, to avoid
148 infringing on user name space. This should be done even for local
149 variables, as they might otherwise be expanded by user macros.
150 There are some unavoidable exceptions within include files to
151 define necessary library symbols; they are noted "INFRINGES ON
152 USER NAME SPACE" below. */
153
9c1e26bd 154]b4_identification
a4e25e1d 155b4_percent_code_get([[top]])[]dnl
aa08666d 156m4_if(b4_prefix, [yy], [],
c5b95ccf 157[/* Substitute the variable and function names. */
be2a1a68
AD
158#define yyparse b4_prefix[]parse
159#define yylex b4_prefix[]lex
160#define yyerror b4_prefix[]error
161#define yylval b4_prefix[]lval
162#define yychar b4_prefix[]char
163#define yydebug b4_prefix[]debug
164#define yynerrs b4_prefix[]nerrs
327afc7c 165b4_locations_if([#define yylloc b4_prefix[]lloc])])[
17da6427 166
0dd1580a 167/* Copy the first part of user declarations. */
136a0f76 168]b4_user_pre_prologue[
cce71710 169
d99361e6
AD
170/* Enabling traces. */
171#ifndef YYDEBUG
327afc7c 172# define YYDEBUG ]b4_debug_flag[
d99361e6
AD
173#endif
174
175/* Enabling verbose error messages. */
176#ifdef YYERROR_VERBOSE
177# undef YYERROR_VERBOSE
178# define YYERROR_VERBOSE 1
179#else
327afc7c 180# define YYERROR_VERBOSE ]b4_error_verbose_flag[
d99361e6
AD
181#endif
182
141f5793
PE
183/* Enabling the token table. */
184#ifndef YYTOKEN_TABLE
185# define YYTOKEN_TABLE ]b4_token_table[
186#endif
187
a4e25e1d 188]b4_percent_code_get([[requires]])[]dnl
9bc0dd67
JD
189
190b4_token_enums_defines(b4_tokens)[
191
02650b7f 192#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
9c1e26bd 193]m4_ifdef([b4_stype],
ddc8ede1 194[[typedef union ]b4_union_name[
7ecec4dd 195{
ddc8ede1 196]b4_user_stype[
7ecec4dd 197} YYSTYPE;
ddc8ede1
PE
198# define YYSTYPE_IS_TRIVIAL 1]],
199[m4_if(b4_tag_seen_flag, 0,
200[[typedef int YYSTYPE;
201# define YYSTYPE_IS_TRIVIAL 1]])])[
050c471b
PE
202# define yystype YYSTYPE /* obsolescent; will be withdrawn */
203# define YYSTYPE_IS_DECLARED 1
fd51e5ff
AD
204#endif
205
327afc7c 206]b4_locations_if([#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
050c471b 207typedef struct YYLTYPE
fd51e5ff
AD
208{
209 int first_line;
210 int first_column;
211 int last_line;
212 int last_column;
050c471b
PE
213} YYLTYPE;
214# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
215# define YYLTYPE_IS_DECLARED 1
71cd15d4 216# define YYLTYPE_IS_TRIVIAL 1
9bc0dd67 217#endif])
fd51e5ff 218
a4e25e1d 219b4_percent_code_get([[provides]])[]dnl
9bc0dd67
JD
220
221[/* Copy the second part of user declarations. */
8e0a5e9e 222]b4_user_post_prologue
a4e25e1d 223b4_percent_code_get[]dnl
7093d0f5 224
8e0a5e9e 225[#ifdef short
d42cf844
PE
226# undef short
227#endif
228
229#ifdef YYTYPE_UINT8
230typedef YYTYPE_UINT8 yytype_uint8;
231#else
232typedef unsigned char yytype_uint8;
233#endif
234
235#ifdef YYTYPE_INT8
236typedef YYTYPE_INT8 yytype_int8;
237#elif ]b4_c_modern[
238typedef signed char yytype_int8;
239#else
240typedef short int yytype_int8;
241#endif
242
243#ifdef YYTYPE_UINT16
244typedef YYTYPE_UINT16 yytype_uint16;
245#else
246typedef unsigned short int yytype_uint16;
247#endif
248
249#ifdef YYTYPE_INT16
250typedef YYTYPE_INT16 yytype_int16;
251#else
252typedef short int yytype_int16;
253#endif
254
55289366 255#ifndef YYSIZE_T
02650b7f 256# ifdef __SIZE_TYPE__
55289366 257# define YYSIZE_T __SIZE_TYPE__
02650b7f 258# elif defined size_t
55289366 259# define YYSIZE_T size_t
02650b7f 260# elif ! defined YYSIZE_T && ]b4_c_modern[
55289366
PE
261# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
262# define YYSIZE_T size_t
263# else
264# define YYSIZE_T unsigned int
265# endif
bedf57f5 266#endif
7093d0f5 267
b4c1f9d2
PE
268#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
269
30757c8c
PE
270#ifndef YY_
271# if YYENABLE_NLS
272# if ENABLE_NLS
273# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
274# define YY_(msgid) dgettext ("bison-runtime", msgid)
275# endif
276# endif
277# ifndef YY_
278# define YY_(msgid) msgid
279# endif
280#endif
281
2a4647a3 282/* Suppress unused-variable warnings by "using" E. */
02650b7f 283#if ! defined lint || defined __GNUC__
12ce2df6
PE
284# define YYUSE(e) ((void) (e))
285#else
286# define YYUSE(e) /* empty */
287#endif
288
289/* Identity function, used to suppress warnings about constant conditions. */
290#ifndef lint
291# define YYID(n) (n)
292#else
cd9e1ba2 293]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
12ce2df6 294{
cd9e1ba2 295 return yyi;
12ce2df6
PE
296}
297#endif
2a4647a3 298
02650b7f 299#if ! defined yyoverflow || YYERROR_VERBOSE
2779e383 300
7093d0f5
AD
301/* The parser invokes alloca or malloc; define the necessary symbols. */
302
b929851a
PE
303# ifdef YYSTACK_USE_ALLOCA
304# if YYSTACK_USE_ALLOCA
b929851a
PE
305# ifdef __GNUC__
306# define YYSTACK_ALLOC __builtin_alloca
02650b7f 307# elif defined __BUILTIN_VA_ARG_INCR
55289366 308# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
02650b7f 309# elif defined _AIX
55289366 310# define YYSTACK_ALLOC __alloca
02650b7f 311# elif defined _MSC_VER
55289366
PE
312# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
313# define alloca _alloca
d7e14fc0
PE
314# else
315# define YYSTACK_ALLOC alloca
02650b7f 316# if ! defined _ALLOCA_H && ! defined _STDLIB_H && ]b4_c_modern[
bedf57f5 317# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
55289366
PE
318# ifndef _STDLIB_H
319# define _STDLIB_H 1
320# endif
bedf57f5 321# endif
7093d0f5
AD
322# endif
323# endif
324# endif
325
326# ifdef YYSTACK_ALLOC
9d9b8b70 327 /* Pacify GCC's `empty if-body' warning. */
12ce2df6 328# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
506ffb1f 329# ifndef YYSTACK_ALLOC_MAXIMUM
b9c9f761
PE
330 /* The OS might guarantee only one guard page at the bottom of the stack,
331 and a page size can be as small as 4096 bytes. So we cannot safely
332 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
333 to allow for a few compiler-allocated temporary stack slots. */
e2a21b6f 334# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
506ffb1f 335# endif
7093d0f5 336# else
2779e383
PE
337# define YYSTACK_ALLOC YYMALLOC
338# define YYSTACK_FREE YYFREE
506ffb1f 339# ifndef YYSTACK_ALLOC_MAXIMUM
b4c1f9d2 340# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
506ffb1f 341# endif
fc3f467f
PE
342# if (defined __cplusplus && ! defined _STDLIB_H \
343 && ! ((defined YYMALLOC || defined malloc) \
344 && (defined YYFREE || defined free)))
345# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
346# ifndef _STDLIB_H
347# define _STDLIB_H 1
348# endif
0925ebb4 349# endif
bedf57f5
PE
350# ifndef YYMALLOC
351# define YYMALLOC malloc
02650b7f 352# if ! defined malloc && ! defined _STDLIB_H && ]b4_c_modern[
bedf57f5
PE
353void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
354# endif
355# endif
356# ifndef YYFREE
357# define YYFREE free
02650b7f 358# if ! defined free && ! defined _STDLIB_H && ]b4_c_modern[
bedf57f5
PE
359void free (void *); /* INFRINGES ON USER NAME SPACE */
360# endif
361# endif
7093d0f5 362# endif
02650b7f 363#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
cf44a9ae
PE
364
365
02650b7f
PE
366#if (! defined yyoverflow \
367 && (! defined __cplusplus \
327afc7c 368 || (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
02650b7f 369 && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
7093d0f5 370
600f9b0c
PE
371/* A type that is properly aligned for any stack member. */
372union yyalloc
373{
d42cf844 374 yytype_int16 yyss;
2729e106 375 YYSTYPE yyvs;
327afc7c 376 ]b4_locations_if([ YYLTYPE yyls;
58612f1d 377])dnl
9c1e26bd 378[};
600f9b0c
PE
379
380/* The size of the maximum gap between one aligned stack and the next. */
17836590 381# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
600f9b0c
PE
382
383/* The size of an array large to enough to hold all stacks, each with
384 N elements. */
327afc7c 385]b4_locations_if(
58612f1d 386[# define YYSTACK_BYTES(N) \
d42cf844 387 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
17836590 388 + 2 * YYSTACK_GAP_MAXIMUM)],
58612f1d 389[# define YYSTACK_BYTES(N) \
d42cf844 390 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
17836590 391 + YYSTACK_GAP_MAXIMUM)])[
600f9b0c 392
5b041382
PE
393/* Copy COUNT objects from FROM to TO. The source and destination do
394 not overlap. */
395# ifndef YYCOPY
02650b7f 396# if defined __GNUC__ && 1 < __GNUC__
5b041382
PE
397# define YYCOPY(To, From, Count) \
398 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
399# else
400# define YYCOPY(To, From, Count) \
401 do \
402 { \
cb530ce9 403 YYSIZE_T yyi; \
5b041382 404 for (yyi = 0; yyi < (Count); yyi++) \
9c1e26bd 405 (To)[yyi] = (From)[yyi]; \
5b041382 406 } \
12ce2df6 407 while (YYID (0))
5b041382
PE
408# endif
409# endif
410
411/* Relocate STACK from its old location to the new one. The
7093d0f5 412 local variables YYSIZE and YYSTACKSIZE give the old and new number of
600f9b0c
PE
413 elements in the stack, and YYPTR gives the new location of the
414 stack. Advance YYPTR to a properly aligned location for the next
415 stack. */
5b041382 416# define YYSTACK_RELOCATE(Stack) \
7093d0f5
AD
417 do \
418 { \
419 YYSIZE_T yynewbytes; \
5b041382 420 YYCOPY (&yyptr->Stack, Stack, yysize); \
2729e106 421 Stack = &yyptr->Stack; \
17836590 422 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
2729e106 423 yyptr += yynewbytes / sizeof (*yyptr); \
7093d0f5 424 } \
12ce2df6 425 while (YYID (0))
7093d0f5 426
cf44a9ae 427#endif
8850be4b 428
9d9b8b70 429/* YYFINAL -- State number of the termination state. */
9c1e26bd 430#define YYFINAL ]b4_final_state_number[
39912f52 431/* YYLAST -- Last index in YYTABLE. */
9c1e26bd 432#define YYLAST ]b4_last[
7742ddeb 433
9d9b8b70 434/* YYNTOKENS -- Number of terminals. */
9c1e26bd 435#define YYNTOKENS ]b4_tokens_number[
9d9b8b70 436/* YYNNTS -- Number of nonterminals. */
9c1e26bd 437#define YYNNTS ]b4_nterms_number[
9d9b8b70 438/* YYNRULES -- Number of rules. */
9c1e26bd 439#define YYNRULES ]b4_rules_number[
9d9b8b70 440/* YYNRULES -- Number of states. */
9c1e26bd 441#define YYNSTATES ]b4_states_number[
7742ddeb
AD
442
443/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
9c1e26bd
AD
444#define YYUNDEFTOK ]b4_undef_token_number[
445#define YYMAXUTOK ]b4_user_token_number_max[
007a50a4 446
04098407 447#define YYTRANSLATE(YYX) \
a20713a4 448 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
a8289c62 449
b0400cc6
AD
450/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
451static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
a8289c62 452{
c5e3e510 453 ]b4_translate[
a8289c62
RA
454};
455
456#if YYDEBUG
c5e3e510 457/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
7742ddeb 458 YYRHS. */
c5e3e510 459static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
a8289c62 460{
c5e3e510 461 ]b4_prhs[
a8289c62
RA
462};
463
9d9b8b70 464/* YYRHS -- A `-1'-separated list of the rules' RHS. */
c5e3e510 465static const ]b4_int_type_for([b4_rhs])[ yyrhs[] =
a8289c62 466{
c5e3e510 467 ]b4_rhs[
a8289c62
RA
468};
469
c5e3e510
AD
470/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
471static const ]b4_int_type_for([b4_rline])[ yyrline[] =
a8289c62 472{
c5e3e510 473 ]b4_rline[
a8289c62
RA
474};
475#endif
476
141f5793 477#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
9e0876fb 478/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
9d9b8b70 479 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
c5e3e510 480static const char *const yytname[] =
a8289c62 481{
c5e3e510 482 ]b4_tname[
a8289c62
RA
483};
484#endif
485
c0ad8bf3 486# ifdef YYPRINT
c5e3e510 487/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
769b430f 488 token YYLEX-NUM. */
c5e3e510 489static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
a8289c62 490{
c5e3e510 491 ]b4_toknum[
a8289c62 492};
c0ad8bf3 493# endif
a8289c62 494
c5e3e510
AD
495/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
496static const ]b4_int_type_for([b4_r1])[ yyr1[] =
a8289c62 497{
c5e3e510 498 ]b4_r1[
a8289c62
RA
499};
500
c5e3e510
AD
501/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
502static const ]b4_int_type_for([b4_r2])[ yyr2[] =
a8289c62 503{
c5e3e510 504 ]b4_r2[
a8289c62
RA
505};
506
c5e3e510 507/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
5504898e
AD
508 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
509 means the default is an error. */
c5e3e510 510static const ]b4_int_type_for([b4_defact])[ yydefact[] =
a8289c62 511{
c5e3e510 512 ]b4_defact[
a8289c62
RA
513};
514
9d9b8b70 515/* YYDEFGOTO[NTERM-NUM]. */
c5e3e510 516static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] =
a8289c62 517{
c5e3e510 518 ]b4_defgoto[
a8289c62
RA
519};
520
c5e3e510 521/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
7742ddeb 522 STATE-NUM. */
c5e3e510
AD
523#define YYPACT_NINF ]b4_pact_ninf[
524static const ]b4_int_type_for([b4_pact])[ yypact[] =
a8289c62 525{
c5e3e510 526 ]b4_pact[
a8289c62
RA
527};
528
c5e3e510
AD
529/* YYPGOTO[NTERM-NUM]. */
530static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
a8289c62 531{
c5e3e510 532 ]b4_pgoto[
a8289c62
RA
533};
534
c5e3e510 535/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
7742ddeb 536 positive, shift that token. If negative, reduce the rule which
f50adbbd 537 number is the opposite. If zero, do what YYDEFACT says.
6e649e65 538 If YYTABLE_NINF, syntax error. */
c5e3e510
AD
539#define YYTABLE_NINF ]b4_table_ninf[
540static const ]b4_int_type_for([b4_table])[ yytable[] =
a8289c62 541{
c5e3e510 542 ]b4_table[
a8289c62
RA
543};
544
c5e3e510 545static const ]b4_int_type_for([b4_check])[ yycheck[] =
a8289c62 546{
c5e3e510 547 ]b4_check[
a8289c62
RA
548};
549
c5e3e510 550/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
5504898e 551 symbol of state STATE-NUM. */
c5e3e510 552static const ]b4_int_type_for([b4_stos])[ yystos[] =
5504898e 553{
c5e3e510 554 ]b4_stos[
5504898e 555};
7093d0f5 556
10fa2066 557#define yyerrok (yyerrstatus = 0)
a20713a4
PE
558#define yyclearin (yychar = YYEMPTY)
559#define YYEMPTY (-2)
10fa2066 560#define YYEOF 0
a8289c62 561
70ddf897 562#define YYACCEPT goto yyacceptlab
a8289c62 563#define YYABORT goto yyabortlab
a6b89bb2 564#define YYERROR goto yyerrorlab
8a3eb3c8 565
a8289c62 566
71da9eea
AD
567/* Like YYERROR except do call yyerror. This remains here temporarily
568 to ease the transition to the new meaning of YYERROR, for GCC.
10fa2066 569 Once GCC version 2 has supplanted version 1, this can go. */
a8289c62 570
10fa2066 571#define YYFAIL goto yyerrlab
a8289c62 572
10fa2066 573#define YYRECOVERING() (!!yyerrstatus)
a8289c62 574
69b4e0c5 575#define YYBACKUP(Token, Value) \
10fa2066 576do \
a20713a4 577 if (yychar == YYEMPTY && yylen == 1) \
71da9eea 578 { \
17da6427 579 yychar = (Token); \
7742ddeb 580 yylval = (Value); \
b0400cc6 581 yytoken = YYTRANSLATE (yychar); \
a85284cf 582 YYPOPSTACK (1); \
10fa2066
RS
583 goto yybackup; \
584 } \
585 else \
04098407 586 { \
30757c8c 587 yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
71da9eea
AD
588 YYERROR; \
589 } \
12ce2df6 590while (YYID (0))
10fa2066 591
3fc16193 592
10fa2066
RS
593#define YYTERROR 1
594#define YYERRCODE 256
595
3fc16193 596
b4a20338
AD
597/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
598 If N is 0, then set CURRENT to the empty location which ends
599 the previous symbol: RHS[0] (always defined). */
3abcd459 600
24e0cbd0 601#define YYRHSLOC(Rhs, K) ((Rhs)[K])
3abcd459 602#ifndef YYLLOC_DEFAULT
24e0cbd0
PE
603# define YYLLOC_DEFAULT(Current, Rhs, N) \
604 do \
d6cff4dc 605 if (YYID (N)) \
24e0cbd0 606 { \
9bec482e
PE
607 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
608 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
609 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
610 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
24e0cbd0
PE
611 } \
612 else \
613 { \
614 (Current).first_line = (Current).last_line = \
9bec482e 615 YYRHSLOC (Rhs, 0).last_line; \
24e0cbd0 616 (Current).first_column = (Current).last_column = \
9bec482e 617 YYRHSLOC (Rhs, 0).last_column; \
24e0cbd0 618 } \
12ce2df6 619 while (YYID (0))
b8458aa5
AD
620#endif
621
3fc16193
AD
622
623/* YY_LOCATION_PRINT -- Print the location on the stream.
624 This macro was not mandated originally: define only if we know
625 we won't break user code: when these are the locations we know. */
626
3fc16193 627#ifndef YY_LOCATION_PRINT
b8458aa5
AD
628# if YYLTYPE_IS_TRIVIAL
629# define YY_LOCATION_PRINT(File, Loc) \
630 fprintf (File, "%d.%d-%d.%d", \
02650b7f
PE
631 (Loc).first_line, (Loc).first_column, \
632 (Loc).last_line, (Loc).last_column)
0dcca5c2
AD
633# else
634# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
b8458aa5 635# endif
3abcd459
AD
636#endif
637
3fc16193 638
3abcd459 639/* YYLEX -- calling `yylex' with the right arguments. */
553e2b22 640
ae7453f2 641#ifdef YYLEX_PARAM
327afc7c 642# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
74310291 643#else
9c1e26bd 644# define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
ae7453f2 645#endif
553e2b22 646
5a35a6cb 647/* Enable debugging if requested. */
0d533154 648#if YYDEBUG
b7575ffe 649
2f4f028d 650# ifndef YYFPRINTF
45119af1
PE
651# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
652# define YYFPRINTF fprintf
b7575ffe
PE
653# endif
654
5a35a6cb
AD
655# define YYDPRINTF(Args) \
656do { \
17da6427 657 if (yydebug) \
b7575ffe 658 YYFPRINTF Args; \
12ce2df6 659} while (YYID (0))
c5e3e510 660
4b367315
AD
661# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
662do { \
663 if (yydebug) \
664 { \
665 YYFPRINTF (stderr, "%s ", Title); \
a0af42fc 666 yy_symbol_print (stderr, \
327afc7c 667 Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
4b367315
AD
668 YYFPRINTF (stderr, "\n"); \
669 } \
12ce2df6 670} while (YYID (0))
9c1e26bd 671
a0af42fc 672]b4_yy_symbol_print_generate([b4_c_function_def])[
d1ff7a7c 673
b0937b22
AD
674/*------------------------------------------------------------------.
675| yy_stack_print -- Print the state stack from its BOTTOM up to its |
5348bfbe 676| TOP (included). |
b0937b22
AD
677`------------------------------------------------------------------*/
678
679]b4_c_function_def([yy_stack_print], [static void],
cd9e1ba2
PE
680 [[yytype_int16 *yybottom], [yybottom]],
681 [[yytype_int16 *yytop], [yytop]])[
b0937b22 682{
2f4f028d 683 YYFPRINTF (stderr, "Stack now");
cd9e1ba2
PE
684 for (; yybottom <= yytop; yybottom++)
685 {
686 int yybot = *yybottom;
687 YYFPRINTF (stderr, " %d", yybot);
688 }
2f4f028d 689 YYFPRINTF (stderr, "\n");
b0937b22
AD
690}
691
692# define YY_STACK_PRINT(Bottom, Top) \
693do { \
694 if (yydebug) \
695 yy_stack_print ((Bottom), (Top)); \
12ce2df6 696} while (YYID (0))
b0937b22
AD
697
698
699/*------------------------------------------------.
700| Report that the YYRULE is going to be reduced. |
701`------------------------------------------------*/
702
703]b4_c_function_def([yy_reduce_print], [static void],
02650b7f 704 [[YYSTYPE *yyvsp], [yyvsp]],
aefef0d6
PE
705 b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
706 ])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
707 ])b4_parse_param)[
b0937b22 708{
d1ff7a7c 709 int yynrhs = yyr2[yyrule];
b0937b22 710 int yyi;
30757c8c 711 unsigned long int yylno = yyrline[yyrule];
d1ff7a7c 712 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
02650b7f 713 yyrule - 1, yylno);
d1ff7a7c
AD
714 /* The symbols being reduced. */
715 for (yyi = 0; yyi < yynrhs; yyi++)
716 {
f57a7536 717 YYFPRINTF (stderr, " $%d = ", yyi + 1);
a0af42fc 718 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
02650b7f 719 &]b4_rhs_value(yynrhs, yyi + 1)[
327afc7c 720 ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
02650b7f 721 b4_user_args[);
f57a7536 722 YYFPRINTF (stderr, "\n");
d1ff7a7c 723 }
b0937b22
AD
724}
725
d9963c85
PE
726# define YY_REDUCE_PRINT(Rule) \
727do { \
728 if (yydebug) \
327afc7c 729 yy_reduce_print (yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
12ce2df6 730} while (YYID (0))
b0937b22 731
cf44a9ae
PE
732/* Nonzero means print parse trace. It is left uninitialized so that
733 multiple parsers can coexist. */
17da6427 734int yydebug;
5a35a6cb
AD
735#else /* !YYDEBUG */
736# define YYDPRINTF(Args)
284acc8b 737# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
b0937b22 738# define YY_STACK_PRINT(Bottom, Top)
d9963c85 739# define YY_REDUCE_PRINT(Rule)
5a35a6cb
AD
740#endif /* !YYDEBUG */
741
b0937b22 742
5a35a6cb 743/* YYINITDEPTH -- initial size of the parser's stacks. */
10fa2066 744#ifndef YYINITDEPTH
9c1e26bd 745# define YYINITDEPTH ]b4_stack_depth_init[
10fa2066
RS
746#endif
747
5a35a6cb 748/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
600f9b0c
PE
749 if the built-in stack extension method is used).
750
751 Do not make this value too large; the results are undefined if
506ffb1f 752 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
600f9b0c
PE
753 evaluated with infinite-precision integer arithmetic. */
754
10fa2066 755#ifndef YYMAXDEPTH
9c1e26bd 756# define YYMAXDEPTH ]b4_stack_depth_max[
10fa2066 757#endif
a8289c62 758
10fa2066 759\f
a8289c62 760
7093d0f5
AD
761#if YYERROR_VERBOSE
762
763# ifndef yystrlen
02650b7f 764# if defined __GLIBC__ && defined _STRING_H
7093d0f5
AD
765# define yystrlen strlen
766# else
767/* Return the length of YYSTR. */
1b9c21fb
PE
768]b4_c_function_def([yystrlen], [static YYSIZE_T],
769 [[const char *yystr], [yystr]])[
7093d0f5 770{
12ce2df6
PE
771 YYSIZE_T yylen;
772 for (yylen = 0; yystr[yylen]; yylen++)
7093d0f5 773 continue;
12ce2df6 774 return yylen;
7093d0f5
AD
775}
776# endif
777# endif
778
779# ifndef yystpcpy
02650b7f 780# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
7093d0f5
AD
781# define yystpcpy stpcpy
782# else
783/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
784 YYDEST. */
1b9c21fb
PE
785]b4_c_function_def([yystpcpy], [static char *],
786 [[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[
7093d0f5 787{
cb530ce9
PE
788 char *yyd = yydest;
789 const char *yys = yysrc;
7093d0f5
AD
790
791 while ((*yyd++ = *yys++) != '\0')
792 continue;
793
794 return yyd - 1;
795}
796# endif
797# endif
798
9e0876fb
PE
799# ifndef yytnamerr
800/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
801 quotes and backslashes, so that it's suitable for yyerror. The
802 heuristic is that double-quoting is unnecessary unless the string
803 contains an apostrophe, a comma, or backslash (other than
804 backslash-backslash). YYSTR is taken from yytname. If YYRES is
805 null, do not copy; instead, return the length of what the result
806 would have been. */
807static YYSIZE_T
808yytnamerr (char *yyres, const char *yystr)
809{
810 if (*yystr == '"')
811 {
276f48df 812 YYSIZE_T yyn = 0;
9e0876fb
PE
813 char const *yyp = yystr;
814
815 for (;;)
816 switch (*++yyp)
817 {
818 case '\'':
819 case ',':
820 goto do_not_strip_quotes;
821
822 case '\\':
823 if (*++yyp != '\\')
824 goto do_not_strip_quotes;
825 /* Fall through. */
826 default:
827 if (yyres)
828 yyres[yyn] = *yyp;
829 yyn++;
830 break;
831
832 case '"':
833 if (yyres)
834 yyres[yyn] = '\0';
835 return yyn;
836 }
837 do_not_strip_quotes: ;
838 }
839
840 if (! yyres)
841 return yystrlen (yystr);
842
843 return yystpcpy (yyres, yystr) - yyres;
844}
845# endif
846
b4c1f9d2
PE
847/* Copy into YYRESULT an error message about the unexpected token
848 YYCHAR while in state YYSTATE. Return the number of bytes copied,
849 including the terminating null byte. If YYRESULT is null, do not
850 copy anything; just return the number of bytes that would be
851 copied. As a special case, return 0 if an ordinary "syntax error"
852 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
853 size calculation. */
854static YYSIZE_T
855yysyntax_error (char *yyresult, int yystate, int yychar)
856{
857 int yyn = yypact[yystate];
7093d0f5 858
d6645148 859 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
b4c1f9d2
PE
860 return 0;
861 else
862 {
863 int yytype = YYTRANSLATE (yychar);
864 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
865 YYSIZE_T yysize = yysize0;
866 YYSIZE_T yysize1;
867 int yysize_overflow = 0;
868 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
869 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
870 int yyx;
871
872# if 0
873 /* This is so xgettext sees the translatable formats that are
02650b7f 874 constructed on the fly. */
b4c1f9d2
PE
875 YY_("syntax error, unexpected %s");
876 YY_("syntax error, unexpected %s, expecting %s");
877 YY_("syntax error, unexpected %s, expecting %s or %s");
878 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
879 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
880# endif
881 char *yyfmt;
882 char const *yyf;
883 static char const yyunexpected[] = "syntax error, unexpected %s";
884 static char const yyexpecting[] = ", expecting %s";
885 static char const yyor[] = " or %s";
886 char yyformat[sizeof yyunexpected
02650b7f
PE
887 + sizeof yyexpecting - 1
888 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
889 * (sizeof yyor - 1))];
b4c1f9d2
PE
890 char const *yyprefix = yyexpecting;
891
892 /* Start YYX at -YYN if negative to avoid negative indexes in
02650b7f 893 YYCHECK. */
b4c1f9d2
PE
894 int yyxbegin = yyn < 0 ? -yyn : 0;
895
896 /* Stay within bounds of both yycheck and yytname. */
d6645148 897 int yychecklim = YYLAST - yyn + 1;
b4c1f9d2
PE
898 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
899 int yycount = 1;
900
901 yyarg[0] = yytname[yytype];
902 yyfmt = yystpcpy (yyformat, yyunexpected);
903
904 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
34ec3579 905 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
02650b7f
PE
906 {
907 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
908 {
909 yycount = 1;
910 yysize = yysize0;
911 yyformat[sizeof yyunexpected - 1] = '\0';
912 break;
913 }
914 yyarg[yycount++] = yytname[yyx];
915 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
916 yysize_overflow |= (yysize1 < yysize);
917 yysize = yysize1;
918 yyfmt = yystpcpy (yyfmt, yyprefix);
919 yyprefix = yyor;
920 }
b4c1f9d2
PE
921
922 yyf = YY_(yyformat);
923 yysize1 = yysize + yystrlen (yyf);
12ce2df6 924 yysize_overflow |= (yysize1 < yysize);
b4c1f9d2
PE
925 yysize = yysize1;
926
927 if (yysize_overflow)
928 return YYSIZE_MAXIMUM;
929
930 if (yyresult)
931 {
02650b7f
PE
932 /* Avoid sprintf, as that infringes on the user's name space.
933 Don't have undefined behavior even if the translation
934 produced a string with the wrong number of "%s"s. */
935 char *yyp = yyresult;
936 int yyi = 0;
937 while ((*yyp = *yyf) != '\0')
938 {
939 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
940 {
941 yyp += yytnamerr (yyp, yyarg[yyi++]);
942 yyf += 2;
943 }
944 else
945 {
946 yyp++;
947 yyf++;
948 }
949 }
950 }
b4c1f9d2
PE
951 return yysize;
952 }
953}
954#endif /* YYERROR_VERBOSE */
10fa2066 955\f
a8289c62 956
d1ff7a7c 957]b4_yydestruct_generate([b4_c_function_def])[
4a2a22f4
AD
958\f
959
0245f82d 960/* Prevent warnings from -Wmissing-prototypes. */
4a2a22f4
AD
961
962#ifdef YYPARSE_PARAM
1b9c21fb
PE
963]b4_c_function_decl([yyparse], [int],
964 [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
0245f82d 965#else /* ! YYPARSE_PARAM */
d1ff7a7c 966]b4_c_function_decl([yyparse], [int], b4_parse_param)[
c5e3e510 967#endif /* ! YYPARSE_PARAM */
1b181651 968
0245f82d 969
d1ff7a7c 970]m4_divert_push([KILL])# ======================== M4 code.
74310291
AD
971# b4_declare_parser_variables
972# ---------------------------
973# Declare the variables that are global, or local to YYPARSE if
0245f82d 974# pure-parser.
74310291 975m4_define([b4_declare_parser_variables],
742e4900 976[/* The lookahead symbol. */
74310291
AD
977int yychar;
978
742e4900 979/* The semantic value of the lookahead symbol. */
74310291
AD
980YYSTYPE yylval;
981
6e649e65 982/* Number of syntax errors so far. */
327afc7c 983int yynerrs;b4_locations_if([
742e4900 984/* Location data for the lookahead symbol. */
58612f1d 985YYLTYPE yylloc;])
74310291
AD
986])
987m4_divert_pop([KILL])dnl# ====================== End of M4 code.
58612f1d 988
74310291 989b4_pure_if([],
02650b7f 990 [b4_declare_parser_variables])
a35f64ea 991
0245f82d
AD
992
993/*----------.
994| yyparse. |
995`----------*/
996
997#ifdef YYPARSE_PARAM
1b9c21fb 998b4_c_function_def([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])
0245f82d
AD
999#else /* ! YYPARSE_PARAM */
1000b4_c_function_def([yyparse], [int], b4_parse_param)
1001#endif
be2a1a68 1002{[
74310291 1003 ]b4_pure_if([b4_declare_parser_variables])[
cb530ce9
PE
1004 int yystate;
1005 int yyn;
600f9b0c 1006 int yyresult;
b07b484a
AD
1007 /* Number of tokens to shift before error messages enabled. */
1008 int yyerrstatus;
742e4900 1009 /* Lookahead token as an internal (translated) token number. */
b0400cc6 1010 int yytoken = 0;
b4c1f9d2
PE
1011#if YYERROR_VERBOSE
1012 /* Buffer for error messages, and its allocated size. */
1013 char yymsgbuf[128];
1014 char *yymsg = yymsgbuf;
1015 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1016#endif
10fa2066 1017
bb10be54
AD
1018 /* Three stacks and their tools:
1019 `yyss': related to states,
e9e4c321 1020 `yyvs': related to semantic values,
bb10be54
AD
1021 `yyls': related to locations.
1022
1023 Refer to the stacks thru separate pointers, to allow yyoverflow
1024 to reallocate them elsewhere. */
1025
e8cb70b9 1026 /* The state stack. */
d42cf844
PE
1027 yytype_int16 yyssa[YYINITDEPTH];
1028 yytype_int16 *yyss = yyssa;
1029 yytype_int16 *yyssp;
bb10be54 1030
b07b484a
AD
1031 /* The semantic value stack. */
1032 YYSTYPE yyvsa[YYINITDEPTH];
b07b484a 1033 YYSTYPE *yyvs = yyvsa;
cb530ce9 1034 YYSTYPE *yyvsp;
10fa2066 1035
327afc7c 1036]b4_locations_if(
58612f1d 1037[[ /* The location stack. */
b07b484a 1038 YYLTYPE yylsa[YYINITDEPTH];
10fa2066 1039 YYLTYPE *yyls = yylsa;
d42f69cd 1040 YYLTYPE *yylsp;
9d9b8b70 1041 /* The locations where the error started and ended. */
3fc16193 1042 YYLTYPE yyerror_range[2];]])[
10fa2066 1043
327afc7c 1044#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[)
10fa2066 1045
7093d0f5 1046 YYSIZE_T yystacksize = YYINITDEPTH;
10fa2066 1047
6666f98f
AD
1048 /* The variables used to return semantic value and location from the
1049 action routines. */
bb10be54 1050 YYSTYPE yyval;
327afc7c 1051]b4_locations_if([ YYLTYPE yyloc;])[
10fa2066 1052
a85284cf 1053 /* The number of symbols on the RHS of the reduced rule.
9d9b8b70 1054 Keep to zero when no symbol should be popped. */
a85284cf 1055 int yylen = 0;
10fa2066 1056
2f4f028d 1057 YYDPRINTF ((stderr, "Starting parse\n"));
10fa2066
RS
1058
1059 yystate = 0;
1060 yyerrstatus = 0;
17da6427 1061 yynerrs = 0;
a20713a4 1062 yychar = YYEMPTY; /* Cause a token to be read. */
10fa2066
RS
1063
1064 /* Initialize stack pointers.
1065 Waste one element of value and location stack
1066 so that they stay on the same level as the state stack.
1067 The wasted elements are never initialized. */
1068
cbd89906 1069 yyssp = yyss;
10fa2066 1070 yyvsp = yyvs;
327afc7c 1071]b4_locations_if([[ yylsp = yyls;
b8458aa5
AD
1072#if YYLTYPE_IS_TRIVIAL
1073 /* Initialize the default location before parsing starts. */
cd48d21d
AD
1074 yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
1075 yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
b8458aa5
AD
1076#endif
1077]])
1078m4_ifdef([b4_initial_action], [
407d4a75
PE
1079m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl
1080m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl
9d9b8b70 1081 /* User initialization code. */
8ec0a172 1082 b4_user_initial_action
cd3684cf 1083m4_popdef([b4_dollar_dollar])dnl
8ec0a172 1084m4_popdef([b4_at_dollar])])dnl
407d4a75
PE
1085m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
1086]])dnl
1087m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
1088]])dnl
1089[ goto yysetstate;
10fa2066 1090
71da9eea
AD
1091/*------------------------------------------------------------.
1092| yynewstate -- Push a new state, which is found in yystate. |
1093`------------------------------------------------------------*/
342b8b6e 1094 yynewstate:
71da9eea 1095 /* In all cases, when you get here, the value and location stacks
9d9b8b70 1096 have just been pushed. So pushing a state here evens the stacks. */
cbd89906
PE
1097 yyssp++;
1098
342b8b6e 1099 yysetstate:
cbd89906 1100 *yyssp = yystate;
10fa2066 1101
39912f52 1102 if (yyss + yystacksize - 1 <= yyssp)
10fa2066 1103 {
10fa2066 1104 /* Get the current used size of the three stacks, in elements. */
7093d0f5 1105 YYSIZE_T yysize = yyssp - yyss + 1;
10fa2066
RS
1106
1107#ifdef yyoverflow
3d76b07d 1108 {
9d9b8b70 1109 /* Give user a chance to reallocate the stack. Use copies of
3d76b07d
AD
1110 these so that the &'s don't force the real ones into
1111 memory. */
1112 YYSTYPE *yyvs1 = yyvs;
d42cf844 1113 yytype_int16 *yyss1 = yyss;
327afc7c 1114]b4_locations_if([ YYLTYPE *yyls1 = yyls;])[
3d76b07d
AD
1115
1116 /* Each stack pointer address is followed by the size of the
58612f1d
AD
1117 data in use in that stack, in bytes. This used to be a
1118 conditional around just the two extra args, but that might
1119 be undefined if yyoverflow is a macro. */
1a059451 1120 yyoverflow (YY_("memory exhausted"),
7093d0f5
AD
1121 &yyss1, yysize * sizeof (*yyssp),
1122 &yyvs1, yysize * sizeof (*yyvsp),
327afc7c 1123]b4_locations_if([ &yyls1, yysize * sizeof (*yylsp),])[
3d76b07d 1124 &yystacksize);
327afc7c 1125]b4_locations_if([ yyls = yyls1;])[
3d76b07d
AD
1126 yyss = yyss1;
1127 yyvs = yyvs1;
1128 }
10fa2066 1129#else /* no yyoverflow */
cf44a9ae 1130# ifndef YYSTACK_RELOCATE
1a059451 1131 goto yyexhaustedlab;
cf44a9ae 1132# else
10fa2066 1133 /* Extend the stack our own way. */
39912f52 1134 if (YYMAXDEPTH <= yystacksize)
1a059451 1135 goto yyexhaustedlab;
10fa2066 1136 yystacksize *= 2;
39912f52 1137 if (YYMAXDEPTH < yystacksize)
10fa2066 1138 yystacksize = YYMAXDEPTH;
e9e4c321 1139
600f9b0c 1140 {
d42cf844 1141 yytype_int16 *yyss1 = yyss;
2729e106
PE
1142 union yyalloc *yyptr =
1143 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
600f9b0c 1144 if (! yyptr)
1a059451 1145 goto yyexhaustedlab;
5b041382
PE
1146 YYSTACK_RELOCATE (yyss);
1147 YYSTACK_RELOCATE (yyvs);
327afc7c 1148]b4_locations_if([ YYSTACK_RELOCATE (yyls);])[
cf44a9ae 1149# undef YYSTACK_RELOCATE
600f9b0c
PE
1150 if (yyss1 != yyssa)
1151 YYSTACK_FREE (yyss1);
1152 }
cf44a9ae 1153# endif
10fa2066
RS
1154#endif /* no yyoverflow */
1155
7093d0f5
AD
1156 yyssp = yyss + yysize - 1;
1157 yyvsp = yyvs + yysize - 1;
327afc7c 1158]b4_locations_if([ yylsp = yyls + yysize - 1;])[
10fa2066 1159
30757c8c 1160 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
600f9b0c 1161 (unsigned long int) yystacksize));
10fa2066 1162
39912f52 1163 if (yyss + yystacksize - 1 <= yyssp)
10fa2066
RS
1164 YYABORT;
1165 }
1166
30757c8c 1167 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
10fa2066 1168
868d2d96
JD
1169 if (yystate == YYFINAL)
1170 YYACCEPT;
1171
10fa2066 1172 goto yybackup;
71da9eea 1173
71da9eea
AD
1174/*-----------.
1175| yybackup. |
1176`-----------*/
1177yybackup:
10fa2066 1178
a85284cf 1179 /* Do appropriate processing given the current state. Read a
742e4900 1180 lookahead token if we need one and don't already have one. */
10fa2066 1181
742e4900 1182 /* First try to decide what to do without reference to lookahead token. */
10fa2066 1183 yyn = yypact[yystate];
12b0043a 1184 if (yyn == YYPACT_NINF)
10fa2066
RS
1185 goto yydefault;
1186
742e4900 1187 /* Not known => get a lookahead token if don't already have one. */
10fa2066 1188
742e4900 1189 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
a20713a4 1190 if (yychar == YYEMPTY)
10fa2066 1191 {
2f4f028d 1192 YYDPRINTF ((stderr, "Reading a token: "));
17da6427 1193 yychar = YYLEX;
10fa2066
RS
1194 }
1195
a20713a4 1196 if (yychar <= YYEOF)
10fa2066 1197 {
a20713a4 1198 yychar = yytoken = YYEOF;
2f4f028d 1199 YYDPRINTF ((stderr, "Now at end of input.\n"));
10fa2066
RS
1200 }
1201 else
1202 {
a20713a4 1203 yytoken = YYTRANSLATE (yychar);
30757c8c 1204 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
10fa2066
RS
1205 }
1206
b0400cc6 1207 /* If the proper action on seeing token YYTOKEN is to reduce or to
e5cfd9d8 1208 detect an error, take that action. */
b0400cc6 1209 yyn += yytoken;
34ec3579 1210 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
e5cfd9d8
PE
1211 goto yydefault;
1212 yyn = yytable[yyn];
1213 if (yyn <= 0)
10fa2066 1214 {
e5cfd9d8
PE
1215 if (yyn == 0 || yyn == YYTABLE_NINF)
1216 goto yyerrlab;
10fa2066
RS
1217 yyn = -yyn;
1218 goto yyreduce;
1219 }
10fa2066 1220
a85284cf
AD
1221 /* Count tokens shifted since error; after three, turn off error
1222 status. */
1223 if (yyerrstatus)
1224 yyerrstatus--;
1225
742e4900 1226 /* Shift the lookahead token. */
30757c8c 1227 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
10fa2066 1228
868d2d96
JD
1229 /* Discard the shifted token. */
1230 yychar = YYEMPTY;
10fa2066 1231
a85284cf 1232 yystate = yyn;
17da6427 1233 *++yyvsp = yylval;
327afc7c 1234]b4_locations_if([ *++yylsp = yylloc;])[
10fa2066
RS
1235 goto yynewstate;
1236
10fa2066 1237
71da9eea
AD
1238/*-----------------------------------------------------------.
1239| yydefault -- do the default action for the current state. |
1240`-----------------------------------------------------------*/
1241yydefault:
10fa2066
RS
1242 yyn = yydefact[yystate];
1243 if (yyn == 0)
1244 goto yyerrlab;
71da9eea 1245 goto yyreduce;
10fa2066 1246
71da9eea
AD
1247
1248/*-----------------------------.
1249| yyreduce -- Do a reduction. |
1250`-----------------------------*/
10fa2066 1251yyreduce:
71da9eea 1252 /* yyn is the number of a rule to reduce with. */
10fa2066 1253 yylen = yyr2[yyn];
da9abf43
AD
1254
1255 /* If YYLEN is nonzero, implement the default value of the action:
573c1d9f 1256 `$$ = $1'.
da9abf43 1257
accea6db
PE
1258 Otherwise, the following line sets YYVAL to garbage.
1259 This behavior is undocumented and Bison
da9abf43
AD
1260 users should not rely upon it. Assigning to YYVAL
1261 unconditionally makes the parser a bit smaller, and it avoids a
1262 GCC warning that YYVAL may be used uninitialized. */
1263 yyval = yyvsp[1-yylen];
3abcd459 1264
327afc7c 1265]b4_locations_if(
9d9b8b70 1266[[ /* Default location. */
401aace6 1267 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
d9963c85 1268 YY_REDUCE_PRINT (yyn);
a8289c62 1269 switch (yyn)
d1ff7a7c 1270 {
8ec0a172 1271 ]b4_user_actions[
95f22ad2 1272 default: break;
a8289c62 1273 }
d1ff7a7c 1274 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
897668ee 1275
a85284cf
AD
1276 YYPOPSTACK (yylen);
1277 yylen = 0;
b0937b22 1278 YY_STACK_PRINT (yyss, yyssp);
10fa2066
RS
1279
1280 *++yyvsp = yyval;
327afc7c 1281]b4_locations_if([ *++yylsp = yyloc;])[
10fa2066 1282
41aca2e0
AD
1283 /* Now `shift' the result of the reduction. Determine what state
1284 that goes to, based on the state we popped back to and the rule
1285 number reduced by. */
10fa2066
RS
1286
1287 yyn = yyr1[yyn];
1288
7742ddeb 1289 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
34ec3579 1290 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
10fa2066
RS
1291 yystate = yytable[yystate];
1292 else
7742ddeb 1293 yystate = yydefgoto[yyn - YYNTOKENS];
10fa2066
RS
1294
1295 goto yynewstate;
1296
10fa2066 1297
71da9eea
AD
1298/*------------------------------------.
1299| yyerrlab -- here on detecting error |
1300`------------------------------------*/
1301yyerrlab:
1302 /* If not already recovering from an error, report this error. */
1303 if (!yyerrstatus)
10fa2066 1304 {
17da6427 1305 ++yynerrs;
b4c1f9d2
PE
1306#if ! YYERROR_VERBOSE
1307 yyerror (]b4_yyerror_args[YY_("syntax error"));
1308#else
1309 {
1310 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1311 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1312 {
1313 YYSIZE_T yyalloc = 2 * yysize;
1314 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1315 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1316 if (yymsg != yymsgbuf)
1317 YYSTACK_FREE (yymsg);
1318 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1319 if (yymsg)
1320 yymsg_alloc = yyalloc;
1321 else
3aa2f55d 1322 {
b4c1f9d2
PE
1323 yymsg = yymsgbuf;
1324 yymsg_alloc = sizeof yymsgbuf;
3aa2f55d 1325 }
b4c1f9d2 1326 }
df5aed8c 1327
b4c1f9d2
PE
1328 if (0 < yysize && yysize <= yymsg_alloc)
1329 {
1330 (void) yysyntax_error (yymsg, yystate, yychar);
1331 yyerror (]b4_yyerror_args[yymsg);
1332 }
1333 else
1334 {
1335 yyerror (]b4_yyerror_args[YY_("syntax error"));
1336 if (yysize != 0)
1a059451 1337 goto yyexhaustedlab;
b4c1f9d2
PE
1338 }
1339 }
1340#endif
10fa2066 1341 }
71da9eea 1342
327afc7c 1343]b4_locations_if([[ yyerror_range[0] = yylloc;]])[
d42f69cd 1344
10fa2066
RS
1345 if (yyerrstatus == 3)
1346 {
742e4900 1347 /* If just tried and failed to reuse lookahead token after an
71da9eea 1348 error, discard it. */
10fa2066 1349
a6b89bb2 1350 if (yychar <= YYEOF)
02650b7f 1351 {
258b75ca 1352 /* Return failure if at end of input. */
a6b89bb2 1353 if (yychar == YYEOF)
80ce3401 1354 YYABORT;
02650b7f 1355 }
a6b89bb2
PE
1356 else
1357 {
4b367315 1358 yydestruct ("Error: discarding",
327afc7c 1359 yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
a6b89bb2 1360 yychar = YYEMPTY;
a6b89bb2 1361 }
10fa2066
RS
1362 }
1363
742e4900 1364 /* Else will try to reuse lookahead token after shifting the error
71da9eea 1365 token. */
8a3eb3c8 1366 goto yyerrlab1;
300a7966 1367
10fa2066 1368
a6b89bb2
PE
1369/*---------------------------------------------------.
1370| yyerrorlab -- error raised explicitly by YYERROR. |
1371`---------------------------------------------------*/
1372yyerrorlab:
1373
c7a65b99
PE
1374 /* Pacify compilers like GCC when the user code never invokes
1375 YYERROR and the label yyerrorlab therefore never appears in user
1376 code. */
2a4647a3 1377 if (/*CONSTCOND*/ 0)
a6b89bb2 1378 goto yyerrorlab;
a6b89bb2 1379
327afc7c 1380]b4_locations_if([[ yyerror_range[0] = yylsp[1-yylen];
a85284cf 1381]])[ /* Do not reclaim the symbols of the rule which action triggered
9d9b8b70 1382 this YYERROR. */
a85284cf
AD
1383 YYPOPSTACK (yylen);
1384 yylen = 0;
1385 YY_STACK_PRINT (yyss, yyssp);
a6b89bb2 1386 yystate = *yyssp;
3fc16193 1387 goto yyerrlab1;
a6b89bb2
PE
1388
1389
1390/*-------------------------------------------------------------.
1391| yyerrlab1 -- common code for both syntax error and YYERROR. |
1392`-------------------------------------------------------------*/
300a7966 1393yyerrlab1:
cf44a9ae 1394 yyerrstatus = 3; /* Each real token shifted decrements this. */
10fa2066 1395
660bc8dd
PE
1396 for (;;)
1397 {
1398 yyn = yypact[yystate];
12b0043a 1399 if (yyn != YYPACT_NINF)
660bc8dd
PE
1400 {
1401 yyn += YYTERROR;
1402 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1403 {
1404 yyn = yytable[yyn];
1405 if (0 < yyn)
1406 break;
1407 }
1408 }
10fa2066 1409
660bc8dd
PE
1410 /* Pop the current state because it cannot handle the error token. */
1411 if (yyssp == yyss)
1412 YYABORT;
5504898e 1413
327afc7c 1414]b4_locations_if([[ yyerror_range[0] = *yylsp;]])[
4b367315 1415 yydestruct ("Error: popping",
327afc7c 1416 yystos[yystate], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
a85284cf 1417 YYPOPSTACK (1);
a6b89bb2 1418 yystate = *yyssp;
b0937b22 1419 YY_STACK_PRINT (yyss, yyssp);
10fa2066 1420 }
10fa2066 1421
17da6427 1422 *++yyvsp = yylval;
327afc7c 1423]b4_locations_if([[
3fc16193
AD
1424 yyerror_range[1] = yylloc;
1425 /* Using YYLLOC is tempting, but would change the location of
742e4900 1426 the lookahead. YYLOC is available though. */
401aace6 1427 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
3fc16193 1428 *++yylsp = yyloc;]])[
10fa2066 1429
9d9b8b70 1430 /* Shift the error token. */
30757c8c 1431 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1576d44d 1432
10fa2066
RS
1433 yystate = yyn;
1434 goto yynewstate;
70ddf897 1435
71da9eea
AD
1436
1437/*-------------------------------------.
1438| yyacceptlab -- YYACCEPT comes here. |
1439`-------------------------------------*/
1440yyacceptlab:
600f9b0c
PE
1441 yyresult = 0;
1442 goto yyreturn;
71da9eea
AD
1443
1444/*-----------------------------------.
1445| yyabortlab -- YYABORT comes here. |
1446`-----------------------------------*/
1447yyabortlab:
600f9b0c
PE
1448 yyresult = 1;
1449 goto yyreturn;
1450
0bfb02ff 1451#ifndef yyoverflow
1a059451
PE
1452/*-------------------------------------------------.
1453| yyexhaustedlab -- memory exhaustion comes here. |
1454`-------------------------------------------------*/
1455yyexhaustedlab:
1456 yyerror (]b4_yyerror_args[YY_("memory exhausted"));
600f9b0c
PE
1457 yyresult = 2;
1458 /* Fall through. */
0bfb02ff 1459#endif
600f9b0c
PE
1460
1461yyreturn:
868d2d96 1462 if (yychar != YYEMPTY)
dd5f2af2 1463 yydestruct ("Cleanup: discarding lookahead",
327afc7c 1464 yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
a85284cf 1465 /* Do not reclaim the symbols of the rule which action triggered
9d9b8b70 1466 this YYABORT or YYACCEPT. */
a85284cf
AD
1467 YYPOPSTACK (yylen);
1468 YY_STACK_PRINT (yyss, yyssp);
258b75ca
PE
1469 while (yyssp != yyss)
1470 {
dd5f2af2 1471 yydestruct ("Cleanup: popping",
327afc7c 1472 yystos[*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
a85284cf 1473 YYPOPSTACK (1);
258b75ca 1474 }
600f9b0c
PE
1475#ifndef yyoverflow
1476 if (yyss != yyssa)
1477 YYSTACK_FREE (yyss);
b4c1f9d2
PE
1478#endif
1479#if YYERROR_VERBOSE
1480 if (yymsg != yymsgbuf)
1481 YYSTACK_FREE (yymsg);
70ddf897 1482#endif
7b5cdcbd
JD
1483 /* Make sure YYID is used. */
1484 return YYID (yyresult);
be2a1a68
AD
1485]}
1486
24c0aad7 1487
be2a1a68 1488b4_epilogue
327afc7c 1489b4_defines_if(
08af01c2 1490[@output(b4_spec_defines_file@)
327afc7c 1491b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl '
e2a21b6f 1492 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])
6e93d810 1493
a4e25e1d 1494b4_percent_code_get([[requires]])[]dnl
9bc0dd67 1495
cf147260 1496b4_token_enums_defines(b4_tokens)
be2a1a68 1497
9bc0dd67
JD
1498[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1499]m4_ifdef([b4_stype],
ddc8ede1 1500[[typedef union ]b4_union_name[
7ecec4dd 1501{
ddc8ede1 1502]b4_user_stype[
7ecec4dd 1503} YYSTYPE;
ddc8ede1
PE
1504# define YYSTYPE_IS_TRIVIAL 1]],
1505[m4_if(b4_tag_seen_flag, 0,
1506[[typedef int YYSTYPE;
1507# define YYSTYPE_IS_TRIVIAL 1]])])[
050c471b
PE
1508# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1509# define YYSTYPE_IS_DECLARED 1
be2a1a68
AD
1510#endif
1511
9bc0dd67 1512]b4_pure_if([],
be2a1a68
AD
1513[extern YYSTYPE b4_prefix[]lval;])
1514
327afc7c 1515b4_locations_if(
02650b7f 1516[#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
050c471b 1517typedef struct YYLTYPE
be2a1a68
AD
1518{
1519 int first_line;
1520 int first_column;
1521 int last_line;
1522 int last_column;
050c471b
PE
1523} YYLTYPE;
1524# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
1525# define YYLTYPE_IS_DECLARED 1
1526# define YYLTYPE_IS_TRIVIAL 1
be2a1a68 1527#endif
ff48177d 1528
9bc0dd67 1529]b4_pure_if([],
327afc7c 1530 [extern YYLTYPE b4_prefix[]lloc;])
9bc0dd67
JD
1531)dnl b4_locations_if
1532
a4e25e1d 1533b4_percent_code_get([[provides]])
327afc7c 1534])dnl b4_defines_if
08af01c2 1535m4_divert_pop(0)
6afc30cc
JD
1536
1537])dnl b4_use_push_for_pull_if