1 m4_divert(-1) -*- C
-*-
3 # GLR skeleton for Bison
4 # Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA
22 ## ---------------- ##
24 ## ---------------- ##
27 m4_define_default([b4_stack_depth_max
], [10000])
28 m4_define_default([b4_stack_depth_init
], [200])
32 ## ------------------------ ##
33 ## Pure/impure interfaces. ##
34 ## ------------------------ ##
39 # Accumule in b4_lex_param all the yylex arguments.
40 # Yes, this is quite ugly...
41 m4_define([b4_lex_param
],
42 m4_dquote(b4_pure_if([[[[YYSTYPE
*]], [[yylvalp]]][]dnl
43 b4_location_if([, [[YYLTYPE
*], [yyllocp
]]])])dnl
44 m4_ifdef([b4_lex_param
], [, ]b4_lex_param
)))
49 m4_define([b4_user_formals
],
50 [m4_ifset([b4_parse_param
], [, b4_c_ansi_formals(b4_parse_param
)])])
55 # Arguments passed to yyerror: user args plus yylloc.
56 m4_define([b4_yyerror_args
],
57 [b4_pure_if([b4_location_if([yylocp
, ])])dnl
58 m4_ifset([b4_parse_param
], [b4_c_args(b4_parse_param
), ])])
63 # Same as above, but on the look-ahead, hence yyllocp instead of yylocp.
64 m4_define([b4_lyyerror_args
],
65 [b4_pure_if([b4_location_if([yyllocp
, ])])dnl
66 m4_ifset([b4_parse_param
], [b4_c_args(b4_parse_param
), ])])
71 # Arguments needed by yyerror: user args plus yylloc.
72 m4_define([b4_pure_args
],
73 [b4_pure_if([b4_location_if([, yylocp
])])[]b4_user_args
])
78 # Arguments passed to yyerror: user formals plus yyllocp.
79 m4_define([b4_pure_formals
],
80 [b4_pure_if([b4_location_if([, YYLTYPE
*yylocp
])])[]b4_user_formals
])
85 # Same as above, but on the look-ahead, hence yyllocp instead of yylocp.
86 m4_define([b4_lpure_args
],
87 [b4_pure_if([b4_location_if([, yyllocp
])])[]b4_user_args
])
92 # Same as above, but on the look-ahead, hence yyllocp instead of yylocp.
93 m4_define([b4_lpure_formals
],
94 [b4_pure_if([b4_location_if([YYLTYPE
*yyllocp
])])[]b4_user_formals
])
97 ## ----------------- ##
98 ## Semantic Values. ##
99 ## ----------------- ##
102 # b4_lhs_value([TYPE])
103 # --------------------
104 # Expansion of $<TYPE>$.
105 m4_define([b4_lhs_value
],
106 [((*yyvalp
)[]m4_ifval([$
1], [.$
1]))])
109 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
110 # --------------------------------------
111 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
113 m4_define([b4_rhs_value
],
114 [(((yyGLRStackItem
const *)yyvsp
)@
{YYFILL (m4_eval([$
2 - $
1]))@
}.yystate
.yysemantics
.yysval
[]m4_ifval([$
3], [.$
3]))])
125 m4_define([b4_lhs_location
],
129 # b4_rhs_location(RULE-LENGTH, NUM)
130 # ---------------------------------
131 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
133 m4_define([b4_rhs_location
],
134 [(((yyGLRStackItem
const *)yyvsp
)@
{YYFILL (m4_eval([$
2 - $
1]))@
}.yystate
.yyloc
)])
136 # We do want M4 expansion after # for CPP macros.
139 @output @output_parser_name@
140 b4_copyright([Skeleton parser
for GLR parsing with Bison
],
141 [2002, 2003, 2004, 2005])
143 /* This is the parser code for GLR (Generalized LR) parser. */
152 m4_if(b4_prefix
[], [yy
], [],
153 [/* Substitute the variable and function 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
161 #define yylloc b4_prefix[]lloc])
163 b4_token_defines(b4_tokens
)
165 /* Copy the first part of user declarations. */
168 /* Enabling traces. */
170 # define YYDEBUG ]b4_debug[
173 /* Enabling verbose error messages. */
174 #ifdef YYERROR_VERBOSE
175 # undef YYERROR_VERBOSE
176 # define YYERROR_VERBOSE 1
178 # define YYERROR_VERBOSE ]b4_error_verbose[
181 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
182 ]m4_ifdef([b4_stype
],
183 [b4_syncline([b4_stype_line
], [b4_filename
])
184 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
185 /* Line __line__ of glr.c. */
186 b4_syncline([@oline@
], [@ofile@
])],
187 [typedef int YYSTYPE
;])[
188 # define YYSTYPE_IS_DECLARED 1
189 # define YYSTYPE_IS_TRIVIAL 1
192 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
193 typedef struct YYLTYPE
204 # define YYLTYPE_IS_DECLARED 1
205 # define YYLTYPE_IS_TRIVIAL 1
208 /* Default (constant) value used for initialization for null
209 right-hand sides. Unlike the standard yacc.c template,
210 here we set the default value of $$ to a zeroed-out value.
211 Since the default value is undefined, this behavior is
212 technically correct. */
213 static YYSTYPE yyval_default
;
215 /* Copy the second part of user declarations. */
218 ]/* Line __line__ of glr.c. */
219 b4_syncline([@oline@
], [@ofile@
])
225 # define YYMALLOC malloc
228 # define YYREALLOC realloc
234 typedef unsigned char yybool
;
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 */
249 ]b4_location_if([# define YYOPTIONAL_LOC(Name) Name],[
250 # if defined (__cplusplus)
251 # define YYOPTIONAL_LOC(Name) /* empty */
253 # define YYOPTIONAL_LOC(Name) Name ATTRIBUTE_UNUSED
259 # define YYASSERT(condition) ((void) ((condition) || (abort (), 0)))
262 #ifndef ATTRIBUTE_UNUSED
263 # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
266 /* YYFINAL -- State number of the termination state. */
267 #define YYFINAL ]b4_final_state_number[
268 /* YYLAST -- Last index in YYTABLE. */
269 #define YYLAST ]b4_last[
271 /* YYNTOKENS -- Number of terminals. */
272 #define YYNTOKENS ]b4_tokens_number[
273 /* YYNNTS -- Number of nonterminals. */
274 #define YYNNTS ]b4_nterms_number[
275 /* YYNRULES -- Number of rules. */
276 #define YYNRULES ]b4_rules_number[
277 /* YYNRULES -- Number of states. */
278 #define YYNSTATES ]b4_states_number[
279 /* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */
280 #define YYMAXRHS ]b4_r2_max[
281 /* YYMAXLEFT -- Maximum number of symbols to the left of a handle
282 accessed by $0, $-1, etc., in any rule. */
283 #define YYMAXLEFT ]b4_max_left_semantic_context[
285 /* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */
286 #define YYUNDEFTOK ]b4_undef_token_number[
287 #define YYMAXUTOK ]b4_user_token_number_max[
289 #define YYTRANSLATE(YYX) \
290 ((YYX <= 0) ? YYEOF : \
291 (unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
293 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
294 static const ]b4_int_type_for([b4_translate
])[ yytranslate
[] =
300 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
302 static const ]b4_int_type_for([b4_prhs
])[ yyprhs
[] =
307 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
308 static const ]b4_int_type_for([b4_rhs
])[ yyrhs
[] =
313 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
314 static const ]b4_int_type_for([b4_rline
])[ yyrline
[] =
320 #if (YYDEBUG) || YYERROR_VERBOSE
321 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
322 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
323 static const char *const yytname
[] =
329 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
330 static const ]b4_int_type_for([b4_r1
])[ yyr1
[] =
335 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
336 static const ]b4_int_type_for([b4_r2
])[ yyr2
[] =
341 /* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */
342 static const ]b4_int_type_for([b4_dprec
])[ yydprec
[] =
347 /* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */
348 static const ]b4_int_type_for([b4_merger
])[ yymerger
[] =
353 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
354 doesn't specify something else to do. Zero means the default is an
356 static const ]b4_int_type_for([b4_defact
])[ yydefact
[] =
361 /* YYPDEFGOTO[NTERM-NUM]. */
362 static const ]b4_int_type_for([b4_defgoto
])[ yydefgoto
[] =
367 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
369 #define YYPACT_NINF ]b4_pact_ninf[
370 static const ]b4_int_type_for([b4_pact
])[ yypact
[] =
375 /* YYPGOTO[NTERM-NUM]. */
376 static const ]b4_int_type_for([b4_pgoto
])[ yypgoto
[] =
381 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
382 positive, shift that token. If negative, reduce the rule which
383 number is the opposite. If zero, do what YYDEFACT says.
384 If YYTABLE_NINF, syntax error. */
385 #define YYTABLE_NINF ]b4_table_ninf[
386 static const ]b4_int_type_for([b4_table
])[ yytable
[] =
391 /* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
392 list of conflicting reductions corresponding to action entry for
393 state STATE-NUM in yytable. 0 means no conflicts. The list in
394 yyconfl is terminated by a rule number of 0. */
395 static const ]b4_int_type_for([b4_conflict_list_heads
])[ yyconflp
[] =
397 ]b4_conflict_list_heads
[
400 /* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
401 0, pointed into by YYCONFLP. */
402 ]dnl Do
not use b4_int_type_for here
, since there are places where
403 dnl pointers onto yyconfl are taken
, which type is
"short int *".
404 dnl We probably ought to introduce a type
for confl
.
405 [static const short int yyconfl
[] =
407 ]b4_conflicting_rules
[
410 static const ]b4_int_type_for([b4_check
])[ yycheck
[] =
415 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
416 symbol of state STATE-NUM. */
417 static const ]b4_int_type_for([b4_stos
])[ yystos
[] =
423 /* Prevent warning if -Wmissing-prototypes. */
424 ]b4_c_ansi_function_decl([yyparse
], [int], b4_parse_param
)[
426 /* Error token number */
429 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
430 If N is 0, then set CURRENT to the empty location which ends
431 the previous symbol: RHS[0] (always defined). */
434 #define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
435 #ifndef YYLLOC_DEFAULT
436 # define YYLLOC_DEFAULT(Current, Rhs, N) \
440 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
441 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
442 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
443 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
447 (Current).first_line = (Current).last_line = \
448 YYRHSLOC (Rhs, 0).last_line; \
449 (Current).first_column = (Current).last_column = \
450 YYRHSLOC (Rhs, 0).last_column; \
454 /* YY_LOCATION_PRINT -- Print the location on the stream.
455 This macro was not mandated originally: define only if we know
456 we won't break user code: when these are the locations we know. */
458 # define YY_LOCATION_PRINT(File, Loc) \
459 fprintf (File, "%d.%d-%d.%d", \
460 (Loc).first_line, (Loc).first_column, \
461 (Loc).last_line, (Loc).last_column)
464 #ifndef YYLLOC_DEFAULT
465 # define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0)
469 #ifndef YY_LOCATION_PRINT
470 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
474 /* YYLEX -- calling `yylex' with the right arguments. */
475 #define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
480 #define yynerrs (yystack->yyerrcnt)
482 #define yychar (yystack->yyrawchar)],
490 static const int YYEOF
= 0;
491 static const int YYEMPTY
= -2;
493 typedef enum { yyok
, yyaccept
, yyabort
, yyerr
} YYRESULTTAG
;
496 do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \
501 #if ! defined (YYFPRINTF)
502 # define YYFPRINTF fprintf
505 # define YYDPRINTF(Args) \
511 ]b4_yysymprint_generate([b4_c_ansi_function_def
])[
513 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
517 YYFPRINTF (stderr, "%s ", Title); \
518 yysymprint (stderr, \
519 Type, Value]b4_location_if([, Location])[); \
523 /* Nonzero means print parse trace. It is left uninitialized so that
524 multiple parsers can coexist. */
529 # define YYDPRINTF(Args)
530 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
532 #endif /* !YYDEBUG */
534 /* YYINITDEPTH -- initial size of the parser's stacks. */
536 # define YYINITDEPTH ]b4_stack_depth_init[
539 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
540 if the built-in stack extension method is used).
542 Do not make this value too large; the results are undefined if
543 SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem)
544 evaluated with infinite-precision integer arithmetic. */
547 # define YYMAXDEPTH ]b4_stack_depth_max[
550 /* Minimum number of free items on the stack allowed after an
551 allocation. This is to allow allocation and initialization
552 to be completed by functions that call expandGLRStack before the
553 stack is expanded, thus insuring that all necessary pointers get
554 properly redirected to new data. */
557 #if (! defined (YYSTACKEXPANDABLE) \
558 && (! defined (__cplusplus) \
559 || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
560 && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
561 #define YYSTACKEXPANDABLE 1
563 #define YYSTACKEXPANDABLE 0
566 /** State numbers, as in LALR(1) machine */
567 typedef int yyStateNum
;
569 /** Rule numbers, as in LALR(1) machine */
570 typedef int yyRuleNum
;
572 /** Grammar symbol */
573 typedef short int yySymbol
;
575 /** Item references, as in LALR(1) machine */
576 typedef short int yyItemNum
;
578 typedef struct yyGLRState yyGLRState
;
579 typedef struct yySemanticOption yySemanticOption
;
580 typedef union yyGLRStackItem yyGLRStackItem
;
581 typedef struct yyGLRStack yyGLRStack
;
582 typedef struct yyGLRStateSet yyGLRStateSet
;
585 /** Type tag: always true. */
587 /** Type tag for yysemantics. If true, yysval applies, otherwise
588 * yyfirstVal applies. */
590 /** Number of corresponding LALR(1) machine state. */
591 yyStateNum yylrState
;
592 /** Preceding state in this stack */
594 /** Source position of the first token produced by my symbol */
597 /** First in a chain of alternative reductions producing the
598 * non-terminal corresponding to this state, threaded through
600 yySemanticOption
* yyfirstVal
;
601 /** Semantic value for this state. */
604 /** Source location for this state. */
608 struct yyGLRStateSet
{
609 yyGLRState
** yystates
;
610 size_t yysize
, yycapacity
;
613 struct yySemanticOption
{
614 /** Type tag: always false. */
616 /** Rule number for this reduction */
618 /** The last RHS state in the list of states to be reduced. */
620 /** Next sibling in chain of options. To facilitate merging,
621 * options are chained in decreasing order by address. */
622 yySemanticOption
* yynext
;
625 /** Type of the items in the GLR stack. The yyisState field
626 * indicates which item of the union is valid. */
627 union yyGLRStackItem
{
629 yySemanticOption yyoption
;
635 ]b4_location_if([[ /* To compute the location of the error token. */
636 yyGLRStackItem yyerror_range
[3];]])[
643 jmp_buf yyexception_buffer
;
644 yyGLRStackItem
* yyitems
;
645 yyGLRStackItem
* yynextFree
;
647 yyGLRState
* yysplitPoint
;
648 yyGLRState
* yylastDeleted
;
649 yyGLRStateSet yytops
;
652 static void yyinitGLRStack (yyGLRStack
* yystack
, size_t yysize
);
653 static void yyexpandGLRStack (yyGLRStack
* yystack
]b4_pure_formals
[);
654 static void yyfreeGLRStack (yyGLRStack
* yystack
);
657 yyFail (yyGLRStack
* yystack
]b4_pure_formals
[, const char* yyformat
, ...)
659 yystack
->yyerrflag
= 1;
660 if (yyformat
!= NULL
)
664 va_start (yyap
, yyformat
);
665 vsprintf (yymsg
, yyformat
, yyap
);
666 yyerror (]b4_yyerror_args
[yymsg
);
668 longjmp (yystack
->yyexception_buffer
, 1);
671 #if YYDEBUG || YYERROR_VERBOSE
672 /** A printable representation of TOKEN. Valid until next call to
674 static inline const char*
675 yytokenName (yySymbol yytoken
)
677 if (yytoken
== YYEMPTY
)
680 return yytname
[yytoken
];
684 /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
685 * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
686 * containing the pointer to the next state in the chain. Assumes
687 * YYLOW1 < YYLOW0. */
688 static void yyfillin (yyGLRStackItem
*, int, int) ATTRIBUTE_UNUSED
;
690 yyfillin (yyGLRStackItem
*yyvsp
, int yylow0
, int yylow1
)
694 s
= yyvsp
[yylow0
].yystate
.yypred
;
695 for (i
= yylow0
-1; i
>= yylow1
; i
-= 1)
697 YYASSERT (s
->yyresolved
);
698 yyvsp
[i
].yystate
.yyresolved
= yytrue
;
699 yyvsp
[i
].yystate
.yysemantics
.yysval
= s
->yysemantics
.yysval
;
700 yyvsp
[i
].yystate
.yyloc
= s
->yyloc
;
701 s
= yyvsp
[i
].yystate
.yypred
= s
->yypred
;
705 /* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
706 YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
707 For convenience, always return YYLOW1. */
708 static inline int yyfill (yyGLRStackItem
*, int *, int, yybool
)
711 yyfill (yyGLRStackItem
*yyvsp
, int *yylow
, int yylow1
, yybool yynormal
)
713 if (!yynormal
&& yylow1
< *yylow
)
715 yyfillin (yyvsp
, *yylow
, yylow1
);
721 /** Perform user action for rule number YYN, with RHS length YYRHSLEN,
722 * and top stack item YYVSP. YYLVALP points to place to put semantic
723 * value ($$), and yylocp points to place for location information
724 * (@@$). Returns yyok for normal return, yyaccept for YYACCEPT,
725 * yyerr for YYERROR, yyabort for YYABORT. */
727 yyuserAction (yyRuleNum yyn
, int yyrhslen
, yyGLRStackItem
* yyvsp
,
729 YYLTYPE
* YYOPTIONAL_LOC (yylocp
),
733 yybool yynormal ATTRIBUTE_UNUSED
= (yystack
->yysplitPoint
== NULL
);
737 # define yyerrok (yystack->yyerrState = 0)
739 # define YYACCEPT return yyaccept
741 # define YYABORT return yyabort
743 # define YYERROR return yyerrok, yyerr
745 # define YYRECOVERING (yystack->yyerrState != 0)
747 # define yyclearin (yychar = *(yystack->yytokenp) = YYEMPTY)
749 # define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal)
751 # define YYBACKUP(Token, Value) \
752 return yyerror (]b4_yyerror_args["syntax error: cannot back up"), \
757 *yyvalp
= yyval_default
;
759 *yyvalp
= yyvsp
[YYFILL (1-yyrhslen
)].yystate
.yysemantics
.yysval
;
760 YYLLOC_DEFAULT (*yylocp
, yyvsp
- yyrhslen
, yyrhslen
);
776 /* Line __line__ of glr.c. */
777 b4_syncline([@oline@
], [@ofile@
])
782 yyuserMerge (int yyn
, YYSTYPE
* yy0
, YYSTYPE
* yy1
)
784 /* `Use' the arguments. */
794 /* Bison grammar-table manipulation. */
796 ]b4_yydestruct_generate([b4_c_ansi_function_def
])[
798 /** Number of symbols composing the right hand side of rule #RULE. */
800 yyrhsLength (yyRuleNum yyrule
)
805 /** Left-hand-side symbol for rule #RULE. */
806 static inline yySymbol
807 yylhsNonterm (yyRuleNum yyrule
)
812 #define yyis_pact_ninf(yystate) \
813 ]m4_if(m4_eval(b4_pact_ninf < b4_pact_min), 1,
815 ((yystate
) == YYPACT_NINF
))[
817 /** True iff LR state STATE has only a default reduction (regardless
820 yyisDefaultedState (yyStateNum yystate
)
822 return yyis_pact_ninf (yypact
[yystate
]);
825 /** The default reduction for STATE, assuming it has one. */
826 static inline yyRuleNum
827 yydefaultAction (yyStateNum yystate
)
829 return yydefact
[yystate
];
832 #define yyis_table_ninf(yytable_value) \
833 ]m4_if(m4_eval(b4_table_ninf < b4_table_min), 1,
835 ((yytable_value
) == YYTABLE_NINF
))[
837 /** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
839 * R < 0: Reduce on rule -R.
841 * R > 0: Shift to state R.
842 * Set *CONFLICTS to a pointer into yyconfl to 0-terminated list of
843 * conflicting reductions.
846 yygetLRActions (yyStateNum yystate
, int yytoken
,
847 int* yyaction
, const short int** yyconflicts
)
849 int yyindex
= yypact
[yystate
] + yytoken
;
850 if (yyindex
< 0 || YYLAST
< yyindex
|| yycheck
[yyindex
] != yytoken
)
852 *yyaction
= -yydefact
[yystate
];
853 *yyconflicts
= yyconfl
;
855 else if (! yyis_table_ninf (yytable
[yyindex
]))
857 *yyaction
= yytable
[yyindex
];
858 *yyconflicts
= yyconfl
+ yyconflp
[yyindex
];
863 *yyconflicts
= yyconfl
+ yyconflp
[yyindex
];
867 static inline yyStateNum
868 yyLRgotoState (yyStateNum yystate
, yySymbol yylhs
)
871 yyr
= yypgoto
[yylhs
- YYNTOKENS
] + yystate
;
872 if (0 <= yyr
&& yyr
<= YYLAST
&& yycheck
[yyr
] == yystate
)
875 return yydefgoto
[yylhs
- YYNTOKENS
];
879 yyisShiftAction (int yyaction
)
885 yyisErrorAction (int yyaction
)
887 return yyaction
== 0;
893 yyaddDeferredAction (yyGLRStack
* yystack
, yyGLRState
* yystate
,
894 yyGLRState
* rhs
, yyRuleNum yyrule
]b4_pure_formals
[)
896 yySemanticOption
* yynewItem
;
897 yynewItem
= &yystack
->yynextFree
->yyoption
;
898 yystack
->yyspaceLeft
-= 1;
899 yystack
->yynextFree
+= 1;
900 yynewItem
->yyisState
= yyfalse
;
901 yynewItem
->yystate
= rhs
;
902 yynewItem
->yyrule
= yyrule
;
903 yynewItem
->yynext
= yystate
->yysemantics
.yyfirstVal
;
904 yystate
->yysemantics
.yyfirstVal
= yynewItem
;
905 if (yystack
->yyspaceLeft
< YYHEADROOM
)
906 yyexpandGLRStack (yystack
]b4_pure_args
[);
911 /** Initialize SET to a singleton set containing an empty stack. */
913 yyinitStateSet (yyGLRStateSet
* yyset
)
916 yyset
->yycapacity
= 16;
917 yyset
->yystates
= (yyGLRState
**) YYMALLOC (16 * sizeof yyset
->yystates
[0]);
918 yyset
->yystates
[0] = NULL
;
921 static void yyfreeStateSet (yyGLRStateSet
* yyset
)
923 YYFREE (yyset
->yystates
);
926 /** Initialize STACK to a single empty stack, with total maximum
927 * capacity for all stacks of SIZE. */
929 yyinitGLRStack (yyGLRStack
* yystack
, size_t yysize
)
931 yystack
->yyerrflag
= 0;
932 yystack
->yyerrState
= 0;
934 yystack
->yyspaceLeft
= yysize
;
935 yystack
->yynextFree
= yystack
->yyitems
=
936 (yyGLRStackItem
*) YYMALLOC (yysize
* sizeof yystack
->yynextFree
[0]);
937 yystack
->yysplitPoint
= NULL
;
938 yystack
->yylastDeleted
= NULL
;
939 yyinitStateSet (&yystack
->yytops
);
942 #define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \
943 &((YYTOITEMS) - ((YYFROMITEMS) - (yyGLRStackItem*) (YYX)))->YYTYPE
945 /** If STACK is expandable, extend it. WARNING: Pointers into the
946 stack from outside should be considered invalid after this call.
947 We always expand when there are 1 or fewer items left AFTER an
948 allocation, so that we can avoid having external pointers exist
949 across an allocation. */
951 yyexpandGLRStack (yyGLRStack
* yystack
]b4_pure_formals
[)
953 #if YYSTACKEXPANDABLE
954 yyGLRStack yynewStack
;
955 yyGLRStackItem
* yyp0
, *yyp1
;
956 size_t yysize
, yynewSize
;
958 yysize
= yystack
->yynextFree
- yystack
->yyitems
;
959 if (YYMAXDEPTH
<= yysize
)
960 yyFail (yystack
][]b4_pure_args
[, "parser stack overflow");
961 yynewSize
= 2*yysize
;
962 if (YYMAXDEPTH
< yynewSize
)
963 yynewSize
= YYMAXDEPTH
;
964 yyinitGLRStack (&yynewStack
, yynewSize
);
965 for (yyp0
= yystack
->yyitems
, yyp1
= yynewStack
.yyitems
, yyn
= yysize
;
967 yyn
-= 1, yyp0
+= 1, yyp1
+= 1)
970 if (*(yybool
*) yyp0
)
972 yyGLRState
* yys0
= &yyp0
->yystate
;
973 yyGLRState
* yys1
= &yyp1
->yystate
;
974 if (yys0
->yypred
!= NULL
)
976 YYRELOC (yyp0
, yyp1
, yys0
->yypred
, yystate
);
977 if (! yys0
->yyresolved
&& yys0
->yysemantics
.yyfirstVal
!= NULL
)
978 yys1
->yysemantics
.yyfirstVal
=
979 YYRELOC(yyp0
, yyp1
, yys0
->yysemantics
.yyfirstVal
, yyoption
);
983 yySemanticOption
* yyv0
= &yyp0
->yyoption
;
984 yySemanticOption
* yyv1
= &yyp1
->yyoption
;
985 if (yyv0
->yystate
!= NULL
)
986 yyv1
->yystate
= YYRELOC (yyp0
, yyp1
, yyv0
->yystate
, yystate
);
987 if (yyv0
->yynext
!= NULL
)
988 yyv1
->yynext
= YYRELOC (yyp0
, yyp1
, yyv0
->yynext
, yyoption
);
991 if (yystack
->yysplitPoint
!= NULL
)
992 yystack
->yysplitPoint
= YYRELOC (yystack
->yyitems
, yynewStack
.yyitems
,
993 yystack
->yysplitPoint
, yystate
);
995 for (yyn
= 0; yyn
< yystack
->yytops
.yysize
; yyn
+= 1)
996 if (yystack
->yytops
.yystates
[yyn
] != NULL
)
997 yystack
->yytops
.yystates
[yyn
] =
998 YYRELOC (yystack
->yyitems
, yynewStack
.yyitems
,
999 yystack
->yytops
.yystates
[yyn
], yystate
);
1000 YYFREE (yystack
->yyitems
);
1001 yystack
->yyitems
= yynewStack
.yyitems
;
1002 yystack
->yynextFree
= yynewStack
.yynextFree
+ yysize
;
1003 yystack
->yyspaceLeft
= yynewStack
.yyspaceLeft
- yysize
;
1007 yyFail (yystack
][]b4_pure_args
[, "parser stack overflow");
1012 yyfreeGLRStack (yyGLRStack
* yystack
)
1014 YYFREE (yystack
->yyitems
);
1015 yyfreeStateSet (&yystack
->yytops
);
1018 /** Assuming that S is a GLRState somewhere on STACK, update the
1019 * splitpoint of STACK, if needed, so that it is at least as deep as
1022 yyupdateSplit (yyGLRStack
* yystack
, yyGLRState
* yys
)
1024 if (yystack
->yysplitPoint
!= NULL
&& yystack
->yysplitPoint
> yys
)
1025 yystack
->yysplitPoint
= yys
;
1028 /** Invalidate stack #K in STACK. */
1030 yymarkStackDeleted (yyGLRStack
* yystack
, int yyk
)
1032 if (yystack
->yytops
.yystates
[yyk
] != NULL
)
1033 yystack
->yylastDeleted
= yystack
->yytops
.yystates
[yyk
];
1034 yystack
->yytops
.yystates
[yyk
] = NULL
;
1037 /** Undelete the last stack that was marked as deleted. Can only be
1038 done once after a deletion, and only when all other stacks have
1041 yyundeleteLastStack (yyGLRStack
* yystack
)
1043 if (yystack
->yylastDeleted
== NULL
|| yystack
->yytops
.yysize
!= 0)
1045 yystack
->yytops
.yystates
[0] = yystack
->yylastDeleted
;
1046 yystack
->yytops
.yysize
= 1;
1047 YYDPRINTF ((stderr
, "Restoring last deleted stack as stack #0.\n"));
1048 yystack
->yylastDeleted
= NULL
;
1052 yyremoveDeletes (yyGLRStack
* yystack
)
1056 while (yyj
< yystack
->yytops
.yysize
)
1058 if (yystack
->yytops
.yystates
[yyi
] == NULL
)
1062 YYDPRINTF ((stderr
, "Removing dead stacks.\n"));
1064 yystack
->yytops
.yysize
-= 1;
1068 yystack
->yytops
.yystates
[yyj
] = yystack
->yytops
.yystates
[yyi
];
1071 YYDPRINTF ((stderr
, "Rename stack %lu -> %lu.\n",
1072 (unsigned long int) yyi
, (unsigned long int) yyj
));
1080 /** Shift to a new state on stack #K of STACK, corresponding to LR state
1081 * LRSTATE, at input position POSN, with (resolved) semantic value SVAL. */
1083 yyglrShift (yyGLRStack
* yystack
, int yyk
, yyStateNum yylrState
, size_t yyposn
,
1084 YYSTYPE yysval
, YYLTYPE
* yylocp
]b4_user_formals
[)
1086 yyGLRStackItem
* yynewItem
;
1088 yynewItem
= yystack
->yynextFree
;
1089 yystack
->yynextFree
+= 1;
1090 yystack
->yyspaceLeft
-= 1;
1091 yynewItem
->yystate
.yyisState
= yytrue
;
1092 yynewItem
->yystate
.yylrState
= yylrState
;
1093 yynewItem
->yystate
.yyposn
= yyposn
;
1094 yynewItem
->yystate
.yyresolved
= yytrue
;
1095 yynewItem
->yystate
.yypred
= yystack
->yytops
.yystates
[yyk
];
1096 yystack
->yytops
.yystates
[yyk
] = &yynewItem
->yystate
;
1097 yynewItem
->yystate
.yysemantics
.yysval
= yysval
;
1098 yynewItem
->yystate
.yyloc
= *yylocp
;
1099 if (yystack
->yyspaceLeft
< YYHEADROOM
)
1100 yyexpandGLRStack (yystack
]b4_pure_args
[);
1103 /** Shift stack #K of YYSTACK, to a new state corresponding to LR
1104 * state YYLRSTATE, at input position YYPOSN, with the (unresolved)
1105 * semantic value of YYRHS under the action for YYRULE. */
1107 yyglrShiftDefer (yyGLRStack
* yystack
, int yyk
, yyStateNum yylrState
,
1108 size_t yyposn
, yyGLRState
* rhs
, yyRuleNum yyrule
]b4_pure_formals
[)
1110 yyGLRStackItem
* yynewItem
;
1112 yynewItem
= yystack
->yynextFree
;
1113 yynewItem
->yystate
.yyisState
= yytrue
;
1114 yynewItem
->yystate
.yylrState
= yylrState
;
1115 yynewItem
->yystate
.yyposn
= yyposn
;
1116 yynewItem
->yystate
.yyresolved
= yyfalse
;
1117 yynewItem
->yystate
.yypred
= yystack
->yytops
.yystates
[yyk
];
1118 yynewItem
->yystate
.yysemantics
.yyfirstVal
= NULL
;
1119 yystack
->yytops
.yystates
[yyk
] = &yynewItem
->yystate
;
1120 yystack
->yynextFree
+= 1;
1121 yystack
->yyspaceLeft
-= 1;
1122 yyaddDeferredAction (yystack
, &yynewItem
->yystate
, rhs
, yyrule
]b4_pure_args
[);
1125 /** Pop the symbols consumed by reduction #RULE from the top of stack
1126 * #K of STACK, and perform the appropriate semantic action on their
1127 * semantic values. Assumes that all ambiguities in semantic values
1128 * have been previously resolved. Set *VALP to the resulting value,
1129 * and *LOCP to the computed location (if any). Return value is as
1130 * for userAction. */
1131 static inline YYRESULTTAG
1132 yydoAction (yyGLRStack
* yystack
, int yyk
, yyRuleNum yyrule
,
1133 YYSTYPE
* yyvalp
, YYLTYPE
* yylocp
]b4_user_formals
[)
1135 int yynrhs
= yyrhsLength (yyrule
);
1137 if (yystack
->yysplitPoint
== NULL
)
1139 /* Standard special case: single stack. */
1140 yyGLRStackItem
* rhs
= (yyGLRStackItem
*) yystack
->yytops
.yystates
[yyk
];
1141 YYASSERT (yyk
== 0);
1142 yystack
->yynextFree
-= yynrhs
;
1143 yystack
->yyspaceLeft
+= yynrhs
;
1144 yystack
->yytops
.yystates
[0] = & yystack
->yynextFree
[-1].yystate
;
1145 return yyuserAction (yyrule
, yynrhs
, rhs
,
1146 yyvalp
, yylocp
, yystack
]b4_user_args
[);
1152 yyGLRStackItem yyrhsVals
[YYMAXRHS
+ YYMAXLEFT
+ 1];
1153 yys
= yyrhsVals
[YYMAXRHS
+ YYMAXLEFT
].yystate
.yypred
1154 = yystack
->yytops
.yystates
[yyk
];
1155 for (yyi
= 0; yyi
< yynrhs
; yyi
+= 1)
1160 yyupdateSplit (yystack
, yys
);
1161 yystack
->yytops
.yystates
[yyk
] = yys
;
1162 return yyuserAction (yyrule
, yynrhs
, yyrhsVals
+ YYMAXRHS
+ YYMAXLEFT
- 1,
1163 yyvalp
, yylocp
, yystack
]b4_user_args
[);
1168 # define YY_REDUCE_PRINT(K, Rule)
1170 # define YY_REDUCE_PRINT(K, Rule) \
1173 yy_reduce_print (K, Rule); \
1176 /*----------------------------------------------------------.
1177 | Report that the RULE is going to be reduced on stack #K. |
1178 `----------------------------------------------------------*/
1181 yy_reduce_print (size_t yyk
, yyRuleNum yyrule
)
1184 YYFPRINTF (stderr
, "Reducing stack %lu by rule %d (line %lu), ",
1185 (unsigned long int) yyk
, yyrule
- 1,
1186 (unsigned long int) yyrline
[yyrule
]);
1187 /* Print the symbols being reduced, and their result. */
1188 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
1189 YYFPRINTF (stderr
, "%s ", yytokenName (yyrhs
[yyi
]));
1190 YYFPRINTF (stderr
, "-> %s\n", yytokenName (yyr1
[yyrule
]));
1194 /** Pop items off stack #K of STACK according to grammar rule RULE,
1195 * and push back on the resulting nonterminal symbol. Perform the
1196 * semantic action associated with RULE and store its value with the
1197 * newly pushed state, if FORCEEVAL or if STACK is currently
1198 * unambiguous. Otherwise, store the deferred semantic action with
1199 * the new state. If the new state would have an identical input
1200 * position, LR state, and predecessor to an existing state on the stack,
1201 * it is identified with that existing state, eliminating stack #K from
1202 * the STACK. In this case, the (necessarily deferred) semantic value is
1203 * added to the options for the existing state's semantic value.
1205 static inline YYRESULTTAG
1206 yyglrReduce (yyGLRStack
* yystack
, size_t yyk
, yyRuleNum yyrule
,
1207 yybool yyforceEval
]b4_pure_formals
[)
1209 size_t yyposn
= yystack
->yytops
.yystates
[yyk
]->yyposn
;
1211 if (yyforceEval
|| yystack
->yysplitPoint
== NULL
)
1216 YY_REDUCE_PRINT (yyk
, yyrule
);
1217 YYCHK (yydoAction (yystack
, yyk
, yyrule
, &yysval
, &yyloc
]b4_user_args
[));
1218 yyglrShift (yystack
, yyk
,
1219 yyLRgotoState (yystack
->yytops
.yystates
[yyk
]->yylrState
,
1220 yylhsNonterm (yyrule
)),
1221 yyposn
, yysval
, &yyloc
]b4_user_args
[);
1227 yyGLRState
* yys
, *yys0
= yystack
->yytops
.yystates
[yyk
];
1228 yyStateNum yynewLRState
;
1230 for (yys
= yystack
->yytops
.yystates
[yyk
], yyn
= yyrhsLength (yyrule
);
1236 yyupdateSplit (yystack
, yys
);
1237 yynewLRState
= yyLRgotoState (yys
->yylrState
, yylhsNonterm (yyrule
));
1239 "Reduced stack %lu by rule #%d; action deferred. Now in state %d.\n",
1240 (unsigned long int) yyk
, yyrule
- 1, yynewLRState
));
1241 for (yyi
= 0; yyi
< yystack
->yytops
.yysize
; yyi
+= 1)
1242 if (yyi
!= yyk
&& yystack
->yytops
.yystates
[yyi
] != NULL
)
1244 yyGLRState
* yyp
, *yysplit
= yystack
->yysplitPoint
;
1245 yyp
= yystack
->yytops
.yystates
[yyi
];
1246 while (yyp
!= yys
&& yyp
!= yysplit
&& yyp
->yyposn
>= yyposn
)
1248 if (yyp
->yylrState
== yynewLRState
&& yyp
->yypred
== yys
)
1250 yyaddDeferredAction (yystack
, yyp
, yys0
, yyrule
]b4_pure_args
[);
1251 yymarkStackDeleted (yystack
, yyk
);
1252 YYDPRINTF ((stderr
, "Merging stack %lu into stack %lu.\n",
1253 (unsigned long int) yyk
,
1254 (unsigned long int) yyi
));
1260 yystack
->yytops
.yystates
[yyk
] = yys
;
1261 yyglrShiftDefer (yystack
, yyk
, yynewLRState
, yyposn
, yys0
, yyrule
]b4_pure_args
[);
1267 yysplitStack (yyGLRStack
* yystack
, int yyk
)
1269 if (yystack
->yysplitPoint
== NULL
)
1271 YYASSERT (yyk
== 0);
1272 yystack
->yysplitPoint
= yystack
->yytops
.yystates
[yyk
];
1274 if (yystack
->yytops
.yysize
>= yystack
->yytops
.yycapacity
)
1276 yystack
->yytops
.yycapacity
*= 2;
1277 yystack
->yytops
.yystates
=
1278 (yyGLRState
**) YYREALLOC (yystack
->yytops
.yystates
,
1279 (yystack
->yytops
.yycapacity
1280 * sizeof yystack
->yytops
.yystates
[0]));
1282 yystack
->yytops
.yystates
[yystack
->yytops
.yysize
]
1283 = yystack
->yytops
.yystates
[yyk
];
1284 yystack
->yytops
.yysize
+= 1;
1285 return yystack
->yytops
.yysize
-1;
1288 /** True iff Y0 and Y1 represent identical options at the top level.
1289 * That is, they represent the same rule applied to RHS symbols
1290 * that produce the same terminal symbols. */
1292 yyidenticalOptions (yySemanticOption
* yyy0
, yySemanticOption
* yyy1
)
1294 if (yyy0
->yyrule
== yyy1
->yyrule
)
1296 yyGLRState
*yys0
, *yys1
;
1298 for (yys0
= yyy0
->yystate
, yys1
= yyy1
->yystate
,
1299 yyn
= yyrhsLength (yyy0
->yyrule
);
1301 yys0
= yys0
->yypred
, yys1
= yys1
->yypred
, yyn
-= 1)
1302 if (yys0
->yyposn
!= yys1
->yyposn
)
1310 /** Assuming identicalOptions (Y0,Y1), destructively merge the
1311 * alternative semantic values for the RHS-symbols of Y1 and Y0. */
1313 yymergeOptionSets (yySemanticOption
* yyy0
, yySemanticOption
* yyy1
)
1315 yyGLRState
*yys0
, *yys1
;
1317 for (yys0
= yyy0
->yystate
, yys1
= yyy1
->yystate
,
1318 yyn
= yyrhsLength (yyy0
->yyrule
);
1320 yys0
= yys0
->yypred
, yys1
= yys1
->yypred
, yyn
-= 1)
1324 else if (yys0
->yyresolved
)
1326 yys1
->yyresolved
= yytrue
;
1327 yys1
->yysemantics
.yysval
= yys0
->yysemantics
.yysval
;
1329 else if (yys1
->yyresolved
)
1331 yys0
->yyresolved
= yytrue
;
1332 yys0
->yysemantics
.yysval
= yys1
->yysemantics
.yysval
;
1336 yySemanticOption
** yyz0p
;
1337 yySemanticOption
* yyz1
;
1338 yyz0p
= &yys0
->yysemantics
.yyfirstVal
;
1339 yyz1
= yys1
->yysemantics
.yyfirstVal
;
1342 if (yyz1
== *yyz0p
|| yyz1
== NULL
)
1344 else if (*yyz0p
== NULL
)
1349 else if (*yyz0p
< yyz1
)
1351 yySemanticOption
* yyz
= *yyz0p
;
1353 yyz1
= yyz1
->yynext
;
1354 (*yyz0p
)->yynext
= yyz
;
1356 yyz0p
= &(*yyz0p
)->yynext
;
1358 yys1
->yysemantics
.yyfirstVal
= yys0
->yysemantics
.yyfirstVal
;
1363 /** Y0 and Y1 represent two possible actions to take in a given
1364 * parsing state; return 0 if no combination is possible,
1365 * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */
1367 yypreference (yySemanticOption
* y0
, yySemanticOption
* y1
)
1369 yyRuleNum r0
= y0
->yyrule
, r1
= y1
->yyrule
;
1370 int p0
= yydprec
[r0
], p1
= yydprec
[r1
];
1374 if (yymerger
[r0
] == 0 || yymerger
[r0
] != yymerger
[r1
])
1379 if (p0
== 0 || p1
== 0)
1388 static YYRESULTTAG
yyresolveValue (yySemanticOption
* yyoptionList
,
1389 yyGLRStack
* yystack
, YYSTYPE
* yyvalp
,
1390 YYLTYPE
* yylocp
]b4_user_formals
[);
1393 yyresolveStates (yyGLRState
* yys
, int yyn
, yyGLRStack
* yystack
]b4_user_formals
[)
1398 YYASSERT (yys
->yypred
);
1399 yyflag
= yyresolveStates (yys
->yypred
, yyn
-1, yystack
]b4_user_args
[);
1402 if (! yys
->yyresolved
)
1404 yyflag
= yyresolveValue (yys
->yysemantics
.yyfirstVal
, yystack
,
1405 &yys
->yysemantics
.yysval
, &yys
->yyloc
1409 yys
->yyresolved
= yytrue
;
1416 yyresolveAction (yySemanticOption
* yyopt
, yyGLRStack
* yystack
,
1417 YYSTYPE
* yyvalp
, YYLTYPE
* yylocp
]b4_user_formals
[)
1419 yyGLRStackItem yyrhsVals
[YYMAXRHS
+ YYMAXLEFT
+ 1];
1422 yynrhs
= yyrhsLength (yyopt
->yyrule
);
1423 YYCHK (yyresolveStates (yyopt
->yystate
, yynrhs
, yystack
]b4_user_args
[));
1424 yyrhsVals
[YYMAXRHS
+ YYMAXLEFT
].yystate
.yypred
= yyopt
->yystate
;
1425 return yyuserAction (yyopt
->yyrule
, yynrhs
,
1426 yyrhsVals
+ YYMAXRHS
+ YYMAXLEFT
- 1,
1427 yyvalp
, yylocp
, yystack
]b4_user_args
[);
1432 yyreportTree (yySemanticOption
* yyx
, int yyindent
)
1434 int yynrhs
= yyrhsLength (yyx
->yyrule
);
1437 yyGLRState
* yystates
[YYMAXRHS
];
1438 yyGLRState yyleftmost_state
;
1440 for (yyi
= yynrhs
, yys
= yyx
->yystate
; 0 < yyi
; yyi
-= 1, yys
= yys
->yypred
)
1441 yystates
[yyi
] = yys
;
1444 yyleftmost_state
.yyposn
= 0;
1445 yystates
[0] = &yyleftmost_state
;
1450 if (yyx
->yystate
->yyposn
< yys
->yyposn
+ 1)
1451 YYFPRINTF (stderr
, "%*s%s -> <Rule %d, empty>\n",
1452 yyindent
, "", yytokenName (yylhsNonterm (yyx
->yyrule
)),
1455 YYFPRINTF (stderr
, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n",
1456 yyindent
, "", yytokenName (yylhsNonterm (yyx
->yyrule
)),
1457 yyx
->yyrule
, (unsigned long int) (yys
->yyposn
+ 1),
1458 (unsigned long int) yyx
->yystate
->yyposn
);
1459 for (yyi
= 1; yyi
<= yynrhs
; yyi
+= 1)
1461 if (yystates
[yyi
]->yyresolved
)
1463 if (yystates
[yyi
-1]->yyposn
+1 > yystates
[yyi
]->yyposn
)
1464 YYFPRINTF (stderr
, "%*s%s <empty>\n", yyindent
+2, "",
1465 yytokenName (yyrhs
[yyprhs
[yyx
->yyrule
]+yyi
-1]));
1467 YYFPRINTF (stderr
, "%*s%s <tokens %lu .. %lu>\n", yyindent
+2, "",
1468 yytokenName (yyrhs
[yyprhs
[yyx
->yyrule
]+yyi
-1]),
1469 (unsigned long int) (yystates
[yyi
- 1]->yyposn
+ 1),
1470 (unsigned long int) yystates
[yyi
]->yyposn
);
1473 yyreportTree (yystates
[yyi
]->yysemantics
.yyfirstVal
, yyindent
+2);
1479 yyreportAmbiguity (yySemanticOption
* yyx0
, yySemanticOption
* yyx1
,
1480 yyGLRStack
* yystack
]b4_pure_formals
[)
1482 /* `Unused' warnings. */
1487 YYFPRINTF (stderr
, "Ambiguity detected.\n");
1488 YYFPRINTF (stderr
, "Option 1,\n");
1489 yyreportTree (yyx0
, 2);
1490 YYFPRINTF (stderr
, "\nOption 2,\n");
1491 yyreportTree (yyx1
, 2);
1492 YYFPRINTF (stderr
, "\n");
1494 yyFail (yystack
][]b4_pure_args
[, "ambiguity detected");
1498 /** Resolve the ambiguity represented by OPTIONLIST, perform the indicated
1499 * actions, and return the result. */
1501 yyresolveValue (yySemanticOption
* yyoptionList
, yyGLRStack
* yystack
,
1502 YYSTYPE
* yyvalp
, YYLTYPE
* yylocp
]b4_user_formals
[)
1504 yySemanticOption
* yybest
;
1505 yySemanticOption
* yyp
;
1508 yybest
= yyoptionList
;
1510 for (yyp
= yyoptionList
->yynext
; yyp
!= NULL
; yyp
= yyp
->yynext
)
1512 if (yyidenticalOptions (yybest
, yyp
))
1513 yymergeOptionSets (yybest
, yyp
);
1515 switch (yypreference (yybest
, yyp
))
1518 yyreportAmbiguity (yybest
, yyp
, yystack
]b4_pure_args
[);
1534 int yyprec
= yydprec
[yybest
->yyrule
];
1535 YYCHK (yyresolveAction (yybest
, yystack
, yyvalp
, yylocp
]b4_user_args
[));
1536 for (yyp
= yybest
->yynext
; yyp
!= NULL
; yyp
= yyp
->yynext
)
1538 if (yyprec
== yydprec
[yyp
->yyrule
])
1542 YYCHK (yyresolveAction (yyp
, yystack
, &yyval1
, &yydummy
]b4_user_args
[));
1543 yyuserMerge (yymerger
[yyp
->yyrule
], yyvalp
, &yyval1
);
1549 return yyresolveAction (yybest
, yystack
, yyvalp
, yylocp
]b4_user_args
[);
1553 yyresolveStack (yyGLRStack
* yystack
]b4_user_formals
[)
1555 if (yystack
->yysplitPoint
!= NULL
)
1560 for (yyn
= 0, yys
= yystack
->yytops
.yystates
[0];
1561 yys
!= yystack
->yysplitPoint
;
1562 yys
= yys
->yypred
, yyn
+= 1)
1564 YYCHK (yyresolveStates (yystack
->yytops
.yystates
[0], yyn
, yystack
1571 yycompressStack (yyGLRStack
* yystack
)
1573 yyGLRState
* yyp
, *yyq
, *yyr
;
1575 if (yystack
->yytops
.yysize
!= 1 || yystack
->yysplitPoint
== NULL
)
1578 for (yyp
= yystack
->yytops
.yystates
[0], yyq
= yyp
->yypred
, yyr
= NULL
;
1579 yyp
!= yystack
->yysplitPoint
;
1580 yyr
= yyp
, yyp
= yyq
, yyq
= yyp
->yypred
)
1583 yystack
->yyspaceLeft
+= yystack
->yynextFree
- yystack
->yyitems
;
1584 yystack
->yynextFree
= ((yyGLRStackItem
*) yystack
->yysplitPoint
) + 1;
1585 yystack
->yyspaceLeft
-= yystack
->yynextFree
- yystack
->yyitems
;
1586 yystack
->yysplitPoint
= NULL
;
1587 yystack
->yylastDeleted
= NULL
;
1591 yystack
->yynextFree
->yystate
= *yyr
;
1593 yystack
->yynextFree
->yystate
.yypred
= & yystack
->yynextFree
[-1].yystate
;
1594 yystack
->yytops
.yystates
[0] = &yystack
->yynextFree
->yystate
;
1595 yystack
->yynextFree
+= 1;
1596 yystack
->yyspaceLeft
-= 1;
1601 yyprocessOneStack (yyGLRStack
* yystack
, int yyk
,
1602 size_t yyposn
, YYSTYPE
* yylvalp
, YYLTYPE
* yyllocp
1606 const short int* yyconflicts
;
1608 yySymbol
* const yytokenp
= yystack
->yytokenp
;
1610 while (yystack
->yytops
.yystates
[yyk
] != NULL
)
1612 yyStateNum yystate
= yystack
->yytops
.yystates
[yyk
]->yylrState
;
1613 YYDPRINTF ((stderr
, "Stack %d Entering state %d\n", yyk
, yystate
));
1615 YYASSERT (yystate
!= YYFINAL
);
1617 if (yyisDefaultedState (yystate
))
1619 yyrule
= yydefaultAction (yystate
);
1622 YYDPRINTF ((stderr
, "Stack %d dies.\n", yyk
));
1623 yymarkStackDeleted (yystack
, yyk
);
1626 YYCHK (yyglrReduce (yystack
, yyk
, yyrule
, yyfalse
]b4_lpure_args
[));
1630 if (*yytokenp
== YYEMPTY
)
1632 YYDPRINTF ((stderr
, "Reading a token: "));
1634 *yytokenp
= YYTRANSLATE (yychar
);
1635 YY_SYMBOL_PRINT ("Next token is", *yytokenp
, yylvalp
, yyllocp
);
1636 YYDPRINTF ((stderr
, "\n"));
1638 yygetLRActions (yystate
, *yytokenp
, &yyaction
, &yyconflicts
);
1640 while (*yyconflicts
!= 0)
1642 int yynewStack
= yysplitStack (yystack
, yyk
);
1643 YYDPRINTF ((stderr
, "Splitting off stack %d from %d.\n",
1645 YYCHK (yyglrReduce (yystack
, yynewStack
,
1646 *yyconflicts
, yyfalse
]b4_lpure_args
[));
1647 YYCHK (yyprocessOneStack (yystack
, yynewStack
, yyposn
,
1648 yylvalp
, yyllocp
]b4_user_args
[));
1652 if (yyisShiftAction (yyaction
))
1654 YYDPRINTF ((stderr
, "On stack %d, ", yyk
));
1655 YY_SYMBOL_PRINT ("shifting", *yytokenp
, yylvalp
, yyllocp
);
1656 yyglrShift (yystack
, yyk
, yyaction
, yyposn
+1,
1657 *yylvalp
, yyllocp
]b4_user_args
[);
1658 YYDPRINTF ((stderr
, ", now in state #%d\n",
1659 yystack
->yytops
.yystates
[yyk
]->yylrState
));
1662 else if (yyisErrorAction (yyaction
))
1664 YYDPRINTF ((stderr
, "Stack %d dies.\n", yyk
));
1665 yymarkStackDeleted (yystack
, yyk
);
1669 YYCHK (yyglrReduce (yystack
, yyk
, -yyaction
, yyfalse
]b4_lpure_args
[));
1676 yyreportSyntaxError (yyGLRStack
* yystack
,
1677 YYSTYPE
* yylvalp
, YYLTYPE
* yyllocp
]b4_user_formals
[)
1679 /* `Unused' warnings. */
1683 if (yystack
->yyerrState
== 0)
1686 yySymbol
* const yytokenp
= yystack
->yytokenp
;
1688 yyn
= yypact
[yystack
->yytops
.yystates
[0]->yylrState
];
1689 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1692 const char* yyprefix
;
1696 /* Start YYX at -YYN if negative to avoid negative indexes in
1698 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1700 /* Stay within bounds of both yycheck and yytname. */
1701 int yychecklim
= YYLAST
- yyn
;
1702 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1705 yyprefix
= ", expecting ";
1706 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1707 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1709 yysize
+= strlen (yyprefix
) + strlen (yytokenName (yyx
));
1718 yysize
+= (sizeof ("syntax error, unexpected ")
1719 + strlen (yytokenName (*yytokenp
)));
1720 yymsg
= (char*) YYMALLOC (yysize
);
1724 sprintf (yyp
, "syntax error%s%s",
1725 (*yytokenp
== YYEMPTY
? "" : ", unexpected "),
1726 yytokenName (*yytokenp
));
1727 yyp
+= strlen (yyp
);
1730 yyprefix
= ", expecting ";
1731 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1732 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1734 sprintf (yyp
, "%s%s", yyprefix
, yytokenName (yyx
));
1735 yyp
+= strlen (yyp
);
1739 yyerror (]b4_lyyerror_args
[yymsg
);
1743 yyerror (]b4_lyyerror_args
["syntax error; also virtual memory exhausted");
1746 #endif /* YYERROR_VERBOSE */
1747 yyerror (]b4_lyyerror_args
["syntax error");
1752 /* Recover from a syntax error on YYSTACK, assuming that YYTOKENP,
1753 YYLVALP, and YYLLOCP point to the syntactic category, semantic
1754 value, and location of the look-ahead. */
1756 yyrecoverSyntaxError (yyGLRStack
* yystack
,
1758 YYLTYPE
* YYOPTIONAL_LOC (yyllocp
)
1761 yySymbol
* const yytokenp
= yystack
->yytokenp
;
1765 if (yystack
->yyerrState
== 3)
1766 /* We just shifted the error token and (perhaps) took some
1767 reductions. Skip tokens until we can proceed. */
1770 if (*yytokenp
== YYEOF
)
1772 /* Now pop stack until empty and fail. */
1773 while (yystack
->yytops
.yystates
[0] != NULL
)
1775 yyGLRState
*yys
= yystack
->yytops
.yystates
[0];
1776 ]b4_location_if([[ yystack
->yyerror_range
[1].yystate
.yyloc
= yys
->yyloc
;]])[
1777 yydestruct ("Error: popping",
1778 yystos
[yys
->yylrState
],
1779 &yys
->yysemantics
.yysval
]b4_location_if([, &yys
->yyloc
])[);
1780 yystack
->yytops
.yystates
[0] = yys
->yypred
;
1781 yystack
->yynextFree
-= 1;
1782 yystack
->yyspaceLeft
+= 1;
1784 yyFail (yystack
][]b4_lpure_args
[, NULL
);
1786 if (*yytokenp
!= YYEMPTY
)
1788 /* We throw away the lookahead, but the error range
1789 of the shifted error token must take it into account. */
1790 yyGLRState
*yys
= yystack
->yytops
.yystates
[0];
1791 yyGLRStackItem yyerror_range
[3];
1792 yyerror_range
[1].yystate
.yyloc
= yys
->yyloc
;
1793 yyerror_range
[2].yystate
.yyloc
= *yyllocp
;
1794 YYLLOC_DEFAULT (yys
->yyloc
, yyerror_range
, 2);]])[
1795 yydestruct ("Error: discarding",
1796 *yytokenp
, yylvalp
]b4_location_if([, yyllocp
])[);
1798 YYDPRINTF ((stderr
, "Reading a token: "));
1800 *yytokenp
= YYTRANSLATE (yychar
);
1801 YY_SYMBOL_PRINT ("Next token is", *yytokenp
, yylvalp
, yyllocp
);
1802 YYDPRINTF ((stderr
, "\n"));
1803 yyj
= yypact
[yystack
->yytops
.yystates
[0]->yylrState
];
1804 if (yyis_pact_ninf (yyj
))
1807 if (yyj
< 0 || YYLAST
< yyj
|| yycheck
[yyj
] != *yytokenp
)
1809 if (yydefact
[yystack
->yytops
.yystates
[0]->yylrState
] != 0)
1812 else if (yytable
[yyj
] != 0 && ! yyis_table_ninf (yytable
[yyj
]))
1816 /* Reduce to one stack. */
1817 for (yyk
= 0; yyk
< yystack
->yytops
.yysize
; yyk
+= 1)
1818 if (yystack
->yytops
.yystates
[yyk
] != NULL
)
1820 if (yyk
>= yystack
->yytops
.yysize
)
1821 yyFail (yystack
][]b4_lpure_args
[, NULL
);
1822 for (yyk
+= 1; yyk
< yystack
->yytops
.yysize
; yyk
+= 1)
1823 yymarkStackDeleted (yystack
, yyk
);
1824 yyremoveDeletes (yystack
);
1825 yycompressStack (yystack
);
1827 /* Now pop stack until we find a state that shifts the error token. */
1828 yystack
->yyerrState
= 3;
1829 while (yystack
->yytops
.yystates
[0] != NULL
)
1831 yyGLRState
*yys
= yystack
->yytops
.yystates
[0];
1832 yyj
= yypact
[yys
->yylrState
];
1833 if (! yyis_pact_ninf (yyj
))
1836 if (0 <= yyj
&& yyj
<= YYLAST
&& yycheck
[yyj
] == YYTERROR
1837 && yyisShiftAction (yytable
[yyj
]))
1839 /* Shift the error token having adjusted its location. */
1840 YYLTYPE yyerrloc
;]b4_location_if([[
1841 yystack
->yyerror_range
[2].yystate
.yyloc
= *yyllocp
;
1842 YYLLOC_DEFAULT (yyerrloc
, yystack
->yyerror_range
, 2);]])[
1843 YY_SYMBOL_PRINT ("Shifting", yystos
[yytable
[yyj
]],
1844 yylvalp
, &yyerrloc
);
1845 YYDPRINTF ((stderr
, "\n"));
1846 yyglrShift (yystack
, 0, yytable
[yyj
],
1847 yys
->yyposn
, *yylvalp
, &yyerrloc
]b4_user_args
[);
1848 yys
= yystack
->yytops
.yystates
[0];
1852 ]b4_location_if([[ yystack
->yyerror_range
[1].yystate
.yyloc
= yys
->yyloc
;]])[
1853 yydestruct ("Error: popping",
1854 yystos
[yys
->yylrState
],
1855 &yys
->yysemantics
.yysval
]b4_location_if([, &yys
->yyloc
])[);
1856 yystack
->yytops
.yystates
[0] = yys
->yypred
;
1857 yystack
->yynextFree
-= 1;
1858 yystack
->yyspaceLeft
+= 1;
1860 if (yystack
->yytops
.yystates
[0] == NULL
)
1861 yyFail (yystack
][]b4_lpure_args
[, NULL
);
1864 #define YYCHK1(YYE) \
1870 yystack.yyerrflag = 1; \
1873 yystack.yyerrflag = 0; \
1876 goto yyuser_error; \
1885 ]b4_c_ansi_function_def([yyparse
], [int], b4_parse_param
)[
1895 #define yychar (yystack.yyrawchar)
1898 YYSTYPE
* const yylvalp
= &yylval
;
1899 YYLTYPE
* const yyllocp
= &yylloc
;
1901 yyinitGLRStack (&yystack
, YYINITDEPTH
);
1902 yystack
.yytokenp
= &yytoken
;
1904 YYDPRINTF ((stderr
, "Starting parse\n"));
1906 if (setjmp (yystack
.yyexception_buffer
) != 0)
1909 yylval
= yyval_default
;
1911 #if YYLTYPE_IS_TRIVIAL
1912 yylloc
.first_line
= yylloc
.last_line
= 1;
1913 yylloc
.first_column
= yylloc
.last_column
= 0;
1916 m4_ifdef([b4_initial_action
], [
1917 m4_pushdef([b4_at_dollar
], [yylval
])dnl
1918 m4_pushdef([b4_dollar_dollar
], [yylloc
])dnl
1919 /* User initialization code. */
1921 m4_popdef([b4_dollar_dollar
])dnl
1922 m4_popdef([b4_at_dollar
])dnl
1923 /* Line __line__ of glr.c. */
1924 b4_syncline([@oline@
], [@ofile@
])])dnl
1926 yyglrShift (&yystack
, 0, 0, 0, yylval
, &yylloc
]b4_user_args
[);
1932 /* For efficiency, we have two loops, the first of which is
1933 specialized to deterministic operation (single stack, no
1934 potential ambiguity). */
1940 const short int* yyconflicts
;
1942 yyStateNum yystate
= yystack
.yytops
.yystates
[0]->yylrState
;
1943 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1944 if (yystate
== YYFINAL
)
1946 if (yyisDefaultedState (yystate
))
1948 yyrule
= yydefaultAction (yystate
);
1951 ]b4_location_if([[ yystack
.yyerror_range
[1].yystate
.yyloc
= *yyllocp
;]])[
1952 yyreportSyntaxError (&yystack
, yylvalp
, yyllocp
]b4_user_args
[);
1955 YYCHK1 (yyglrReduce (&yystack
, 0, yyrule
, yytrue
]b4_lpure_args
[));
1959 if (yytoken
== YYEMPTY
)
1961 YYDPRINTF ((stderr
, "Reading a token: "));
1963 yytoken
= YYTRANSLATE (yychar
);
1964 YY_SYMBOL_PRINT ("Next token is", yytoken
, yylvalp
, yyllocp
);
1965 YYDPRINTF ((stderr
, "\n"));
1967 yygetLRActions (yystate
, yytoken
, &yyaction
, &yyconflicts
);
1968 if (*yyconflicts
!= 0)
1970 if (yyisShiftAction (yyaction
))
1972 YY_SYMBOL_PRINT ("Shifting", yytoken
, yylvalp
, yyllocp
);
1973 YYDPRINTF ((stderr
, "\n"));
1974 if (yytoken
!= YYEOF
)
1977 yyglrShift (&yystack
, 0, yyaction
, yyposn
,
1978 yylval
, yyllocp
]b4_user_args
[);
1979 if (0 < yystack
.yyerrState
)
1980 yystack
.yyerrState
-= 1;
1982 else if (yyisErrorAction (yyaction
))
1984 ]b4_location_if([[ yystack
.yyerror_range
[1].yystate
.yyloc
= *yyllocp
;]])[
1985 yyreportSyntaxError (&yystack
, yylvalp
, yyllocp
]b4_user_args
[);
1989 YYCHK1 (yyglrReduce (&yystack
, 0, -yyaction
, yytrue
]b4_lpure_args
[));
1996 int yyn
= yystack
.yytops
.yysize
;
1997 for (yys
= 0; yys
< yyn
; yys
+= 1)
1998 YYCHK1 (yyprocessOneStack (&yystack
, yys
, yyposn
,
1999 yylvalp
, yyllocp
]b4_user_args
[));
2002 yyremoveDeletes (&yystack
);
2003 if (yystack
.yytops
.yysize
== 0)
2005 yyundeleteLastStack (&yystack
);
2006 if (yystack
.yytops
.yysize
== 0)
2007 yyFail (&yystack
][]b4_lpure_args
[, "syntax error");
2008 YYCHK1 (yyresolveStack (&yystack
]b4_user_args
[));
2009 YYDPRINTF ((stderr
, "Returning to deterministic operation.\n"));
2010 ]b4_location_if([[ yystack
.yyerror_range
[1].yystate
.yyloc
= *yyllocp
;]])[
2011 yyreportSyntaxError (&yystack
, yylvalp
, yyllocp
]b4_user_args
[);
2014 else if (yystack
.yytops
.yysize
== 1)
2016 YYCHK1 (yyresolveStack (&yystack
]b4_user_args
[));
2017 YYDPRINTF ((stderr
, "Returning to deterministic operation.\n"));
2018 yycompressStack (&yystack
);
2024 yyrecoverSyntaxError (&yystack
, yylvalp
, yyllocp
]b4_user_args
[);
2025 yyposn
= yystack
.yytops
.yystates
[0]->yyposn
;
2028 /* On YYABORT, free the lookahead. */
2029 if (yystack
.yyerrflag
== 1 && yytoken
!= YYEMPTY
)
2030 yydestruct ("Error: discarding lookahead",
2031 yytoken
, yylvalp
]b4_location_if([, yyllocp
])[);
2033 yyfreeGLRStack (&yystack
);
2034 return yystack
.yyerrflag
;
2037 /* DEBUGGING ONLY */
2039 static void yypstack (yyGLRStack
* yystack
, int yyk
) ATTRIBUTE_UNUSED
;
2040 static void yypdumpstack (yyGLRStack
* yystack
) ATTRIBUTE_UNUSED
;
2043 yy_yypstack (yyGLRState
* yys
)
2047 yy_yypstack (yys
->yypred
);
2048 fprintf (stderr
, " -> ");
2050 fprintf (stderr
, "%d@@%lu", yys
->yylrState
, (unsigned long int) yys
->yyposn
);
2054 yypstates (yyGLRState
* yyst
)
2057 fprintf (stderr
, "<null>");
2060 fprintf (stderr
, "\n");
2064 yypstack (yyGLRStack
* yystack
, int yyk
)
2066 yypstates (yystack
->yytops
.yystates
[yyk
]);
2069 #define YYINDEX(YYX) \
2070 ((YYX) == NULL ? -1 : (yyGLRStackItem*) (YYX) - yystack->yyitems)
2074 yypdumpstack (yyGLRStack
* yystack
)
2076 yyGLRStackItem
* yyp
;
2078 for (yyp
= yystack
->yyitems
; yyp
< yystack
->yynextFree
; yyp
+= 1)
2080 fprintf (stderr
, "%3lu. ", (unsigned long int) (yyp
- yystack
->yyitems
));
2081 if (*(yybool
*) yyp
)
2083 fprintf (stderr
, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
2084 yyp
->yystate
.yyresolved
, yyp
->yystate
.yylrState
,
2085 (unsigned long int) yyp
->yystate
.yyposn
,
2086 (long int) YYINDEX (yyp
->yystate
.yypred
));
2087 if (! yyp
->yystate
.yyresolved
)
2088 fprintf (stderr
, ", firstVal: %ld",
2089 (long int) YYINDEX (yyp
->yystate
.yysemantics
.yyfirstVal
));
2093 fprintf (stderr
, "Option. rule: %d, state: %ld, next: %ld",
2094 yyp
->yyoption
.yyrule
,
2095 (long int) YYINDEX (yyp
->yyoption
.yystate
),
2096 (long int) YYINDEX (yyp
->yyoption
.yynext
));
2098 fprintf (stderr
, "\n");
2100 fprintf (stderr
, "Tops:");
2101 for (yyi
= 0; yyi
< yystack
->yytops
.yysize
; yyi
+= 1)
2102 fprintf (stderr
, "%lu: %ld; ", (unsigned long int) yyi
,
2103 (long int) YYINDEX (yystack
->yytops
.yystates
[yyi
]));
2104 fprintf (stderr
, "\n");
2110 m4_if(b4_defines_flag
, 0, [],
2111 [@output @output_header_name@
2112 b4_copyright([Skeleton parser
for GLR parsing with Bison
],
2113 [2002, 2003, 2004, 2005])
2115 b4_token_defines(b4_tokens
)
2117 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
2118 m4_ifdef([b4_stype
],
2119 [b4_syncline([b4_stype_line
], [b4_filename
])
2120 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
2121 /* Line __line__ of glr.c. */
2122 b4_syncline([@oline@
], [@ofile@
])],
2123 [typedef int YYSTYPE
;])
2124 # define YYSTYPE_IS_DECLARED 1
2125 # define YYSTYPE_IS_TRIVIAL 1
2129 [extern YYSTYPE b4_prefix
[]lval
;])
2131 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
2132 typedef struct YYLTYPE
2143 # define YYLTYPE_IS_DECLARED 1
2144 # define YYLTYPE_IS_TRIVIAL 1
2147 b4_location_if([b4_pure_if([],
2148 [extern YYLTYPE b4_prefix
[]lloc
;])