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