1 m4_divert(-1) -*- C
-*-
3 # Yacc compatible skeleton for Bison
4 # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 # Return the smallest signed int type able to handle the number MAX.
24 m4_define([b4_sint_type
],
25 [m4_if(m4_eval([$
1 <= 127]), [1], [signed char],
26 m4_eval([$
1 <= 32767]), [1], [signed short],
32 # Return the smallest unsigned int type able to handle the number MAX.
33 m4_define([b4_uint_type
],
34 [m4_if(m4_eval([$
1 <= 255]), [1], [unsigned char],
35 m4_eval([$
1 <= 65535]), [1], [unsigned short],
39 # b4_lhs_value([TYPE])
40 # --------------------
41 # Expansion of $<TYPE>$.
42 m4_define([b4_lhs_value
],
43 [yyval
[]m4_ifval([$
1], [.$
1])])
46 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
47 # --------------------------------------
48 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
50 m4_define([b4_rhs_value
],
51 [yyvsp@
<:@
m4_eval([$
2 - $
1])@
:>@
m4_ifval([$
3], [.$
3])])
59 # b4_location_if(IF-TRUE, IF-FALSE)
60 # ---------------------------------
61 # Expand IF-TRUE, if locations are used, IF-FALSE otherwise.
62 m4_define([b4_location_if
],
63 [m4_if(b4_locations_flag
, [1],
71 m4_define([b4_lhs_location
],
75 # b4_rhs_location(RULE-LENGTH, NUM)
76 # ---------------------------------
77 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
79 m4_define([b4_rhs_location
],
80 [yylsp@
<:@
m4_eval([$
2 - $
1])@
:>@
])
88 # b4_pure_if(IF-TRUE, IF-FALSE)
89 # -----------------------------
90 # Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise.
91 m4_define([b4_pure_if
],
97 ## ------------------- ##
98 ## Output file names. ##
99 ## ------------------- ##
101 m4_define_default([b4_input_suffix
], [.y
])
103 m4_define_default([b4_output_parser_suffix
],
104 [m4_translit(b4_input_suffix
, [yY
], [cC
])])
106 m4_define_default([b4_output_parser_name
],
107 [b4_output_prefix
[]b4_output_infix
[]b4_output_parser_suffix
[]])
110 m4_define_default([b4_output_header_suffix
],
111 [m4_translit(b4_input_suffix
, [yY
], [hH
])])
113 m4_define_default([b4_output_header_name
],
114 [b4_output_prefix
[]b4_output_infix
[]b4_output_header_suffix
[]])
116 m4_define_default([b4_header_guard
],
117 [m4_bpatsubst(m4_toupper([BISON_
]b4_output_header_name
),
118 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ
]], [_
])])
121 ## ------------------------- ##
122 ## Assigning token numbers. ##
123 ## ------------------------- ##
125 # b4_token_define(TOKEN-NAME, TOKEN-NUMBER)
126 # -----------------------------------------
127 # Output the definition of this token as #define.
128 m4_define([b4_token_define
],
133 # b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
134 # ---------------------------------------
135 # Output the definition of this token as an enum.
136 m4_define([b4_token_enum
],
140 # b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
141 # -------------------------------------------------------
142 # Output the definition of the tokens (if there are) as enums and #define.
143 m4_define([b4_token_defines
],
144 [m4_if([$@
], [[]], [],
147 # if defined (__STDC__) || defined (__cplusplus)
148 /* Put the tokens into the symbol table, so that GDB and other debuggers
151 m4_map_sep([ b4_token_enum
], [,
156 /* POSIX requires `int' for tokens in interfaces. */
157 # define YYTOKENTYPE int
158 #endif /* !YYTOKENTYPE */
159 m4_map([b4_token_define
], [$@
])
164 ## --------------------------------------------------------- ##
165 ## Defining symbol actions, e.g., printers and destructors. ##
166 ## --------------------------------------------------------- ##
168 # b4_symbol_actions(FILENAME, LINENO,
169 # SYMBOL-TAG, SYMBOL-NUM,
170 # SYMBOL-ACTION, SYMBOL-TYPENAME)
171 # -------------------------------------------------
172 m4_define([b4_symbol_actions
],
173 [m4_pushdef([b4_dollar_dollar
], [yyvalue
.$
6])dnl
174 m4_pushdef([b4_at_dollar
], [yylocation
])dnl
178 #line __oline__ "__ofile__"
180 m4_popdef([b4_at_dollar
])dnl
181 m4_popdef([b4_dollar_dollar
])dnl
187 #output "b4_output_parser_name"
188 /* A Bison parser, made from b4_filename
189 by GNU bison b4_version. */
191 /* Skeleton output parser for Bison,
192 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
195 This program is free software; you can redistribute it and/or modify
196 it under the terms of the GNU General Public License as published by
197 the Free Software Foundation; either version 2, or (at your option)
200 This program is distributed in the hope that it will be useful,
201 but WITHOUT ANY WARRANTY; without even the implied warranty of
202 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
203 GNU General Public License for more details.
205 You should have received a copy of the GNU General Public License
206 along with this program; if not, write to the Free Software
207 Foundation, Inc., 59 Temple Place - Suite 330,
208 Boston, MA 02111-1307, USA. */
210 /* As a special exception, when this file is copied by Bison into a
211 Bison output file, you may use that output file without restriction.
212 This special exception was added by the Free Software Foundation
213 in version 1.24 of Bison. */
215 /* This is the parser code that is written into each bison parser when
216 the %semantic_parser declaration is not specified in the grammar.
217 It was written by Richard Stallman by simplifying the original so
218 called ``semantic'' parser. */
220 /* All symbols defined below should begin with yy or YY, to avoid
221 infringing on user name space. This should be done even for local
222 variables, as they might otherwise be expanded by user macros.
223 There are some unavoidable exceptions within include files to
224 define necessary library symbols; they are noted "INFRINGES ON
225 USER NAME SPACE" below. */
227 /* Identify Bison output. */
231 #define YYPURE b4_pure
233 /* Using locations. */
234 #define YYLSP_NEEDED b4_locations_flag
236 m4_if(b4_prefix
[], [yy
], [],
237 [/* If NAME_PREFIX is specified substitute the variables and functions
239 #define yyparse b4_prefix[]parse
240 #define yylex b4_prefix[]lex
241 #define yyerror b4_prefix[]error
242 #define yylval b4_prefix[]lval
243 #define yychar b4_prefix[]char
244 #define yydebug b4_prefix[]debug
245 #define yynerrs b4_prefix[]nerrs
246 b4_location_if([#define yylloc b4_prefix[]lloc])])
248 /* Copy the first part of user declarations. */
251 b4_token_defines(b4_tokens
)
253 /* Enabling traces. */
255 # define YYDEBUG b4_debug
258 /* Enabling verbose error messages. */
259 #ifdef YYERROR_VERBOSE
260 # undef YYERROR_VERBOSE
261 # define YYERROR_VERBOSE 1
263 # define YYERROR_VERBOSE b4_error_verbose
268 [#line b4_stype_line "b4_filename"
269 typedef union b4_stype yystype
;
270 /* Line __line__ of __file__. */
271 #line __oline__ "__ofile__"],
272 [typedef int yystype
;])
273 # define YYSTYPE yystype
274 # define YYSTYPE_IS_TRIVIAL 1
278 typedef struct yyltype
285 # define YYLTYPE b4_ltype
286 # define YYLTYPE_IS_TRIVIAL 1
289 /* Copy the second part of user declarations. */
292 /* Line __line__ of __file__. */
293 #line __oline__ "__ofile__"
295 #if ! defined (yyoverflow) || YYERROR_VERBOSE
297 /* The parser invokes alloca or malloc; define the necessary symbols. */
299 # if YYSTACK_USE_ALLOCA
300 # define YYSTACK_ALLOC alloca
302 # ifndef YYSTACK_USE_ALLOCA
303 # if defined (alloca) || defined (_ALLOCA_H)
304 # define YYSTACK_ALLOC alloca
307 # define YYSTACK_ALLOC __builtin_alloca
313 # ifdef YYSTACK_ALLOC
314 /* Pacify GCC's `empty if-body' warning. */
315 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
317 # if defined (__STDC__) || defined (__cplusplus)
318 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
319 # define YYSIZE_T size_t
321 # define YYSTACK_ALLOC malloc
322 # define YYSTACK_FREE free
324 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
327 #if (! defined (yyoverflow) \
328 && (! defined (__cplusplus) \
329 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
331 /* A type that is properly aligned for any stack member. */
336 b4_location_if([ YYLTYPE yyls
;
340 /* The size of the maximum gap between one aligned stack and the next. */
341 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
343 /* The size of an array large to enough to hold all stacks, each with
346 [# define YYSTACK_BYTES(N) \
347 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
348 + 2 * YYSTACK_GAP_MAX)],
349 [# define YYSTACK_BYTES(N) \
350 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
353 /* Copy COUNT objects from FROM to TO. The source and destination do
357 # define YYCOPY(To, From, Count) \
358 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
360 # define YYCOPY(To, From, Count) \
363 register YYSIZE_T yyi; \
364 for (yyi = 0; yyi < (Count); yyi++) \
365 (To)[[yyi]] = (From)[[yyi]]; \
371 /* Relocate STACK from its old location to the new one. The
372 local variables YYSIZE and YYSTACKSIZE give the old and new number of
373 elements in the stack, and YYPTR gives the new location of the
374 stack. Advance YYPTR to a properly aligned location for the next
376 # define YYSTACK_RELOCATE(Stack) \
379 YYSIZE_T yynewbytes; \
380 YYCOPY (&yyptr->Stack, Stack, yysize); \
381 Stack = &yyptr->Stack; \
382 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
383 yyptr += yynewbytes / sizeof (*yyptr); \
389 /* YYFINAL -- State number of the termination state. */
390 #define YYFINAL b4_final
391 #define YYFLAG b4_flag
392 #define YYLAST b4_last
394 /* YYNTOKENS -- Number of terminals. */
395 #define YYNTOKENS b4_ntokens
396 /* YYNNTS -- Number of nonterminals. */
397 #define YYNNTS b4_nnts
398 /* YYNRULES -- Number of rules. */
399 #define YYNRULES b4_nrules
400 /* YYNRULES -- Number of states. */
401 #define YYNSTATES b4_nstates
403 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
404 #define YYUNDEFTOK b4_undef_token_number
405 #define YYMAXUTOK b4_user_token_number_max
407 #define YYTRANSLATE(X) \
408 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
410 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
411 static const b4_uint_type(b4_translate_max
) yytranslate
[[]] =
417 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
419 static const b4_uint_type(b4_prhs_max
) yyprhs
[[]] =
424 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
425 static const b4_sint_type(b4_rhs_max
) yyrhs
[[]] =
430 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
431 static const b4_uint_type(b4_rline_max
) yyrline
[[]] =
437 #if YYDEBUG || YYERROR_VERBOSE
438 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
439 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
440 static const char *const yytname
[[]] =
446 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
448 static const short yytoknum
[[]] =
453 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
454 static const b4_uint_type(b4_r1_max
) yyr1
[[]] =
459 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
460 static const b4_uint_type(b4_r2_max
) yyr2
[[]] =
465 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
466 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
467 means the default is an error. */
468 static const short yydefact
[[]] =
473 /* YYPGOTO[[NTERM-NUM]]. */
474 static const short yydefgoto
[[]] =
479 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
481 static const short yypact
[[]] =
486 /* YYPGOTO[[NTERM-NUM]]. */
487 static const short yypgoto
[[]] =
492 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
493 positive, shift that token. If negative, reduce the rule which
494 number is the opposite. If zero, do what YYDEFACT says. */
495 static const short yytable
[[]] =
500 static const short yycheck
[[]] =
505 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
506 symbol of state STATE-NUM. */
507 static const b4_uint_type(b4_stos_max
) yystos
[[]] =
512 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
513 # define YYSIZE_T __SIZE_TYPE__
515 #if ! defined (YYSIZE_T) && defined (size_t)
516 # define YYSIZE_T size_t
518 #if ! defined (YYSIZE_T)
519 # if defined (__STDC__) || defined (__cplusplus)
520 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
521 # define YYSIZE_T size_t
524 #if ! defined (YYSIZE_T)
525 # define YYSIZE_T unsigned int
528 #define yyerrok (yyerrstatus = 0)
529 #define yyclearin (yychar = YYEMPTY)
533 #define YYACCEPT goto yyacceptlab
534 #define YYABORT goto yyabortlab
535 #define YYERROR goto yyerrlab1
537 /* Like YYERROR except do call yyerror. This remains here temporarily
538 to ease the transition to the new meaning of YYERROR, for GCC.
539 Once GCC version 2 has supplanted version 1, this can go. */
541 #define YYFAIL goto yyerrlab
543 #define YYRECOVERING() (!!yyerrstatus)
545 #define YYBACKUP(Token, Value) \
547 if (yychar == YYEMPTY && yylen == 1) \
551 yychar1 = YYTRANSLATE (yychar); \
557 yyerror ("syntax error: cannot back up"); \
563 #define YYERRCODE 256
565 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
568 #ifndef YYLLOC_DEFAULT
569 # define YYLLOC_DEFAULT(Current, Rhs, N) \
570 Current.first_line = Rhs[[1]].first_line; \
571 Current.first_column = Rhs[[1]].first_column; \
572 Current.last_line = Rhs[[N]].last_line; \
573 Current.last_column = Rhs[[N]].last_column;
576 /* YYLEX -- calling `yylex' with the right arguments. */
580 # define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]), YYLEX_PARAM)
582 # define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]))
584 [#define YYLEX yylex ()])
586 /* Enable debugging if requested. */
590 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
591 # define YYFPRINTF fprintf
594 # define YYDPRINTF(Args) \
599 # define YYDSYMPRINT(Args) \
604 /* Nonzero means print parse trace. It is left uninitialized so that
605 multiple parsers can coexist. */
608 # define YYDPRINTF(Args)
609 # define YYDSYMPRINT(Args)
610 #endif /* !YYDEBUG */
612 /* YYINITDEPTH -- initial size of the parser's stacks. */
614 # define YYINITDEPTH b4_initdepth
617 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
618 if the built-in stack extension method is used).
620 Do not make this value too large; the results are undefined if
621 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
622 evaluated with infinite-precision integer arithmetic. */
629 # define YYMAXDEPTH b4_maxdepth
637 # if defined (__GLIBC__) && defined (_STRING_H)
638 # define yystrlen strlen
640 /* Return the length of YYSTR. */
642 # if defined (__STDC__) || defined (__cplusplus)
643 yystrlen (const char *yystr
)
649 register const char *yys
= yystr
;
651 while (*yys
++ != '\0')
654 return yys
- yystr
- 1;
660 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
661 # define yystpcpy stpcpy
663 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
666 # if defined (__STDC__) || defined (__cplusplus)
667 yystpcpy (char *yydest
, const char *yysrc
)
669 yystpcpy (yydest
, yysrc
)
674 register char *yyd
= yydest
;
675 register const char *yys
= yysrc
;
677 while ((*yyd
++ = *yys
++) != '\0')
685 #endif /* !YYERROR_VERBOSE */
689 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
690 into yyparse. The argument should have type void *.
691 It should actually point to an object.
692 Grammar actions can access the variable by casting it
693 to the proper pointer type. */
696 # if defined (__STDC__) || defined (__cplusplus)
697 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
698 # define YYPARSE_PARAM_DECL
700 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
701 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
703 #else /* !YYPARSE_PARAM */
704 # define YYPARSE_PARAM_ARG
705 # define YYPARSE_PARAM_DECL
706 #endif /* !YYPARSE_PARAM */
708 /* Prevent warning if -Wstrict-prototypes. */
710 # ifdef YYPARSE_PARAM
711 int yyparse (void *);
717 #if defined (__STDC__) || defined (__cplusplus)
718 static void yydestruct (int yytype
,
719 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]));
721 static void yysymprint (FILE* out
, int yytype
,
722 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]));
726 m4_divert_push([KILL
])# ======================== M4 code.
727 # b4_declare_parser_variables
728 # ---------------------------
729 # Declare the variables that are global, or local to YYPARSE if
731 m4_define([b4_declare_parser_variables
],
732 [/* The lookahead symbol. */
735 /* The semantic value of the lookahead symbol. */
738 /* Number of parse errors so far. */
739 int yynerrs
;b4_location_if([
740 /* Location data for the lookahead symbol. */
743 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
746 [b4_declare_parser_variables
])
749 yyparse (YYPARSE_PARAM_ARG
)
752 ]b4_pure_if([b4_declare_parser_variables
])[
753 register int yystate
;
756 /* Number of tokens to shift before error messages enabled. */
758 /* Lookahead token as an internal (translated) token number. */
761 /* Three stacks and their tools:
762 `yyss': related to states,
763 `yyvs': related to semantic values,
764 `yyls': related to locations.
766 Refer to the stacks thru separate pointers, to allow yyoverflow
767 to reallocate them elsewhere. */
769 /* The state stack. */
770 short yyssa
[YYINITDEPTH
];
772 register short *yyssp
;
774 /* The semantic value stack. */
775 YYSTYPE yyvsa
[YYINITDEPTH
];
776 YYSTYPE
*yyvs
= yyvsa
;
777 register YYSTYPE
*yyvsp
;
780 [[ /* The location stack. */
781 YYLTYPE yylsa
[YYINITDEPTH
];
782 YYLTYPE
*yyls
= yylsa
;
785 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
787 YYSIZE_T yystacksize
= YYINITDEPTH
;
789 /* The variables used to return semantic value and location from the
792 ]b4_location_if([ YYLTYPE yyloc
;])[
794 /* When reducing, the number of symbols on the RHS of the reduced
798 YYDPRINTF ((stderr
, "Starting parse\n"));
803 yychar
= YYEMPTY
; /* Cause a token to be read. */
805 /* Initialize stack pointers.
806 Waste one element of value and location stack
807 so that they stay on the same level as the state stack.
808 The wasted elements are never initialized. */
812 ]b4_location_if([ yylsp
= yyls
;])[
815 /*------------------------------------------------------------.
816 | yynewstate -- Push a new state, which is found in yystate. |
817 `------------------------------------------------------------*/
819 /* In all cases, when you get here, the value and location stacks
820 have just been pushed. so pushing a state here evens the stacks.
827 if (yyssp
>= yyss
+ yystacksize
- 1)
829 /* Get the current used size of the three stacks, in elements. */
830 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
834 /* Give user a chance to reallocate the stack. Use copies of
835 these so that the &'s don't force the real ones into
837 YYSTYPE
*yyvs1
= yyvs
;
839 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
841 /* Each stack pointer address is followed by the size of the
842 data in use in that stack, in bytes. This used to be a
843 conditional around just the two extra args, but that might
844 be undefined if yyoverflow is a macro. */
845 yyoverflow ("parser stack overflow",
846 &yyss1
, yysize
* sizeof (*yyssp
),
847 &yyvs1
, yysize
* sizeof (*yyvsp
),
848 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
850 ]b4_location_if([ yyls
= yyls1
;])[
854 #else /* no yyoverflow */
855 # ifndef YYSTACK_RELOCATE
858 /* Extend the stack our own way. */
859 if (yystacksize
>= YYMAXDEPTH
)
862 if (yystacksize
> YYMAXDEPTH
)
863 yystacksize
= YYMAXDEPTH
;
867 union yyalloc
*yyptr
=
868 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
871 YYSTACK_RELOCATE (yyss
);
872 YYSTACK_RELOCATE (yyvs
);
873 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
874 # undef YYSTACK_RELOCATE
876 YYSTACK_FREE (yyss1
);
879 #endif /* no yyoverflow */
881 yyssp
= yyss
+ yysize
- 1;
882 yyvsp
= yyvs
+ yysize
- 1;
883 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
885 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
886 (unsigned long int) yystacksize
));
888 if (yyssp
>= yyss
+ yystacksize
- 1)
892 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
901 /* Do appropriate processing given the current state. */
902 /* Read a lookahead token if we need one and don't already have one. */
905 /* First try to decide what to do without reference to lookahead token. */
907 yyn
= yypact
[yystate
];
911 /* Not known => get a lookahead token if don't already have one. */
913 /* yychar is either YYEMPTY or YYEOF
914 or a valid token in external form. */
916 if (yychar
== YYEMPTY
)
918 YYDPRINTF ((stderr
, "Reading a token: "));
922 /* Convert token to internal form (in yychar1) for indexing tables with. */
924 if (yychar
<= 0) /* This means end of input. */
927 yychar
= YYEOF
; /* Don't call YYLEX any more. */
929 YYDPRINTF ((stderr
, "Now at end of input.\n"));
933 yychar1
= YYTRANSLATE (yychar
);
935 /* We have to keep this `#if YYDEBUG', since we use variables
936 which are defined only if `YYDEBUG' is set. */
937 YYDPRINTF ((stderr
, "Next token is "));
938 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
939 YYDPRINTF ((stderr
, "\n"));
943 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
948 /* yyn is what to do for this token type in this state.
949 Negative => reduce, -yyn is rule number.
950 Positive => shift, yyn is new state.
951 New state is final state => don't bother to shift,
953 0, or most negative number => error. */
968 /* Shift the lookahead token. */
969 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
970 yychar
, yytname
[yychar1
]));
972 /* Discard the token being shifted unless it is eof. */
977 ]b4_location_if([ *++yylsp
= yylloc
;])[
979 /* Count tokens shifted since error; after three, turn off error
988 /*-----------------------------------------------------------.
989 | yydefault -- do the default action for the current state. |
990 `-----------------------------------------------------------*/
992 yyn
= yydefact
[yystate
];
998 /*-----------------------------.
999 | yyreduce -- Do a reduction. |
1000 `-----------------------------*/
1002 /* yyn is the number of a rule to reduce with. */
1005 /* If YYLEN is nonzero, implement the default value of the action:
1008 Otherwise, the following line sets YYVAL to the semantic value of
1009 the lookahead token. This behavior is undocumented and Bison
1010 users should not rely upon it. Assigning to YYVAL
1011 unconditionally makes the parser a bit smaller, and it avoids a
1012 GCC warning that YYVAL may be used uninitialized. */
1013 yyval
= yyvsp
[1-yylen
];
1016 [ /* Default location. */
1017 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
1020 /* We have to keep this `#if YYDEBUG', since we use variables which
1021 are defined only if `YYDEBUG' is set. */
1026 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1027 yyn
- 1, yyrline
[yyn
]);
1029 /* Print the symbols being reduced, and their result. */
1030 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] >= 0; yyi
++)
1031 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1032 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1040 /* Line __line__ of __file__. */
1041 #line __oline__ "__ofile__"
1045 ]b4_location_if([ yylsp
-= yylen
;])[
1050 short *yyssp1
= yyss
- 1;
1051 YYFPRINTF (stderr
, "state stack now");
1052 while (yyssp1
!= yyssp
)
1053 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1054 YYFPRINTF (stderr
, "\n");
1059 ]b4_location_if([ *++yylsp
= yyloc
;])[
1061 /* Now `shift' the result of the reduction. Determine what state
1062 that goes to, based on the state we popped back to and the rule
1063 number reduced by. */
1067 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1068 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1069 yystate
= yytable
[yystate
];
1071 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1076 /*------------------------------------.
1077 | yyerrlab -- here on detecting error |
1078 `------------------------------------*/
1080 /* If not already recovering from an error, report this error. */
1086 yyn
= yypact
[yystate
];
1088 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1090 YYSIZE_T yysize
= 0;
1095 /* Start YYX at -YYN if negative to avoid negative indexes in
1097 for (yyx
= yyn
< 0 ? -yyn
: 0;
1098 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1099 if (yycheck
[yyx
+ yyn
] == yyx
)
1100 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1101 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1102 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1103 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1106 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1107 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1112 for (yyx
= yyn
< 0 ? -yyn
: 0;
1113 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1115 if (yycheck
[yyx
+ yyn
] == yyx
)
1117 const char *yyq
= ! yycount
? ", expecting " : " or ";
1118 yyp
= yystpcpy (yyp
, yyq
);
1119 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1124 YYSTACK_FREE (yymsg
);
1127 yyerror ("parse error; also virtual memory exhausted");
1130 #endif /* YYERROR_VERBOSE */
1131 yyerror ("parse error");
1136 /*----------------------------------------------------.
1137 | yyerrlab1 -- error raised explicitly by an action. |
1138 `----------------------------------------------------*/
1140 if (yyerrstatus
== 3)
1142 /* If just tried and failed to reuse lookahead token after an
1143 error, discard it. */
1145 /* Return failure if at end of input. */
1146 if (yychar
== YYEOF
)
1148 /* Pop the error token. */
1150 /* Pop the rest of the stack. */
1151 while (yyssp
> yyss
)
1153 YYDPRINTF ((stderr
, "Error: popping "));
1154 YYDSYMPRINT ((stderr
,
1156 *yyvsp
]b4_location_if([, *yylsp
])[));
1157 YYDPRINTF ((stderr
, "\n"));
1158 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1164 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1165 yychar
, yytname
[yychar1
]));
1166 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1170 /* Else will try to reuse lookahead token after shifting the error
1173 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1177 yyn
= yypact
[yystate
];
1181 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1189 /* Pop the current state because it cannot handle the error token. */
1193 YYDPRINTF ((stderr
, "Error: popping "));
1194 YYDSYMPRINT ((stderr
,
1195 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1196 YYDPRINTF ((stderr
, "\n"));
1198 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1201 ]b4_location_if([ yylsp
--;])[
1206 short *yyssp1
= yyss
- 1;
1207 YYFPRINTF (stderr
, "Error: state stack now");
1208 while (yyssp1
!= yyssp
)
1209 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1210 YYFPRINTF (stderr
, "\n");
1218 YYDPRINTF ((stderr
, "Shifting error token, "));
1221 ]b4_location_if([ *++yylsp
= yylloc
;])[
1227 /*-------------------------------------.
1228 | yyacceptlab -- YYACCEPT comes here. |
1229 `-------------------------------------*/
1234 /*-----------------------------------.
1235 | yyabortlab -- YYABORT comes here. |
1236 `-----------------------------------*/
1242 /*----------------------------------------------.
1243 | yyoverflowlab -- parser overflow comes here. |
1244 `----------------------------------------------*/
1246 yyerror ("parser stack overflow");
1254 YYSTACK_FREE (yyss
);
1260 /*-----------------------------------------------.
1261 | Release the memory associated to this symbol. |
1262 `-----------------------------------------------*/
1265 yydestruct (int yytype
,
1266 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]))
1270 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
1278 /*-----------------------------.
1279 | Print this symbol on YYOUT. |
1280 `-----------------------------*/
1283 yysymprint (FILE* yyout
, int yytype
,
1284 YYSTYPE yyvalue
[]b4_location_if([, YYLTYPE yylocation
]))
1286 if (yytype
< YYNTOKENS
)
1288 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
1290 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
1294 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
1298 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
1302 YYFPRINTF (yyout
, ")");
1304 #endif /* YYDEBUG. */
1307 m4_if(b4_defines_flag
, 0, [],
1308 [#output "b4_output_header_name"
1309 #ifndef b4_header_guard
1310 # define b4_header_guard
1312 b4_token_defines(b4_tokens
)
1315 m4_ifdef([b4_stype
],
1316 [#line b4_stype_line "b4_filename"
1317 typedef union b4_stype yystype
;
1318 /* Line __line__ of __file__. */
1319 #line __oline__ "__ofile__"],
1320 [typedef int yystype
;])
1321 # define YYSTYPE yystype
1325 [extern YYSTYPE b4_prefix
[]lval
;])
1329 typedef struct yyltype
1336 # define YYLTYPE yyltype
1340 [extern YYLTYPE b4_prefix
[]lloc
;])
1342 #endif /* not b4_header_guard */