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