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
25 ## ---------------- ##
27 ## ---------------- ##
30 m4_define_default([b4_stack_depth_max
], [10000])
31 m4_define_default([b4_stack_depth_init
], [200])
34 m4_define_default([b4_location_type
], [yyltype
])
36 # Accumule in b4_lex_param all the yylex arguments.
37 # Yes, this is quite ugly...
38 m4_define([b4_lex_param
],
39 m4_dquote(b4_pure_if([[[[YYSTYPE
*]], [[&yylval
]]][]dnl
40 b4_location_if([, [[YYLTYPE
*], [&yylloc
]]])])dnl
41 m4_ifdef([b4_lex_param
], [, ]b4_lex_param
)))
44 ## ----------------- ##
45 ## Semantic Values. ##
46 ## ----------------- ##
49 # b4_lhs_value([TYPE])
50 # --------------------
51 # Expansion of $<TYPE>$.
52 m4_define([b4_lhs_value
],
53 [yyval
[]m4_ifval([$
1], [.$
1])])
56 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
57 # --------------------------------------
58 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
60 m4_define([b4_rhs_value
],
61 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
72 m4_define([b4_lhs_location
],
76 # b4_rhs_location(RULE-LENGTH, NUM)
77 # ---------------------------------
78 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
80 m4_define([b4_rhs_location
],
81 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
85 ## ------------------- ##
86 ## Output file names. ##
87 ## ------------------- ##
89 m4_define_default([b4_input_suffix
], [.y
])
91 m4_define_default([b4_output_parser_suffix
],
92 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
94 m4_define_default([b4_output_parser_name
],
95 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
98 m4_define_default([b4_output_header_suffix
],
99 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
101 m4_define_default([b4_output_header_name
],
102 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
104 m4_define_default([b4_header_guard
],
105 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
106 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
110 ## --------------------------------------------------------- ##
111 ## Defining symbol actions, e.g., printers and destructors. ##
112 ## --------------------------------------------------------- ##
114 # b4_symbol_actions(FILENAME, LINENO,
115 # SYMBOL-TAG, SYMBOL-NUM,
116 # SYMBOL-ACTION, SYMBOL-TYPENAME)
117 # -------------------------------------------------
118 m4_define([b4_symbol_actions
],
119 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
120 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
124 #line __oline__ "__ofile__"
126 m4_popdef([b4_at_dollar
])dnl
127 m4_popdef([b4_dollar_dollar
])dnl
133 #output "b4_output_parser_name"
134 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
135 [1984, 1989, 1990, 2000, 2001, 2002])
137 /* As a special exception, when this file is copied by Bison into a
138 Bison output file, you may use that output file without restriction.
139 This special exception was added by the Free Software Foundation
140 in version 1.24 of Bison. */
142 /* Written by Richard Stallman by simplifying the original so called
143 ``semantic'' parser. */
145 /* All symbols defined below should begin with yy or YY, to avoid
146 infringing on user name space. This should be done even for local
147 variables, as they might otherwise be expanded by user macros.
148 There are some unavoidable exceptions within include files to
149 define necessary library symbols; they are noted "INFRINGES ON
150 USER NAME SPACE" below. */
152 /* Identify Bison output. */
156 #define YYPURE b4_pure
158 /* Using locations. */
159 #define YYLSP_NEEDED b4_locations_flag
161 m4_if(b4_prefix
[], [yy
], [],
162 [/* If NAME_PREFIX is specified substitute the variables and functions
164 #define yyparse b4_prefix[]parse
165 #define yylex b4_prefix[]lex
166 #define yyerror b4_prefix[]error
167 #define yylval b4_prefix[]lval
168 #define yychar b4_prefix[]char
169 #define yydebug b4_prefix[]debug
170 #define yynerrs b4_prefix[]nerrs
171 b4_location_if([#define yylloc b4_prefix[]lloc])])
173 b4_token_defines(b4_tokens
)
175 /* Copy the first part of user declarations. */
178 /* Enabling traces. */
180 # define YYDEBUG b4_debug
183 /* Enabling verbose error messages. */
184 #ifdef YYERROR_VERBOSE
185 # undef YYERROR_VERBOSE
186 # define YYERROR_VERBOSE 1
188 # define YYERROR_VERBOSE b4_error_verbose
193 [#line b4_stype_line "b4_filename"
194 typedef union b4_stype yystype
;
195 /* Line __line__ of __file__. */
196 #line __oline__ "__ofile__"],
197 [typedef int yystype
;])
198 # define YYSTYPE yystype
199 # define YYSTYPE_IS_TRIVIAL 1
203 typedef struct yyltype
210 # define YYLTYPE b4_location_type
211 # define YYLTYPE_IS_TRIVIAL 1
214 /* Copy the second part of user declarations. */
217 /* Line __line__ of __file__. */
218 #line __oline__ "__ofile__"
220 #if ! defined (yyoverflow) || YYERROR_VERBOSE
222 /* The parser invokes alloca or malloc; define the necessary symbols. */
224 # if YYSTACK_USE_ALLOCA
225 # define YYSTACK_ALLOC alloca
227 # ifndef YYSTACK_USE_ALLOCA
228 # if defined (alloca) || defined (_ALLOCA_H)
229 # define YYSTACK_ALLOC alloca
232 # define YYSTACK_ALLOC __builtin_alloca
238 # ifdef YYSTACK_ALLOC
239 /* Pacify GCC's `empty if-body' warning. */
240 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
242 # if defined (__STDC__) || defined (__cplusplus)
243 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
244 # define YYSIZE_T size_t
246 # define YYSTACK_ALLOC malloc
247 # define YYSTACK_FREE free
249 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
252 #if (! defined (yyoverflow) \
253 && (! defined (__cplusplus) \
254 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
256 /* A type that is properly aligned for any stack member. */
261 b4_location_if([ YYLTYPE yyls
;
265 /* The size of the maximum gap between one aligned stack and the next. */
266 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
268 /* The size of an array large to enough to hold all stacks, each with
271 [# define YYSTACK_BYTES(N) \
272 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
273 + 2 * YYSTACK_GAP_MAX)],
274 [# define YYSTACK_BYTES(N) \
275 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
278 /* Copy COUNT objects from FROM to TO. The source and destination do
282 # define YYCOPY(To, From, Count) \
283 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
285 # define YYCOPY(To, From, Count) \
288 register YYSIZE_T yyi; \
289 for (yyi = 0; yyi < (Count); yyi++) \
290 (To)[[yyi]] = (From)[[yyi]]; \
296 /* Relocate STACK from its old location to the new one. The
297 local variables YYSIZE and YYSTACKSIZE give the old and new number of
298 elements in the stack, and YYPTR gives the new location of the
299 stack. Advance YYPTR to a properly aligned location for the next
301 # define YYSTACK_RELOCATE(Stack) \
304 YYSIZE_T yynewbytes; \
305 YYCOPY (&yyptr->Stack, Stack, yysize); \
306 Stack = &yyptr->Stack; \
307 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
308 yyptr += yynewbytes / sizeof (*yyptr); \
314 #if defined (__STDC__) || defined (__cplusplus)
315 typedef signed char yysigned_char
;
317 typedef short yysigned_char
;
320 /* YYFINAL -- State number of the termination state. */
321 #define YYFINAL b4_final_state_number
322 #define YYLAST b4_last
324 /* YYNTOKENS -- Number of terminals. */
325 #define YYNTOKENS b4_tokens_number
326 /* YYNNTS -- Number of nonterminals. */
327 #define YYNNTS b4_nterms_number
328 /* YYNRULES -- Number of rules. */
329 #define YYNRULES b4_rules_number
330 /* YYNRULES -- Number of states. */
331 #define YYNSTATES b4_states_number
333 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
334 #define YYUNDEFTOK b4_undef_token_number
335 #define YYMAXUTOK b4_user_token_number_max
337 #define YYTRANSLATE(X) \
338 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
340 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
341 static const b4_int_type_for([b4_translate
]) yytranslate
[[]] =
347 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
349 static const b4_int_type_for([b4_prhs
]) yyprhs
[[]] =
354 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
355 static const b4_int_type_for([b4_rhs
]) yyrhs
[[]] =
360 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
361 static const b4_int_type_for([b4_rline
]) yyrline
[[]] =
367 #if YYDEBUG || YYERROR_VERBOSE
368 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
369 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
370 static const char *const yytname
[[]] =
377 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
379 static const b4_int_type_for([b4_toknum
]) yytoknum
[[]] =
385 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
386 static const b4_int_type_for([b4_r1
]) yyr1
[[]] =
391 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
392 static const b4_int_type_for([b4_r2
]) yyr2
[[]] =
397 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
398 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
399 means the default is an error. */
400 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
405 /* YYDEFGOTO[[NTERM-NUM]]. */
406 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
411 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
413 #define YYPACT_NINF b4_pact_ninf
414 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
419 /* YYPGOTO[[NTERM-NUM]]. */
420 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
425 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
426 positive, shift that token. If negative, reduce the rule which
427 number is the opposite. If zero, do what YYDEFACT says.
428 If YYTABLE_NINF, parse error. */
429 #define YYTABLE_NINF b4_table_ninf
430 static const b4_int_type_for([b4_table
]) yytable
[[]] =
435 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
440 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
441 symbol of state STATE-NUM. */
442 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
447 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
448 # define YYSIZE_T __SIZE_TYPE__
450 #if ! defined (YYSIZE_T) && defined (size_t)
451 # define YYSIZE_T size_t
453 #if ! defined (YYSIZE_T)
454 # if defined (__STDC__) || defined (__cplusplus)
455 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
456 # define YYSIZE_T size_t
459 #if ! defined (YYSIZE_T)
460 # define YYSIZE_T unsigned int
463 #define yyerrok (yyerrstatus = 0)
464 #define yyclearin (yychar = YYEMPTY)
468 #define YYACCEPT goto yyacceptlab
469 #define YYABORT goto yyabortlab
470 #define YYERROR goto yyerrlab1
472 /* Like YYERROR except do call yyerror. This remains here temporarily
473 to ease the transition to the new meaning of YYERROR, for GCC.
474 Once GCC version 2 has supplanted version 1, this can go. */
476 #define YYFAIL goto yyerrlab
478 #define YYRECOVERING() (!!yyerrstatus)
480 #define YYBACKUP(Token, Value) \
482 if (yychar == YYEMPTY && yylen == 1) \
486 yychar1 = YYTRANSLATE (yychar); \
492 yyerror ("syntax error: cannot back up"); \
498 #define YYERRCODE 256
500 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
503 #ifndef YYLLOC_DEFAULT
504 # define YYLLOC_DEFAULT(Current, Rhs, N) \
505 Current.first_line = Rhs[[1]].first_line; \
506 Current.first_column = Rhs[[1]].first_column; \
507 Current.last_line = Rhs[[N]].last_line; \
508 Current.last_column = Rhs[[N]].last_column;
511 /* YYLEX -- calling `yylex' with the right arguments. */
514 # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
516 # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param)
519 /* Enable debugging if requested. */
523 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
524 # define YYFPRINTF fprintf
527 # define YYDPRINTF(Args) \
532 # define YYDSYMPRINT(Args) \
537 /* Nonzero means print parse trace. It is left uninitialized so that
538 multiple parsers can coexist. */
541 # define YYDPRINTF(Args)
542 # define YYDSYMPRINT(Args)
543 #endif /* !YYDEBUG */
545 /* YYINITDEPTH -- initial size of the parser's stacks. */
547 # define YYINITDEPTH b4_stack_depth_init
550 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
551 if the built-in stack extension method is used).
553 Do not make this value too large; the results are undefined if
554 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
555 evaluated with infinite-precision integer arithmetic. */
562 # define YYMAXDEPTH b4_stack_depth_max
570 # if defined (__GLIBC__) && defined (_STRING_H)
571 # define yystrlen strlen
573 /* Return the length of YYSTR. */
575 # if defined (__STDC__) || defined (__cplusplus)
576 yystrlen (const char *yystr
)
582 register const char *yys
= yystr
;
584 while (*yys
++ != '\0')
587 return yys
- yystr
- 1;
593 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
594 # define yystpcpy stpcpy
596 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
599 # if defined (__STDC__) || defined (__cplusplus)
600 yystpcpy (char *yydest
, const char *yysrc
)
602 yystpcpy (yydest
, yysrc
)
607 register char *yyd
= yydest
;
608 register const char *yys
= yysrc
;
610 while ((*yyd
++ = *yys
++) != '\0')
618 #endif /* !YYERROR_VERBOSE */
623 /*-----------------------------.
624 | Print this symbol on YYOUT. |
625 `-----------------------------*/
627 b4_c_function([yysymprint
],
631 [[YYSTYPE
], [yyvalue
]]b4_location_if([,
632 [[YYLTYPE
], [yylocation
]]]))
634 /* Pacify ``unused variable'' warnings. */
636 b4_location_if([ (void) yylocation
;
639 if (yytype
< YYNTOKENS
)
641 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
643 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
647 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
651 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
655 YYFPRINTF (yyout
, ")");
657 #endif /* YYDEBUG. */
660 /*-----------------------------------------------.
661 | Release the memory associated to this symbol. |
662 `-----------------------------------------------*/
664 b4_c_function([yydestruct
],
667 [[YYSTYPE
], [yyvalue
]]b4_location_if([,
668 [[YYLTYPE
], [yylocation
]]]))
670 /* Pacify ``unused variable'' warnings. */
672 b4_location_if([ (void) yylocation
;
677 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
685 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
686 into yyparse. The argument should have type void *.
687 It should actually point to an object.
688 Grammar actions can access the variable by casting it
689 to the proper pointer type. */
692 # if defined (__STDC__) || defined (__cplusplus)
693 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
694 # define YYPARSE_PARAM_DECL
696 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
697 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
699 #else /* !YYPARSE_PARAM */
700 # define YYPARSE_PARAM_ARG
701 # define YYPARSE_PARAM_DECL
702 #endif /* !YYPARSE_PARAM */
704 /* Prevent warning if -Wstrict-prototypes. */
706 # ifdef YYPARSE_PARAM
707 int yyparse (void *);
713 m4_divert_push([KILL
])# ======================== M4 code.
714 # b4_declare_parser_variables
715 # ---------------------------
716 # Declare the variables that are global, or local to YYPARSE if
718 m4_define([b4_declare_parser_variables
],
719 [/* The lookahead symbol. */
722 /* The semantic value of the lookahead symbol. */
725 /* Number of parse errors so far. */
726 int yynerrs
;b4_location_if([
727 /* Location data for the lookahead symbol. */
730 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
733 [b4_declare_parser_variables
])
736 yyparse (YYPARSE_PARAM_ARG
)
739 ]b4_pure_if([b4_declare_parser_variables
])[
740 register int yystate
;
743 /* Number of tokens to shift before error messages enabled. */
745 /* Lookahead token as an internal (translated) token number. */
748 /* Three stacks and their tools:
749 `yyss': related to states,
750 `yyvs': related to semantic values,
751 `yyls': related to locations.
753 Refer to the stacks thru separate pointers, to allow yyoverflow
754 to reallocate them elsewhere. */
756 /* The state stack. */
757 short yyssa
[YYINITDEPTH
];
759 register short *yyssp
;
761 /* The semantic value stack. */
762 YYSTYPE yyvsa
[YYINITDEPTH
];
763 YYSTYPE
*yyvs
= yyvsa
;
764 register YYSTYPE
*yyvsp
;
767 [[ /* The location stack. */
768 YYLTYPE yylsa
[YYINITDEPTH
];
769 YYLTYPE
*yyls
= yylsa
;
772 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
774 YYSIZE_T yystacksize
= YYINITDEPTH
;
776 /* The variables used to return semantic value and location from the
779 ]b4_location_if([ YYLTYPE yyloc
;])[
781 /* When reducing, the number of symbols on the RHS of the reduced
785 YYDPRINTF ((stderr
, "Starting parse\n"));
790 yychar
= YYEMPTY
; /* Cause a token to be read. */
792 /* Initialize stack pointers.
793 Waste one element of value and location stack
794 so that they stay on the same level as the state stack.
795 The wasted elements are never initialized. */
799 ]b4_location_if([ yylsp
= yyls
;])[
802 /*------------------------------------------------------------.
803 | yynewstate -- Push a new state, which is found in yystate. |
804 `------------------------------------------------------------*/
806 /* In all cases, when you get here, the value and location stacks
807 have just been pushed. so pushing a state here evens the stacks.
814 if (yyssp
>= yyss
+ yystacksize
- 1)
816 /* Get the current used size of the three stacks, in elements. */
817 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
821 /* Give user a chance to reallocate the stack. Use copies of
822 these so that the &'s don't force the real ones into
824 YYSTYPE
*yyvs1
= yyvs
;
826 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
828 /* Each stack pointer address is followed by the size of the
829 data in use in that stack, in bytes. This used to be a
830 conditional around just the two extra args, but that might
831 be undefined if yyoverflow is a macro. */
832 yyoverflow ("parser stack overflow",
833 &yyss1
, yysize
* sizeof (*yyssp
),
834 &yyvs1
, yysize
* sizeof (*yyvsp
),
835 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
837 ]b4_location_if([ yyls
= yyls1
;])[
841 #else /* no yyoverflow */
842 # ifndef YYSTACK_RELOCATE
845 /* Extend the stack our own way. */
846 if (yystacksize
>= YYMAXDEPTH
)
849 if (yystacksize
> YYMAXDEPTH
)
850 yystacksize
= YYMAXDEPTH
;
854 union yyalloc
*yyptr
=
855 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
858 YYSTACK_RELOCATE (yyss
);
859 YYSTACK_RELOCATE (yyvs
);
860 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
861 # undef YYSTACK_RELOCATE
863 YYSTACK_FREE (yyss1
);
866 #endif /* no yyoverflow */
868 yyssp
= yyss
+ yysize
- 1;
869 yyvsp
= yyvs
+ yysize
- 1;
870 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
872 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
873 (unsigned long int) yystacksize
));
875 if (yyssp
>= yyss
+ yystacksize
- 1)
879 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
888 /* Do appropriate processing given the current state. */
889 /* Read a lookahead token if we need one and don't already have one. */
892 /* First try to decide what to do without reference to lookahead token. */
894 yyn
= yypact
[yystate
];
895 if (yyn
== YYPACT_NINF
)
898 /* Not known => get a lookahead token if don't already have one. */
900 /* yychar is either YYEMPTY or YYEOF
901 or a valid token in external form. */
903 if (yychar
== YYEMPTY
)
905 YYDPRINTF ((stderr
, "Reading a token: "));
909 /* Convert token to internal form (in yychar1) for indexing tables with. */
911 if (yychar
<= 0) /* This means end of input. */
914 yychar
= YYEOF
; /* Don't call YYLEX any more. */
916 YYDPRINTF ((stderr
, "Now at end of input.\n"));
920 yychar1
= YYTRANSLATE (yychar
);
922 /* We have to keep this `#if YYDEBUG', since we use variables
923 which are defined only if `YYDEBUG' is set. */
924 YYDPRINTF ((stderr
, "Next token is "));
925 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
926 YYDPRINTF ((stderr
, "\n"));
929 /* If the proper action on seeing token YYCHAR1 is to reduce or to
930 detect an error, take that action. */
932 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
937 if (yyn
== 0 || 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 */