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