]> git.saurik.com Git - bison.git/blame - data/glr.c
* src/output.c (escaped_output): Renamed from
[bison.git] / data / glr.c
CommitLineData
720623af 1m4_divert(-1) -*- C -*-
01241d47 2
fb8135fa 3# GLR skeleton for Bison
d0d5aa64 4# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
fb8135fa
AD
5
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19# 02111-1307 USA
20
66d30cd4
AD
21
22## ---------------- ##
23## Default values. ##
24## ---------------- ##
25
26# Stack parameters.
27m4_define_default([b4_stack_depth_max], [10000])
28m4_define_default([b4_stack_depth_init], [200])
29
2a8d363a
AD
30
31
32## ------------------------ ##
33## Pure/impure interfaces. ##
34## ------------------------ ##
35
36
37# b4_lex_param
38# ------------
21964f43
AD
39# Accumule in b4_lex_param all the yylex arguments.
40# Yes, this is quite ugly...
41m4_define([b4_lex_param],
42m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[yylvalp]]][]dnl
43b4_location_if([, [[YYLTYPE *], [yyllocp]]])])dnl
44m4_ifdef([b4_lex_param], [, ]b4_lex_param)))
45
2a8d363a
AD
46
47# b4_user_formals
48# ---------------
49m4_define([b4_user_formals],
50[m4_ifset([b4_parse_param], [, b4_c_ansi_formals(b4_parse_param)])])
51
52
93724f13
AD
53# b4_yyerror_args
54# ---------------
55# Arguments passed to yyerror: user args plus yylloc.
56m4_define([b4_yyerror_args],
57[b4_pure_if([b4_location_if([yylocp, ])])dnl
58m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
59
60
61# b4_lyyerror_args
62# ----------------
8dd162d3 63# Same as above, but on the look-ahead, hence yyllocp instead of yylocp.
93724f13
AD
64m4_define([b4_lyyerror_args],
65[b4_pure_if([b4_location_if([yyllocp, ])])dnl
66m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
67
68
2a8d363a
AD
69# b4_pure_args
70# ------------
93724f13 71# Arguments needed by yyerror: user args plus yylloc.
2a8d363a
AD
72m4_define([b4_pure_args],
73[b4_pure_if([b4_location_if([, yylocp])])[]b4_user_args])
74
75
76# b4_pure_formals
77# ---------------
78# Arguments passed to yyerror: user formals plus yyllocp.
79m4_define([b4_pure_formals],
80[b4_pure_if([b4_location_if([, YYLTYPE *yylocp])])[]b4_user_formals])
81
82
83# b4_lpure_args
84# -------------
8dd162d3 85# Same as above, but on the look-ahead, hence yyllocp instead of yylocp.
2a8d363a
AD
86m4_define([b4_lpure_args],
87[b4_pure_if([b4_location_if([, yyllocp])])[]b4_user_args])
0245f82d 88
66d30cd4 89
2a8d363a
AD
90# b4_lpure_formals
91# ----------------
8dd162d3 92# Same as above, but on the look-ahead, hence yyllocp instead of yylocp.
2a8d363a
AD
93m4_define([b4_lpure_formals],
94[b4_pure_if([b4_location_if([YYLTYPE *yyllocp])])[]b4_user_formals])
95
66d30cd4
AD
96
97## ----------------- ##
98## Semantic Values. ##
99## ----------------- ##
100
101
01241d47
PH
102# b4_lhs_value([TYPE])
103# --------------------
104# Expansion of $<TYPE>$.
105m4_define([b4_lhs_value],
bc82c5a5 106[((*yyvalp)[]m4_ifval([$1], [.$1]))])
01241d47
PH
107
108
109# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
110# --------------------------------------
111# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
112# symbols on RHS.
113m4_define([b4_rhs_value],
bc82c5a5 114[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))])
01241d47
PH
115
116
117
118## ----------- ##
119## Locations. ##
120## ----------- ##
121
01241d47
PH
122# b4_lhs_location()
123# -----------------
124# Expansion of @$.
125m4_define([b4_lhs_location],
126[(*yylocp)])
127
128
129# b4_rhs_location(RULE-LENGTH, NUM)
130# ---------------------------------
131# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
132# on RHS.
133m4_define([b4_rhs_location],
bc82c5a5 134[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc)])
01241d47 135
b526ee61
AD
136# We do want M4 expansion after # for CPP macros.
137m4_changecom()
01241d47 138m4_divert(0)dnl
947427ae 139@output @output_parser_name@
779e7ceb 140b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003, 2004])
fb8135fa 141[
01241d47
PH
142/* This is the parser code for GLR (Generalized LR) parser. */
143
cf126971
PE
144#include <stdio.h>
145#include <stdlib.h>
146#include <string.h>
2a8d363a
AD
147#include <stdarg.h>
148#include <setjmp.h>
01241d47 149
2a8d363a
AD
150]b4_identification
151m4_if(b4_prefix[], [yy], [],
c5b95ccf 152[/* Substitute the variable and function names. */
01241d47
PH
153#define yyparse b4_prefix[]parse
154#define yylex b4_prefix[]lex
155#define yyerror b4_prefix[]error
156#define yylval b4_prefix[]lval
157#define yychar b4_prefix[]char
158#define yydebug b4_prefix[]debug
159#define yynerrs b4_prefix[]nerrs
383e69dc 160#define yylloc b4_prefix[]lloc])
01241d47 161
17acead5 162b4_token_defines(b4_tokens)
01241d47 163
17acead5
PE
164/* Copy the first part of user declarations. */
165b4_pre_prologue[
01241d47
PH
166
167/* Enabling traces. */
168#ifndef YYDEBUG
169# define YYDEBUG ]b4_debug[
170#endif
171
172/* Enabling verbose error messages. */
173#ifdef YYERROR_VERBOSE
174# undef YYERROR_VERBOSE
175# define YYERROR_VERBOSE 1
176#else
177# define YYERROR_VERBOSE ]b4_error_verbose[
178#endif
179
fa8c3ebc 180#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
01241d47 181]m4_ifdef([b4_stype],
437c2d80 182[b4_syncline([b4_stype_line], [b4_filename])
fa8c3ebc 183typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
996b1c7e 184/* Line __line__ of glr.c. */
947427ae 185b4_syncline([@oline@], [@ofile@])],
fa8c3ebc
PE
186[typedef int YYSTYPE;])[
187# define YYSTYPE_IS_DECLARED 1
01241d47
PH
188# define YYSTYPE_IS_TRIVIAL 1
189#endif
190
fa8c3ebc
PE
191#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
192typedef struct YYLTYPE
01241d47 193{
25005f6a 194]b4_location_if([
f50adbbd
AD
195 int first_line;
196 int first_column;
197 int last_line;
ffa4c58a 198 int last_column;
5cc16ecc
PE
199],[
200 char yydummy;
25005f6a 201])[
fa8c3ebc
PE
202} YYLTYPE;
203# define YYLTYPE_IS_DECLARED 1
01241d47
PH
204# define YYLTYPE_IS_TRIVIAL 1
205#endif
206
288006a2 207/* Default (constant) value used for initialization for null
f6abc26e 208 right-hand sides. Unlike the standard yacc.c template,
288006a2 209 here we set the default value of $$ to a zeroed-out value.
b9b51bf0
PE
210 Since the default value is undefined, this behavior is
211 technically correct. */
01241d47 212static YYSTYPE yyval_default;
01241d47
PH
213
214/* Copy the second part of user declarations. */
215]b4_post_prologue[
216
996b1c7e 217]/* Line __line__ of glr.c. */
947427ae 218b4_syncline([@oline@], [@ofile@])
01241d47 219[
a525b568
PE
220#ifndef YYFREE
221# define YYFREE free
222#endif
223#ifndef YYMALLOC
224# define YYMALLOC malloc
225#endif
226#ifndef YYREALLOC
227# define YYREALLOC realloc
228#endif
229
f7c398aa
PE
230#ifdef __cplusplus
231 typedef bool yybool;
232#else
233 typedef unsigned char yybool;
01241d47 234#endif
f7c398aa
PE
235#define yytrue 1
236#define yyfalse 0
01241d47 237
1154cced
AD
238/*-----------------.
239| GCC extensions. |
240`-----------------*/
241
242#ifndef __attribute__
243/* This feature is available in gcc versions 2.5 and later. */
244# if !defined (__GNUC__) || __GNUC__ < 2 || \
245(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
246# define __attribute__(Spec) /* empty */
247# endif
248#endif
249
64c4fd52
PE
250#ifndef YYASSERT
251# define YYASSERT(condition) ((void) ((condition) || (abort (), 0)))
252#endif
253
1154cced
AD
254#ifndef ATTRIBUTE_UNUSED
255# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
256#endif
257
01241d47 258/* YYFINAL -- State number of the termination state. */
7db2ed2d 259#define YYFINAL ]b4_final_state_number[
39912f52 260/* YYLAST -- Last index in YYTABLE. */
01241d47
PH
261#define YYLAST ]b4_last[
262
263/* YYNTOKENS -- Number of terminals. */
7db2ed2d 264#define YYNTOKENS ]b4_tokens_number[
01241d47 265/* YYNNTS -- Number of nonterminals. */
7db2ed2d 266#define YYNNTS ]b4_nterms_number[
01241d47 267/* YYNRULES -- Number of rules. */
7db2ed2d 268#define YYNRULES ]b4_rules_number[
01241d47 269/* YYNRULES -- Number of states. */
7db2ed2d 270#define YYNSTATES ]b4_states_number[
01241d47
PH
271/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */
272#define YYMAXRHS ]b4_r2_max[
25005f6a
PH
273/* YYMAXLEFT -- Maximum number of symbols to the left of a handle
274 accessed by $0, $-1, etc., in any rule. */
275#define YYMAXLEFT ]b4_max_left_semantic_context[
01241d47
PH
276
277/* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */
278#define YYUNDEFTOK ]b4_undef_token_number[
279#define YYMAXUTOK ]b4_user_token_number_max[
280
5cc16ecc 281#define YYTRANSLATE(YYX) \
b0400cc6 282 ((YYX <= 0) ? YYEOF : \
779e7ceb 283 (unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
01241d47
PH
284
285/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
a762e609 286static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
01241d47
PH
287{
288 ]b4_translate[
289};
290
291#if YYDEBUG
292/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
293 YYRHS. */
a762e609 294static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
01241d47
PH
295{
296 ]b4_prhs[
297};
298
299/* YYRHS -- A `-1'-separated list of the rules' RHS. */
a762e609 300static const ]b4_int_type_for([b4_rhs])[ yyrhs[] =
01241d47
PH
301{
302 ]b4_rhs[
303};
304
305/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
a762e609 306static const ]b4_int_type_for([b4_rline])[ yyrline[] =
01241d47
PH
307{
308 ]b4_rline[
309};
310#endif
311
312#if (YYDEBUG) || YYERROR_VERBOSE
313/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
314 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
315static const char *const yytname[] =
316{
317 ]b4_tname[
318};
01241d47
PH
319#endif
320
321/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
a762e609 322static const ]b4_int_type_for([b4_r1])[ yyr1[] =
01241d47
PH
323{
324 ]b4_r1[
325};
326
327/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
a762e609 328static const ]b4_int_type_for([b4_r2])[ yyr2[] =
01241d47
PH
329{
330 ]b4_r2[
331};
332
333/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */
a762e609 334static const ]b4_int_type_for([b4_dprec])[ yydprec[] =
01241d47
PH
335{
336 ]b4_dprec[
337};
338
339/* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */
a762e609 340static const ]b4_int_type_for([b4_merger])[ yymerger[] =
01241d47
PH
341{
342 ]b4_merger[
343};
344
345/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
346 doesn't specify something else to do. Zero means the default is an
347 error. */
a762e609 348static const ]b4_int_type_for([b4_defact])[ yydefact[] =
01241d47
PH
349{
350 ]b4_defact[
351};
352
12b0043a 353/* YYPDEFGOTO[NTERM-NUM]. */
a762e609 354static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] =
01241d47
PH
355{
356 ]b4_defgoto[
357};
358
359/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
360 STATE-NUM. */
12b0043a 361#define YYPACT_NINF ]b4_pact_ninf[
a762e609 362static const ]b4_int_type_for([b4_pact])[ yypact[] =
01241d47
PH
363{
364 ]b4_pact[
365};
366
367/* YYPGOTO[NTERM-NUM]. */
a762e609 368static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
01241d47
PH
369{
370 ]b4_pgoto[
371};
372
373/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
374 positive, shift that token. If negative, reduce the rule which
f50adbbd 375 number is the opposite. If zero, do what YYDEFACT says.
6e649e65 376 If YYTABLE_NINF, syntax error. */
12b0043a 377#define YYTABLE_NINF ]b4_table_ninf[
a762e609 378static const ]b4_int_type_for([b4_table])[ yytable[] =
01241d47
PH
379{
380 ]b4_table[
381};
382
ea99527d
AD
383/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
384 list of conflicting reductions corresponding to action entry for
385 state STATE-NUM in yytable. 0 means no conflicts. The list in
386 yyconfl is terminated by a rule number of 0. */
a762e609 387static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
01241d47
PH
388{
389 ]b4_conflict_list_heads[
390};
391
ea99527d
AD
392/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
393 0, pointed into by YYCONFLP. */
a762e609 394]dnl Do not use b4_int_type_for here, since there are places where
779e7ceb 395dnl pointers onto yyconfl are taken, which type is "short int *".
a762e609 396dnl We probably ought to introduce a type for confl.
779e7ceb 397[static const short int yyconfl[] =
01241d47
PH
398{
399 ]b4_conflicting_rules[
400};
401
a762e609 402static const ]b4_int_type_for([b4_check])[ yycheck[] =
01241d47
PH
403{
404 ]b4_check[
405};
406
7bd6c77e
AD
407/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
408 symbol of state STATE-NUM. */
409static const ]b4_int_type_for([b4_stos])[ yystos[] =
410{
411 ]b4_stos[
412};
413
01241d47 414\f
0245f82d 415/* Prevent warning if -Wmissing-prototypes. */
2a8d363a 416]b4_c_ansi_function_decl([yyparse], [int], b4_parse_param)[
e7cb57c0 417
2a8d363a 418/* Error token number */
01241d47
PH
419#define YYTERROR 1
420
b4a20338
AD
421/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
422 If N is 0, then set CURRENT to the empty location which ends
423 the previous symbol: RHS[0] (always defined). */
01241d47 424
25005f6a 425]b4_location_if([[
9fafc4dd 426#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
01241d47 427#ifndef YYLLOC_DEFAULT
9fafc4dd
PE
428# define YYLLOC_DEFAULT(Current, Rhs, N) \
429 do \
430 if (N) \
431 { \
9bec482e
PE
432 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
433 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
434 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
435 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
9fafc4dd
PE
436 } \
437 else \
438 { \
439 (Current).first_line = (Current).last_line = \
9bec482e 440 YYRHSLOC (Rhs, 0).last_line; \
9fafc4dd 441 (Current).first_column = (Current).last_column = \
9bec482e 442 YYRHSLOC (Rhs, 0).last_column; \
9fafc4dd
PE
443 } \
444 while (0)
3fc16193
AD
445
446/* YY_LOCATION_PRINT -- Print the location on the stream.
447 This macro was not mandated originally: define only if we know
448 we won't break user code: when these are the locations we know. */
449
450# define YY_LOCATION_PRINT(File, Loc) \
451 fprintf (File, "%d.%d-%d.%d", \
452 (Loc).first_line, (Loc).first_column, \
453 (Loc).last_line, (Loc).last_column)
25005f6a
PH
454#endif
455]],[
456#ifndef YYLLOC_DEFAULT
9fafc4dd 457# define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0)
01241d47 458#endif
25005f6a
PH
459])[
460
3fc16193
AD
461#ifndef YY_LOCATION_PRINT
462# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
463#endif
464
01241d47
PH
465
466/* YYLEX -- calling `yylex' with the right arguments. */
21964f43 467#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
01241d47
PH
468
469]b4_pure_if(
470[
01241d47
PH
471#undef yynerrs
472#define yynerrs (yystack->yyerrcnt)
473#undef yychar
474#define yychar (yystack->yyrawchar)],
475[YYSTYPE yylval;
476
477YYLTYPE yylloc;
478
479int yynerrs;
480int yychar;])[
481
482static const int YYEOF = 0;
483static const int YYEMPTY = -2;
484
485typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
486
487#define YYCHK(YYE) \
5cc16ecc 488 do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \
01241d47
PH
489 while (0)
490
491#if YYDEBUG
492
493#if ! defined (YYFPRINTF)
494# define YYFPRINTF fprintf
495#endif
496
497# define YYDPRINTF(Args) \
498do { \
499 if (yydebug) \
500 YYFPRINTF Args; \
501} while (0)
7bd6c77e
AD
502
503]b4_yysymprint_generate([b4_c_ansi_function_def])[
504
284acc8b 505# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
9c1e26bd
AD
506do { \
507 if (yydebug) \
508 { \
509 YYFPRINTF (stderr, "%s ", Title); \
5cc16ecc 510 yysymprint (stderr, \
284acc8b 511 Type, Value]b4_location_if([, Location])[); \
9c1e26bd
AD
512 YYFPRINTF (stderr, "\n"); \
513 } \
514} while (0)
515
01241d47
PH
516/* Nonzero means print parse trace. It is left uninitialized so that
517 multiple parsers can coexist. */
518int yydebug;
7bd6c77e 519
01241d47 520#else /* !YYDEBUG */
7bd6c77e 521
ee16363f 522# define YYDPRINTF(Args)
284acc8b 523# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
7bd6c77e 524
01241d47
PH
525#endif /* !YYDEBUG */
526
527/* YYINITDEPTH -- initial size of the parser's stacks. */
528#ifndef YYINITDEPTH
66d30cd4 529# define YYINITDEPTH ]b4_stack_depth_init[
01241d47
PH
530#endif
531
532/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
533 if the built-in stack extension method is used).
534
535 Do not make this value too large; the results are undefined if
fb8135fa 536 SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem)
01241d47
PH
537 evaluated with infinite-precision integer arithmetic. */
538
01241d47 539#ifndef YYMAXDEPTH
66d30cd4 540# define YYMAXDEPTH ]b4_stack_depth_max[
01241d47
PH
541#endif
542
543/* Minimum number of free items on the stack allowed after an
fb8135fa
AD
544 allocation. This is to allow allocation and initialization
545 to be completed by functions that call expandGLRStack before the
546 stack is expanded, thus insuring that all necessary pointers get
01241d47
PH
547 properly redirected to new data. */
548#define YYHEADROOM 2
549
fa8c3ebc
PE
550#if (! defined (YYSTACKEXPANDABLE) \
551 && (! defined (__cplusplus) \
f5452625
PE
552 || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
553 && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
01241d47
PH
554#define YYSTACKEXPANDABLE 1
555#else
556#define YYSTACKEXPANDABLE 0
557#endif
558
559/** State numbers, as in LALR(1) machine */
560typedef int yyStateNum;
561
562/** Rule numbers, as in LALR(1) machine */
563typedef int yyRuleNum;
564
565/** Grammar symbol */
779e7ceb 566typedef short int yySymbol;
01241d47
PH
567
568/** Item references, as in LALR(1) machine */
779e7ceb 569typedef short int yyItemNum;
01241d47
PH
570
571typedef struct yyGLRState yyGLRState;
572typedef struct yySemanticOption yySemanticOption;
573typedef union yyGLRStackItem yyGLRStackItem;
574typedef struct yyGLRStack yyGLRStack;
575typedef struct yyGLRStateSet yyGLRStateSet;
576
577struct yyGLRState {
f7c398aa
PE
578 yybool yyisState;
579 yybool yyresolved;
01241d47
PH
580 yyStateNum yylrState;
581 yyGLRState* yypred;
582 size_t yyposn;
583 union {
584 yySemanticOption* yyfirstVal;
585 YYSTYPE yysval;
586 } yysemantics;
587 YYLTYPE yyloc;
588};
589
590struct yyGLRStateSet {
591 yyGLRState** yystates;
592 size_t yysize, yycapacity;
593};
594
595struct yySemanticOption {
f7c398aa 596 yybool yyisState;
01241d47
PH
597 yyRuleNum yyrule;
598 yyGLRState* yystate;
599 yySemanticOption* yynext;
600};
601
602union yyGLRStackItem {
603 yyGLRState yystate;
604 yySemanticOption yyoption;
605};
606
607struct yyGLRStack {
608 int yyerrflag;
609 int yyerrState;
63d72da7
PE
610]b4_location_if([[ /* To compute the location of the error token. */
611 yyGLRStackItem yyerror_range[3];]])[
01241d47
PH
612]b4_pure_if(
613[
614 int yyerrcnt;
615 int yyrawchar;
616])[
617 yySymbol* yytokenp;
618 jmp_buf yyexception_buffer;
619 yyGLRStackItem* yyitems;
620 yyGLRStackItem* yynextFree;
621 int yyspaceLeft;
622 yyGLRState* yysplitPoint;
623 yyGLRState* yylastDeleted;
624 yyGLRStateSet yytops;
625};
626
627static void yyinitGLRStack (yyGLRStack* yystack, size_t yysize);
2a8d363a 628static void yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[);
01241d47
PH
629static void yyfreeGLRStack (yyGLRStack* yystack);
630
631static void
2a8d363a 632yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yyformat, ...)
01241d47 633{
970785f1 634 yystack->yyerrflag = 1;
01241d47
PH
635 if (yyformat != NULL)
636 {
637 char yymsg[256];
638 va_list yyap;
639 va_start (yyap, yyformat);
01241d47 640 vsprintf (yymsg, yyformat, yyap);
93724f13 641 yyerror (]b4_yyerror_args[yymsg);
01241d47
PH
642 }
643 longjmp (yystack->yyexception_buffer, 1);
644}
645
646#if YYDEBUG || YYERROR_VERBOSE
647/** A printable representation of TOKEN. Valid until next call to
648 * tokenName. */
fb8135fa
AD
649static inline const char*
650yytokenName (yySymbol yytoken)
01241d47 651{
d0d5aa64
PE
652 if (yytoken == YYEMPTY)
653 return "";
654
01241d47
PH
655 return yytname[yytoken];
656}
657#endif
658
f868dc04
PH
659/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
660 * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
c4749565 661 * containing the pointer to the next state in the chain. Assumes
6a84279c
PE
662 * YYLOW1 < YYLOW0. */
663static void yyfillin (yyGLRStackItem *, int, int) ATTRIBUTE_UNUSED;
664static void
665yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
f868dc04
PH
666{
667 yyGLRState* s;
668 int i;
c4749565 669 s = yyvsp[yylow0].yystate.yypred;
f868dc04
PH
670 for (i = yylow0-1; i >= yylow1; i -= 1)
671 {
64c4fd52 672 YYASSERT (s->yyresolved);
f868dc04
PH
673 yyvsp[i].yystate.yyresolved = yytrue;
674 yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;
675 yyvsp[i].yystate.yyloc = s->yyloc;
676 s = yyvsp[i].yystate.yypred = s->yypred;
677 }
6a84279c
PE
678}
679
680/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
681 YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
682 For convenience, always return YYLOW1. */
683static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
684 ATTRIBUTE_UNUSED;
685static inline int
686yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
687{
688 if (!yynormal && yylow1 < *yylow)
689 {
690 yyfillin (yyvsp, *yylow, yylow1);
691 *yylow = yylow1;
692 }
f868dc04
PH
693 return yylow1;
694}
695
01241d47
PH
696/** Perform user action for rule number YYN, with RHS length YYRHSLEN,
697 * and top stack item YYVSP. YYLVALP points to place to put semantic
698 * value ($$), and yylocp points to place for location information
947427ae 699 * (@@$). Returns yyok for normal return, yyaccept for YYACCEPT,
01241d47
PH
700 * yyerr for YYERROR, yyabort for YYABORT. */
701static YYRESULTTAG
fb8135fa 702yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
80a18357
PE
703 YYSTYPE* yyvalp,
704 YYLTYPE* yylocp]b4_location_if(, [ ATTRIBUTE_UNUSED])[,
705 yyGLRStack* yystack
2a8d363a 706 ]b4_user_formals[)
01241d47 707{
6a84279c 708 yybool yynormal ATTRIBUTE_UNUSED = (yystack->yysplitPoint == NULL);
f868dc04 709 int yylow;
1154cced 710
01241d47
PH
711# undef yyerrok
712# define yyerrok (yystack->yyerrState = 0)
713# undef YYACCEPT
714# define YYACCEPT return yyaccept
715# undef YYABORT
716# define YYABORT return yyabort
717# undef YYERROR
5cc16ecc 718# define YYERROR return yyerrok, yyerr
01241d47
PH
719# undef YYRECOVERING
720# define YYRECOVERING (yystack->yyerrState != 0)
721# undef yyclearin
722# define yyclearin (yychar = *(yystack->yytokenp) = YYEMPTY)
f868dc04 723# undef YYFILL
6a84279c 724# define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal)
01241d47
PH
725# undef YYBACKUP
726# define YYBACKUP(Token, Value) \
5cc16ecc
PE
727 return yyerror (]b4_yyerror_args["syntax error: cannot back up"), \
728 yyerrok, yyerr
01241d47 729
25005f6a
PH
730 yylow = 1;
731 if (yyrhslen == 0)
b4a20338 732 *yyvalp = yyval_default;
25005f6a 733 else
b4a20338
AD
734 *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;
735 YYLLOC_DEFAULT (*yylocp, yyvsp - yyrhslen, yyrhslen);
01241d47 736]
25005f6a
PH
737 switch (yyn)
738 {
739 b4_actions
95f22ad2 740 default: break;
25005f6a 741 }
01241d47 742
25005f6a 743 return yyok;
01241d47
PH
744# undef yyerrok
745# undef YYABORT
746# undef YYACCEPT
747# undef YYERROR
748# undef YYBACKUP
749# undef yyclearin
750# undef YYRECOVERING
996b1c7e 751/* Line __line__ of glr.c. */
947427ae 752b4_syncline([@oline@], [@ofile@])
01241d47
PH
753}
754\f
755
7b98f503 756static void
01241d47
PH
757yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
758{
2a8d363a 759 /* `Use' the arguments. */
1154cced
AD
760 (void) yy0;
761 (void) yy1;
762
fb8135fa 763 switch (yyn)
01241d47
PH
764 {
765 b4_mergers
766 }
01241d47
PH
767}
768[
2a8d363a 769 /* Bison grammar-table manipulation. */
01241d47 770
7bd6c77e
AD
771]b4_yydestruct_generate([b4_c_ansi_function_def])[
772
01241d47
PH
773/** Number of symbols composing the right hand side of rule #RULE. */
774static inline int
fb8135fa 775yyrhsLength (yyRuleNum yyrule)
01241d47
PH
776{
777 return yyr2[yyrule];
778}
779
780/** Left-hand-side symbol for rule #RULE. */
781static inline yySymbol
fb8135fa 782yylhsNonterm (yyRuleNum yyrule)
01241d47
PH
783{
784 return yyr1[yyrule];
785}
786
944ed9f4
PE
787#define yyis_pact_ninf(yystate) \
788 ]m4_if(m4_eval(b4_pact_ninf < b4_pact_min), 1,
789 0,
790 ((yystate) == YYPACT_NINF))[
791
01241d47
PH
792/** True iff LR state STATE has only a default reduction (regardless
793 * of token). */
f7c398aa 794static inline yybool
01241d47
PH
795yyisDefaultedState (yyStateNum yystate)
796{
944ed9f4 797 return yyis_pact_ninf (yypact[yystate]);
01241d47 798}
fb8135fa 799
01241d47
PH
800/** The default reduction for STATE, assuming it has one. */
801static inline yyRuleNum
802yydefaultAction (yyStateNum yystate)
803{
804 return yydefact[yystate];
805}
806
df38312a 807#define yyis_table_ninf(yytable_value) \
944ed9f4
PE
808 ]m4_if(m4_eval(b4_table_ninf < b4_table_min), 1,
809 0,
df38312a 810 ((yytable_value) == YYTABLE_NINF))[
944ed9f4 811
2a1fe6ed 812/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
01241d47
PH
813 * Result R means
814 * R < 0: Reduce on rule -R.
815 * R = 0: Error.
fb8135fa
AD
816 * R > 0: Shift to state R.
817 * Set *CONFLICTS to a pointer into yyconfl to 0-terminated list of
01241d47
PH
818 * conflicting reductions.
819 */
820static inline void
fb8135fa 821yygetLRActions (yyStateNum yystate, int yytoken,
779e7ceb 822 int* yyaction, const short int** yyconflicts)
01241d47
PH
823{
824 int yyindex = yypact[yystate] + yytoken;
f50adbbd 825 if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
01241d47
PH
826 {
827 *yyaction = -yydefact[yystate];
828 *yyconflicts = yyconfl;
829 }
df38312a 830 else if (! yyis_table_ninf (yytable[yyindex]))
01241d47
PH
831 {
832 *yyaction = yytable[yyindex];
833 *yyconflicts = yyconfl + yyconflp[yyindex];
834 }
f50adbbd
AD
835 else
836 {
837 *yyaction = 0;
838 *yyconflicts = yyconfl + yyconflp[yyindex];
839 }
01241d47
PH
840}
841
842static inline yyStateNum
843yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
844{
845 int yyr;
846 yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
f50adbbd 847 if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
01241d47
PH
848 return yytable[yyr];
849 else
850 return yydefgoto[yylhs - YYNTOKENS];
851}
852
f7c398aa 853static inline yybool
fb8135fa 854yyisShiftAction (int yyaction)
01241d47 855{
39912f52 856 return 0 < yyaction;
01241d47
PH
857}
858
f7c398aa 859static inline yybool
fb8135fa 860yyisErrorAction (int yyaction)
01241d47 861{
f50adbbd 862 return yyaction == 0;
01241d47
PH
863}
864
865 /* GLRStates */
866
1154cced
AD
867static void
868yyaddDeferredAction (yyGLRStack* yystack, yyGLRState* yystate,
2a8d363a 869 yyGLRState* rhs, yyRuleNum yyrule]b4_pure_formals[)
01241d47
PH
870{
871 yySemanticOption* yynewItem;
872 yynewItem = &yystack->yynextFree->yyoption;
873 yystack->yyspaceLeft -= 1;
874 yystack->yynextFree += 1;
875 yynewItem->yyisState = yyfalse;
6fed0802 876 yynewItem->yystate = rhs;
fb8135fa 877 yynewItem->yyrule = yyrule;
01241d47
PH
878 yynewItem->yynext = yystate->yysemantics.yyfirstVal;
879 yystate->yysemantics.yyfirstVal = yynewItem;
880 if (yystack->yyspaceLeft < YYHEADROOM)
2a8d363a 881 yyexpandGLRStack (yystack]b4_pure_args[);
01241d47
PH
882}
883
884 /* GLRStacks */
885
886/** Initialize SET to a singleton set containing an empty stack. */
887static void
888yyinitStateSet (yyGLRStateSet* yyset)
889{
890 yyset->yysize = 1;
891 yyset->yycapacity = 16;
be16239b 892 yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
01241d47
PH
893 yyset->yystates[0] = NULL;
894}
895
fb8135fa 896static void yyfreeStateSet (yyGLRStateSet* yyset)
01241d47 897{
a525b568 898 YYFREE (yyset->yystates);
01241d47
PH
899}
900
901/** Initialize STACK to a single empty stack, with total maximum
902 * capacity for all stacks of SIZE. */
903static void
904yyinitGLRStack (yyGLRStack* yystack, size_t yysize)
905{
906 yystack->yyerrflag = 0;
907 yystack->yyerrState = 0;
908 yynerrs = 0;
909 yystack->yyspaceLeft = yysize;
fb8135fa 910 yystack->yynextFree = yystack->yyitems =
be16239b 911 (yyGLRStackItem*) YYMALLOC (yysize * sizeof yystack->yynextFree[0]);
01241d47
PH
912 yystack->yysplitPoint = NULL;
913 yystack->yylastDeleted = NULL;
914 yyinitStateSet (&yystack->yytops);
915}
916
917#define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \
918 &((YYTOITEMS) - ((YYFROMITEMS) - (yyGLRStackItem*) (YYX)))->YYTYPE
919
920/** If STACK is expandable, extend it. WARNING: Pointers into the
921 stack from outside should be considered invalid after this call.
922 We always expand when there are 1 or fewer items left AFTER an
923 allocation, so that we can avoid having external pointers exist
924 across an allocation. */
925static void
2a8d363a 926yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[)
01241d47
PH
927{
928#if YYSTACKEXPANDABLE
929 yyGLRStack yynewStack;
930 yyGLRStackItem* yyp0, *yyp1;
931 size_t yysize, yynewSize;
932 size_t yyn;
933 yysize = yystack->yynextFree - yystack->yyitems;
39912f52 934 if (YYMAXDEPTH <= yysize)
6e649e65 935 yyFail (yystack][]b4_pure_args[, "parser stack overflow");
01241d47 936 yynewSize = 2*yysize;
39912f52 937 if (YYMAXDEPTH < yynewSize)
01241d47
PH
938 yynewSize = YYMAXDEPTH;
939 yyinitGLRStack (&yynewStack, yynewSize);
fb8135fa 940 for (yyp0 = yystack->yyitems, yyp1 = yynewStack.yyitems, yyn = yysize;
39912f52 941 0 < yyn;
fb8135fa 942 yyn -= 1, yyp0 += 1, yyp1 += 1)
01241d47
PH
943 {
944 *yyp1 = *yyp0;
f7c398aa 945 if (*(yybool *) yyp0)
fb8135fa 946 {
01241d47
PH
947 yyGLRState* yys0 = &yyp0->yystate;
948 yyGLRState* yys1 = &yyp1->yystate;
fb8135fa
AD
949 if (yys0->yypred != NULL)
950 yys1->yypred =
01241d47
PH
951 YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
952 if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != NULL)
fb8135fa 953 yys1->yysemantics.yyfirstVal =
01241d47
PH
954 YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
955 }
fb8135fa 956 else
01241d47
PH
957 {
958 yySemanticOption* yyv0 = &yyp0->yyoption;
959 yySemanticOption* yyv1 = &yyp1->yyoption;
960 if (yyv0->yystate != NULL)
961 yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
962 if (yyv0->yynext != NULL)
963 yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
964 }
965 }
966 if (yystack->yysplitPoint != NULL)
fb8135fa 967 yystack->yysplitPoint = YYRELOC (yystack->yyitems, yynewStack.yyitems,
01241d47 968 yystack->yysplitPoint, yystate);
fb8135fa
AD
969
970 for (yyn = 0; yyn < yystack->yytops.yysize; yyn += 1)
01241d47 971 if (yystack->yytops.yystates[yyn] != NULL)
fb8135fa
AD
972 yystack->yytops.yystates[yyn] =
973 YYRELOC (yystack->yyitems, yynewStack.yyitems,
01241d47 974 yystack->yytops.yystates[yyn], yystate);
a525b568 975 YYFREE (yystack->yyitems);
01241d47
PH
976 yystack->yyitems = yynewStack.yyitems;
977 yystack->yynextFree = yynewStack.yynextFree + yysize;
978 yystack->yyspaceLeft = yynewStack.yyspaceLeft - yysize;
979
980#else
fb8135fa 981
1d2d7edd 982 yyFail (yystack][]b4_pure_args[, "parser stack overflow");
fb8135fa 983#endif
01241d47
PH
984}
985
986static void
fb8135fa 987yyfreeGLRStack (yyGLRStack* yystack)
01241d47 988{
a525b568 989 YYFREE (yystack->yyitems);
01241d47
PH
990 yyfreeStateSet (&yystack->yytops);
991}
992
993/** Assuming that S is a GLRState somewhere on STACK, update the
fb8135fa 994 * splitpoint of STACK, if needed, so that it is at least as deep as
01241d47
PH
995 * S. */
996static inline void
fb8135fa 997yyupdateSplit (yyGLRStack* yystack, yyGLRState* yys)
01241d47 998{
fb8135fa 999 if (yystack->yysplitPoint != NULL && yystack->yysplitPoint > yys)
01241d47
PH
1000 yystack->yysplitPoint = yys;
1001}
1002
1003/** Invalidate stack #K in STACK. */
1004static inline void
fb8135fa 1005yymarkStackDeleted (yyGLRStack* yystack, int yyk)
01241d47
PH
1006{
1007 if (yystack->yytops.yystates[yyk] != NULL)
1008 yystack->yylastDeleted = yystack->yytops.yystates[yyk];
1009 yystack->yytops.yystates[yyk] = NULL;
1010}
1011
fb8135fa 1012/** Undelete the last stack that was marked as deleted. Can only be
01241d47
PH
1013 done once after a deletion, and only when all other stacks have
1014 been deleted. */
1015static void
1016yyundeleteLastStack (yyGLRStack* yystack)
1017{
1018 if (yystack->yylastDeleted == NULL || yystack->yytops.yysize != 0)
1019 return;
fb8135fa 1020 yystack->yytops.yystates[0] = yystack->yylastDeleted;
01241d47
PH
1021 yystack->yytops.yysize = 1;
1022 YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
1023 yystack->yylastDeleted = NULL;
1024}
1025
1026static inline void
1027yyremoveDeletes (yyGLRStack* yystack)
1028{
1154cced 1029 size_t yyi, yyj;
01241d47 1030 yyi = yyj = 0;
fb8135fa 1031 while (yyj < yystack->yytops.yysize)
01241d47
PH
1032 {
1033 if (yystack->yytops.yystates[yyi] == NULL)
1034 {
1154cced 1035 if (yyi == yyj)
ee16363f
PE
1036 {
1037 YYDPRINTF ((stderr, "Removing dead stacks.\n"));
1038 }
01241d47
PH
1039 yystack->yytops.yysize -= 1;
1040 }
fb8135fa 1041 else
01241d47
PH
1042 {
1043 yystack->yytops.yystates[yyj] = yystack->yytops.yystates[yyi];
1044 if (yyj != yyi)
ee16363f 1045 {
08fc98e5
PE
1046 YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n",
1047 (unsigned long int) yyi, (unsigned long int) yyj));
ee16363f 1048 }
01241d47
PH
1049 yyj += 1;
1050 }
1051 yyi += 1;
1052 }
1053}
1054
fb8135fa 1055/** Shift to a new state on stack #K of STACK, corresponding to LR state
01241d47
PH
1056 * LRSTATE, at input position POSN, with (resolved) semantic value SVAL. */
1057static inline void
fb8135fa 1058yyglrShift (yyGLRStack* yystack, int yyk, yyStateNum yylrState, size_t yyposn,
2a8d363a 1059 YYSTYPE yysval, YYLTYPE* yylocp]b4_user_formals[)
01241d47
PH
1060{
1061 yyGLRStackItem* yynewItem;
1062
1063 yynewItem = yystack->yynextFree;
1064 yystack->yynextFree += 1;
1065 yystack->yyspaceLeft -= 1;
1066 yynewItem->yystate.yyisState = yytrue;
1067 yynewItem->yystate.yylrState = yylrState;
1068 yynewItem->yystate.yyposn = yyposn;
1069 yynewItem->yystate.yyresolved = yytrue;
1070 yynewItem->yystate.yypred = yystack->yytops.yystates[yyk];
1071 yystack->yytops.yystates[yyk] = &yynewItem->yystate;
1072 yynewItem->yystate.yysemantics.yysval = yysval;
1073 yynewItem->yystate.yyloc = *yylocp;
1074 if (yystack->yyspaceLeft < YYHEADROOM)
2a8d363a 1075 yyexpandGLRStack (yystack]b4_pure_args[);
01241d47
PH
1076}
1077
f868dc04 1078/** Shift stack #K of YYSTACK, to a new state corresponding to LR
c4749565 1079 * state YYLRSTATE, at input position YYPOSN, with the (unresolved)
f868dc04 1080 * semantic value of YYRHS under the action for YYRULE. */
01241d47 1081static inline void
fb8135fa 1082yyglrShiftDefer (yyGLRStack* yystack, int yyk, yyStateNum yylrState,
2a8d363a 1083 size_t yyposn, yyGLRState* rhs, yyRuleNum yyrule]b4_pure_formals[)
01241d47
PH
1084{
1085 yyGLRStackItem* yynewItem;
1086
1087 yynewItem = yystack->yynextFree;
1088 yynewItem->yystate.yyisState = yytrue;
1089 yynewItem->yystate.yylrState = yylrState;
1090 yynewItem->yystate.yyposn = yyposn;
1091 yynewItem->yystate.yyresolved = yyfalse;
1092 yynewItem->yystate.yypred = yystack->yytops.yystates[yyk];
1093 yynewItem->yystate.yysemantics.yyfirstVal = NULL;
1094 yystack->yytops.yystates[yyk] = &yynewItem->yystate;
1095 yystack->yynextFree += 1;
1096 yystack->yyspaceLeft -= 1;
2a8d363a 1097 yyaddDeferredAction (yystack, &yynewItem->yystate, rhs, yyrule]b4_pure_args[);
01241d47
PH
1098}
1099
1100/** Pop the symbols consumed by reduction #RULE from the top of stack
fb8135fa
AD
1101 * #K of STACK, and perform the appropriate semantic action on their
1102 * semantic values. Assumes that all ambiguities in semantic values
01241d47
PH
1103 * have been previously resolved. Set *VALP to the resulting value,
1104 * and *LOCP to the computed location (if any). Return value is as
1105 * for userAction. */
ff032592 1106static inline YYRESULTTAG
01241d47 1107yydoAction (yyGLRStack* yystack, int yyk, yyRuleNum yyrule,
5cc16ecc 1108 YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
01241d47
PH
1109{
1110 int yynrhs = yyrhsLength (yyrule);
1111
fb8135fa 1112 if (yystack->yysplitPoint == NULL)
01241d47
PH
1113 {
1114 /* Standard special case: single stack. */
6fed0802 1115 yyGLRStackItem* rhs = (yyGLRStackItem*) yystack->yytops.yystates[yyk];
64c4fd52 1116 YYASSERT (yyk == 0);
01241d47
PH
1117 yystack->yynextFree -= yynrhs;
1118 yystack->yyspaceLeft += yynrhs;
1119 yystack->yytops.yystates[0] = & yystack->yynextFree[-1].yystate;
e7cb57c0 1120 return yyuserAction (yyrule, yynrhs, rhs,
2a8d363a 1121 yyvalp, yylocp, yystack]b4_user_args[);
01241d47 1122 }
fb8135fa 1123 else
01241d47
PH
1124 {
1125 int yyi;
1126 yyGLRState* yys;
25005f6a 1127 yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
5cc16ecc 1128 yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred
25005f6a 1129 = yystack->yytops.yystates[yyk];
f868dc04 1130 for (yyi = 0; yyi < yynrhs; yyi += 1)
01241d47 1131 {
f868dc04 1132 yys = yys->yypred;
64c4fd52 1133 YYASSERT (yys);
01241d47
PH
1134 }
1135 yyupdateSplit (yystack, yys);
1136 yystack->yytops.yystates[yyk] = yys;
25005f6a 1137 return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
2a8d363a 1138 yyvalp, yylocp, yystack]b4_user_args[);
01241d47
PH
1139 }
1140}
1141
e7cb57c0
AD
1142#if !YYDEBUG
1143# define YY_REDUCE_PRINT(K, Rule)
1144#else
1145# define YY_REDUCE_PRINT(K, Rule) \
1146do { \
1147 if (yydebug) \
1148 yy_reduce_print (K, Rule); \
1149} while (0)
1150
1151/*----------------------------------------------------------.
1152| Report that the RULE is going to be reduced on stack #K. |
1153`----------------------------------------------------------*/
1154
1155static inline void
1156yy_reduce_print (size_t yyk, yyRuleNum yyrule)
1157{
1158 int yyi;
08fc98e5
PE
1159 YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu), ",
1160 (unsigned long int) yyk, yyrule - 1,
1161 (unsigned long int) yyrline[yyrule]);
e7cb57c0
AD
1162 /* Print the symbols being reduced, and their result. */
1163 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1164 YYFPRINTF (stderr, "%s ", yytokenName (yyrhs[yyi]));
9c1e26bd 1165 YYFPRINTF (stderr, "-> %s\n", yytokenName (yyr1[yyrule]));
e7cb57c0
AD
1166}
1167#endif
1168
01241d47
PH
1169/** Pop items off stack #K of STACK according to grammar rule RULE,
1170 * and push back on the resulting nonterminal symbol. Perform the
fb8135fa 1171 * semantic action associated with RULE and store its value with the
01241d47
PH
1172 * newly pushed state, if FORCEEVAL or if STACK is currently
1173 * unambiguous. Otherwise, store the deferred semantic action with
1174 * the new state. If the new state would have an identical input
1175 * position, LR state, and predecessor to an existing state on the stack,
fb8135fa
AD
1176 * it is identified with that existing state, eliminating stack #K from
1177 * the STACK. In this case, the (necessarily deferred) semantic value is
1178 * added to the options for the existing state's semantic value.
01241d47
PH
1179 */
1180static inline YYRESULTTAG
1154cced 1181yyglrReduce (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
f7c398aa 1182 yybool yyforceEval]b4_pure_formals[)
01241d47 1183{
1154cced 1184 size_t yyposn = yystack->yytops.yystates[yyk]->yyposn;
01241d47 1185
fb8135fa 1186 if (yyforceEval || yystack->yysplitPoint == NULL)
01241d47
PH
1187 {
1188 YYSTYPE yysval;
1189 YYLTYPE yyloc;
fb8135fa 1190
e7cb57c0 1191 YY_REDUCE_PRINT (yyk, yyrule);
2a8d363a 1192 YYCHK (yydoAction (yystack, yyk, yyrule, &yysval, &yyloc]b4_user_args[));
fb8135fa
AD
1193 yyglrShift (yystack, yyk,
1194 yyLRgotoState (yystack->yytops.yystates[yyk]->yylrState,
01241d47 1195 yylhsNonterm (yyrule)),
2a8d363a 1196 yyposn, yysval, &yyloc]b4_user_args[);
01241d47 1197 }
fb8135fa 1198 else
01241d47 1199 {
1154cced
AD
1200 size_t yyi;
1201 int yyn;
01241d47
PH
1202 yyGLRState* yys, *yys0 = yystack->yytops.yystates[yyk];
1203 yyStateNum yynewLRState;
1204
fb8135fa 1205 for (yys = yystack->yytops.yystates[yyk], yyn = yyrhsLength (yyrule);
39912f52 1206 0 < yyn; yyn -= 1)
01241d47
PH
1207 {
1208 yys = yys->yypred;
64c4fd52 1209 YYASSERT (yys);
01241d47
PH
1210 }
1211 yyupdateSplit (yystack, yys);
1212 yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));
fb8135fa 1213 YYDPRINTF ((stderr,
dfc8a220 1214 "Reduced stack %lu by rule #%d; action deferred. Now in state %d.\n",
08fc98e5 1215 (unsigned long int) yyk, yyrule - 1, yynewLRState));
01241d47 1216 for (yyi = 0; yyi < yystack->yytops.yysize; yyi += 1)
fb8135fa 1217 if (yyi != yyk && yystack->yytops.yystates[yyi] != NULL)
01241d47
PH
1218 {
1219 yyGLRState* yyp, *yysplit = yystack->yysplitPoint;
1220 yyp = yystack->yytops.yystates[yyi];
fb8135fa 1221 while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn)
01241d47 1222 {
fb8135fa 1223 if (yyp->yylrState == yynewLRState && yyp->yypred == yys)
01241d47 1224 {
2a8d363a 1225 yyaddDeferredAction (yystack, yyp, yys0, yyrule]b4_pure_args[);
01241d47 1226 yymarkStackDeleted (yystack, yyk);
08fc98e5
PE
1227 YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n",
1228 (unsigned long int) yyk,
1229 (unsigned long int) yyi));
ff032592 1230 return yyok;
01241d47
PH
1231 }
1232 yyp = yyp->yypred;
1233 }
1234 }
1235 yystack->yytops.yystates[yyk] = yys;
2a8d363a 1236 yyglrShiftDefer (yystack, yyk, yynewLRState, yyposn, yys0, yyrule]b4_pure_args[);
fb8135fa 1237 }
ff032592 1238 return yyok;
01241d47
PH
1239}
1240
1241static int
1242yysplitStack (yyGLRStack* yystack, int yyk)
1243{
fb8135fa 1244 if (yystack->yysplitPoint == NULL)
01241d47 1245 {
64c4fd52 1246 YYASSERT (yyk == 0);
01241d47
PH
1247 yystack->yysplitPoint = yystack->yytops.yystates[yyk];
1248 }
fb8135fa 1249 if (yystack->yytops.yysize >= yystack->yytops.yycapacity)
01241d47
PH
1250 {
1251 yystack->yytops.yycapacity *= 2;
fb8135fa 1252 yystack->yytops.yystates =
be16239b
PH
1253 (yyGLRState**) YYREALLOC (yystack->yytops.yystates,
1254 (yystack->yytops.yycapacity
1255 * sizeof yystack->yytops.yystates[0]));
01241d47 1256 }
fb8135fa 1257 yystack->yytops.yystates[yystack->yytops.yysize]
01241d47
PH
1258 = yystack->yytops.yystates[yyk];
1259 yystack->yytops.yysize += 1;
1260 return yystack->yytops.yysize-1;
1261}
1262
1263/** True iff Y0 and Y1 represent identical options at the top level.
1264 * That is, they represent the same rule applied to RHS symbols
1265 * that produce the same terminal symbols. */
f7c398aa 1266static yybool
01241d47
PH
1267yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1)
1268{
fb8135fa 1269 if (yyy0->yyrule == yyy1->yyrule)
01241d47
PH
1270 {
1271 yyGLRState *yys0, *yys1;
1272 int yyn;
fb8135fa 1273 for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
01241d47
PH
1274 yyn = yyrhsLength (yyy0->yyrule);
1275 yyn > 0;
1276 yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
1277 if (yys0->yyposn != yys1->yyposn)
1278 return yyfalse;
1279 return yytrue;
1280 }
1281 else
1282 return yyfalse;
1283}
1284
1285/** Assuming identicalOptions (Y0,Y1), (destructively) merge the
fb8135fa 1286 * alternative semantic values for the RHS-symbols of Y1 into the
01241d47
PH
1287 * corresponding semantic value sets of the symbols of Y0. */
1288static void
1289yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
1290{
1291 yyGLRState *yys0, *yys1;
1292 int yyn;
fb8135fa 1293 for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
01241d47
PH
1294 yyn = yyrhsLength (yyy0->yyrule);
1295 yyn > 0;
1296 yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
1297 if (yys0 == yys1)
1298 break;
fb8135fa 1299 else if (! yys0->yyresolved && ! yys1->yyresolved)
01241d47
PH
1300 {
1301 yySemanticOption* yyz;
fb8135fa 1302 for (yyz = yys0->yysemantics.yyfirstVal; yyz->yynext != NULL;
01241d47 1303 yyz = yyz->yynext)
ee16363f 1304 continue;
01241d47
PH
1305 yyz->yynext = yys1->yysemantics.yyfirstVal;
1306 }
1307}
1308
1309/** Y0 and Y1 represent two possible actions to take in a given
1310 * parsing state; return 0 if no combination is possible,
1311 * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */
1312static int
1154cced 1313yypreference (yySemanticOption* y0, yySemanticOption* y1)
01241d47 1314{
1154cced
AD
1315 yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule;
1316 int p0 = yydprec[r0], p1 = yydprec[r1];
01241d47 1317
1154cced 1318 if (p0 == p1)
01241d47 1319 {
1154cced 1320 if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1])
01241d47
PH
1321 return 0;
1322 else
1323 return 1;
1324 }
1154cced 1325 if (p0 == 0 || p1 == 0)
01241d47 1326 return 0;
1154cced 1327 if (p0 < p1)
01241d47 1328 return 3;
39912f52 1329 if (p1 < p0)
01241d47
PH
1330 return 2;
1331 return 0;
1332}
1333
fb8135fa
AD
1334static YYRESULTTAG yyresolveValue (yySemanticOption* yyoptionList,
1335 yyGLRStack* yystack, YYSTYPE* yyvalp,
2a8d363a 1336 YYLTYPE* yylocp]b4_user_formals[);
01241d47
PH
1337
1338static YYRESULTTAG
2a8d363a 1339yyresolveStates (yyGLRState* yys, int yyn, yyGLRStack* yystack]b4_user_formals[)
01241d47
PH
1340{
1341 YYRESULTTAG yyflag;
39912f52 1342 if (0 < yyn)
01241d47 1343 {
64c4fd52 1344 YYASSERT (yys->yypred);
2a8d363a 1345 yyflag = yyresolveStates (yys->yypred, yyn-1, yystack]b4_user_args[);
01241d47
PH
1346 if (yyflag != yyok)
1347 return yyflag;
fb8135fa 1348 if (! yys->yyresolved)
01241d47
PH
1349 {
1350 yyflag = yyresolveValue (yys->yysemantics.yyfirstVal, yystack,
e7cb57c0 1351 &yys->yysemantics.yysval, &yys->yyloc
2a8d363a 1352 ]b4_user_args[);
01241d47
PH
1353 if (yyflag != yyok)
1354 return yyflag;
1355 yys->yyresolved = yytrue;
1356 }
1357 }
1358 return yyok;
1359}
1360
1361static YYRESULTTAG
fb8135fa 1362yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystack,
2a8d363a 1363 YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
01241d47 1364{
25005f6a 1365 yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
f868dc04 1366 int yynrhs;
01241d47
PH
1367
1368 yynrhs = yyrhsLength (yyopt->yyrule);
2a8d363a 1369 YYCHK (yyresolveStates (yyopt->yystate, yynrhs, yystack]b4_user_args[));
25005f6a 1370 yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;
5cc16ecc 1371 return yyuserAction (yyopt->yyrule, yynrhs,
25005f6a 1372 yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
2a8d363a 1373 yyvalp, yylocp, yystack]b4_user_args[);
01241d47
PH
1374}
1375
1376#if YYDEBUG
e7cb57c0
AD
1377static void
1378yyreportTree (yySemanticOption* yyx, int yyindent)
01241d47
PH
1379{
1380 int yynrhs = yyrhsLength (yyx->yyrule);
1381 int yyi;
1382 yyGLRState* yys;
1383 yyGLRState* yystates[YYMAXRHS];
782a05f9 1384 yyGLRState yyleftmost_state;
01241d47 1385
39912f52 1386 for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
01241d47
PH
1387 yystates[yyi] = yys;
1388 if (yys == NULL)
782a05f9
PE
1389 {
1390 yyleftmost_state.yyposn = 0;
1391 yystates[0] = &yyleftmost_state;
1392 }
01241d47
PH
1393 else
1394 yystates[0] = yys;
1395
39912f52 1396 if (yyx->yystate->yyposn < yys->yyposn + 1)
01241d47 1397 YYFPRINTF (stderr, "%*s%s -> <Rule %d, empty>\n",
fb8135fa 1398 yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
01241d47
PH
1399 yyx->yyrule);
1400 else
08fc98e5 1401 YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n",
01241d47 1402 yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
08fc98e5
PE
1403 yyx->yyrule, (unsigned long int) (yys->yyposn + 1),
1404 (unsigned long int) yyx->yystate->yyposn);
fb8135fa 1405 for (yyi = 1; yyi <= yynrhs; yyi += 1)
01241d47 1406 {
fb8135fa 1407 if (yystates[yyi]->yyresolved)
01241d47
PH
1408 {
1409 if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
1410 YYFPRINTF (stderr, "%*s%s <empty>\n", yyindent+2, "",
1411 yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]));
1412 else
08fc98e5 1413 YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
01241d47 1414 yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]),
08fc98e5
PE
1415 (unsigned long int) (yystates[yyi - 1]->yyposn + 1),
1416 (unsigned long int) yystates[yyi]->yyposn);
01241d47 1417 }
fb8135fa 1418 else
01241d47
PH
1419 yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
1420 }
1421}
fb8135fa 1422#endif
01241d47
PH
1423
1424static void
1425yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1,
2a8d363a 1426 yyGLRStack* yystack]b4_pure_formals[)
01241d47 1427{
1154cced
AD
1428 /* `Unused' warnings. */
1429 (void) yyx0;
1430 (void) yyx1;
1431
01241d47
PH
1432#if YYDEBUG
1433 YYFPRINTF (stderr, "Ambiguity detected.\n");
1434 YYFPRINTF (stderr, "Option 1,\n");
1435 yyreportTree (yyx0, 2);
1436 YYFPRINTF (stderr, "\nOption 2,\n");
1437 yyreportTree (yyx1, 2);
1438 YYFPRINTF (stderr, "\n");
1439#endif
2a8d363a 1440 yyFail (yystack][]b4_pure_args[, "ambiguity detected");
01241d47
PH
1441}
1442
1443
1444/** Resolve the ambiguity represented by OPTIONLIST, perform the indicated
1445 * actions, and return the result. */
1446static YYRESULTTAG
fb8135fa 1447yyresolveValue (yySemanticOption* yyoptionList, yyGLRStack* yystack,
2a8d363a 1448 YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
01241d47
PH
1449{
1450 yySemanticOption* yybest;
1451 yySemanticOption* yyp;
1452 int yymerge;
1453
fb8135fa 1454 yybest = yyoptionList;
01241d47 1455 yymerge = 0;
fb8135fa 1456 for (yyp = yyoptionList->yynext; yyp != NULL; yyp = yyp->yynext)
01241d47
PH
1457 {
1458 if (yyidenticalOptions (yybest, yyp))
1459 yymergeOptionSets (yybest, yyp);
1460 else
fb8135fa 1461 switch (yypreference (yybest, yyp))
01241d47
PH
1462 {
1463 case 0:
2a8d363a 1464 yyreportAmbiguity (yybest, yyp, yystack]b4_pure_args[);
01241d47
PH
1465 break;
1466 case 1:
1467 yymerge = 1;
1468 break;
1469 case 2:
1470 break;
1471 case 3:
1472 yybest = yyp;
1473 yymerge = 0;
1474 break;
1475 }
1476 }
1477
fb8135fa 1478 if (yymerge)
01241d47
PH
1479 {
1480 int yyprec = yydprec[yybest->yyrule];
2a8d363a 1481 YYCHK (yyresolveAction (yybest, yystack, yyvalp, yylocp]b4_user_args[));
fb8135fa 1482 for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext)
01241d47 1483 {
fb8135fa 1484 if (yyprec == yydprec[yyp->yyrule])
01241d47
PH
1485 {
1486 YYSTYPE yyval1;
1487 YYLTYPE yydummy;
2a8d363a 1488 YYCHK (yyresolveAction (yyp, yystack, &yyval1, &yydummy]b4_user_args[));
7b98f503 1489 yyuserMerge (yymerger[yyp->yyrule], yyvalp, &yyval1);
01241d47
PH
1490 }
1491 }
1492 return yyok;
1493 }
1494 else
2a8d363a 1495 return yyresolveAction (yybest, yystack, yyvalp, yylocp]b4_user_args[);
01241d47
PH
1496}
1497
1498static YYRESULTTAG
2a8d363a 1499yyresolveStack (yyGLRStack* yystack]b4_user_formals[)
01241d47 1500{
fb8135fa 1501 if (yystack->yysplitPoint != NULL)
01241d47
PH
1502 {
1503 yyGLRState* yys;
1504 int yyn;
1505
fb8135fa
AD
1506 for (yyn = 0, yys = yystack->yytops.yystates[0];
1507 yys != yystack->yysplitPoint;
01241d47 1508 yys = yys->yypred, yyn += 1)
ee16363f 1509 continue;
e7cb57c0 1510 YYCHK (yyresolveStates (yystack->yytops.yystates[0], yyn, yystack
2a8d363a 1511 ]b4_user_args[));
01241d47
PH
1512 }
1513 return yyok;
1514}
1515
1516static void
fb8135fa 1517yycompressStack (yyGLRStack* yystack)
01241d47
PH
1518{
1519 yyGLRState* yyp, *yyq, *yyr;
1520
1521 if (yystack->yytops.yysize != 1 || yystack->yysplitPoint == NULL)
1522 return;
1523
fb8135fa
AD
1524 for (yyp = yystack->yytops.yystates[0], yyq = yyp->yypred, yyr = NULL;
1525 yyp != yystack->yysplitPoint;
01241d47
PH
1526 yyr = yyp, yyp = yyq, yyq = yyp->yypred)
1527 yyp->yypred = yyr;
fb8135fa 1528
01241d47
PH
1529 yystack->yyspaceLeft += yystack->yynextFree - yystack->yyitems;
1530 yystack->yynextFree = ((yyGLRStackItem*) yystack->yysplitPoint) + 1;
1531 yystack->yyspaceLeft -= yystack->yynextFree - yystack->yyitems;
1532 yystack->yysplitPoint = NULL;
1533 yystack->yylastDeleted = NULL;
fb8135fa
AD
1534
1535 while (yyr != NULL)
1536 {
01241d47
PH
1537 yystack->yynextFree->yystate = *yyr;
1538 yyr = yyr->yypred;
1539 yystack->yynextFree->yystate.yypred = & yystack->yynextFree[-1].yystate;
1540 yystack->yytops.yystates[0] = &yystack->yynextFree->yystate;
1541 yystack->yynextFree += 1;
1542 yystack->yyspaceLeft -= 1;
1543 }
1544}
1545
1546static YYRESULTTAG
fb8135fa 1547yyprocessOneStack (yyGLRStack* yystack, int yyk,
e7cb57c0 1548 size_t yyposn, YYSTYPE* yylvalp, YYLTYPE* yyllocp
2a8d363a 1549 ]b4_user_formals[)
01241d47
PH
1550{
1551 int yyaction;
779e7ceb 1552 const short int* yyconflicts;
01241d47
PH
1553 yyRuleNum yyrule;
1554 yySymbol* const yytokenp = yystack->yytokenp;
1555
fb8135fa 1556 while (yystack->yytops.yystates[yyk] != NULL)
01241d47
PH
1557 {
1558 yyStateNum yystate = yystack->yytops.yystates[yyk]->yylrState;
b0937b22 1559 YYDPRINTF ((stderr, "Stack %d Entering state %d\n", yyk, yystate));
01241d47 1560
64c4fd52
PE
1561 YYASSERT (yystate != YYFINAL);
1562
fb8135fa 1563 if (yyisDefaultedState (yystate))
01241d47
PH
1564 {
1565 yyrule = yydefaultAction (yystate);
fb8135fa 1566 if (yyrule == 0)
01241d47
PH
1567 {
1568 YYDPRINTF ((stderr, "Stack %d dies.\n", yyk));
1569 yymarkStackDeleted (yystack, yyk);
1570 return yyok;
1571 }
2a8d363a 1572 YYCHK (yyglrReduce (yystack, yyk, yyrule, yyfalse]b4_lpure_args[));
01241d47 1573 }
fb8135fa 1574 else
01241d47 1575 {
fb8135fa 1576 if (*yytokenp == YYEMPTY)
01241d47 1577 {
2a1fe6ed 1578 YYDPRINTF ((stderr, "Reading a token: "));
01241d47 1579 yychar = YYLEX;
b0400cc6 1580 *yytokenp = YYTRANSLATE (yychar);
284acc8b 1581 YY_SYMBOL_PRINT ("Next token is", *yytokenp, yylvalp, yyllocp);
01241d47
PH
1582 }
1583 yygetLRActions (yystate, *yytokenp, &yyaction, &yyconflicts);
1584
fb8135fa 1585 while (*yyconflicts != 0)
01241d47
PH
1586 {
1587 int yynewStack = yysplitStack (yystack, yyk);
1588 YYDPRINTF ((stderr, "Splitting off stack %d from %d.\n",
1589 yynewStack, yyk));
e7cb57c0 1590 YYCHK (yyglrReduce (yystack, yynewStack,
2a8d363a 1591 *yyconflicts, yyfalse]b4_lpure_args[));
fb8135fa 1592 YYCHK (yyprocessOneStack (yystack, yynewStack, yyposn,
2a8d363a 1593 yylvalp, yyllocp]b4_user_args[));
01241d47
PH
1594 yyconflicts += 1;
1595 }
fb8135fa
AD
1596
1597 if (yyisShiftAction (yyaction))
01241d47 1598 {
1576d44d 1599 YYDPRINTF ((stderr, "On stack %d, ", yyk));
3fc16193 1600 YY_SYMBOL_PRINT ("shifting", *yytokenp, yylvalp, yyllocp);
2a8d363a
AD
1601 yyglrShift (yystack, yyk, yyaction, yyposn+1,
1602 *yylvalp, yyllocp]b4_user_args[);
1576d44d 1603 YYDPRINTF ((stderr, ", now in state #%d\n",
01241d47
PH
1604 yystack->yytops.yystates[yyk]->yylrState));
1605 break;
1606 }
fb8135fa 1607 else if (yyisErrorAction (yyaction))
01241d47
PH
1608 {
1609 YYDPRINTF ((stderr, "Stack %d dies.\n", yyk));
1610 yymarkStackDeleted (yystack, yyk);
1611 break;
1612 }
1613 else
2a8d363a 1614 YYCHK (yyglrReduce (yystack, yyk, -yyaction, yyfalse]b4_lpure_args[));
01241d47
PH
1615 }
1616 }
1617 return yyok;
1618}
1619
1620static void
ee16363f
PE
1621yyreportSyntaxError (yyGLRStack* yystack,
1622 YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[)
01241d47 1623{
1154cced
AD
1624 /* `Unused' warnings. */
1625 (void) yylvalp;
1626 (void) yyllocp;
01241d47
PH
1627
1628 if (yystack->yyerrState == 0)
1629 {
fb8135fa 1630#if YYERROR_VERBOSE
1154cced 1631 yySymbol* const yytokenp = yystack->yytokenp;
93a0df69 1632 int yyn;
01241d47 1633 yyn = yypact[yystack->yytops.yystates[0]->yylrState];
12b0043a 1634 if (YYPACT_NINF < yyn && yyn < YYLAST)
01241d47 1635 {
93a0df69 1636 size_t yysize = 0;
c4749565 1637 const char* yyprefix;
93a0df69
PE
1638 char* yymsg;
1639 int yyx;
1640
01241d47
PH
1641 /* Start YYX at -YYN if negative to avoid negative indexes in
1642 YYCHECK. */
c4749565 1643 int yyxbegin = yyn < 0 ? -yyn : 0;
93a0df69
PE
1644
1645 /* Stay within bounds of both yycheck and yytname. */
1646 int yychecklim = YYLAST - yyn;
c4749565 1647 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
93a0df69
PE
1648 int yycount = 0;
1649
01241d47 1650 yyprefix = ", expecting ";
c4749565 1651 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
217598da 1652 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
93a0df69 1653 {
c4749565 1654 yysize += strlen (yyprefix) + strlen (yytokenName (yyx));
93a0df69
PE
1655 yycount += 1;
1656 if (yycount == 5)
01241d47 1657 {
93a0df69
PE
1658 yysize = 0;
1659 break;
01241d47 1660 }
93a0df69
PE
1661 yyprefix = " or ";
1662 }
1663 yysize += (sizeof ("syntax error, unexpected ")
1664 + strlen (yytokenName (*yytokenp)));
be16239b 1665 yymsg = (char*) YYMALLOC (yysize);
93a0df69
PE
1666 if (yymsg != 0)
1667 {
1668 char* yyp = yymsg;
d0d5aa64
PE
1669 sprintf (yyp, "syntax error%s%s",
1670 (*yytokenp == YYEMPTY ? "" : ", unexpected "),
93a0df69
PE
1671 yytokenName (*yytokenp));
1672 yyp += strlen (yyp);
1673 if (yycount < 5)
1674 {
1675 yyprefix = ", expecting ";
c4749565 1676 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
93a0df69
PE
1677 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1678 {
1679 sprintf (yyp, "%s%s", yyprefix, yytokenName (yyx));
1680 yyp += strlen (yyp);
1681 yyprefix = " or ";
1682 }
1683 }
1684 yyerror (]b4_lyyerror_args[yymsg);
a525b568 1685 YYFREE (yymsg);
01241d47 1686 }
93a0df69
PE
1687 else
1688 yyerror (]b4_lyyerror_args["syntax error; also virtual memory exhausted");
01241d47
PH
1689 }
1690 else
93a0df69 1691#endif /* YYERROR_VERBOSE */
6e649e65 1692 yyerror (]b4_lyyerror_args["syntax error");
01241d47
PH
1693 yynerrs += 1;
1694 }
1695}
1696
f50adbbd 1697/* Recover from a syntax error on YYSTACK, assuming that YYTOKENP,
01241d47 1698 YYLVALP, and YYLLOCP point to the syntactic category, semantic
8dd162d3 1699 value, and location of the look-ahead. */
fb8135fa 1700static void
ee16363f 1701yyrecoverSyntaxError (yyGLRStack* yystack,
80a18357
PE
1702 YYSTYPE* yylvalp,
1703 YYLTYPE* yyllocp]b4_location_if(, [ ATTRIBUTE_UNUSED])[
1704 ]b4_user_formals[)
01241d47
PH
1705{
1706 yySymbol* const yytokenp = yystack->yytokenp;
1154cced
AD
1707 size_t yyk;
1708 int yyj;
01241d47 1709
25005f6a 1710 if (yystack->yyerrState == 3)
2a1fe6ed
AD
1711 /* We just shifted the error token and (perhaps) took some
1712 reductions. Skip tokens until we can proceed. */
1713 while (yytrue)
1714 {
01241d47 1715 if (*yytokenp == YYEOF)
7bd6c77e 1716 {
25005f6a 1717 /* Now pop stack until empty and fail. */
7bd6c77e
AD
1718 while (yystack->yytops.yystates[0] != NULL)
1719 {
1720 yyGLRState *yys = yystack->yytops.yystates[0];
63d72da7 1721]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
a0e68930
AD
1722 yydestruct ("Error: popping",
1723 yystos[yys->yylrState],
7bd6c77e
AD
1724 &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
1725 yystack->yytops.yystates[0] = yys->yypred;
1726 yystack->yynextFree -= 1;
1727 yystack->yyspaceLeft += 1;
1728 }
1729 yyFail (yystack][]b4_lpure_args[, NULL);
1730 }
01241d47 1731 if (*yytokenp != YYEMPTY)
e342c3be
AD
1732 {]b4_location_if([[
1733 /* We throw away the lookahead, but the error range
1734 of the shifted error token must take it into account. */
1735 yyGLRState *yys = yystack->yytops.yystates[0];
63d72da7
PE
1736 yyGLRStackItem yyerror_range[3];
1737 yyerror_range[1].yystate.yyloc = yys->yyloc;
1738 yyerror_range[2].yystate.yyloc = *yyllocp;
1739 YYLLOC_DEFAULT (yys->yyloc, yyerror_range, 2);]])[
e342c3be
AD
1740 yydestruct ("Error: discarding",
1741 *yytokenp, yylvalp]b4_location_if([, yyllocp])[);
1742 }
2a1fe6ed 1743 YYDPRINTF ((stderr, "Reading a token: "));
01241d47
PH
1744 yychar = YYLEX;
1745 *yytokenp = YYTRANSLATE (yychar);
284acc8b 1746 YY_SYMBOL_PRINT ("Next token is", *yytokenp, yylvalp, yyllocp);
01241d47 1747 yyj = yypact[yystack->yytops.yystates[0]->yylrState];
944ed9f4 1748 if (yyis_pact_ninf (yyj))
25005f6a 1749 return;
01241d47 1750 yyj += *yytokenp;
ea99527d 1751 if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != *yytokenp)
01241d47
PH
1752 {
1753 if (yydefact[yystack->yytops.yystates[0]->yylrState] != 0)
1754 return;
1755 }
944ed9f4 1756 else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj]))
01241d47 1757 return;
2a1fe6ed 1758 }
fb8135fa 1759
2a1fe6ed 1760 /* Reduce to one stack. */
01241d47
PH
1761 for (yyk = 0; yyk < yystack->yytops.yysize; yyk += 1)
1762 if (yystack->yytops.yystates[yyk] != NULL)
1763 break;
1764 if (yyk >= yystack->yytops.yysize)
2a8d363a 1765 yyFail (yystack][]b4_lpure_args[, NULL);
01241d47
PH
1766 for (yyk += 1; yyk < yystack->yytops.yysize; yyk += 1)
1767 yymarkStackDeleted (yystack, yyk);
1768 yyremoveDeletes (yystack);
1769 yycompressStack (yystack);
1770
1771 /* Now pop stack until we find a state that shifts the error token. */
25005f6a 1772 yystack->yyerrState = 3;
fb8135fa 1773 while (yystack->yytops.yystates[0] != NULL)
01241d47 1774 {
7bd6c77e
AD
1775 yyGLRState *yys = yystack->yytops.yystates[0];
1776 yyj = yypact[yys->yylrState];
944ed9f4 1777 if (! yyis_pact_ninf (yyj))
01241d47 1778 {
944ed9f4
PE
1779 yyj += YYTERROR;
1780 if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
1781 && yyisShiftAction (yytable[yyj]))
1782 {
e342c3be
AD
1783 /* Shift the error token having adjusted its location. */
1784 YYLTYPE yyerrloc;]b4_location_if([[
63d72da7
PE
1785 yystack->yyerror_range[2].yystate.yyloc = *yyllocp;
1786 YYLLOC_DEFAULT (yyerrloc, yystack->yyerror_range, 2);]])[
1576d44d 1787 YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]],
e342c3be 1788 yylvalp, &yyerrloc);
944ed9f4 1789 yyglrShift (yystack, 0, yytable[yyj],
e342c3be
AD
1790 yys->yyposn, *yylvalp, &yyerrloc]b4_user_args[);
1791 yys = yystack->yytops.yystates[0];
944ed9f4
PE
1792 break;
1793 }
01241d47 1794 }
63d72da7 1795]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
a0e68930
AD
1796 yydestruct ("Error: popping",
1797 yystos[yys->yylrState],
5cc16ecc 1798 &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
7bd6c77e 1799 yystack->yytops.yystates[0] = yys->yypred;
01241d47
PH
1800 yystack->yynextFree -= 1;
1801 yystack->yyspaceLeft += 1;
1802 }
1803 if (yystack->yytops.yystates[0] == NULL)
2a8d363a 1804 yyFail (yystack][]b4_lpure_args[, NULL);
fb8135fa
AD
1805}
1806
01241d47
PH
1807#define YYCHK1(YYE) \
1808 do { \
1809 switch (YYE) { \
1810 default: \
1811 break; \
1812 case yyabort: \
1813 yystack.yyerrflag = 1; \
1814 goto yyDone; \
1815 case yyaccept: \
1816 yystack.yyerrflag = 0; \
1817 goto yyDone; \
1818 case yyerr: \
1819 goto yyuser_error; \
1820 } \
fb8135fa 1821 } while (0)
01241d47 1822
0245f82d
AD
1823
1824/*----------.
1825| yyparse. |
1826`----------*/
1827
1828]b4_c_ansi_function_def([yyparse], [int], b4_parse_param)[
01241d47
PH
1829{
1830 yySymbol yytoken;
1831 yyGLRStack yystack;
1832 size_t yyposn;
1833]b4_pure_if(
1834[
1835 YYSTYPE yylval;
1836 YYLTYPE yylloc;
1837 #undef yychar
1838 #define yychar (yystack.yyrawchar)
1839])[
1840
1841 YYSTYPE* const yylvalp = &yylval;
1842 YYLTYPE* const yyllocp = &yylloc;
fb8135fa 1843
01241d47
PH
1844 yyinitGLRStack (&yystack, YYINITDEPTH);
1845 yystack.yytokenp = &yytoken;
1846
2a1fe6ed
AD
1847 YYDPRINTF ((stderr, "Starting parse\n"));
1848
01241d47
PH
1849 if (setjmp (yystack.yyexception_buffer) != 0)
1850 goto yyDone;
1851
b8458aa5
AD
1852 yylval = yyval_default;
1853]b4_location_if([
1854#if YYLTYPE_IS_TRIVIAL
1855 yylloc.first_line = yylloc.last_line = 1;
1856 yylloc.first_column = yylloc.last_column = 0;
1857#endif
1858])
1859m4_ifdef([b4_initial_action], [
0092f063
AD
1860m4_pushdef([b4_at_dollar], [yylval])dnl
1861m4_pushdef([b4_dollar_dollar], [yylloc])dnl
b8458aa5
AD
1862 /* User initialization code. */
1863 b4_initial_action
1864m4_popdef([b4_dollar_dollar])dnl
1865m4_popdef([b4_at_dollar])dnl
1866/* Line __line__ of glr.c. */
1867b4_syncline([@oline@], [@ofile@])])dnl
1868[
1869 yyglrShift (&yystack, 0, 0, 0, yylval, &yylloc]b4_user_args[);
01241d47
PH
1870 yytoken = YYEMPTY;
1871 yyposn = 0;
1872
fb8135fa 1873 while (yytrue)
01241d47 1874 {
21964f43
AD
1875 /* For efficiency, we have two loops, the first of which is
1876 specialized to deterministic operation (single stack, no
1877 potential ambiguity). */
01241d47 1878 /* Standard mode */
fb8135fa 1879 while (yytrue)
01241d47
PH
1880 {
1881 yyRuleNum yyrule;
1882 int yyaction;
779e7ceb 1883 const short int* yyconflicts;
01241d47
PH
1884
1885 yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
b0937b22 1886 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01241d47
PH
1887 if (yystate == YYFINAL)
1888 goto yyDone;
fb8135fa 1889 if (yyisDefaultedState (yystate))
01241d47
PH
1890 {
1891 yyrule = yydefaultAction (yystate);
fb8135fa 1892 if (yyrule == 0)
01241d47 1893 {
63d72da7 1894]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[
ee16363f 1895 yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
01241d47
PH
1896 goto yyuser_error;
1897 }
2a8d363a 1898 YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue]b4_lpure_args[));
01241d47 1899 }
fb8135fa 1900 else
01241d47 1901 {
fb8135fa 1902 if (yytoken == YYEMPTY)
01241d47 1903 {
2a1fe6ed 1904 YYDPRINTF ((stderr, "Reading a token: "));
01241d47
PH
1905 yychar = YYLEX;
1906 yytoken = YYTRANSLATE (yychar);
284acc8b 1907 YY_SYMBOL_PRINT ("Next token is", yytoken, yylvalp, yyllocp);
01241d47
PH
1908 }
1909 yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts);
1910 if (*yyconflicts != 0)
1911 break;
fb8135fa 1912 if (yyisShiftAction (yyaction))
01241d47 1913 {
1576d44d 1914 YY_SYMBOL_PRINT ("Shifting", yytoken, yylvalp, yyllocp);
01241d47
PH
1915 if (yytoken != YYEOF)
1916 yytoken = YYEMPTY;
1917 yyposn += 1;
2a8d363a
AD
1918 yyglrShift (&yystack, 0, yyaction, yyposn,
1919 yylval, yyllocp]b4_user_args[);
39912f52 1920 if (0 < yystack.yyerrState)
01241d47 1921 yystack.yyerrState -= 1;
01241d47
PH
1922 }
1923 else if (yyisErrorAction (yyaction))
1924 {
63d72da7 1925]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[
ee16363f 1926 yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
01241d47
PH
1927 goto yyuser_error;
1928 }
1929 else
2a8d363a 1930 YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue]b4_lpure_args[));
01241d47
PH
1931 }
1932 }
1933
fb8135fa 1934 while (yytrue)
01241d47
PH
1935 {
1936 int yys;
1937 int yyn = yystack.yytops.yysize;
1938 for (yys = 0; yys < yyn; yys += 1)
1939 YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn,
2a8d363a 1940 yylvalp, yyllocp]b4_user_args[));
01241d47
PH
1941 yytoken = YYEMPTY;
1942 yyposn += 1;
1943 yyremoveDeletes (&yystack);
1944 if (yystack.yytops.yysize == 0)
1945 {
1946 yyundeleteLastStack (&yystack);
1947 if (yystack.yytops.yysize == 0)
6e649e65 1948 yyFail (&yystack][]b4_lpure_args[, "syntax error");
2a8d363a 1949 YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
01241d47 1950 YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
63d72da7 1951]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[
ee16363f 1952 yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
01241d47
PH
1953 goto yyuser_error;
1954 }
fb8135fa 1955 else if (yystack.yytops.yysize == 1)
01241d47 1956 {
2a8d363a 1957 YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
01241d47
PH
1958 YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
1959 yycompressStack (&yystack);
1960 break;
1961 }
1962 }
1963 continue;
1964 yyuser_error:
ee16363f 1965 yyrecoverSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
01241d47
PH
1966 yyposn = yystack.yytops.yystates[0]->yyposn;
1967 }
1968 yyDone:
e757bb10
AD
1969 /* On YYABORT, free the lookahead. */
1970 if (yystack.yyerrflag == 1 && yytoken != YYEMPTY)
a0e68930
AD
1971 yydestruct ("Error: discarding lookahead",
1972 yytoken, yylvalp]b4_location_if([, yyllocp])[);
01241d47
PH
1973
1974 yyfreeGLRStack (&yystack);
1975 return yystack.yyerrflag;
1976}
1977
1978/* DEBUGGING ONLY */
417141dd 1979#ifdef YYDEBUG
1154cced
AD
1980static void yypstack (yyGLRStack* yystack, int yyk) ATTRIBUTE_UNUSED;
1981static void yypdumpstack (yyGLRStack* yystack) ATTRIBUTE_UNUSED;
01241d47 1982
1154cced 1983static void
cf126971 1984yy_yypstack (yyGLRState* yys)
01241d47 1985{
cf126971 1986 if (yys->yypred)
01241d47 1987 {
cf126971
PE
1988 yy_yypstack (yys->yypred);
1989 fprintf (stderr, " -> ");
01241d47 1990 }
779e7ceb 1991 fprintf (stderr, "%d@@%lu", yys->yylrState, (unsigned long int) yys->yyposn);
cf126971 1992}
01241d47 1993
cf126971
PE
1994static void
1995yypstates (yyGLRState* yyst)
1996{
fb8135fa 1997 if (yyst == NULL)
01241d47 1998 fprintf (stderr, "<null>");
fb8135fa 1999 else
01241d47
PH
2000 yy_yypstack (yyst);
2001 fprintf (stderr, "\n");
2002}
2003
1154cced 2004static void
fb8135fa 2005yypstack (yyGLRStack* yystack, int yyk)
01241d47
PH
2006{
2007 yypstates (yystack->yytops.yystates[yyk]);
2008}
2009
5cc16ecc 2010#define YYINDEX(YYX) \
01241d47
PH
2011 ((YYX) == NULL ? -1 : (yyGLRStackItem*) (YYX) - yystack->yyitems)
2012
2013
1154cced 2014static void
fb8135fa 2015yypdumpstack (yyGLRStack* yystack)
01241d47
PH
2016{
2017 yyGLRStackItem* yyp;
1154cced 2018 size_t yyi;
fb8135fa 2019 for (yyp = yystack->yyitems; yyp < yystack->yynextFree; yyp += 1)
01241d47 2020 {
779e7ceb 2021 fprintf (stderr, "%3lu. ", (unsigned long int) (yyp - yystack->yyitems));
f7c398aa 2022 if (*(yybool *) yyp)
01241d47 2023 {
cf126971 2024 fprintf (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
fb8135fa 2025 yyp->yystate.yyresolved, yyp->yystate.yylrState,
779e7ceb
PE
2026 (unsigned long int) yyp->yystate.yyposn,
2027 (long int) YYINDEX (yyp->yystate.yypred));
fb8135fa 2028 if (! yyp->yystate.yyresolved)
cf126971 2029 fprintf (stderr, ", firstVal: %ld",
779e7ceb 2030 (long int) YYINDEX (yyp->yystate.yysemantics.yyfirstVal));
01241d47 2031 }
fb8135fa 2032 else
01241d47 2033 {
cf126971
PE
2034 fprintf (stderr, "Option. rule: %d, state: %ld, next: %ld",
2035 yyp->yyoption.yyrule,
779e7ceb
PE
2036 (long int) YYINDEX (yyp->yyoption.yystate),
2037 (long int) YYINDEX (yyp->yyoption.yynext));
01241d47
PH
2038 }
2039 fprintf (stderr, "\n");
2040 }
2041 fprintf (stderr, "Tops:");
2042 for (yyi = 0; yyi < yystack->yytops.yysize; yyi += 1)
779e7ceb
PE
2043 fprintf (stderr, "%lu: %ld; ", (unsigned long int) yyi,
2044 (long int) YYINDEX (yystack->yytops.yystates[yyi]));
01241d47
PH
2045 fprintf (stderr, "\n");
2046}
417141dd 2047#endif
01241d47
PH
2048]
2049
2050b4_epilogue
2051m4_if(b4_defines_flag, 0, [],
947427ae 2052[@output @output_header_name@
779e7ceb 2053b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003, 2004])
01241d47
PH
2054
2055b4_token_defines(b4_tokens)
2056
fa8c3ebc 2057#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
01241d47 2058m4_ifdef([b4_stype],
437c2d80 2059[b4_syncline([b4_stype_line], [b4_filename])
fa8c3ebc 2060typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
996b1c7e 2061/* Line __line__ of glr.c. */
947427ae 2062b4_syncline([@oline@], [@ofile@])],
fa8c3ebc
PE
2063[typedef int YYSTYPE;])
2064# define YYSTYPE_IS_DECLARED 1
947427ae 2065# define YYSTYPE_IS_TRIVIAL 1
01241d47
PH
2066#endif
2067
2068b4_pure_if([],
2069[extern YYSTYPE b4_prefix[]lval;])
2070
25005f6a 2071#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
fa8c3ebc 2072typedef struct YYLTYPE
01241d47 2073{
25005f6a 2074b4_location_if([
f50adbbd
AD
2075 int first_line;
2076 int first_column;
2077 int last_line;
2078 int last_column;
5cc16ecc
PE
2079],[
2080 char yydummy;
25005f6a 2081])
fa8c3ebc
PE
2082} YYLTYPE;
2083# define YYLTYPE_IS_DECLARED 1
2084# define YYLTYPE_IS_TRIVIAL 1
01241d47
PH
2085#endif
2086
e342c3be 2087b4_location_if([b4_pure_if([],
01241d47
PH
2088[extern YYLTYPE b4_prefix[]lloc;])
2089])
01241d47 2090])