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