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