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