]>
Commit | Line | Data |
---|---|---|
007a50a4 | 1 | m4_divert(-1) -*- C -*- |
a8289c62 | 2 | |
60491a94 | 3 | # Yacc compatible skeleton for Bison |
779e7ceb | 4 | # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 |
12b0043a | 5 | # Free Software Foundation, Inc. |
60491a94 AD |
6 | |
7 | # This program is free software; you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation; either version 2 of the License, or | |
10 | # (at your option) any later version. | |
11 | ||
12 | # This program is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | ||
17 | # You should have received a copy of the GNU General Public License | |
18 | # along with this program; if not, write to the Free Software | |
19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
20 | # 02111-1307 USA | |
21 | ||
66d30cd4 AD |
22 | |
23 | ||
24 | ## ---------------- ## | |
25 | ## Default values. ## | |
26 | ## ---------------- ## | |
27 | ||
28 | # Stack parameters. | |
29 | m4_define_default([b4_stack_depth_max], [10000]) | |
30 | m4_define_default([b4_stack_depth_init], [200]) | |
31 | ||
2a8d363a AD |
32 | |
33 | ## ------------------------ ## | |
34 | ## Pure/impure interfaces. ## | |
35 | ## ------------------------ ## | |
36 | ||
37 | ||
947427ae | 38 | # b4_pure_if(IF-TRUE, IF-FALSE) |
2a8d363a AD |
39 | # ----------------------------- |
40 | # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise. | |
41 | m4_define([b4_Pure_if], | |
42 | [b4_pure_if([m4_ifset([b4_parse_param], | |
43 | [$1], [$2])], | |
44 | [$2])]) | |
45 | ||
46 | ||
93724f13 AD |
47 | # b4_yyerror_args |
48 | # --------------- | |
2a8d363a | 49 | # Arguments passed to yyerror: user args plus yylloc. |
93724f13 AD |
50 | m4_define([b4_yyerror_args], |
51 | [b4_Pure_if([b4_location_if([&yylloc, ])])dnl | |
52 | m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) | |
2a8d363a AD |
53 | |
54 | ||
55 | # b4_lex_param | |
56 | # ------------ | |
d42f69cd | 57 | # Accumulate in b4_lex_param all the yylex arguments. |
2a8d363a | 58 | # b4_lex_param arrives quoted twice, but we want to keep only one level. |
21964f43 AD |
59 | m4_define([b4_lex_param], |
60 | m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl | |
68cdf747 PE |
61 | b4_location_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl |
62 | m4_ifdef([b4_lex_param], b4_lex_param))) | |
66d30cd4 AD |
63 | |
64 | ||
f1886bb2 AD |
65 | |
66 | ## ------------ ## | |
67 | ## Data Types. ## | |
68 | ## ------------ ## | |
69 | ||
70 | # b4_int_type(MIN, MAX) | |
71 | # --------------------- | |
72 | # Return the smallest int type able to handle numbers ranging from | |
73 | # MIN to MAX (included). We overwrite the version from c.m4 which relies | |
2a8d363a | 74 | # on "signed char" which is not portable to old K&R compilers. |
f1886bb2 AD |
75 | m4_define([b4_int_type], |
76 | [m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char], | |
77 | b4_ints_in($@, [-128], [127]), [1], [yysigned_char], | |
78 | ||
779e7ceb PE |
79 | b4_ints_in($@, [0], [65535]), [1], [unsigned short int], |
80 | b4_ints_in($@, [-32768], [32767]), [1], [short int], | |
f1886bb2 AD |
81 | |
82 | m4_eval([0 <= $1]), [1], [unsigned int], | |
83 | ||
84 | [int])]) | |
85 | ||
86 | ||
66d30cd4 AD |
87 | ## ----------------- ## |
88 | ## Semantic Values. ## | |
89 | ## ----------------- ## | |
90 | ||
91 | ||
82b6cb3f AD |
92 | # b4_lhs_value([TYPE]) |
93 | # -------------------- | |
94 | # Expansion of $<TYPE>$. | |
95 | m4_define([b4_lhs_value], | |
bc82c5a5 | 96 | [(yyval[]m4_ifval([$1], [.$1]))]) |
82b6cb3f AD |
97 | |
98 | ||
99 | # b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) | |
100 | # -------------------------------------- | |
101 | # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH | |
102 | # symbols on RHS. | |
103 | m4_define([b4_rhs_value], | |
bc82c5a5 | 104 | [(yyvsp@{m4_eval([$2 - $1])@}m4_ifval([$3], [.$3]))]) |
82b6cb3f AD |
105 | |
106 | ||
58612f1d AD |
107 | |
108 | ## ----------- ## | |
109 | ## Locations. ## | |
110 | ## ----------- ## | |
111 | ||
82b6cb3f AD |
112 | # b4_lhs_location() |
113 | # ----------------- | |
114 | # Expansion of @$. | |
115 | m4_define([b4_lhs_location], | |
bc82c5a5 | 116 | [(yyloc)]) |
82b6cb3f AD |
117 | |
118 | ||
119 | # b4_rhs_location(RULE-LENGTH, NUM) | |
120 | # --------------------------------- | |
121 | # Expansion of @NUM, where the current rule has RULE-LENGTH symbols | |
122 | # on RHS. | |
123 | m4_define([b4_rhs_location], | |
bc82c5a5 | 124 | [(yylsp@{m4_eval([$2 - $1])@})]) |
be2a1a68 | 125 | |
0d8bed56 | 126 | |
0d8bed56 | 127 | |
1ae72863 AD |
128 | ## --------------------------------------------------------- ## |
129 | ## Defining symbol actions, e.g., printers and destructors. ## | |
130 | ## --------------------------------------------------------- ## | |
131 | ||
b526ee61 AD |
132 | # We do want M4 expansion after # for CPP macros. |
133 | m4_changecom() | |
be2a1a68 | 134 | m4_divert(0)dnl |
947427ae | 135 | @output @output_parser_name@ |
fb8135fa | 136 | b4_copyright([Skeleton parser for Yacc-like parsing with Bison], |
779e7ceb | 137 | [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])[ |
fb8135fa | 138 | |
0252b55c PE |
139 | /* As a special exception, when this file is copied by Bison into a |
140 | Bison output file, you may use that output file without restriction. | |
141 | This special exception was added by the Free Software Foundation | |
142 | in version 1.24 of Bison. */ | |
143 | ||
fb8135fa AD |
144 | /* Written by Richard Stallman by simplifying the original so called |
145 | ``semantic'' parser. */ | |
444fbf65 | 146 | |
cf44a9ae PE |
147 | /* All symbols defined below should begin with yy or YY, to avoid |
148 | infringing on user name space. This should be done even for local | |
149 | variables, as they might otherwise be expanded by user macros. | |
150 | There are some unavoidable exceptions within include files to | |
151 | define necessary library symbols; they are noted "INFRINGES ON | |
152 | USER NAME SPACE" below. */ | |
153 | ||
9c1e26bd | 154 | ]b4_identification |
be2a1a68 | 155 | m4_if(b4_prefix[], [yy], [], |
c5b95ccf | 156 | [/* Substitute the variable and function names. */ |
be2a1a68 AD |
157 | #define yyparse b4_prefix[]parse |
158 | #define yylex b4_prefix[]lex | |
159 | #define yyerror b4_prefix[]error | |
160 | #define yylval b4_prefix[]lval | |
161 | #define yychar b4_prefix[]char | |
162 | #define yydebug b4_prefix[]debug | |
163 | #define yynerrs b4_prefix[]nerrs | |
9c1e26bd | 164 | b4_location_if([#define yylloc b4_prefix[]lloc])])[ |
17da6427 | 165 | |
9c1e26bd | 166 | ]b4_token_defines(b4_tokens)[ |
17acead5 | 167 | |
0dd1580a | 168 | /* Copy the first part of user declarations. */ |
9c1e26bd | 169 | ]b4_pre_prologue[ |
cce71710 | 170 | |
d99361e6 AD |
171 | /* Enabling traces. */ |
172 | #ifndef YYDEBUG | |
9c1e26bd | 173 | # define YYDEBUG ]b4_debug[ |
d99361e6 AD |
174 | #endif |
175 | ||
176 | /* Enabling verbose error messages. */ | |
177 | #ifdef YYERROR_VERBOSE | |
178 | # undef YYERROR_VERBOSE | |
179 | # define YYERROR_VERBOSE 1 | |
180 | #else | |
9c1e26bd | 181 | # define YYERROR_VERBOSE ]b4_error_verbose[ |
d99361e6 AD |
182 | #endif |
183 | ||
050c471b | 184 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
9c1e26bd | 185 | ]m4_ifdef([b4_stype], |
437c2d80 | 186 | [b4_syncline([b4_stype_line], [b4_filename]) |
050c471b | 187 | typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; |
996b1c7e | 188 | /* Line __line__ of yacc.c. */ |
947427ae | 189 | b4_syncline([@oline@], [@ofile@])], |
050c471b PE |
190 | [typedef int YYSTYPE;])[ |
191 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | |
192 | # define YYSTYPE_IS_DECLARED 1 | |
71cd15d4 | 193 | # define YYSTYPE_IS_TRIVIAL 1 |
fd51e5ff AD |
194 | #endif |
195 | ||
050c471b PE |
196 | ]b4_location_if([#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED) |
197 | typedef struct YYLTYPE | |
fd51e5ff AD |
198 | { |
199 | int first_line; | |
200 | int first_column; | |
201 | int last_line; | |
202 | int last_column; | |
050c471b PE |
203 | } YYLTYPE; |
204 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ | |
205 | # define YYLTYPE_IS_DECLARED 1 | |
71cd15d4 | 206 | # define YYLTYPE_IS_TRIVIAL 1 |
fd51e5ff | 207 | #endif |
1915f133 | 208 | ])[ |
fd51e5ff | 209 | |
0dd1580a | 210 | /* Copy the second part of user declarations. */ |
ee41006f | 211 | ]b4_post_prologue |
0dd1580a | 212 | |
996b1c7e | 213 | /* Line __line__ of yacc.c. */ |
ee41006f | 214 | b4_syncline([@oline@], [@ofile@])[ |
7093d0f5 | 215 | |
cf44a9ae | 216 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
7093d0f5 | 217 | |
2779e383 PE |
218 | # ifndef YYFREE |
219 | # define YYFREE free | |
220 | # endif | |
221 | # ifndef YYMALLOC | |
222 | # define YYMALLOC malloc | |
223 | # endif | |
224 | ||
7093d0f5 AD |
225 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
226 | ||
b929851a PE |
227 | # ifdef YYSTACK_USE_ALLOCA |
228 | # if YYSTACK_USE_ALLOCA | |
229 | # define YYSTACK_ALLOC alloca | |
230 | # endif | |
7093d0f5 | 231 | # else |
b929851a PE |
232 | # if defined (alloca) || defined (_ALLOCA_H) |
233 | # define YYSTACK_ALLOC alloca | |
234 | # else | |
235 | # ifdef __GNUC__ | |
236 | # define YYSTACK_ALLOC __builtin_alloca | |
7093d0f5 AD |
237 | # endif |
238 | # endif | |
239 | # endif | |
240 | ||
241 | # ifdef YYSTACK_ALLOC | |
242 | /* Pacify GCC's `empty if-body' warning. */ | |
243 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | |
244 | # else | |
45119af1 PE |
245 | # if defined (__STDC__) || defined (__cplusplus) |
246 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
247 | # define YYSIZE_T size_t | |
7093d0f5 | 248 | # endif |
2779e383 PE |
249 | # define YYSTACK_ALLOC YYMALLOC |
250 | # define YYSTACK_FREE YYFREE | |
7093d0f5 | 251 | # endif |
cf44a9ae PE |
252 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
253 | ||
254 | ||
255 | #if (! defined (yyoverflow) \ | |
256 | && (! defined (__cplusplus) \ | |
d7aa6ec1 PE |
257 | || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \ |
258 | && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) | |
7093d0f5 | 259 | |
600f9b0c PE |
260 | /* A type that is properly aligned for any stack member. */ |
261 | union yyalloc | |
262 | { | |
779e7ceb | 263 | short int yyss; |
2729e106 | 264 | YYSTYPE yyvs; |
9c1e26bd | 265 | ]b4_location_if([ YYLTYPE yyls; |
58612f1d | 266 | ])dnl |
9c1e26bd | 267 | [}; |
600f9b0c PE |
268 | |
269 | /* The size of the maximum gap between one aligned stack and the next. */ | |
17836590 | 270 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
600f9b0c PE |
271 | |
272 | /* The size of an array large to enough to hold all stacks, each with | |
273 | N elements. */ | |
9c1e26bd | 274 | ]b4_location_if( |
58612f1d | 275 | [# define YYSTACK_BYTES(N) \ |
779e7ceb | 276 | ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ |
17836590 | 277 | + 2 * YYSTACK_GAP_MAXIMUM)], |
58612f1d | 278 | [# define YYSTACK_BYTES(N) \ |
779e7ceb | 279 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
17836590 | 280 | + YYSTACK_GAP_MAXIMUM)])[ |
600f9b0c | 281 | |
5b041382 PE |
282 | /* Copy COUNT objects from FROM to TO. The source and destination do |
283 | not overlap. */ | |
284 | # ifndef YYCOPY | |
d7aa6ec1 | 285 | # if defined (__GNUC__) && 1 < __GNUC__ |
5b041382 PE |
286 | # define YYCOPY(To, From, Count) \ |
287 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | |
288 | # else | |
289 | # define YYCOPY(To, From, Count) \ | |
290 | do \ | |
291 | { \ | |
292 | register YYSIZE_T yyi; \ | |
293 | for (yyi = 0; yyi < (Count); yyi++) \ | |
9c1e26bd | 294 | (To)[yyi] = (From)[yyi]; \ |
5b041382 PE |
295 | } \ |
296 | while (0) | |
297 | # endif | |
298 | # endif | |
299 | ||
300 | /* Relocate STACK from its old location to the new one. The | |
7093d0f5 | 301 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
600f9b0c PE |
302 | elements in the stack, and YYPTR gives the new location of the |
303 | stack. Advance YYPTR to a properly aligned location for the next | |
304 | stack. */ | |
5b041382 | 305 | # define YYSTACK_RELOCATE(Stack) \ |
7093d0f5 AD |
306 | do \ |
307 | { \ | |
308 | YYSIZE_T yynewbytes; \ | |
5b041382 | 309 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
2729e106 | 310 | Stack = &yyptr->Stack; \ |
17836590 | 311 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
2729e106 | 312 | yyptr += yynewbytes / sizeof (*yyptr); \ |
7093d0f5 AD |
313 | } \ |
314 | while (0) | |
315 | ||
cf44a9ae | 316 | #endif |
8850be4b | 317 | |
768eb43f PE |
318 | #if defined (__STDC__) || defined (__cplusplus) |
319 | typedef signed char yysigned_char; | |
320 | #else | |
779e7ceb | 321 | typedef short int yysigned_char; |
768eb43f PE |
322 | #endif |
323 | ||
7742ddeb | 324 | /* YYFINAL -- State number of the termination state. */ |
9c1e26bd | 325 | #define YYFINAL ]b4_final_state_number[ |
39912f52 | 326 | /* YYLAST -- Last index in YYTABLE. */ |
9c1e26bd | 327 | #define YYLAST ]b4_last[ |
7742ddeb AD |
328 | |
329 | /* YYNTOKENS -- Number of terminals. */ | |
9c1e26bd | 330 | #define YYNTOKENS ]b4_tokens_number[ |
7742ddeb | 331 | /* YYNNTS -- Number of nonterminals. */ |
9c1e26bd | 332 | #define YYNNTS ]b4_nterms_number[ |
7742ddeb | 333 | /* YYNRULES -- Number of rules. */ |
9c1e26bd | 334 | #define YYNRULES ]b4_rules_number[ |
7742ddeb | 335 | /* YYNRULES -- Number of states. */ |
9c1e26bd | 336 | #define YYNSTATES ]b4_states_number[ |
7742ddeb AD |
337 | |
338 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | |
9c1e26bd AD |
339 | #define YYUNDEFTOK ]b4_undef_token_number[ |
340 | #define YYMAXUTOK ]b4_user_token_number_max[ | |
007a50a4 | 341 | |
b0400cc6 | 342 | #define YYTRANSLATE(YYX) \ |
a20713a4 | 343 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
a8289c62 | 344 | |
b0400cc6 AD |
345 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
346 | static const ]b4_int_type_for([b4_translate])[ yytranslate[] = | |
a8289c62 | 347 | { |
c5e3e510 | 348 | ]b4_translate[ |
a8289c62 RA |
349 | }; |
350 | ||
351 | #if YYDEBUG | |
c5e3e510 | 352 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
7742ddeb | 353 | YYRHS. */ |
c5e3e510 | 354 | static const ]b4_int_type_for([b4_prhs])[ yyprhs[] = |
a8289c62 | 355 | { |
c5e3e510 | 356 | ]b4_prhs[ |
a8289c62 RA |
357 | }; |
358 | ||
3db472b9 | 359 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
c5e3e510 | 360 | static const ]b4_int_type_for([b4_rhs])[ yyrhs[] = |
a8289c62 | 361 | { |
c5e3e510 | 362 | ]b4_rhs[ |
a8289c62 RA |
363 | }; |
364 | ||
c5e3e510 AD |
365 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
366 | static const ]b4_int_type_for([b4_rline])[ yyrline[] = | |
a8289c62 | 367 | { |
c5e3e510 | 368 | ]b4_rline[ |
a8289c62 RA |
369 | }; |
370 | #endif | |
371 | ||
5504898e | 372 | #if YYDEBUG || YYERROR_VERBOSE |
c5e3e510 | 373 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
7742ddeb | 374 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
c5e3e510 | 375 | static const char *const yytname[] = |
a8289c62 | 376 | { |
c5e3e510 | 377 | ]b4_tname[ |
a8289c62 RA |
378 | }; |
379 | #endif | |
380 | ||
c0ad8bf3 | 381 | # ifdef YYPRINT |
c5e3e510 | 382 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
769b430f | 383 | token YYLEX-NUM. */ |
c5e3e510 | 384 | static const ]b4_int_type_for([b4_toknum])[ yytoknum[] = |
a8289c62 | 385 | { |
c5e3e510 | 386 | ]b4_toknum[ |
a8289c62 | 387 | }; |
c0ad8bf3 | 388 | # endif |
a8289c62 | 389 | |
c5e3e510 AD |
390 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
391 | static const ]b4_int_type_for([b4_r1])[ yyr1[] = | |
a8289c62 | 392 | { |
c5e3e510 | 393 | ]b4_r1[ |
a8289c62 RA |
394 | }; |
395 | ||
c5e3e510 AD |
396 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
397 | static const ]b4_int_type_for([b4_r2])[ yyr2[] = | |
a8289c62 | 398 | { |
c5e3e510 | 399 | ]b4_r2[ |
a8289c62 RA |
400 | }; |
401 | ||
c5e3e510 | 402 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
5504898e AD |
403 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
404 | means the default is an error. */ | |
c5e3e510 | 405 | static const ]b4_int_type_for([b4_defact])[ yydefact[] = |
a8289c62 | 406 | { |
c5e3e510 | 407 | ]b4_defact[ |
a8289c62 RA |
408 | }; |
409 | ||
c5e3e510 AD |
410 | /* YYDEFGOTO[NTERM-NUM]. */ |
411 | static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] = | |
a8289c62 | 412 | { |
c5e3e510 | 413 | ]b4_defgoto[ |
a8289c62 RA |
414 | }; |
415 | ||
c5e3e510 | 416 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
7742ddeb | 417 | STATE-NUM. */ |
c5e3e510 AD |
418 | #define YYPACT_NINF ]b4_pact_ninf[ |
419 | static const ]b4_int_type_for([b4_pact])[ yypact[] = | |
a8289c62 | 420 | { |
c5e3e510 | 421 | ]b4_pact[ |
a8289c62 RA |
422 | }; |
423 | ||
c5e3e510 AD |
424 | /* YYPGOTO[NTERM-NUM]. */ |
425 | static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] = | |
a8289c62 | 426 | { |
c5e3e510 | 427 | ]b4_pgoto[ |
a8289c62 RA |
428 | }; |
429 | ||
c5e3e510 | 430 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
7742ddeb | 431 | positive, shift that token. If negative, reduce the rule which |
f50adbbd | 432 | number is the opposite. If zero, do what YYDEFACT says. |
6e649e65 | 433 | If YYTABLE_NINF, syntax error. */ |
c5e3e510 AD |
434 | #define YYTABLE_NINF ]b4_table_ninf[ |
435 | static const ]b4_int_type_for([b4_table])[ yytable[] = | |
a8289c62 | 436 | { |
c5e3e510 | 437 | ]b4_table[ |
a8289c62 RA |
438 | }; |
439 | ||
c5e3e510 | 440 | static const ]b4_int_type_for([b4_check])[ yycheck[] = |
a8289c62 | 441 | { |
c5e3e510 | 442 | ]b4_check[ |
a8289c62 RA |
443 | }; |
444 | ||
c5e3e510 | 445 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
5504898e | 446 | symbol of state STATE-NUM. */ |
c5e3e510 | 447 | static const ]b4_int_type_for([b4_stos])[ yystos[] = |
5504898e | 448 | { |
c5e3e510 | 449 | ]b4_stos[ |
5504898e | 450 | }; |
7093d0f5 AD |
451 | |
452 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | |
453 | # define YYSIZE_T __SIZE_TYPE__ | |
454 | #endif | |
455 | #if ! defined (YYSIZE_T) && defined (size_t) | |
456 | # define YYSIZE_T size_t | |
457 | #endif | |
b7575ffe | 458 | #if ! defined (YYSIZE_T) |
45119af1 PE |
459 | # if defined (__STDC__) || defined (__cplusplus) |
460 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | |
461 | # define YYSIZE_T size_t | |
b7575ffe | 462 | # endif |
7093d0f5 AD |
463 | #endif |
464 | #if ! defined (YYSIZE_T) | |
465 | # define YYSIZE_T unsigned int | |
466 | #endif | |
467 | ||
10fa2066 | 468 | #define yyerrok (yyerrstatus = 0) |
a20713a4 PE |
469 | #define yyclearin (yychar = YYEMPTY) |
470 | #define YYEMPTY (-2) | |
10fa2066 | 471 | #define YYEOF 0 |
a8289c62 | 472 | |
70ddf897 | 473 | #define YYACCEPT goto yyacceptlab |
a8289c62 | 474 | #define YYABORT goto yyabortlab |
a6b89bb2 | 475 | #define YYERROR goto yyerrorlab |
8a3eb3c8 | 476 | |
a8289c62 | 477 | |
71da9eea AD |
478 | /* Like YYERROR except do call yyerror. This remains here temporarily |
479 | to ease the transition to the new meaning of YYERROR, for GCC. | |
10fa2066 | 480 | Once GCC version 2 has supplanted version 1, this can go. */ |
a8289c62 | 481 | |
10fa2066 | 482 | #define YYFAIL goto yyerrlab |
a8289c62 | 483 | |
10fa2066 | 484 | #define YYRECOVERING() (!!yyerrstatus) |
a8289c62 | 485 | |
69b4e0c5 | 486 | #define YYBACKUP(Token, Value) \ |
10fa2066 | 487 | do \ |
a20713a4 | 488 | if (yychar == YYEMPTY && yylen == 1) \ |
71da9eea | 489 | { \ |
17da6427 | 490 | yychar = (Token); \ |
7742ddeb | 491 | yylval = (Value); \ |
b0400cc6 | 492 | yytoken = YYTRANSLATE (yychar); \ |
10fa2066 RS |
493 | YYPOPSTACK; \ |
494 | goto yybackup; \ | |
495 | } \ | |
496 | else \ | |
71da9eea | 497 | { \ |
9c1e26bd | 498 | yyerror (]b4_yyerror_args["syntax error: cannot back up");\ |
71da9eea AD |
499 | YYERROR; \ |
500 | } \ | |
10fa2066 RS |
501 | while (0) |
502 | ||
3fc16193 | 503 | |
10fa2066 RS |
504 | #define YYTERROR 1 |
505 | #define YYERRCODE 256 | |
506 | ||
3fc16193 | 507 | |
b4a20338 AD |
508 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
509 | If N is 0, then set CURRENT to the empty location which ends | |
510 | the previous symbol: RHS[0] (always defined). */ | |
3abcd459 | 511 | |
24e0cbd0 | 512 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
3abcd459 | 513 | #ifndef YYLLOC_DEFAULT |
24e0cbd0 PE |
514 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
515 | do \ | |
516 | if (N) \ | |
517 | { \ | |
518 | (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ | |
519 | (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ | |
520 | (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ | |
521 | (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ | |
522 | } \ | |
523 | else \ | |
524 | { \ | |
525 | (Current).first_line = (Current).last_line = \ | |
526 | YYRHSLOC(Rhs, 0).last_line; \ | |
527 | (Current).first_column = (Current).last_column = \ | |
528 | YYRHSLOC(Rhs, 0).last_column; \ | |
529 | } \ | |
530 | while (0) | |
b8458aa5 AD |
531 | #endif |
532 | ||
3fc16193 AD |
533 | |
534 | /* YY_LOCATION_PRINT -- Print the location on the stream. | |
535 | This macro was not mandated originally: define only if we know | |
536 | we won't break user code: when these are the locations we know. */ | |
537 | ||
3fc16193 | 538 | #ifndef YY_LOCATION_PRINT |
b8458aa5 AD |
539 | # if YYLTYPE_IS_TRIVIAL |
540 | # define YY_LOCATION_PRINT(File, Loc) \ | |
541 | fprintf (File, "%d.%d-%d.%d", \ | |
542 | (Loc).first_line, (Loc).first_column, \ | |
543 | (Loc).last_line, (Loc).last_column) | |
0dcca5c2 AD |
544 | # else |
545 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | |
b8458aa5 | 546 | # endif |
3abcd459 AD |
547 | #endif |
548 | ||
3fc16193 | 549 | |
3abcd459 | 550 | /* YYLEX -- calling `yylex' with the right arguments. */ |
553e2b22 | 551 | |
ae7453f2 | 552 | #ifdef YYLEX_PARAM |
9c1e26bd | 553 | # define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM) |
74310291 | 554 | #else |
9c1e26bd | 555 | # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ |
ae7453f2 | 556 | #endif |
553e2b22 | 557 | |
5a35a6cb | 558 | /* Enable debugging if requested. */ |
0d533154 | 559 | #if YYDEBUG |
b7575ffe PE |
560 | |
561 | # ifndef YYFPRINTF | |
45119af1 PE |
562 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
563 | # define YYFPRINTF fprintf | |
b7575ffe PE |
564 | # endif |
565 | ||
5a35a6cb AD |
566 | # define YYDPRINTF(Args) \ |
567 | do { \ | |
17da6427 | 568 | if (yydebug) \ |
b7575ffe | 569 | YYFPRINTF Args; \ |
5a35a6cb | 570 | } while (0) |
c5e3e510 | 571 | |
284acc8b | 572 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
9c1e26bd AD |
573 | do { \ |
574 | if (yydebug) \ | |
575 | { \ | |
576 | YYFPRINTF (stderr, "%s ", Title); \ | |
577 | yysymprint (stderr, \ | |
284acc8b | 578 | Type, Value]b4_location_if([, Location])[); \ |
9c1e26bd AD |
579 | YYFPRINTF (stderr, "\n"); \ |
580 | } \ | |
581 | } while (0) | |
582 | ||
b0937b22 AD |
583 | /*------------------------------------------------------------------. |
584 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | |
5348bfbe | 585 | | TOP (included). | |
b0937b22 AD |
586 | `------------------------------------------------------------------*/ |
587 | ||
588 | ]b4_c_function_def([yy_stack_print], [static void], | |
779e7ceb PE |
589 | [[short int *bottom], [bottom]], |
590 | [[short int *top], [top]])[ | |
b0937b22 AD |
591 | { |
592 | YYFPRINTF (stderr, "Stack now"); | |
593 | for (/* Nothing. */; bottom <= top; ++bottom) | |
594 | YYFPRINTF (stderr, " %d", *bottom); | |
595 | YYFPRINTF (stderr, "\n"); | |
596 | } | |
597 | ||
598 | # define YY_STACK_PRINT(Bottom, Top) \ | |
599 | do { \ | |
600 | if (yydebug) \ | |
601 | yy_stack_print ((Bottom), (Top)); \ | |
602 | } while (0) | |
603 | ||
604 | ||
605 | /*------------------------------------------------. | |
606 | | Report that the YYRULE is going to be reduced. | | |
607 | `------------------------------------------------*/ | |
608 | ||
609 | ]b4_c_function_def([yy_reduce_print], [static void], | |
610 | [[int yyrule], [yyrule]])[ | |
611 | { | |
612 | int yyi; | |
52f32190 | 613 | unsigned int yylno = yyrline[yyrule]; |
4f21fffe | 614 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", |
52f32190 | 615 | yyrule - 1, yylno); |
b0937b22 AD |
616 | /* Print the symbols being reduced, and their result. */ |
617 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) | |
618 | YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); | |
619 | YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); | |
620 | } | |
621 | ||
622 | # define YY_REDUCE_PRINT(Rule) \ | |
623 | do { \ | |
624 | if (yydebug) \ | |
625 | yy_reduce_print (Rule); \ | |
626 | } while (0) | |
627 | ||
cf44a9ae PE |
628 | /* Nonzero means print parse trace. It is left uninitialized so that |
629 | multiple parsers can coexist. */ | |
17da6427 | 630 | int yydebug; |
5a35a6cb AD |
631 | #else /* !YYDEBUG */ |
632 | # define YYDPRINTF(Args) | |
284acc8b | 633 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
b0937b22 AD |
634 | # define YY_STACK_PRINT(Bottom, Top) |
635 | # define YY_REDUCE_PRINT(Rule) | |
5a35a6cb AD |
636 | #endif /* !YYDEBUG */ |
637 | ||
b0937b22 | 638 | |
5a35a6cb | 639 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
10fa2066 | 640 | #ifndef YYINITDEPTH |
9c1e26bd | 641 | # define YYINITDEPTH ]b4_stack_depth_init[ |
10fa2066 RS |
642 | #endif |
643 | ||
5a35a6cb | 644 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
600f9b0c PE |
645 | if the built-in stack extension method is used). |
646 | ||
647 | Do not make this value too large; the results are undefined if | |
648 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | |
649 | evaluated with infinite-precision integer arithmetic. */ | |
650 | ||
b929851a | 651 | #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 |
b07b484a | 652 | # undef YYMAXDEPTH |
10fa2066 RS |
653 | #endif |
654 | ||
655 | #ifndef YYMAXDEPTH | |
9c1e26bd | 656 | # define YYMAXDEPTH ]b4_stack_depth_max[ |
10fa2066 | 657 | #endif |
a8289c62 | 658 | |
10fa2066 | 659 | \f |
a8289c62 | 660 | |
7093d0f5 AD |
661 | #if YYERROR_VERBOSE |
662 | ||
663 | # ifndef yystrlen | |
664 | # if defined (__GLIBC__) && defined (_STRING_H) | |
665 | # define yystrlen strlen | |
666 | # else | |
667 | /* Return the length of YYSTR. */ | |
668 | static YYSIZE_T | |
669 | # if defined (__STDC__) || defined (__cplusplus) | |
670 | yystrlen (const char *yystr) | |
671 | # else | |
672 | yystrlen (yystr) | |
673 | const char *yystr; | |
674 | # endif | |
675 | { | |
676 | register const char *yys = yystr; | |
677 | ||
678 | while (*yys++ != '\0') | |
679 | continue; | |
680 | ||
681 | return yys - yystr - 1; | |
682 | } | |
683 | # endif | |
684 | # endif | |
685 | ||
686 | # ifndef yystpcpy | |
687 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | |
688 | # define yystpcpy stpcpy | |
689 | # else | |
690 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | |
691 | YYDEST. */ | |
692 | static char * | |
f11966ff PE |
693 | # if defined (__STDC__) || defined (__cplusplus) |
694 | yystpcpy (char *yydest, const char *yysrc) | |
695 | # else | |
7093d0f5 AD |
696 | yystpcpy (yydest, yysrc) |
697 | char *yydest; | |
698 | const char *yysrc; | |
7093d0f5 AD |
699 | # endif |
700 | { | |
701 | register char *yyd = yydest; | |
702 | register const char *yys = yysrc; | |
703 | ||
704 | while ((*yyd++ = *yys++) != '\0') | |
705 | continue; | |
706 | ||
707 | return yyd - 1; | |
708 | } | |
709 | # endif | |
710 | # endif | |
711 | ||
712 | #endif /* !YYERROR_VERBOSE */ | |
713 | ||
10fa2066 | 714 | \f |
a8289c62 | 715 | |
b8df3223 | 716 | #if YYDEBUG |
9c1e26bd | 717 | ]b4_yysymprint_generate([b4_c_function_def])[ |
c5e3e510 | 718 | #endif /* ! YYDEBUG */ |
9c1e26bd | 719 | ]b4_yydestruct_generate([b4_c_function_def]) |
4a2a22f4 AD |
720 | \f |
721 | ||
0245f82d | 722 | /* Prevent warnings from -Wmissing-prototypes. */ |
4a2a22f4 AD |
723 | |
724 | #ifdef YYPARSE_PARAM | |
725 | # if defined (__STDC__) || defined (__cplusplus) | |
0245f82d | 726 | int yyparse (void *YYPARSE_PARAM); |
4a2a22f4 | 727 | # else |
0245f82d | 728 | int yyparse (); |
4a2a22f4 | 729 | # endif |
0245f82d AD |
730 | #else /* ! YYPARSE_PARAM */ |
731 | b4_c_function_decl([yyparse], [int], b4_parse_param) | |
c5e3e510 | 732 | #endif /* ! YYPARSE_PARAM */ |
1b181651 | 733 | |
0245f82d | 734 | |
74310291 AD |
735 | m4_divert_push([KILL])# ======================== M4 code. |
736 | # b4_declare_parser_variables | |
737 | # --------------------------- | |
738 | # Declare the variables that are global, or local to YYPARSE if | |
0245f82d | 739 | # pure-parser. |
74310291 | 740 | m4_define([b4_declare_parser_variables], |
8dd162d3 | 741 | [/* The look-ahead symbol. */ |
74310291 AD |
742 | int yychar; |
743 | ||
8dd162d3 | 744 | /* The semantic value of the look-ahead symbol. */ |
74310291 AD |
745 | YYSTYPE yylval; |
746 | ||
6e649e65 | 747 | /* Number of syntax errors so far. */ |
74310291 | 748 | int yynerrs;b4_location_if([ |
8dd162d3 | 749 | /* Location data for the look-ahead symbol. */ |
58612f1d | 750 | YYLTYPE yylloc;]) |
74310291 AD |
751 | ]) |
752 | m4_divert_pop([KILL])dnl# ====================== End of M4 code. | |
58612f1d | 753 | |
74310291 AD |
754 | b4_pure_if([], |
755 | [b4_declare_parser_variables]) | |
a35f64ea | 756 | |
0245f82d AD |
757 | |
758 | /*----------. | |
759 | | yyparse. | | |
760 | `----------*/ | |
761 | ||
762 | #ifdef YYPARSE_PARAM | |
763 | # if defined (__STDC__) || defined (__cplusplus) | |
764 | int yyparse (void *YYPARSE_PARAM) | |
765 | # else | |
766 | int yyparse (YYPARSE_PARAM) | |
767 | void *YYPARSE_PARAM; | |
768 | # endif | |
769 | #else /* ! YYPARSE_PARAM */ | |
770 | b4_c_function_def([yyparse], [int], b4_parse_param) | |
771 | #endif | |
be2a1a68 | 772 | {[ |
74310291 | 773 | ]b4_pure_if([b4_declare_parser_variables])[ |
10fa2066 RS |
774 | register int yystate; |
775 | register int yyn; | |
600f9b0c | 776 | int yyresult; |
b07b484a AD |
777 | /* Number of tokens to shift before error messages enabled. */ |
778 | int yyerrstatus; | |
8dd162d3 | 779 | /* Look-ahead token as an internal (translated) token number. */ |
b0400cc6 | 780 | int yytoken = 0; |
10fa2066 | 781 | |
bb10be54 AD |
782 | /* Three stacks and their tools: |
783 | `yyss': related to states, | |
e9e4c321 | 784 | `yyvs': related to semantic values, |
bb10be54 AD |
785 | `yyls': related to locations. |
786 | ||
787 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
788 | to reallocate them elsewhere. */ | |
789 | ||
e8cb70b9 | 790 | /* The state stack. */ |
779e7ceb PE |
791 | short int yyssa[YYINITDEPTH]; |
792 | short int *yyss = yyssa; | |
793 | register short int *yyssp; | |
bb10be54 | 794 | |
b07b484a AD |
795 | /* The semantic value stack. */ |
796 | YYSTYPE yyvsa[YYINITDEPTH]; | |
b07b484a | 797 | YYSTYPE *yyvs = yyvsa; |
bb10be54 | 798 | register YYSTYPE *yyvsp; |
10fa2066 | 799 | |
58612f1d AD |
800 | ]b4_location_if( |
801 | [[ /* The location stack. */ | |
b07b484a | 802 | YYLTYPE yylsa[YYINITDEPTH]; |
10fa2066 | 803 | YYLTYPE *yyls = yylsa; |
d42f69cd | 804 | YYLTYPE *yylsp; |
3fc16193 AD |
805 | /* The locations where the error started and ended. */ |
806 | YYLTYPE yyerror_range[2];]])[ | |
10fa2066 | 807 | |
58612f1d | 808 | #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[) |
10fa2066 | 809 | |
7093d0f5 | 810 | YYSIZE_T yystacksize = YYINITDEPTH; |
10fa2066 | 811 | |
6666f98f AD |
812 | /* The variables used to return semantic value and location from the |
813 | action routines. */ | |
bb10be54 | 814 | YYSTYPE yyval; |
58612f1d | 815 | ]b4_location_if([ YYLTYPE yyloc;])[ |
10fa2066 | 816 | |
6666f98f | 817 | /* When reducing, the number of symbols on the RHS of the reduced |
e8cb70b9 | 818 | rule. */ |
10fa2066 RS |
819 | int yylen; |
820 | ||
7ea5e977 | 821 | YYDPRINTF ((stderr, "Starting parse\n")); |
10fa2066 RS |
822 | |
823 | yystate = 0; | |
824 | yyerrstatus = 0; | |
17da6427 | 825 | yynerrs = 0; |
a20713a4 | 826 | yychar = YYEMPTY; /* Cause a token to be read. */ |
10fa2066 RS |
827 | |
828 | /* Initialize stack pointers. | |
829 | Waste one element of value and location stack | |
830 | so that they stay on the same level as the state stack. | |
831 | The wasted elements are never initialized. */ | |
832 | ||
cbd89906 | 833 | yyssp = yyss; |
10fa2066 | 834 | yyvsp = yyvs; |
b8458aa5 AD |
835 | ]b4_location_if([[ yylsp = yyls; |
836 | #if YYLTYPE_IS_TRIVIAL | |
837 | /* Initialize the default location before parsing starts. */ | |
451364ed AD |
838 | yylloc.first_line = yylloc.last_line = 1; |
839 | yylloc.first_column = yylloc.last_column = 0; | |
b8458aa5 AD |
840 | #endif |
841 | ]]) | |
842 | m4_ifdef([b4_initial_action], [ | |
0092f063 AD |
843 | m4_pushdef([b4_at_dollar], [yylloc])dnl |
844 | m4_pushdef([b4_dollar_dollar], [yylval])dnl | |
cd3684cf AD |
845 | /* User initialization code. */ |
846 | b4_initial_action | |
847 | m4_popdef([b4_dollar_dollar])dnl | |
848 | m4_popdef([b4_at_dollar])dnl | |
849 | /* Line __line__ of yacc.c. */ | |
850 | b4_syncline([@oline@], [@ofile@])])dnl | |
451364ed AD |
851 | [ |
852 | yyvsp[0] = yylval; | |
853 | ]b4_location_if([[ yylsp[0] = yylloc; | |
854 | ]]) | |
cd3684cf | 855 | [ goto yysetstate; |
10fa2066 | 856 | |
71da9eea AD |
857 | /*------------------------------------------------------------. |
858 | | yynewstate -- Push a new state, which is found in yystate. | | |
859 | `------------------------------------------------------------*/ | |
342b8b6e | 860 | yynewstate: |
71da9eea AD |
861 | /* In all cases, when you get here, the value and location stacks |
862 | have just been pushed. so pushing a state here evens the stacks. | |
863 | */ | |
cbd89906 PE |
864 | yyssp++; |
865 | ||
342b8b6e | 866 | yysetstate: |
cbd89906 | 867 | *yyssp = yystate; |
10fa2066 | 868 | |
39912f52 | 869 | if (yyss + yystacksize - 1 <= yyssp) |
10fa2066 | 870 | { |
10fa2066 | 871 | /* Get the current used size of the three stacks, in elements. */ |
7093d0f5 | 872 | YYSIZE_T yysize = yyssp - yyss + 1; |
10fa2066 RS |
873 | |
874 | #ifdef yyoverflow | |
3d76b07d AD |
875 | { |
876 | /* Give user a chance to reallocate the stack. Use copies of | |
877 | these so that the &'s don't force the real ones into | |
878 | memory. */ | |
879 | YYSTYPE *yyvs1 = yyvs; | |
779e7ceb | 880 | short int *yyss1 = yyss; |
58612f1d | 881 | ]b4_location_if([ YYLTYPE *yyls1 = yyls;])[ |
3d76b07d AD |
882 | |
883 | /* Each stack pointer address is followed by the size of the | |
58612f1d AD |
884 | data in use in that stack, in bytes. This used to be a |
885 | conditional around just the two extra args, but that might | |
886 | be undefined if yyoverflow is a macro. */ | |
3d76b07d | 887 | yyoverflow ("parser stack overflow", |
7093d0f5 AD |
888 | &yyss1, yysize * sizeof (*yyssp), |
889 | &yyvs1, yysize * sizeof (*yyvsp), | |
58612f1d | 890 | ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ |
3d76b07d | 891 | &yystacksize); |
58612f1d | 892 | ]b4_location_if([ yyls = yyls1;])[ |
3d76b07d AD |
893 | yyss = yyss1; |
894 | yyvs = yyvs1; | |
895 | } | |
10fa2066 | 896 | #else /* no yyoverflow */ |
cf44a9ae PE |
897 | # ifndef YYSTACK_RELOCATE |
898 | goto yyoverflowlab; | |
899 | # else | |
10fa2066 | 900 | /* Extend the stack our own way. */ |
39912f52 | 901 | if (YYMAXDEPTH <= yystacksize) |
600f9b0c | 902 | goto yyoverflowlab; |
10fa2066 | 903 | yystacksize *= 2; |
39912f52 | 904 | if (YYMAXDEPTH < yystacksize) |
10fa2066 | 905 | yystacksize = YYMAXDEPTH; |
e9e4c321 | 906 | |
600f9b0c | 907 | { |
779e7ceb | 908 | short int *yyss1 = yyss; |
2729e106 PE |
909 | union yyalloc *yyptr = |
910 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | |
600f9b0c PE |
911 | if (! yyptr) |
912 | goto yyoverflowlab; | |
5b041382 PE |
913 | YYSTACK_RELOCATE (yyss); |
914 | YYSTACK_RELOCATE (yyvs); | |
58612f1d | 915 | ]b4_location_if([ YYSTACK_RELOCATE (yyls);])[ |
cf44a9ae | 916 | # undef YYSTACK_RELOCATE |
600f9b0c PE |
917 | if (yyss1 != yyssa) |
918 | YYSTACK_FREE (yyss1); | |
919 | } | |
cf44a9ae | 920 | # endif |
10fa2066 RS |
921 | #endif /* no yyoverflow */ |
922 | ||
7093d0f5 AD |
923 | yyssp = yyss + yysize - 1; |
924 | yyvsp = yyvs + yysize - 1; | |
58612f1d | 925 | ]b4_location_if([ yylsp = yyls + yysize - 1;])[ |
10fa2066 | 926 | |
7ea5e977 | 927 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
600f9b0c | 928 | (unsigned long int) yystacksize)); |
10fa2066 | 929 | |
39912f52 | 930 | if (yyss + yystacksize - 1 <= yyssp) |
10fa2066 RS |
931 | YYABORT; |
932 | } | |
933 | ||
7ea5e977 | 934 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
10fa2066 RS |
935 | |
936 | goto yybackup; | |
71da9eea | 937 | |
71da9eea AD |
938 | /*-----------. |
939 | | yybackup. | | |
940 | `-----------*/ | |
941 | yybackup: | |
10fa2066 RS |
942 | |
943 | /* Do appropriate processing given the current state. */ | |
8dd162d3 | 944 | /* Read a look-ahead token if we need one and don't already have one. */ |
10fa2066 RS |
945 | /* yyresume: */ |
946 | ||
8dd162d3 | 947 | /* First try to decide what to do without reference to look-ahead token. */ |
10fa2066 RS |
948 | |
949 | yyn = yypact[yystate]; | |
12b0043a | 950 | if (yyn == YYPACT_NINF) |
10fa2066 RS |
951 | goto yydefault; |
952 | ||
8dd162d3 | 953 | /* Not known => get a look-ahead token if don't already have one. */ |
10fa2066 | 954 | |
8dd162d3 | 955 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
a20713a4 | 956 | if (yychar == YYEMPTY) |
10fa2066 | 957 | { |
7ea5e977 | 958 | YYDPRINTF ((stderr, "Reading a token: ")); |
17da6427 | 959 | yychar = YYLEX; |
10fa2066 RS |
960 | } |
961 | ||
a20713a4 | 962 | if (yychar <= YYEOF) |
10fa2066 | 963 | { |
a20713a4 | 964 | yychar = yytoken = YYEOF; |
7ea5e977 | 965 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
10fa2066 RS |
966 | } |
967 | else | |
968 | { | |
a20713a4 | 969 | yytoken = YYTRANSLATE (yychar); |
284acc8b | 970 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
10fa2066 RS |
971 | } |
972 | ||
b0400cc6 | 973 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
e5cfd9d8 | 974 | detect an error, take that action. */ |
b0400cc6 AD |
975 | yyn += yytoken; |
976 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | |
e5cfd9d8 PE |
977 | goto yydefault; |
978 | yyn = yytable[yyn]; | |
979 | if (yyn <= 0) | |
10fa2066 | 980 | { |
e5cfd9d8 PE |
981 | if (yyn == 0 || yyn == YYTABLE_NINF) |
982 | goto yyerrlab; | |
10fa2066 RS |
983 | yyn = -yyn; |
984 | goto yyreduce; | |
985 | } | |
10fa2066 RS |
986 | |
987 | if (yyn == YYFINAL) | |
988 | YYACCEPT; | |
989 | ||
8dd162d3 | 990 | /* Shift the look-ahead token. */ |
1576d44d | 991 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
10fa2066 RS |
992 | |
993 | /* Discard the token being shifted unless it is eof. */ | |
a20713a4 PE |
994 | if (yychar != YYEOF) |
995 | yychar = YYEMPTY; | |
10fa2066 | 996 | |
17da6427 | 997 | *++yyvsp = yylval; |
58612f1d | 998 | ]b4_location_if([ *++yylsp = yylloc;])[ |
10fa2066 | 999 | |
71da9eea AD |
1000 | /* Count tokens shifted since error; after three, turn off error |
1001 | status. */ | |
1002 | if (yyerrstatus) | |
1003 | yyerrstatus--; | |
10fa2066 RS |
1004 | |
1005 | yystate = yyn; | |
1006 | goto yynewstate; | |
1007 | ||
10fa2066 | 1008 | |
71da9eea AD |
1009 | /*-----------------------------------------------------------. |
1010 | | yydefault -- do the default action for the current state. | | |
1011 | `-----------------------------------------------------------*/ | |
1012 | yydefault: | |
10fa2066 RS |
1013 | yyn = yydefact[yystate]; |
1014 | if (yyn == 0) | |
1015 | goto yyerrlab; | |
71da9eea | 1016 | goto yyreduce; |
10fa2066 | 1017 | |
71da9eea AD |
1018 | |
1019 | /*-----------------------------. | |
1020 | | yyreduce -- Do a reduction. | | |
1021 | `-----------------------------*/ | |
10fa2066 | 1022 | yyreduce: |
71da9eea | 1023 | /* yyn is the number of a rule to reduce with. */ |
10fa2066 | 1024 | yylen = yyr2[yyn]; |
da9abf43 AD |
1025 | |
1026 | /* If YYLEN is nonzero, implement the default value of the action: | |
573c1d9f | 1027 | `$$ = $1'. |
da9abf43 | 1028 | |
accea6db PE |
1029 | Otherwise, the following line sets YYVAL to garbage. |
1030 | This behavior is undocumented and Bison | |
da9abf43 AD |
1031 | users should not rely upon it. Assigning to YYVAL |
1032 | unconditionally makes the parser a bit smaller, and it avoids a | |
1033 | GCC warning that YYVAL may be used uninitialized. */ | |
1034 | yyval = yyvsp[1-yylen]; | |
3abcd459 | 1035 | |
58612f1d | 1036 | ]b4_location_if( |
b8458aa5 | 1037 | [[ /* Default location. */ |
b4a20338 | 1038 | YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);]])[ |
b0937b22 | 1039 | YY_REDUCE_PRINT (yyn); |
a8289c62 | 1040 | switch (yyn) |
be2a1a68 AD |
1041 | ]{ |
1042 | b4_actions | |
a8289c62 | 1043 | } |
897668ee | 1044 | |
996b1c7e | 1045 | /* Line __line__ of yacc.c. */ |
947427ae | 1046 | b4_syncline([@oline@], [@ofile@]) |
10fa2066 | 1047 | \f |
be2a1a68 | 1048 | [ yyvsp -= yylen; |
10fa2066 | 1049 | yyssp -= yylen; |
58612f1d | 1050 | ]b4_location_if([ yylsp -= yylen;])[ |
10fa2066 | 1051 | |
b0937b22 | 1052 | YY_STACK_PRINT (yyss, yyssp); |
10fa2066 RS |
1053 | |
1054 | *++yyvsp = yyval; | |
58612f1d | 1055 | ]b4_location_if([ *++yylsp = yyloc;])[ |
10fa2066 | 1056 | |
41aca2e0 AD |
1057 | /* Now `shift' the result of the reduction. Determine what state |
1058 | that goes to, based on the state we popped back to and the rule | |
1059 | number reduced by. */ | |
10fa2066 RS |
1060 | |
1061 | yyn = yyr1[yyn]; | |
1062 | ||
7742ddeb | 1063 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
12b0043a | 1064 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
10fa2066 RS |
1065 | yystate = yytable[yystate]; |
1066 | else | |
7742ddeb | 1067 | yystate = yydefgoto[yyn - YYNTOKENS]; |
10fa2066 RS |
1068 | |
1069 | goto yynewstate; | |
1070 | ||
10fa2066 | 1071 | |
71da9eea AD |
1072 | /*------------------------------------. |
1073 | | yyerrlab -- here on detecting error | | |
1074 | `------------------------------------*/ | |
1075 | yyerrlab: | |
1076 | /* If not already recovering from an error, report this error. */ | |
1077 | if (!yyerrstatus) | |
10fa2066 | 1078 | { |
17da6427 | 1079 | ++yynerrs; |
df5aed8c PE |
1080 | #if YYERROR_VERBOSE |
1081 | yyn = yypact[yystate]; | |
1082 | ||
1083 | if (YYPACT_NINF < yyn && yyn < YYLAST) | |
1084 | { | |
1085 | YYSIZE_T yysize = 0; | |
1086 | int yytype = YYTRANSLATE (yychar); | |
c4749565 | 1087 | const char* yyprefix; |
df5aed8c | 1088 | char *yymsg; |
3aa2f55d | 1089 | int yyx; |
df5aed8c | 1090 | |
df5aed8c PE |
1091 | /* Start YYX at -YYN if negative to avoid negative indexes in |
1092 | YYCHECK. */ | |
c4749565 | 1093 | int yyxbegin = yyn < 0 ? -yyn : 0; |
3aa2f55d PE |
1094 | |
1095 | /* Stay within bounds of both yycheck and yytname. */ | |
1096 | int yychecklim = YYLAST - yyn; | |
c4749565 | 1097 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
3aa2f55d PE |
1098 | int yycount = 0; |
1099 | ||
c4749565 AD |
1100 | yyprefix = ", expecting "; |
1101 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | |
df5aed8c | 1102 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
3aa2f55d | 1103 | { |
c4749565 AD |
1104 | yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); |
1105 | yycount += 1; | |
3aa2f55d PE |
1106 | if (yycount == 5) |
1107 | { | |
1108 | yysize = 0; | |
1109 | break; | |
c4749565 | 1110 | } |
3aa2f55d PE |
1111 | } |
1112 | yysize += (sizeof ("syntax error, unexpected ") | |
1113 | + yystrlen (yytname[yytype])); | |
df5aed8c PE |
1114 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
1115 | if (yymsg != 0) | |
1116 | { | |
6e649e65 | 1117 | char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); |
df5aed8c PE |
1118 | yyp = yystpcpy (yyp, yytname[yytype]); |
1119 | ||
1120 | if (yycount < 5) | |
1121 | { | |
c4749565 AD |
1122 | yyprefix = ", expecting "; |
1123 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | |
df5aed8c PE |
1124 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
1125 | { | |
c4749565 | 1126 | yyp = yystpcpy (yyp, yyprefix); |
df5aed8c | 1127 | yyp = yystpcpy (yyp, yytname[yyx]); |
c4749565 | 1128 | yyprefix = " or "; |
df5aed8c PE |
1129 | } |
1130 | } | |
93724f13 | 1131 | yyerror (]b4_yyerror_args[yymsg); |
df5aed8c PE |
1132 | YYSTACK_FREE (yymsg); |
1133 | } | |
1134 | else | |
6e649e65 | 1135 | yyerror (]b4_yyerror_args["syntax error; also virtual memory exhausted"); |
df5aed8c PE |
1136 | } |
1137 | else | |
1138 | #endif /* YYERROR_VERBOSE */ | |
6e649e65 | 1139 | yyerror (]b4_yyerror_args["syntax error"); |
10fa2066 | 1140 | } |
71da9eea | 1141 | |
3fc16193 | 1142 | ]b4_location_if([[ yyerror_range[0] = yylloc;]])[ |
d42f69cd | 1143 | |
10fa2066 RS |
1144 | if (yyerrstatus == 3) |
1145 | { | |
8dd162d3 | 1146 | /* If just tried and failed to reuse look-ahead token after an |
71da9eea | 1147 | error, discard it. */ |
10fa2066 | 1148 | |
a6b89bb2 | 1149 | if (yychar <= YYEOF) |
5719c109 | 1150 | { |
a6b89bb2 PE |
1151 | /* If at end of input, pop the error token, |
1152 | then the rest of the stack, then return failure. */ | |
1153 | if (yychar == YYEOF) | |
1154 | for (;;) | |
1155 | { | |
3fc16193 | 1156 | ]b4_location_if([[ yyerror_range[0] = *yylsp;]])[ |
a6b89bb2 PE |
1157 | YYPOPSTACK; |
1158 | if (yyssp == yyss) | |
1159 | YYABORT; | |
a0e68930 AD |
1160 | yydestruct ("Error: popping", |
1161 | yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[); | |
a6b89bb2 | 1162 | } |
5719c109 | 1163 | } |
a6b89bb2 PE |
1164 | else |
1165 | { | |
a0e68930 | 1166 | yydestruct ("Error: discarding", yytoken, &yylval]b4_location_if([, &yylloc])[); |
a6b89bb2 | 1167 | yychar = YYEMPTY; |
a6b89bb2 | 1168 | } |
10fa2066 RS |
1169 | } |
1170 | ||
8dd162d3 | 1171 | /* Else will try to reuse look-ahead token after shifting the error |
71da9eea | 1172 | token. */ |
8a3eb3c8 | 1173 | goto yyerrlab1; |
300a7966 | 1174 | |
10fa2066 | 1175 | |
a6b89bb2 PE |
1176 | /*---------------------------------------------------. |
1177 | | yyerrorlab -- error raised explicitly by YYERROR. | | |
1178 | `---------------------------------------------------*/ | |
1179 | yyerrorlab: | |
1180 | ||
1181 | #ifdef __GNUC__ | |
1182 | /* Pacify GCC when the user code never invokes YYERROR and the label | |
1183 | yyerrorlab therefore never appears in user code. */ | |
1184 | if (0) | |
1185 | goto yyerrorlab; | |
1186 | #endif | |
1187 | ||
3fc16193 AD |
1188 | ]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen]; |
1189 | yylsp -= yylen; | |
1190 | ]])[yyvsp -= yylen; | |
a6b89bb2 PE |
1191 | yyssp -= yylen; |
1192 | yystate = *yyssp; | |
3fc16193 | 1193 | goto yyerrlab1; |
a6b89bb2 PE |
1194 | |
1195 | ||
1196 | /*-------------------------------------------------------------. | |
1197 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | |
1198 | `-------------------------------------------------------------*/ | |
300a7966 | 1199 | yyerrlab1: |
cf44a9ae | 1200 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
10fa2066 | 1201 | |
660bc8dd PE |
1202 | for (;;) |
1203 | { | |
1204 | yyn = yypact[yystate]; | |
12b0043a | 1205 | if (yyn != YYPACT_NINF) |
660bc8dd PE |
1206 | { |
1207 | yyn += YYTERROR; | |
1208 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | |
1209 | { | |
1210 | yyn = yytable[yyn]; | |
1211 | if (0 < yyn) | |
1212 | break; | |
1213 | } | |
1214 | } | |
10fa2066 | 1215 | |
660bc8dd PE |
1216 | /* Pop the current state because it cannot handle the error token. */ |
1217 | if (yyssp == yyss) | |
1218 | YYABORT; | |
5504898e | 1219 | |
3fc16193 | 1220 | ]b4_location_if([[ yyerror_range[0] = *yylsp;]])[ |
a0e68930 | 1221 | yydestruct ("Error: popping", yystos[yystate], yyvsp]b4_location_if([, yylsp])[); |
a6b89bb2 PE |
1222 | YYPOPSTACK; |
1223 | yystate = *yyssp; | |
b0937b22 | 1224 | YY_STACK_PRINT (yyss, yyssp); |
10fa2066 | 1225 | } |
10fa2066 RS |
1226 | |
1227 | if (yyn == YYFINAL) | |
1228 | YYACCEPT; | |
1229 | ||
17da6427 | 1230 | *++yyvsp = yylval; |
3fc16193 AD |
1231 | ]b4_location_if([[ |
1232 | yyerror_range[1] = yylloc; | |
1233 | /* Using YYLLOC is tempting, but would change the location of | |
1234 | the look-ahead. YYLOC is available though. */ | |
1235 | YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2); | |
1236 | *++yylsp = yyloc;]])[ | |
10fa2066 | 1237 | |
1576d44d AD |
1238 | /* Shift the error token. */ |
1239 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | |
1240 | ||
10fa2066 RS |
1241 | yystate = yyn; |
1242 | goto yynewstate; | |
70ddf897 | 1243 | |
71da9eea AD |
1244 | |
1245 | /*-------------------------------------. | |
1246 | | yyacceptlab -- YYACCEPT comes here. | | |
1247 | `-------------------------------------*/ | |
1248 | yyacceptlab: | |
600f9b0c PE |
1249 | yyresult = 0; |
1250 | goto yyreturn; | |
71da9eea AD |
1251 | |
1252 | /*-----------------------------------. | |
1253 | | yyabortlab -- YYABORT comes here. | | |
1254 | `-----------------------------------*/ | |
1255 | yyabortlab: | |
a0e68930 AD |
1256 | yydestruct ("Error: discarding lookahead", |
1257 | yytoken, &yylval]b4_location_if([, &yylloc])[); | |
e757bb10 | 1258 | yychar = YYEMPTY; |
600f9b0c PE |
1259 | yyresult = 1; |
1260 | goto yyreturn; | |
1261 | ||
0bfb02ff | 1262 | #ifndef yyoverflow |
ca98bf57 AD |
1263 | /*----------------------------------------------. |
1264 | | yyoverflowlab -- parser overflow comes here. | | |
1265 | `----------------------------------------------*/ | |
600f9b0c | 1266 | yyoverflowlab: |
93724f13 | 1267 | yyerror (]b4_yyerror_args["parser stack overflow"); |
600f9b0c PE |
1268 | yyresult = 2; |
1269 | /* Fall through. */ | |
0bfb02ff | 1270 | #endif |
600f9b0c PE |
1271 | |
1272 | yyreturn: | |
1273 | #ifndef yyoverflow | |
1274 | if (yyss != yyssa) | |
1275 | YYSTACK_FREE (yyss); | |
70ddf897 | 1276 | #endif |
600f9b0c | 1277 | return yyresult; |
be2a1a68 AD |
1278 | ]} |
1279 | ||
24c0aad7 | 1280 | |
be2a1a68 AD |
1281 | b4_epilogue |
1282 | m4_if(b4_defines_flag, 0, [], | |
947427ae | 1283 | [@output @output_header_name@ |
c76e14da | 1284 | b4_copyright([Skeleton parser for Yacc-like parsing with Bison], |
779e7ceb | 1285 | [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004]) |
0252b55c PE |
1286 | |
1287 | /* As a special exception, when this file is copied by Bison into a | |
1288 | Bison output file, you may use that output file without restriction. | |
1289 | This special exception was added by the Free Software Foundation | |
1290 | in version 1.24 of Bison. */ | |
c76e14da | 1291 | |
0d8bed56 | 1292 | b4_token_defines(b4_tokens) |
be2a1a68 | 1293 | |
050c471b | 1294 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
e9955c83 | 1295 | m4_ifdef([b4_stype], |
437c2d80 | 1296 | [b4_syncline([b4_stype_line], [b4_filename]) |
050c471b | 1297 | typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; |
996b1c7e | 1298 | /* Line __line__ of yacc.c. */ |
947427ae | 1299 | b4_syncline([@oline@], [@ofile@])], |
050c471b PE |
1300 | [typedef int YYSTYPE;]) |
1301 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | |
1302 | # define YYSTYPE_IS_DECLARED 1 | |
947427ae | 1303 | # define YYSTYPE_IS_TRIVIAL 1 |
be2a1a68 AD |
1304 | #endif |
1305 | ||
74310291 | 1306 | b4_pure_if([], |
be2a1a68 AD |
1307 | [extern YYSTYPE b4_prefix[]lval;]) |
1308 | ||
58612f1d | 1309 | b4_location_if( |
050c471b PE |
1310 | [#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED) |
1311 | typedef struct YYLTYPE | |
be2a1a68 AD |
1312 | { |
1313 | int first_line; | |
1314 | int first_column; | |
1315 | int last_line; | |
1316 | int last_column; | |
050c471b PE |
1317 | } YYLTYPE; |
1318 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ | |
1319 | # define YYLTYPE_IS_DECLARED 1 | |
1320 | # define YYLTYPE_IS_TRIVIAL 1 | |
be2a1a68 | 1321 | #endif |
ff48177d | 1322 | |
be2a1a68 AD |
1323 | m4_if(b4_pure, [0], |
1324 | [extern YYLTYPE b4_prefix[]lloc;]) | |
1325 | ]) | |
be2a1a68 | 1326 | ]) |