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