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