1 m4_divert(-1) -*- C
-*-
4 # Yacc compatible skeleton for Bison
5 # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002
6 # Free Software Foundation, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 # b4_lhs_value([TYPE])
24 # --------------------
25 # Expansion of $<TYPE>$.
26 m4_define([b4_lhs_value
],
27 [yyval
[]m4_ifval([$
1], [.$
1])])
30 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
31 # --------------------------------------
32 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
34 m4_define([b4_rhs_value
],
35 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
43 # b4_location_if(IF-TRUE, IF-FALSE)
44 # ---------------------------------
45 # Expand IF-TRUE, if locations are used, IF-FALSE otherwise.
46 m4_define([b4_location_if
],
47 [m4_if(b4_locations_flag
, [1],
55 m4_define([b4_lhs_location
],
59 # b4_rhs_location(RULE-LENGTH, NUM)
60 # ---------------------------------
61 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
63 m4_define([b4_rhs_location
],
64 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
72 # b4_pure_if(IF-TRUE, IF-FALSE)
73 # -----------------------------
74 # Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise.
75 m4_define([b4_pure_if
],
81 ## ------------------- ##
82 ## Output file names. ##
83 ## ------------------- ##
85 m4_define_default([b4_input_suffix
], [.y
])
87 m4_define_default([b4_output_parser_suffix
],
88 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
90 m4_define_default([b4_output_parser_name
],
91 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
94 m4_define_default([b4_output_header_suffix
],
95 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
97 m4_define_default([b4_output_header_name
],
98 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
100 m4_define_default([b4_header_guard
],
101 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
102 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
106 ## --------------------------------------------------------- ##
107 ## Defining symbol actions, e.g., printers and destructors. ##
108 ## --------------------------------------------------------- ##
110 # b4_symbol_actions(FILENAME, LINENO,
111 # SYMBOL-TAG, SYMBOL-NUM,
112 # SYMBOL-ACTION, SYMBOL-TYPENAME)
113 # -------------------------------------------------
114 m4_define([b4_symbol_actions
],
115 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
116 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
120 #line __oline__ "__ofile__"
122 m4_popdef([b4_at_dollar
])dnl
123 m4_popdef([b4_dollar_dollar
])dnl
129 #output "b4_output_parser_name"
130 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
131 [1984, 1989, 1990, 2000, 2001, 2002])
133 /* As a special exception, when this file is copied by Bison into a
134 Bison output file, you may use that output file without restriction.
135 This special exception was added by the Free Software Foundation
136 in version 1.24 of Bison. */
138 /* Written by Richard Stallman by simplifying the original so called
139 ``semantic'' parser. */
141 /* All symbols defined below should begin with yy or YY, to avoid
142 infringing on user name space. This should be done even for local
143 variables, as they might otherwise be expanded by user macros.
144 There are some unavoidable exceptions within include files to
145 define necessary library symbols; they are noted "INFRINGES ON
146 USER NAME SPACE" below. */
148 /* Identify Bison output. */
152 #define YYPURE b4_pure
154 /* Using locations. */
155 #define YYLSP_NEEDED b4_locations_flag
157 m4_if(b4_prefix
[], [yy
], [],
158 [/* If NAME_PREFIX is specified substitute the variables and functions
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 b4_location_if([#define yylloc b4_prefix[]lloc])])
169 b4_token_defines(b4_tokens
)
171 /* Copy the first part of user declarations. */
174 /* Enabling traces. */
176 # define YYDEBUG b4_debug
179 /* Enabling verbose error messages. */
180 #ifdef YYERROR_VERBOSE
181 # undef YYERROR_VERBOSE
182 # define YYERROR_VERBOSE 1
184 # define YYERROR_VERBOSE b4_error_verbose
189 [#line b4_stype_line "b4_filename"
190 typedef union b4_stype yystype
;
191 /* Line __line__ of __file__. */
192 #line __oline__ "__ofile__"],
193 [typedef int yystype
;])
194 # define YYSTYPE yystype
195 # define YYSTYPE_IS_TRIVIAL 1
199 typedef struct yyltype
206 # define YYLTYPE b4_ltype
207 # define YYLTYPE_IS_TRIVIAL 1
210 /* Copy the second part of user declarations. */
213 /* Line __line__ of __file__. */
214 #line __oline__ "__ofile__"
216 #if ! defined (yyoverflow) || YYERROR_VERBOSE
218 /* The parser invokes alloca or malloc; define the necessary symbols. */
220 # if YYSTACK_USE_ALLOCA
221 # define YYSTACK_ALLOC alloca
223 # ifndef YYSTACK_USE_ALLOCA
224 # if defined (alloca) || defined (_ALLOCA_H)
225 # define YYSTACK_ALLOC alloca
228 # define YYSTACK_ALLOC __builtin_alloca
234 # ifdef YYSTACK_ALLOC
235 /* Pacify GCC's `empty if-body' warning. */
236 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
238 # if defined (__STDC__) || defined (__cplusplus)
239 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
240 # define YYSIZE_T size_t
242 # define YYSTACK_ALLOC malloc
243 # define YYSTACK_FREE free
245 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
248 #if (! defined (yyoverflow) \
249 && (! defined (__cplusplus) \
250 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
252 /* A type that is properly aligned for any stack member. */
257 b4_location_if([ YYLTYPE yyls
;
261 /* The size of the maximum gap between one aligned stack and the next. */
262 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
264 /* The size of an array large to enough to hold all stacks, each with
267 [# define YYSTACK_BYTES(N) \
268 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
269 + 2 * YYSTACK_GAP_MAX)],
270 [# define YYSTACK_BYTES(N) \
271 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
274 /* Copy COUNT objects from FROM to TO. The source and destination do
278 # define YYCOPY(To, From, Count) \
279 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
281 # define YYCOPY(To, From, Count) \
284 register YYSIZE_T yyi; \
285 for (yyi = 0; yyi < (Count); yyi++) \
286 (To)[[yyi]] = (From)[[yyi]]; \
292 /* Relocate STACK from its old location to the new one. The
293 local variables YYSIZE and YYSTACKSIZE give the old and new number of
294 elements in the stack, and YYPTR gives the new location of the
295 stack. Advance YYPTR to a properly aligned location for the next
297 # define YYSTACK_RELOCATE(Stack) \
300 YYSIZE_T yynewbytes; \
301 YYCOPY (&yyptr->Stack, Stack, yysize); \
302 Stack = &yyptr->Stack; \
303 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
304 yyptr += yynewbytes / sizeof (*yyptr); \
310 /* YYFINAL -- State number of the termination state. */
311 #define YYFINAL b4_final_state_number
312 #define YYLAST b4_last
314 /* YYNTOKENS -- Number of terminals. */
315 #define YYNTOKENS b4_tokens_number
316 /* YYNNTS -- Number of nonterminals. */
317 #define YYNNTS b4_nterms_number
318 /* YYNRULES -- Number of rules. */
319 #define YYNRULES b4_rules_number
320 /* YYNRULES -- Number of states. */
321 #define YYNSTATES b4_states_number
323 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
324 #define YYUNDEFTOK b4_undef_token_number
325 #define YYMAXUTOK b4_user_token_number_max
327 #define YYTRANSLATE(X) \
328 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
330 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
331 static const b4_int_type_for([b4_translate
]) yytranslate
[[]] =
337 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
339 static const b4_int_type_for([b4_prhs
]) yyprhs
[[]] =
344 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
345 static const b4_int_type_for([b4_rhs
]) yyrhs
[[]] =
350 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
351 static const b4_int_type_for([b4_rline
]) yyrline
[[]] =
357 #if YYDEBUG || YYERROR_VERBOSE
358 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
359 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
360 static const char *const yytname
[[]] =
367 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
369 static const b4_int_type_for([b4_toknum
]) yytoknum
[[]] =
375 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
376 static const b4_int_type_for([b4_r1
]) yyr1
[[]] =
381 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
382 static const b4_int_type_for([b4_r2
]) yyr2
[[]] =
387 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
388 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
389 means the default is an error. */
390 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
395 /* YYDEFGOTO[[NTERM-NUM]]. */
396 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
401 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
403 #define YYPACT_NINF b4_pact_ninf
404 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
409 /* YYPGOTO[[NTERM-NUM]]. */
410 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
415 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
416 positive, shift that token. If negative, reduce the rule which
417 number is the opposite. If zero, do what YYDEFACT says.
418 If YYTABLE_NINF, parse error. */
419 #define YYTABLE_NINF b4_table_ninf
420 static const b4_int_type_for([b4_table
]) yytable
[[]] =
425 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
430 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
431 symbol of state STATE-NUM. */
432 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
437 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
438 # define YYSIZE_T __SIZE_TYPE__
440 #if ! defined (YYSIZE_T) && defined (size_t)
441 # define YYSIZE_T size_t
443 #if ! defined (YYSIZE_T)
444 # if defined (__STDC__) || defined (__cplusplus)
445 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
446 # define YYSIZE_T size_t
449 #if ! defined (YYSIZE_T)
450 # define YYSIZE_T unsigned int
453 #define yyerrok (yyerrstatus = 0)
454 #define yyclearin (yychar = YYEMPTY)
458 #define YYACCEPT goto yyacceptlab
459 #define YYABORT goto yyabortlab
460 #define YYERROR goto yyerrlab1
462 /* Like YYERROR except do call yyerror. This remains here temporarily
463 to ease the transition to the new meaning of YYERROR, for GCC.
464 Once GCC version 2 has supplanted version 1, this can go. */
466 #define YYFAIL goto yyerrlab
468 #define YYRECOVERING() (!!yyerrstatus)
470 #define YYBACKUP(Token, Value) \
472 if (yychar == YYEMPTY && yylen == 1) \
476 yychar1 = YYTRANSLATE (yychar); \
482 yyerror ("syntax error: cannot back up"); \
488 #define YYERRCODE 256
490 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
493 #ifndef YYLLOC_DEFAULT
494 # define YYLLOC_DEFAULT(Current, Rhs, N) \
495 Current.first_line = Rhs[[1]].first_line; \
496 Current.first_column = Rhs[[1]].first_column; \
497 Current.last_line = Rhs[[N]].last_line; \
498 Current.last_column = Rhs[[N]].last_column;
501 /* YYLEX -- calling `yylex' with the right arguments. */
505 # define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]), YYLEX_PARAM)
507 # define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]))
509 [#define YYLEX yylex ()])
511 /* Enable debugging if requested. */
515 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
516 # define YYFPRINTF fprintf
519 # define YYDPRINTF(Args) \
524 # define YYDSYMPRINT(Args) \
529 /* Nonzero means print parse trace. It is left uninitialized so that
530 multiple parsers can coexist. */
533 # define YYDPRINTF(Args)
534 # define YYDSYMPRINT(Args)
535 #endif /* !YYDEBUG */
537 /* YYINITDEPTH -- initial size of the parser's stacks. */
539 # define YYINITDEPTH b4_initdepth
542 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
543 if the built-in stack extension method is used).
545 Do not make this value too large; the results are undefined if
546 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
547 evaluated with infinite-precision integer arithmetic. */
554 # define YYMAXDEPTH b4_maxdepth
562 # if defined (__GLIBC__) && defined (_STRING_H)
563 # define yystrlen strlen
565 /* Return the length of YYSTR. */
567 # if defined (__STDC__) || defined (__cplusplus)
568 yystrlen (const char *yystr
)
574 register const char *yys
= yystr
;
576 while (*yys
++ != '\0')
579 return yys
- yystr
- 1;
585 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
586 # define yystpcpy stpcpy
588 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
591 # if defined (__STDC__) || defined (__cplusplus)
592 yystpcpy (char *yydest
, const char *yysrc
)
594 yystpcpy (yydest
, yysrc
)
599 register char *yyd
= yydest
;
600 register const char *yys
= yysrc
;
602 while ((*yyd
++ = *yys
++) != '\0')
610 #endif /* !YYERROR_VERBOSE */
615 /*-----------------------------.
616 | Print this symbol on YYOUT. |
617 `-----------------------------*/
619 b4_c_function([yysymprint
],
623 [[YYSTYPE
], [yyvalue
]]b4_location_if([,
624 [[YYLTYPE
], [yylocation
]]]))
626 /* Pacify ``unused variable'' warnings. */
628 b4_location_if([ (void) yylocation
;
631 if (yytype
< YYNTOKENS
)
633 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
635 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
639 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
643 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
647 YYFPRINTF (yyout
, ")");
649 #endif /* YYDEBUG. */
652 /*-----------------------------------------------.
653 | Release the memory associated to this symbol. |
654 `-----------------------------------------------*/
656 b4_c_function([yydestruct
],
659 [[YYSTYPE
], [yyvalue
]]b4_location_if([,
660 [[YYLTYPE
], [yylocation
]]]))
662 /* Pacify ``unused variable'' warnings. */
664 b4_location_if([ (void) yylocation
;
669 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
677 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
678 into yyparse. The argument should have type void *.
679 It should actually point to an object.
680 Grammar actions can access the variable by casting it
681 to the proper pointer type. */
684 # if defined (__STDC__) || defined (__cplusplus)
685 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
686 # define YYPARSE_PARAM_DECL
688 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
689 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
691 #else /* !YYPARSE_PARAM */
692 # define YYPARSE_PARAM_ARG
693 # define YYPARSE_PARAM_DECL
694 #endif /* !YYPARSE_PARAM */
696 /* Prevent warning if -Wstrict-prototypes. */
698 # ifdef YYPARSE_PARAM
699 int yyparse (void *);
705 m4_divert_push([KILL
])# ======================== M4 code.
706 # b4_declare_parser_variables
707 # ---------------------------
708 # Declare the variables that are global, or local to YYPARSE if
710 m4_define([b4_declare_parser_variables
],
711 [/* The lookahead symbol. */
714 /* The semantic value of the lookahead symbol. */
717 /* Number of parse errors so far. */
718 int yynerrs
;b4_location_if([
719 /* Location data for the lookahead symbol. */
722 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
725 [b4_declare_parser_variables
])
728 yyparse (YYPARSE_PARAM_ARG
)
731 ]b4_pure_if([b4_declare_parser_variables
])[
732 register int yystate
;
735 /* Number of tokens to shift before error messages enabled. */
737 /* Lookahead token as an internal (translated) token number. */
740 /* Three stacks and their tools:
741 `yyss': related to states,
742 `yyvs': related to semantic values,
743 `yyls': related to locations.
745 Refer to the stacks thru separate pointers, to allow yyoverflow
746 to reallocate them elsewhere. */
748 /* The state stack. */
749 short yyssa
[YYINITDEPTH
];
751 register short *yyssp
;
753 /* The semantic value stack. */
754 YYSTYPE yyvsa
[YYINITDEPTH
];
755 YYSTYPE
*yyvs
= yyvsa
;
756 register YYSTYPE
*yyvsp
;
759 [[ /* The location stack. */
760 YYLTYPE yylsa
[YYINITDEPTH
];
761 YYLTYPE
*yyls
= yylsa
;
764 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
766 YYSIZE_T yystacksize
= YYINITDEPTH
;
768 /* The variables used to return semantic value and location from the
771 ]b4_location_if([ YYLTYPE yyloc
;])[
773 /* When reducing, the number of symbols on the RHS of the reduced
777 YYDPRINTF ((stderr
, "Starting parse\n"));
782 yychar
= YYEMPTY
; /* Cause a token to be read. */
784 /* Initialize stack pointers.
785 Waste one element of value and location stack
786 so that they stay on the same level as the state stack.
787 The wasted elements are never initialized. */
791 ]b4_location_if([ yylsp
= yyls
;])[
794 /*------------------------------------------------------------.
795 | yynewstate -- Push a new state, which is found in yystate. |
796 `------------------------------------------------------------*/
798 /* In all cases, when you get here, the value and location stacks
799 have just been pushed. so pushing a state here evens the stacks.
806 if (yyssp
>= yyss
+ yystacksize
- 1)
808 /* Get the current used size of the three stacks, in elements. */
809 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
813 /* Give user a chance to reallocate the stack. Use copies of
814 these so that the &'s don't force the real ones into
816 YYSTYPE
*yyvs1
= yyvs
;
818 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
820 /* Each stack pointer address is followed by the size of the
821 data in use in that stack, in bytes. This used to be a
822 conditional around just the two extra args, but that might
823 be undefined if yyoverflow is a macro. */
824 yyoverflow ("parser stack overflow",
825 &yyss1
, yysize
* sizeof (*yyssp
),
826 &yyvs1
, yysize
* sizeof (*yyvsp
),
827 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
829 ]b4_location_if([ yyls
= yyls1
;])[
833 #else /* no yyoverflow */
834 # ifndef YYSTACK_RELOCATE
837 /* Extend the stack our own way. */
838 if (yystacksize
>= YYMAXDEPTH
)
841 if (yystacksize
> YYMAXDEPTH
)
842 yystacksize
= YYMAXDEPTH
;
846 union yyalloc
*yyptr
=
847 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
850 YYSTACK_RELOCATE (yyss
);
851 YYSTACK_RELOCATE (yyvs
);
852 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
853 # undef YYSTACK_RELOCATE
855 YYSTACK_FREE (yyss1
);
858 #endif /* no yyoverflow */
860 yyssp
= yyss
+ yysize
- 1;
861 yyvsp
= yyvs
+ yysize
- 1;
862 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
864 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
865 (unsigned long int) yystacksize
));
867 if (yyssp
>= yyss
+ yystacksize
- 1)
871 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
880 /* Do appropriate processing given the current state. */
881 /* Read a lookahead token if we need one and don't already have one. */
884 /* First try to decide what to do without reference to lookahead token. */
886 yyn
= yypact
[yystate
];
887 if (yyn
== YYPACT_NINF
)
890 /* Not known => get a lookahead token if don't already have one. */
892 /* yychar is either YYEMPTY or YYEOF
893 or a valid token in external form. */
895 if (yychar
== YYEMPTY
)
897 YYDPRINTF ((stderr
, "Reading a token: "));
901 /* Convert token to internal form (in yychar1) for indexing tables with. */
903 if (yychar
<= 0) /* This means end of input. */
906 yychar
= YYEOF
; /* Don't call YYLEX any more. */
908 YYDPRINTF ((stderr
, "Now at end of input.\n"));
912 yychar1
= YYTRANSLATE (yychar
);
914 /* We have to keep this `#if YYDEBUG', since we use variables
915 which are defined only if `YYDEBUG' is set. */
916 YYDPRINTF ((stderr
, "Next token is "));
917 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
918 YYDPRINTF ((stderr
, "\n"));
921 /* Set YYN to the action to take in STATE on seeing token YYCHAR1.
923 - YYN < 0: Reduce on rule -YYN.
925 - YYN > 0: Shift to state YYN. */
927 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
928 /* Defaulted action (reduction). */
929 yyn
= -yydefact
[yystate
];
930 else if (yytable
[yyn
] != YYTABLE_NINF
)
946 /* Shift the lookahead token. */
947 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
948 yychar
, yytname
[yychar1
]));
950 /* Discard the token being shifted unless it is eof. */
955 ]b4_location_if([ *++yylsp
= yylloc
;])[
957 /* Count tokens shifted since error; after three, turn off error
966 /*-----------------------------------------------------------.
967 | yydefault -- do the default action for the current state. |
968 `-----------------------------------------------------------*/
970 yyn
= yydefact
[yystate
];
976 /*-----------------------------.
977 | yyreduce -- Do a reduction. |
978 `-----------------------------*/
980 /* yyn is the number of a rule to reduce with. */
983 /* If YYLEN is nonzero, implement the default value of the action:
986 Otherwise, the following line sets YYVAL to garbage.
987 This behavior is undocumented and Bison
988 users should not rely upon it. Assigning to YYVAL
989 unconditionally makes the parser a bit smaller, and it avoids a
990 GCC warning that YYVAL may be used uninitialized. */
991 yyval
= yyvsp
[1-yylen
];
994 [ /* Default location. */
995 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
998 /* We have to keep this `#if YYDEBUG', since we use variables which
999 are defined only if `YYDEBUG' is set. */
1004 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1005 yyn
- 1, yyrline
[yyn
]);
1007 /* Print the symbols being reduced, and their result. */
1008 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] >= 0; yyi
++)
1009 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1010 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1018 /* Line __line__ of __file__. */
1019 #line __oline__ "__ofile__"
1023 ]b4_location_if([ yylsp
-= yylen
;])[
1028 short *yyssp1
= yyss
- 1;
1029 YYFPRINTF (stderr
, "state stack now");
1030 while (yyssp1
!= yyssp
)
1031 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1032 YYFPRINTF (stderr
, "\n");
1037 ]b4_location_if([ *++yylsp
= yyloc
;])[
1039 /* Now `shift' the result of the reduction. Determine what state
1040 that goes to, based on the state we popped back to and the rule
1041 number reduced by. */
1045 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1046 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1047 yystate
= yytable
[yystate
];
1049 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1054 /*------------------------------------.
1055 | yyerrlab -- here on detecting error |
1056 `------------------------------------*/
1058 /* If not already recovering from an error, report this error. */
1063 yyn
= yypact
[yystate
];
1065 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1067 YYSIZE_T yysize
= 0;
1068 int yytype
= YYTRANSLATE (yychar
);
1073 /* Start YYX at -YYN if negative to avoid negative indexes in
1075 for (yyx
= yyn
< 0 ? -yyn
: 0;
1076 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1077 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1078 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1079 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1080 yysize
+= yystrlen (yytname
[yytype
]);
1081 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1084 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1085 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1090 for (yyx
= yyn
< 0 ? -yyn
: 0;
1091 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1093 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1095 const char *yyq
= ! yycount
? ", expecting " : " or ";
1096 yyp
= yystpcpy (yyp
, yyq
);
1097 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1102 YYSTACK_FREE (yymsg
);
1105 yyerror ("parse error; also virtual memory exhausted");
1108 #endif /* YYERROR_VERBOSE */
1109 yyerror ("parse error");
1114 /*----------------------------------------------------.
1115 | yyerrlab1 -- error raised explicitly by an action. |
1116 `----------------------------------------------------*/
1118 if (yyerrstatus
== 3)
1120 /* If just tried and failed to reuse lookahead token after an
1121 error, discard it. */
1123 /* Return failure if at end of input. */
1124 if (yychar
== YYEOF
)
1126 /* Pop the error token. */
1128 /* Pop the rest of the stack. */
1129 while (yyssp
> yyss
)
1131 YYDPRINTF ((stderr
, "Error: popping "));
1132 YYDSYMPRINT ((stderr
,
1134 *yyvsp
]b4_location_if([, *yylsp
])[));
1135 YYDPRINTF ((stderr
, "\n"));
1136 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1142 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1143 yychar
, yytname
[yychar1
]));
1144 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1148 /* Else will try to reuse lookahead token after shifting the error
1151 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1155 yyn
= yypact
[yystate
];
1156 if (yyn
!= YYPACT_NINF
)
1159 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1167 /* Pop the current state because it cannot handle the error token. */
1171 YYDPRINTF ((stderr
, "Error: popping "));
1172 YYDSYMPRINT ((stderr
,
1173 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1174 YYDPRINTF ((stderr
, "\n"));
1176 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1179 ]b4_location_if([ yylsp
--;])[
1184 short *yyssp1
= yyss
- 1;
1185 YYFPRINTF (stderr
, "Error: state stack now");
1186 while (yyssp1
!= yyssp
)
1187 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1188 YYFPRINTF (stderr
, "\n");
1196 YYDPRINTF ((stderr
, "Shifting error token, "));
1199 ]b4_location_if([ *++yylsp
= yylloc
;])[
1205 /*-------------------------------------.
1206 | yyacceptlab -- YYACCEPT comes here. |
1207 `-------------------------------------*/
1212 /*-----------------------------------.
1213 | yyabortlab -- YYABORT comes here. |
1214 `-----------------------------------*/
1220 /*----------------------------------------------.
1221 | yyoverflowlab -- parser overflow comes here. |
1222 `----------------------------------------------*/
1224 yyerror ("parser stack overflow");
1232 YYSTACK_FREE (yyss
);
1239 m4_if(b4_defines_flag
, 0, [],
1240 [#output "b4_output_header_name"
1241 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1242 [1984, 1989, 1990, 2000, 2001, 2002])
1244 /* As a special exception, when this file is copied by Bison into a
1245 Bison output file, you may use that output file without restriction.
1246 This special exception was added by the Free Software Foundation
1247 in version 1.24 of Bison. */
1249 #ifndef b4_header_guard
1250 # define b4_header_guard
1252 b4_token_defines(b4_tokens
)
1255 m4_ifdef([b4_stype
],
1256 [#line b4_stype_line "b4_filename"
1257 typedef union b4_stype yystype
;
1258 /* Line __line__ of __file__. */
1259 #line __oline__ "__ofile__"],
1260 [typedef int yystype
;])
1261 # define YYSTYPE yystype
1265 [extern YYSTYPE b4_prefix
[]lval
;])
1269 typedef struct yyltype
1276 # define YYLTYPE yyltype
1280 [extern YYLTYPE b4_prefix
[]lloc
;])
1282 #endif /* not b4_header_guard */