]>
Commit | Line | Data |
---|---|---|
cd3684cf | 1 | /* A Bison parser, made by GNU Bison 1.875c. */ |
e9955c83 | 2 | |
c76e14da | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
584bbcd8 | 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
1921f1d7 AD |
5 | |
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | /* As a special exception, when this file is copied by Bison into a | |
22 | Bison output file, you may use that output file without restriction. | |
23 | This special exception was added by the Free Software Foundation | |
24 | in version 1.24 of Bison. */ | |
25 | ||
c76e14da AD |
26 | /* Written by Richard Stallman by simplifying the original so called |
27 | ``semantic'' parser. */ | |
1921f1d7 AD |
28 | |
29 | /* All symbols defined below should begin with yy or YY, to avoid | |
30 | infringing on user name space. This should be done even for local | |
31 | variables, as they might otherwise be expanded by user macros. | |
32 | There are some unavoidable exceptions within include files to | |
33 | define necessary library symbols; they are noted "INFRINGES ON | |
34 | USER NAME SPACE" below. */ | |
35 | ||
36 | /* Identify Bison output. */ | |
62ddaef6 PE |
37 | #define YYBISON 1 |
38 | ||
39 | /* Skeleton name. */ | |
40 | #define YYSKELETON_NAME "yacc.c" | |
1921f1d7 AD |
41 | |
42 | /* Pure parsers. */ | |
62ddaef6 | 43 | #define YYPURE 1 |
1921f1d7 AD |
44 | |
45 | /* Using locations. */ | |
46 | #define YYLSP_NEEDED 1 | |
e96c9728 | 47 | |
1921f1d7 AD |
48 | /* If NAME_PREFIX is specified substitute the variables and functions |
49 | names. */ | |
e9955c83 | 50 | #define yyparse gram_parse |
1921f1d7 | 51 | #define yylex gram_lex |
e9955c83 | 52 | #define yyerror gram_error |
1921f1d7 AD |
53 | #define yylval gram_lval |
54 | #define yychar gram_char | |
e9955c83 AD |
55 | #define yydebug gram_debug |
56 | #define yynerrs gram_nerrs | |
366eea36 | 57 | #define yylloc gram_lloc |
e9955c83 | 58 | |
ae7453f2 AD |
59 | /* Tokens. */ |
60 | #ifndef YYTOKENTYPE | |
61 | # define YYTOKENTYPE | |
62 | /* Put the tokens into the symbol table, so that GDB and other debuggers | |
63 | know about them. */ | |
64 | enum yytokentype { | |
65 | GRAM_EOF = 0, | |
66 | STRING = 258, | |
62ddaef6 PE |
67 | INT = 259, |
68 | PERCENT_TOKEN = 260, | |
69 | PERCENT_NTERM = 261, | |
70 | PERCENT_TYPE = 262, | |
71 | PERCENT_DESTRUCTOR = 263, | |
72 | PERCENT_PRINTER = 264, | |
73 | PERCENT_UNION = 265, | |
74 | PERCENT_LEFT = 266, | |
75 | PERCENT_RIGHT = 267, | |
76 | PERCENT_NONASSOC = 268, | |
77 | PERCENT_PREC = 269, | |
78 | PERCENT_DPREC = 270, | |
79 | PERCENT_MERGE = 271, | |
80 | PERCENT_DEBUG = 272, | |
92f5e991 AD |
81 | PERCENT_DEFAULT_PREC = 273, |
82 | PERCENT_DEFINE = 274, | |
83 | PERCENT_DEFINES = 275, | |
84 | PERCENT_ERROR_VERBOSE = 276, | |
85 | PERCENT_EXPECT = 277, | |
d6328241 PH |
86 | PERCENT_EXPECT_RR = 278, |
87 | PERCENT_FILE_PREFIX = 279, | |
88 | PERCENT_GLR_PARSER = 280, | |
89 | PERCENT_INITIAL_ACTION = 281, | |
90 | PERCENT_LEX_PARAM = 282, | |
91 | PERCENT_LOCATIONS = 283, | |
92 | PERCENT_NAME_PREFIX = 284, | |
93 | PERCENT_NO_DEFAULT_PREC = 285, | |
94 | PERCENT_NO_LINES = 286, | |
95 | PERCENT_NONDETERMINISTIC_PARSER = 287, | |
96 | PERCENT_OUTPUT = 288, | |
97 | PERCENT_PARSE_PARAM = 289, | |
98 | PERCENT_PURE_PARSER = 290, | |
99 | PERCENT_SKELETON = 291, | |
100 | PERCENT_START = 292, | |
101 | PERCENT_TOKEN_TABLE = 293, | |
102 | PERCENT_VERBOSE = 294, | |
103 | PERCENT_YACC = 295, | |
104 | TYPE = 296, | |
105 | EQUAL = 297, | |
106 | SEMICOLON = 298, | |
107 | PIPE = 299, | |
108 | ID = 300, | |
109 | ID_COLON = 301, | |
110 | PERCENT_PERCENT = 302, | |
111 | PROLOGUE = 303, | |
112 | EPILOGUE = 304, | |
113 | BRACED_CODE = 305 | |
ae7453f2 AD |
114 | }; |
115 | #endif | |
116 | #define GRAM_EOF 0 | |
117 | #define STRING 258 | |
62ddaef6 PE |
118 | #define INT 259 |
119 | #define PERCENT_TOKEN 260 | |
120 | #define PERCENT_NTERM 261 | |
121 | #define PERCENT_TYPE 262 | |
122 | #define PERCENT_DESTRUCTOR 263 | |
123 | #define PERCENT_PRINTER 264 | |
124 | #define PERCENT_UNION 265 | |
125 | #define PERCENT_LEFT 266 | |
126 | #define PERCENT_RIGHT 267 | |
127 | #define PERCENT_NONASSOC 268 | |
128 | #define PERCENT_PREC 269 | |
129 | #define PERCENT_DPREC 270 | |
130 | #define PERCENT_MERGE 271 | |
131 | #define PERCENT_DEBUG 272 | |
92f5e991 AD |
132 | #define PERCENT_DEFAULT_PREC 273 |
133 | #define PERCENT_DEFINE 274 | |
134 | #define PERCENT_DEFINES 275 | |
135 | #define PERCENT_ERROR_VERBOSE 276 | |
136 | #define PERCENT_EXPECT 277 | |
d6328241 PH |
137 | #define PERCENT_EXPECT_RR 278 |
138 | #define PERCENT_FILE_PREFIX 279 | |
139 | #define PERCENT_GLR_PARSER 280 | |
140 | #define PERCENT_INITIAL_ACTION 281 | |
141 | #define PERCENT_LEX_PARAM 282 | |
142 | #define PERCENT_LOCATIONS 283 | |
143 | #define PERCENT_NAME_PREFIX 284 | |
144 | #define PERCENT_NO_DEFAULT_PREC 285 | |
145 | #define PERCENT_NO_LINES 286 | |
146 | #define PERCENT_NONDETERMINISTIC_PARSER 287 | |
147 | #define PERCENT_OUTPUT 288 | |
148 | #define PERCENT_PARSE_PARAM 289 | |
149 | #define PERCENT_PURE_PARSER 290 | |
150 | #define PERCENT_SKELETON 291 | |
151 | #define PERCENT_START 292 | |
152 | #define PERCENT_TOKEN_TABLE 293 | |
153 | #define PERCENT_VERBOSE 294 | |
154 | #define PERCENT_YACC 295 | |
155 | #define TYPE 296 | |
156 | #define EQUAL 297 | |
157 | #define SEMICOLON 298 | |
158 | #define PIPE 299 | |
159 | #define ID 300 | |
160 | #define ID_COLON 301 | |
161 | #define PERCENT_PERCENT 302 | |
162 | #define PROLOGUE 303 | |
163 | #define EPILOGUE 304 | |
164 | #define BRACED_CODE 305 | |
ae7453f2 AD |
165 | |
166 | ||
167 | ||
168 | ||
1921f1d7 | 169 | /* Copy the first part of user declarations. */ |
584bbcd8 | 170 | #line 32 "parse-gram.y" |
e9955c83 AD |
171 | |
172 | #include "system.h" | |
05d18c24 | 173 | |
b275314e | 174 | #include "complain.h" |
05d18c24 | 175 | #include "conflicts.h" |
e9955c83 AD |
176 | #include "files.h" |
177 | #include "getargs.h" | |
e9955c83 | 178 | #include "gram.h" |
05d18c24 PE |
179 | #include "muscle_tab.h" |
180 | #include "output.h" | |
e9955c83 | 181 | #include "reader.h" |
05d18c24 | 182 | #include "symlist.h" |
e9955c83 | 183 | |
05d18c24 PE |
184 | #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) |
185 | static YYLTYPE lloc_default (YYLTYPE const *, int); | |
e9955c83 | 186 | |
f0616f0b | 187 | /* Request detailed syntax error messages, and pass them to GRAM_ERROR. |
05d18c24 | 188 | FIXME: depends on the undocumented availability of YYLLOC. */ |
e9955c83 AD |
189 | #undef yyerror |
190 | #define yyerror(Msg) \ | |
fc5734fe | 191 | gram_error (&yylloc, Msg) |
05d18c24 | 192 | static void gram_error (location const *, char const *); |
e9955c83 | 193 | |
e9955c83 | 194 | #define YYPRINT(File, Type, Value) \ |
05d18c24 PE |
195 | print_token_value (File, Type, &Value) |
196 | static void print_token_value (FILE *, int, YYSTYPE const *); | |
197 | ||
73521d9f | 198 | static void add_param (char const *, char *, location); |
e9955c83 AD |
199 | |
200 | symbol_class current_class = unknown_sym; | |
05d18c24 PE |
201 | uniqstr current_type = 0; |
202 | symbol *current_lhs; | |
203 | location current_lhs_location; | |
204 | assoc current_assoc; | |
e9955c83 AD |
205 | int current_prec = 0; |
206 | ||
1921f1d7 | 207 | |
1921f1d7 AD |
208 | /* Enabling traces. */ |
209 | #ifndef YYDEBUG | |
210 | # define YYDEBUG 1 | |
211 | #endif | |
212 | ||
213 | /* Enabling verbose error messages. */ | |
214 | #ifdef YYERROR_VERBOSE | |
215 | # undef YYERROR_VERBOSE | |
216 | # define YYERROR_VERBOSE 1 | |
217 | #else | |
cd3684cf | 218 | # define YYERROR_VERBOSE 1 |
1921f1d7 AD |
219 | #endif |
220 | ||
73521d9f | 221 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
584bbcd8 | 222 | #line 80 "parse-gram.y" |
73521d9f | 223 | typedef union YYSTYPE { |
05d18c24 PE |
224 | symbol *symbol; |
225 | symbol_list *list; | |
e9955c83 | 226 | int integer; |
05d18c24 PE |
227 | char *chars; |
228 | assoc assoc; | |
229 | uniqstr uniqstr; | |
73521d9f | 230 | } YYSTYPE; |
78a00b7d | 231 | /* Line 191 of yacc.c. */ |
584bbcd8 | 232 | #line 233 "parse-gram.c" |
73521d9f PE |
233 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
234 | # define YYSTYPE_IS_DECLARED 1 | |
e9955c83 AD |
235 | # define YYSTYPE_IS_TRIVIAL 1 |
236 | #endif | |
237 | ||
73521d9f PE |
238 | #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED) |
239 | typedef struct YYLTYPE | |
e9955c83 AD |
240 | { |
241 | int first_line; | |
242 | int first_column; | |
243 | int last_line; | |
244 | int last_column; | |
73521d9f PE |
245 | } YYLTYPE; |
246 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ | |
247 | # define YYLTYPE_IS_DECLARED 1 | |
e9955c83 AD |
248 | # define YYLTYPE_IS_TRIVIAL 1 |
249 | #endif | |
250 | ||
73521d9f | 251 | |
1921f1d7 | 252 | /* Copy the second part of user declarations. */ |
0c15323d | 253 | |
0c15323d | 254 | |
78a00b7d | 255 | /* Line 214 of yacc.c. */ |
584bbcd8 | 256 | #line 257 "parse-gram.c" |
0c15323d | 257 | |
1921f1d7 | 258 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
e9955c83 | 259 | |
cd3684cf AD |
260 | # ifndef YYFREE |
261 | # define YYFREE free | |
262 | # endif | |
263 | # ifndef YYMALLOC | |
264 | # define YYMALLOC malloc | |
265 | # endif | |
266 | ||
e9955c83 AD |
267 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
268 | ||
eae34f44 PE |
269 | # ifdef YYSTACK_USE_ALLOCA |
270 | # if YYSTACK_USE_ALLOCA | |
271 | # define YYSTACK_ALLOC alloca | |
272 | # endif | |
e9955c83 | 273 | # else |
eae34f44 PE |
274 | # if defined (alloca) || defined (_ALLOCA_H) |
275 | # define YYSTACK_ALLOC alloca | |
276 | # else | |
277 | # ifdef __GNUC__ | |
278 | # define YYSTACK_ALLOC __builtin_alloca | |
e9955c83 AD |
279 | # endif |
280 | # endif | |
281 | # endif | |
282 | ||
283 | # ifdef YYSTACK_ALLOC | |
284 | /* Pacify GCC's `empty if-body' warning. */ | |
285 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | |
286 | # else | |
287 | # if defined (__STDC__) || defined (__cplusplus) | |
288 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
289 | # define YYSIZE_T size_t | |
290 | # endif | |
cd3684cf AD |
291 | # define YYSTACK_ALLOC YYMALLOC |
292 | # define YYSTACK_FREE YYFREE | |
e9955c83 | 293 | # endif |
1921f1d7 | 294 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
e9955c83 AD |
295 | |
296 | ||
297 | #if (! defined (yyoverflow) \ | |
298 | && (! defined (__cplusplus) \ | |
465b4444 PE |
299 | || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \ |
300 | && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) | |
e9955c83 AD |
301 | |
302 | /* A type that is properly aligned for any stack member. */ | |
303 | union yyalloc | |
304 | { | |
584bbcd8 | 305 | short int yyss; |
e9955c83 | 306 | YYSTYPE yyvs; |
366eea36 | 307 | YYLTYPE yyls; |
e9955c83 AD |
308 | }; |
309 | ||
310 | /* The size of the maximum gap between one aligned stack and the next. */ | |
05d18c24 | 311 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
e9955c83 AD |
312 | |
313 | /* The size of an array large to enough to hold all stacks, each with | |
314 | N elements. */ | |
366eea36 | 315 | # define YYSTACK_BYTES(N) \ |
584bbcd8 | 316 | ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ |
05d18c24 | 317 | + 2 * YYSTACK_GAP_MAXIMUM) |
e9955c83 AD |
318 | |
319 | /* Copy COUNT objects from FROM to TO. The source and destination do | |
320 | not overlap. */ | |
321 | # ifndef YYCOPY | |
465b4444 | 322 | # if defined (__GNUC__) && 1 < __GNUC__ |
e9955c83 AD |
323 | # define YYCOPY(To, From, Count) \ |
324 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | |
325 | # else | |
326 | # define YYCOPY(To, From, Count) \ | |
327 | do \ | |
328 | { \ | |
329 | register YYSIZE_T yyi; \ | |
330 | for (yyi = 0; yyi < (Count); yyi++) \ | |
f0616f0b | 331 | (To)[yyi] = (From)[yyi]; \ |
e9955c83 AD |
332 | } \ |
333 | while (0) | |
334 | # endif | |
335 | # endif | |
336 | ||
337 | /* Relocate STACK from its old location to the new one. The | |
338 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | |
339 | elements in the stack, and YYPTR gives the new location of the | |
340 | stack. Advance YYPTR to a properly aligned location for the next | |
341 | stack. */ | |
342 | # define YYSTACK_RELOCATE(Stack) \ | |
343 | do \ | |
344 | { \ | |
345 | YYSIZE_T yynewbytes; \ | |
346 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | |
347 | Stack = &yyptr->Stack; \ | |
05d18c24 | 348 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
e9955c83 AD |
349 | yyptr += yynewbytes / sizeof (*yyptr); \ |
350 | } \ | |
351 | while (0) | |
352 | ||
353 | #endif | |
354 | ||
ae7453f2 AD |
355 | #if defined (__STDC__) || defined (__cplusplus) |
356 | typedef signed char yysigned_char; | |
357 | #else | |
584bbcd8 | 358 | typedef short int yysigned_char; |
ae7453f2 AD |
359 | #endif |
360 | ||
1921f1d7 AD |
361 | /* YYFINAL -- State number of the termination state. */ |
362 | #define YYFINAL 3 | |
d33cb3ae | 363 | /* YYLAST -- Last index in YYTABLE. */ |
d6328241 | 364 | #define YYLAST 158 |
1921f1d7 AD |
365 | |
366 | /* YYNTOKENS -- Number of terminals. */ | |
d6328241 | 367 | #define YYNTOKENS 51 |
1921f1d7 | 368 | /* YYNNTS -- Number of nonterminals. */ |
73521d9f | 369 | #define YYNNTS 25 |
1921f1d7 | 370 | /* YYNRULES -- Number of rules. */ |
d6328241 | 371 | #define YYNRULES 79 |
1921f1d7 | 372 | /* YYNRULES -- Number of states. */ |
d6328241 | 373 | #define YYNSTATES 108 |
1921f1d7 AD |
374 | |
375 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | |
376 | #define YYUNDEFTOK 2 | |
d6328241 | 377 | #define YYMAXUTOK 305 |
1921f1d7 | 378 | |
886b69d1 | 379 | #define YYTRANSLATE(YYX) \ |
73521d9f | 380 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
1921f1d7 AD |
381 | |
382 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | |
383 | static const unsigned char yytranslate[] = | |
384 | { | |
385 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
386 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
387 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
388 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
389 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
390 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
391 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
392 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
393 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
394 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
395 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
396 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
397 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
398 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
399 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
400 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
401 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
402 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
403 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
404 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
405 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
406 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
407 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
408 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
409 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
410 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | |
411 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | |
412 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | |
413 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | |
ae7453f2 | 414 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
d6328241 | 415 | 45, 46, 47, 48, 49, 50 |
1921f1d7 AD |
416 | }; |
417 | ||
418 | #if YYDEBUG | |
419 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | |
420 | YYRHS. */ | |
421 | static const unsigned char yyprhs[] = | |
422 | { | |
05d18c24 | 423 | 0, 0, 3, 8, 9, 12, 14, 16, 18, 22, |
d6328241 PH |
424 | 24, 26, 29, 32, 36, 38, 40, 42, 44, 48, |
425 | 50, 52, 56, 58, 60, 63, 65, 67, 69, 71, | |
426 | 73, 75, 78, 80, 83, 86, 88, 90, 91, 95, | |
427 | 96, 100, 104, 108, 110, 112, 114, 115, 117, 119, | |
428 | 122, 124, 126, 129, 132, 136, 138, 141, 143, 146, | |
429 | 148, 151, 154, 155, 159, 161, 165, 168, 169, 172, | |
430 | 175, 179, 183, 187, 189, 191, 193, 195, 197, 198 | |
1921f1d7 AD |
431 | }; |
432 | ||
433 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | |
ae7453f2 | 434 | static const yysigned_char yyrhs[] = |
1921f1d7 | 435 | { |
d6328241 PH |
436 | 52, 0, -1, 53, 47, 65, 75, -1, -1, 53, |
437 | 54, -1, 55, -1, 48, -1, 17, -1, 19, 74, | |
438 | 74, -1, 20, -1, 21, -1, 22, 4, -1, 23, | |
439 | 4, -1, 24, 42, 74, -1, 25, -1, 26, -1, | |
440 | 27, -1, 28, -1, 29, 42, 74, -1, 31, -1, | |
441 | 32, -1, 33, 42, 74, -1, 34, -1, 35, -1, | |
442 | 36, 74, -1, 38, -1, 39, -1, 40, -1, 43, | |
443 | -1, 59, -1, 56, -1, 37, 71, -1, 10, -1, | |
444 | 8, 62, -1, 9, 62, -1, 18, -1, 30, -1, | |
445 | -1, 6, 57, 64, -1, -1, 5, 58, 64, -1, | |
446 | 7, 41, 62, -1, 60, 61, 62, -1, 11, -1, | |
447 | 12, -1, 13, -1, -1, 41, -1, 71, -1, 62, | |
448 | 71, -1, 41, -1, 45, -1, 45, 4, -1, 45, | |
449 | 73, -1, 45, 4, 73, -1, 63, -1, 64, 63, | |
450 | -1, 66, -1, 65, 66, -1, 67, -1, 55, 43, | |
451 | -1, 1, 43, -1, -1, 46, 68, 69, -1, 70, | |
452 | -1, 69, 44, 70, -1, 69, 43, -1, -1, 70, | |
453 | 71, -1, 70, 72, -1, 70, 14, 71, -1, 70, | |
454 | 15, 4, -1, 70, 16, 41, -1, 45, -1, 73, | |
455 | -1, 50, -1, 3, -1, 3, -1, -1, 47, 49, | |
456 | -1 | |
1921f1d7 AD |
457 | }; |
458 | ||
459 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | |
584bbcd8 | 460 | static const unsigned short int yyrline[] = |
1921f1d7 | 461 | { |
d6328241 PH |
462 | 0, 173, 173, 181, 183, 187, 188, 189, 190, 191, |
463 | 192, 193, 194, 195, 196, 201, 205, 206, 207, 208, | |
464 | 209, 210, 211, 212, 213, 214, 215, 216, 217, 221, | |
465 | 222, 223, 227, 233, 240, 247, 251, 258, 258, 263, | |
466 | 263, 268, 278, 293, 294, 295, 299, 300, 306, 307, | |
467 | 312, 316, 321, 327, 333, 344, 345, 354, 355, 361, | |
468 | 362, 367, 374, 374, 378, 379, 380, 385, 386, 388, | |
469 | 390, 392, 394, 399, 400, 404, 410, 419, 426, 428 | |
1921f1d7 AD |
470 | }; |
471 | #endif | |
472 | ||
473 | #if YYDEBUG || YYERROR_VERBOSE | |
474 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | |
475 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | |
476 | static const char *const yytname[] = | |
477 | { | |
eae34f44 PE |
478 | "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"", |
479 | "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"", | |
480 | "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"", | |
481 | "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"", | |
92f5e991 | 482 | "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"", |
d6328241 | 483 | "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"", |
92f5e991 | 484 | "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"", |
66ef8b9d PE |
485 | "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"", |
486 | "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"", | |
487 | "\"%pure-parser\"", "\"%skeleton\"", "\"%start\"", "\"%token-table\"", | |
488 | "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"", "\";\"", "\"|\"", | |
489 | "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"%{...%}\"", | |
490 | "\"epilogue\"", "\"{...}\"", "$accept", "input", "declarations", | |
491 | "declaration", "grammar_declaration", "symbol_declaration", "@1", "@2", | |
492 | "precedence_declaration", "precedence_declarator", "type.opt", | |
493 | "symbols.1", "symbol_def", "symbol_defs.1", "grammar", | |
494 | "rules_or_grammar_declaration", "rules", "@3", "rhses.1", "rhs", | |
495 | "symbol", "action", "string_as_id", "string_content", "epilogue.opt", 0 | |
1921f1d7 AD |
496 | }; |
497 | #endif | |
498 | ||
3d38c03a | 499 | # ifdef YYPRINT |
1921f1d7 AD |
500 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
501 | token YYLEX-NUM. */ | |
584bbcd8 | 502 | static const unsigned short int yytoknum[] = |
1921f1d7 AD |
503 | { |
504 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | |
505 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | |
506 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | |
507 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, | |
d6328241 PH |
508 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
509 | 305 | |
1921f1d7 | 510 | }; |
3d38c03a | 511 | # endif |
1921f1d7 AD |
512 | |
513 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | |
514 | static const unsigned char yyr1[] = | |
515 | { | |
d6328241 PH |
516 | 0, 51, 52, 53, 53, 54, 54, 54, 54, 54, |
517 | 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, | |
518 | 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, | |
519 | 55, 55, 55, 55, 55, 55, 55, 57, 56, 58, | |
520 | 56, 56, 59, 60, 60, 60, 61, 61, 62, 62, | |
521 | 63, 63, 63, 63, 63, 64, 64, 65, 65, 66, | |
522 | 66, 66, 68, 67, 69, 69, 69, 70, 70, 70, | |
523 | 70, 70, 70, 71, 71, 72, 73, 74, 75, 75 | |
1921f1d7 AD |
524 | }; |
525 | ||
526 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | |
527 | static const unsigned char yyr2[] = | |
528 | { | |
05d18c24 | 529 | 0, 2, 4, 0, 2, 1, 1, 1, 3, 1, |
d6328241 PH |
530 | 1, 2, 2, 3, 1, 1, 1, 1, 3, 1, |
531 | 1, 3, 1, 1, 2, 1, 1, 1, 1, 1, | |
532 | 1, 2, 1, 2, 2, 1, 1, 0, 3, 0, | |
533 | 3, 3, 3, 1, 1, 1, 0, 1, 1, 2, | |
534 | 1, 1, 2, 2, 3, 1, 2, 1, 2, 1, | |
535 | 2, 2, 0, 3, 1, 3, 2, 0, 2, 2, | |
536 | 3, 3, 3, 1, 1, 1, 1, 1, 0, 2 | |
1921f1d7 AD |
537 | }; |
538 | ||
539 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | |
540 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | |
541 | means the default is an error. */ | |
04b6e11e | 542 | static const unsigned char yydefact[] = |
1921f1d7 | 543 | { |
d6328241 PH |
544 | 3, 0, 0, 1, 39, 37, 0, 0, 0, 32, |
545 | 43, 44, 45, 7, 35, 0, 9, 10, 0, 0, | |
546 | 0, 14, 15, 16, 17, 0, 36, 19, 20, 0, | |
547 | 22, 23, 0, 0, 25, 26, 27, 28, 0, 6, | |
548 | 4, 5, 30, 29, 46, 0, 0, 0, 76, 73, | |
549 | 33, 48, 74, 34, 77, 0, 11, 12, 0, 0, | |
550 | 0, 24, 31, 0, 62, 0, 0, 57, 59, 47, | |
551 | 0, 50, 51, 55, 40, 38, 41, 49, 8, 13, | |
552 | 18, 21, 61, 67, 60, 0, 58, 2, 42, 52, | |
553 | 53, 56, 63, 64, 79, 54, 66, 67, 0, 0, | |
554 | 0, 75, 68, 69, 65, 70, 71, 72 | |
1921f1d7 AD |
555 | }; |
556 | ||
04b6e11e | 557 | /* YYDEFGOTO[NTERM-NUM]. */ |
ae7453f2 | 558 | static const yysigned_char yydefgoto[] = |
1921f1d7 | 559 | { |
d6328241 PH |
560 | -1, 1, 2, 40, 65, 42, 46, 45, 43, 44, |
561 | 70, 50, 73, 74, 66, 67, 68, 83, 92, 93, | |
562 | 51, 103, 52, 55, 87 | |
1921f1d7 AD |
563 | }; |
564 | ||
565 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | |
566 | STATE-NUM. */ | |
66ef8b9d | 567 | #define YYPACT_NINF -67 |
ae7453f2 | 568 | static const yysigned_char yypact[] = |
1921f1d7 | 569 | { |
d6328241 PH |
570 | -67, 5, 110, -67, -67, -67, -34, 0, 0, -67, |
571 | -67, -67, -67, -67, -67, 13, -67, -67, 20, 31, | |
572 | -17, -67, -67, -67, -67, -6, -67, -67, -67, -5, | |
573 | -67, -67, 13, 0, -67, -67, -67, -67, 68, -67, | |
574 | -67, -67, -67, -67, -3, -37, -37, 0, -67, -67, | |
575 | 0, -67, -67, 0, -67, 13, -67, -67, 13, 13, | |
576 | 13, -67, -67, -2, -67, 3, 21, -67, -67, -67, | |
577 | 0, -67, 6, -67, -37, -37, 0, -67, -67, -67, | |
578 | -67, -67, -67, -67, -67, 1, -67, -67, 0, 39, | |
579 | -67, -67, -32, -1, -67, -67, -67, -67, 0, 43, | |
580 | 7, -67, -67, -67, -1, -67, -67, -67 | |
1921f1d7 AD |
581 | }; |
582 | ||
583 | /* YYPGOTO[NTERM-NUM]. */ | |
ae7453f2 | 584 | static const yysigned_char yypgoto[] = |
1921f1d7 | 585 | { |
d6328241 PH |
586 | -67, -67, -67, -67, 50, -67, -67, -67, -67, -67, |
587 | -67, -7, -56, 8, -67, -13, -67, -67, -67, -41, | |
588 | -33, -67, -66, 29, -67 | |
1921f1d7 AD |
589 | }; |
590 | ||
591 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | |
592 | positive, shift that token. If negative, reduce the rule which | |
ae7453f2 | 593 | number is the opposite. If zero, do what YYDEFACT says. |
f0616f0b | 594 | If YYTABLE_NINF, syntax error. */ |
d6328241 | 595 | #define YYTABLE_NINF -79 |
ae7453f2 | 596 | static const yysigned_char yytable[] = |
1921f1d7 | 597 | { |
d6328241 PH |
598 | 62, 53, 48, 48, 71, 3, 90, 47, 72, 48, |
599 | 89, 96, 97, 98, 99, 100, 54, 77, 91, 91, | |
600 | 77, -78, 63, 95, 56, 58, 4, 5, 6, 7, | |
601 | 8, 9, 10, 11, 12, 57, 59, 60, 69, 14, | |
602 | 76, 82, 48, 77, 49, 49, 84, 106, 107, 101, | |
603 | 94, 26, 41, 86, 75, 77, 104, 0, 33, 0, | |
604 | 102, 61, 0, 88, 0, 105, 0, 64, 85, 63, | |
605 | 0, 102, 0, 4, 5, 6, 7, 8, 9, 10, | |
606 | 11, 12, 0, 0, 78, 0, 14, 79, 80, 81, | |
607 | 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, | |
608 | 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, | |
609 | 0, 0, 0, 0, 64, 4, 5, 6, 7, 8, | |
610 | 9, 10, 11, 12, 0, 0, 0, 13, 14, 15, | |
611 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, | |
612 | 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, | |
613 | 36, 0, 0, 37, 0, 0, 0, 38, 39 | |
1921f1d7 AD |
614 | }; |
615 | ||
ae7453f2 | 616 | static const yysigned_char yycheck[] = |
1921f1d7 | 617 | { |
d6328241 PH |
618 | 33, 8, 3, 3, 41, 0, 72, 41, 45, 3, |
619 | 4, 43, 44, 14, 15, 16, 3, 50, 74, 75, | |
620 | 53, 0, 1, 89, 4, 42, 5, 6, 7, 8, | |
621 | 9, 10, 11, 12, 13, 4, 42, 42, 41, 18, | |
622 | 47, 43, 3, 76, 45, 45, 43, 4, 41, 50, | |
623 | 49, 30, 2, 66, 46, 88, 97, -1, 37, -1, | |
624 | 93, 32, -1, 70, -1, 98, -1, 46, 47, 1, | |
625 | -1, 104, -1, 5, 6, 7, 8, 9, 10, 11, | |
626 | 12, 13, -1, -1, 55, -1, 18, 58, 59, 60, | |
627 | -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, | |
628 | -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, | |
629 | -1, -1, -1, -1, 46, 5, 6, 7, 8, 9, | |
630 | 10, 11, 12, 13, -1, -1, -1, 17, 18, 19, | |
631 | 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, | |
632 | 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, | |
633 | 40, -1, -1, 43, -1, -1, -1, 47, 48 | |
1921f1d7 AD |
634 | }; |
635 | ||
1921f1d7 AD |
636 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
637 | symbol of state STATE-NUM. */ | |
638 | static const unsigned char yystos[] = | |
639 | { | |
d6328241 | 640 | 0, 52, 53, 0, 5, 6, 7, 8, 9, 10, |
62ddaef6 PE |
641 | 11, 12, 13, 17, 18, 19, 20, 21, 22, 23, |
642 | 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, | |
d6328241 PH |
643 | 34, 35, 36, 37, 38, 39, 40, 43, 47, 48, |
644 | 54, 55, 56, 59, 60, 58, 57, 41, 3, 45, | |
645 | 62, 71, 73, 62, 3, 74, 4, 4, 42, 42, | |
646 | 42, 74, 71, 1, 46, 55, 65, 66, 67, 41, | |
647 | 61, 41, 45, 63, 64, 64, 62, 71, 74, 74, | |
648 | 74, 74, 43, 68, 43, 47, 66, 75, 62, 4, | |
649 | 73, 63, 69, 70, 49, 73, 43, 44, 14, 15, | |
650 | 16, 50, 71, 72, 70, 71, 4, 41 | |
1921f1d7 | 651 | }; |
e9955c83 AD |
652 | |
653 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | |
654 | # define YYSIZE_T __SIZE_TYPE__ | |
655 | #endif | |
656 | #if ! defined (YYSIZE_T) && defined (size_t) | |
657 | # define YYSIZE_T size_t | |
658 | #endif | |
659 | #if ! defined (YYSIZE_T) | |
660 | # if defined (__STDC__) || defined (__cplusplus) | |
661 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | |
662 | # define YYSIZE_T size_t | |
663 | # endif | |
664 | #endif | |
665 | #if ! defined (YYSIZE_T) | |
666 | # define YYSIZE_T unsigned int | |
667 | #endif | |
668 | ||
669 | #define yyerrok (yyerrstatus = 0) | |
73521d9f PE |
670 | #define yyclearin (yychar = YYEMPTY) |
671 | #define YYEMPTY (-2) | |
e9955c83 | 672 | #define YYEOF 0 |
1921f1d7 | 673 | |
e9955c83 | 674 | #define YYACCEPT goto yyacceptlab |
1921f1d7 | 675 | #define YYABORT goto yyabortlab |
465b4444 | 676 | #define YYERROR goto yyerrorlab |
6d5aa694 | 677 | |
1921f1d7 | 678 | |
e9955c83 AD |
679 | /* Like YYERROR except do call yyerror. This remains here temporarily |
680 | to ease the transition to the new meaning of YYERROR, for GCC. | |
681 | Once GCC version 2 has supplanted version 1, this can go. */ | |
1921f1d7 | 682 | |
e9955c83 | 683 | #define YYFAIL goto yyerrlab |
1921f1d7 | 684 | |
e9955c83 | 685 | #define YYRECOVERING() (!!yyerrstatus) |
1921f1d7 | 686 | |
e9955c83 AD |
687 | #define YYBACKUP(Token, Value) \ |
688 | do \ | |
73521d9f | 689 | if (yychar == YYEMPTY && yylen == 1) \ |
e9955c83 AD |
690 | { \ |
691 | yychar = (Token); \ | |
692 | yylval = (Value); \ | |
886b69d1 | 693 | yytoken = YYTRANSLATE (yychar); \ |
e9955c83 AD |
694 | YYPOPSTACK; \ |
695 | goto yybackup; \ | |
696 | } \ | |
697 | else \ | |
698 | { \ | |
f0616f0b | 699 | yyerror ("syntax error: cannot back up");\ |
e9955c83 AD |
700 | YYERROR; \ |
701 | } \ | |
702 | while (0) | |
703 | ||
704 | #define YYTERROR 1 | |
705 | #define YYERRCODE 256 | |
706 | ||
707 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions | |
1921f1d7 | 708 | are run). */ |
e9955c83 AD |
709 | |
710 | #ifndef YYLLOC_DEFAULT | |
cd3684cf AD |
711 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
712 | ((Current).first_line = (Rhs)[1].first_line, \ | |
713 | (Current).first_column = (Rhs)[1].first_column, \ | |
714 | (Current).last_line = (Rhs)[N].last_line, \ | |
715 | (Current).last_column = (Rhs)[N].last_column) | |
e9955c83 AD |
716 | #endif |
717 | ||
718 | /* YYLEX -- calling `yylex' with the right arguments. */ | |
719 | ||
366eea36 | 720 | #ifdef YYLEX_PARAM |
d33cb3ae | 721 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) |
366eea36 | 722 | #else |
d33cb3ae | 723 | # define YYLEX yylex (&yylval, &yylloc) |
366eea36 | 724 | #endif |
e9955c83 AD |
725 | |
726 | /* Enable debugging if requested. */ | |
727 | #if YYDEBUG | |
728 | ||
729 | # ifndef YYFPRINTF | |
730 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | |
731 | # define YYFPRINTF fprintf | |
732 | # endif | |
733 | ||
734 | # define YYDPRINTF(Args) \ | |
735 | do { \ | |
736 | if (yydebug) \ | |
737 | YYFPRINTF Args; \ | |
738 | } while (0) | |
05d18c24 | 739 | |
e776192e AD |
740 | # define YYDSYMPRINT(Args) \ |
741 | do { \ | |
742 | if (yydebug) \ | |
743 | yysymprint Args; \ | |
744 | } while (0) | |
05d18c24 | 745 | |
f0616f0b PE |
746 | # define YYDSYMPRINTF(Title, Token, Value, Location) \ |
747 | do { \ | |
748 | if (yydebug) \ | |
749 | { \ | |
750 | YYFPRINTF (stderr, "%s ", Title); \ | |
751 | yysymprint (stderr, \ | |
752 | Token, Value, Location); \ | |
753 | YYFPRINTF (stderr, "\n"); \ | |
754 | } \ | |
755 | } while (0) | |
756 | ||
05d18c24 PE |
757 | /*------------------------------------------------------------------. |
758 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | |
cd3684cf | 759 | | TOP (included). | |
05d18c24 PE |
760 | `------------------------------------------------------------------*/ |
761 | ||
762 | #if defined (__STDC__) || defined (__cplusplus) | |
763 | static void | |
584bbcd8 | 764 | yy_stack_print (short int *bottom, short int *top) |
05d18c24 PE |
765 | #else |
766 | static void | |
767 | yy_stack_print (bottom, top) | |
584bbcd8 PE |
768 | short int *bottom; |
769 | short int *top; | |
05d18c24 PE |
770 | #endif |
771 | { | |
772 | YYFPRINTF (stderr, "Stack now"); | |
773 | for (/* Nothing. */; bottom <= top; ++bottom) | |
774 | YYFPRINTF (stderr, " %d", *bottom); | |
775 | YYFPRINTF (stderr, "\n"); | |
776 | } | |
777 | ||
778 | # define YY_STACK_PRINT(Bottom, Top) \ | |
779 | do { \ | |
780 | if (yydebug) \ | |
781 | yy_stack_print ((Bottom), (Top)); \ | |
782 | } while (0) | |
783 | ||
784 | ||
785 | /*------------------------------------------------. | |
786 | | Report that the YYRULE is going to be reduced. | | |
787 | `------------------------------------------------*/ | |
788 | ||
789 | #if defined (__STDC__) || defined (__cplusplus) | |
790 | static void | |
791 | yy_reduce_print (int yyrule) | |
792 | #else | |
793 | static void | |
794 | yy_reduce_print (yyrule) | |
795 | int yyrule; | |
796 | #endif | |
797 | { | |
798 | int yyi; | |
6d5aa694 | 799 | unsigned int yylno = yyrline[yyrule]; |
05d18c24 | 800 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", |
6d5aa694 | 801 | yyrule - 1, yylno); |
05d18c24 PE |
802 | /* Print the symbols being reduced, and their result. */ |
803 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) | |
804 | YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); | |
805 | YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); | |
806 | } | |
807 | ||
808 | # define YY_REDUCE_PRINT(Rule) \ | |
809 | do { \ | |
810 | if (yydebug) \ | |
811 | yy_reduce_print (Rule); \ | |
812 | } while (0) | |
813 | ||
e9955c83 AD |
814 | /* Nonzero means print parse trace. It is left uninitialized so that |
815 | multiple parsers can coexist. */ | |
816 | int yydebug; | |
817 | #else /* !YYDEBUG */ | |
818 | # define YYDPRINTF(Args) | |
e776192e | 819 | # define YYDSYMPRINT(Args) |
f0616f0b | 820 | # define YYDSYMPRINTF(Title, Token, Value, Location) |
05d18c24 PE |
821 | # define YY_STACK_PRINT(Bottom, Top) |
822 | # define YY_REDUCE_PRINT(Rule) | |
e9955c83 AD |
823 | #endif /* !YYDEBUG */ |
824 | ||
05d18c24 | 825 | |
e9955c83 AD |
826 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
827 | #ifndef YYINITDEPTH | |
828 | # define YYINITDEPTH 200 | |
829 | #endif | |
830 | ||
831 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | |
832 | if the built-in stack extension method is used). | |
833 | ||
834 | Do not make this value too large; the results are undefined if | |
835 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | |
836 | evaluated with infinite-precision integer arithmetic. */ | |
837 | ||
eae34f44 | 838 | #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 |
e9955c83 AD |
839 | # undef YYMAXDEPTH |
840 | #endif | |
841 | ||
842 | #ifndef YYMAXDEPTH | |
843 | # define YYMAXDEPTH 10000 | |
844 | #endif | |
1921f1d7 | 845 | |
e9955c83 | 846 | \f |
1921f1d7 AD |
847 | |
848 | #if YYERROR_VERBOSE | |
e9955c83 AD |
849 | |
850 | # ifndef yystrlen | |
851 | # if defined (__GLIBC__) && defined (_STRING_H) | |
852 | # define yystrlen strlen | |
853 | # else | |
854 | /* Return the length of YYSTR. */ | |
855 | static YYSIZE_T | |
856 | # if defined (__STDC__) || defined (__cplusplus) | |
857 | yystrlen (const char *yystr) | |
858 | # else | |
859 | yystrlen (yystr) | |
860 | const char *yystr; | |
861 | # endif | |
862 | { | |
863 | register const char *yys = yystr; | |
864 | ||
865 | while (*yys++ != '\0') | |
866 | continue; | |
867 | ||
868 | return yys - yystr - 1; | |
869 | } | |
870 | # endif | |
871 | # endif | |
872 | ||
873 | # ifndef yystpcpy | |
874 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | |
875 | # define yystpcpy stpcpy | |
876 | # else | |
877 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | |
878 | YYDEST. */ | |
879 | static char * | |
880 | # if defined (__STDC__) || defined (__cplusplus) | |
881 | yystpcpy (char *yydest, const char *yysrc) | |
882 | # else | |
883 | yystpcpy (yydest, yysrc) | |
884 | char *yydest; | |
885 | const char *yysrc; | |
886 | # endif | |
887 | { | |
888 | register char *yyd = yydest; | |
889 | register const char *yys = yysrc; | |
890 | ||
891 | while ((*yyd++ = *yys++) != '\0') | |
892 | continue; | |
893 | ||
894 | return yyd - 1; | |
895 | } | |
896 | # endif | |
897 | # endif | |
0c15323d | 898 | |
1921f1d7 AD |
899 | #endif /* !YYERROR_VERBOSE */ |
900 | ||
901 | \f | |
e9955c83 | 902 | |
04b6e11e | 903 | #if YYDEBUG |
05d18c24 PE |
904 | /*--------------------------------. |
905 | | Print this symbol on YYOUTPUT. | | |
906 | `--------------------------------*/ | |
04b6e11e | 907 | |
04b6e11e | 908 | #if defined (__STDC__) || defined (__cplusplus) |
d33cb3ae | 909 | static void |
05d18c24 | 910 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) |
04b6e11e | 911 | #else |
d33cb3ae | 912 | static void |
05d18c24 PE |
913 | yysymprint (yyoutput, yytype, yyvaluep, yylocationp) |
914 | FILE *yyoutput; | |
04b6e11e | 915 | int yytype; |
886b69d1 AD |
916 | YYSTYPE *yyvaluep; |
917 | YYLTYPE *yylocationp; | |
04b6e11e PE |
918 | #endif |
919 | { | |
920 | /* Pacify ``unused variable'' warnings. */ | |
886b69d1 AD |
921 | (void) yyvaluep; |
922 | (void) yylocationp; | |
04b6e11e PE |
923 | |
924 | if (yytype < YYNTOKENS) | |
925 | { | |
05d18c24 | 926 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
04b6e11e | 927 | # ifdef YYPRINT |
05d18c24 | 928 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
04b6e11e PE |
929 | # endif |
930 | } | |
931 | else | |
05d18c24 | 932 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
04b6e11e PE |
933 | |
934 | switch (yytype) | |
935 | { | |
936 | default: | |
937 | break; | |
938 | } | |
05d18c24 | 939 | YYFPRINTF (yyoutput, ")"); |
04b6e11e | 940 | } |
04b6e11e | 941 | |
05d18c24 | 942 | #endif /* ! YYDEBUG */ |
04b6e11e PE |
943 | /*-----------------------------------------------. |
944 | | Release the memory associated to this symbol. | | |
945 | `-----------------------------------------------*/ | |
946 | ||
04b6e11e | 947 | #if defined (__STDC__) || defined (__cplusplus) |
d33cb3ae | 948 | static void |
886b69d1 | 949 | yydestruct (int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) |
04b6e11e | 950 | #else |
d33cb3ae | 951 | static void |
886b69d1 | 952 | yydestruct (yytype, yyvaluep, yylocationp) |
04b6e11e | 953 | int yytype; |
886b69d1 AD |
954 | YYSTYPE *yyvaluep; |
955 | YYLTYPE *yylocationp; | |
04b6e11e PE |
956 | #endif |
957 | { | |
958 | /* Pacify ``unused variable'' warnings. */ | |
886b69d1 AD |
959 | (void) yyvaluep; |
960 | (void) yylocationp; | |
04b6e11e PE |
961 | |
962 | switch (yytype) | |
963 | { | |
886b69d1 | 964 | |
04b6e11e PE |
965 | default: |
966 | break; | |
967 | } | |
968 | } | |
04b6e11e PE |
969 | \f |
970 | ||
d33cb3ae | 971 | /* Prevent warnings from -Wmissing-prototypes. */ |
e9955c83 AD |
972 | |
973 | #ifdef YYPARSE_PARAM | |
974 | # if defined (__STDC__) || defined (__cplusplus) | |
d33cb3ae | 975 | int yyparse (void *YYPARSE_PARAM); |
e9955c83 | 976 | # else |
d33cb3ae | 977 | int yyparse (); |
e9955c83 | 978 | # endif |
d33cb3ae PE |
979 | #else /* ! YYPARSE_PARAM */ |
980 | #if defined (__STDC__) || defined (__cplusplus) | |
e9955c83 | 981 | int yyparse (void); |
d33cb3ae PE |
982 | #else |
983 | int yyparse (); | |
984 | #endif | |
05d18c24 | 985 | #endif /* ! YYPARSE_PARAM */ |
e776192e | 986 | |
e9955c83 | 987 | |
e9955c83 | 988 | |
e9955c83 | 989 | |
d33cb3ae PE |
990 | |
991 | ||
992 | /*----------. | |
993 | | yyparse. | | |
994 | `----------*/ | |
995 | ||
996 | #ifdef YYPARSE_PARAM | |
997 | # if defined (__STDC__) || defined (__cplusplus) | |
998 | int yyparse (void *YYPARSE_PARAM) | |
999 | # else | |
1000 | int yyparse (YYPARSE_PARAM) | |
1001 | void *YYPARSE_PARAM; | |
1002 | # endif | |
1003 | #else /* ! YYPARSE_PARAM */ | |
1004 | #if defined (__STDC__) || defined (__cplusplus) | |
1005 | int | |
1006 | yyparse (void) | |
1007 | #else | |
e9955c83 | 1008 | int |
d33cb3ae PE |
1009 | yyparse () |
1010 | ||
1011 | #endif | |
1012 | #endif | |
e9955c83 | 1013 | { |
366eea36 AD |
1014 | /* The lookahead symbol. */ |
1015 | int yychar; | |
1016 | ||
1017 | /* The semantic value of the lookahead symbol. */ | |
1018 | YYSTYPE yylval; | |
1019 | ||
f0616f0b | 1020 | /* Number of syntax errors so far. */ |
366eea36 AD |
1021 | int yynerrs; |
1022 | /* Location data for the lookahead symbol. */ | |
1023 | YYLTYPE yylloc; | |
e9955c83 AD |
1024 | |
1025 | register int yystate; | |
1026 | register int yyn; | |
1027 | int yyresult; | |
1028 | /* Number of tokens to shift before error messages enabled. */ | |
1029 | int yyerrstatus; | |
1030 | /* Lookahead token as an internal (translated) token number. */ | |
886b69d1 | 1031 | int yytoken = 0; |
e9955c83 AD |
1032 | |
1033 | /* Three stacks and their tools: | |
1034 | `yyss': related to states, | |
1035 | `yyvs': related to semantic values, | |
1036 | `yyls': related to locations. | |
1037 | ||
1038 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
1039 | to reallocate them elsewhere. */ | |
1040 | ||
1921f1d7 | 1041 | /* The state stack. */ |
584bbcd8 PE |
1042 | short int yyssa[YYINITDEPTH]; |
1043 | short int *yyss = yyssa; | |
1044 | register short int *yyssp; | |
e9955c83 AD |
1045 | |
1046 | /* The semantic value stack. */ | |
1047 | YYSTYPE yyvsa[YYINITDEPTH]; | |
1048 | YYSTYPE *yyvs = yyvsa; | |
1049 | register YYSTYPE *yyvsp; | |
1050 | ||
e9955c83 AD |
1051 | /* The location stack. */ |
1052 | YYLTYPE yylsa[YYINITDEPTH]; | |
1053 | YYLTYPE *yyls = yylsa; | |
1054 | YYLTYPE *yylsp; | |
78a00b7d | 1055 | YYLTYPE *yylerrsp; |
e9955c83 | 1056 | |
366eea36 | 1057 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
e9955c83 AD |
1058 | |
1059 | YYSIZE_T yystacksize = YYINITDEPTH; | |
1060 | ||
1061 | /* The variables used to return semantic value and location from the | |
1062 | action routines. */ | |
1063 | YYSTYPE yyval; | |
e9955c83 | 1064 | YYLTYPE yyloc; |
e9955c83 AD |
1065 | |
1066 | /* When reducing, the number of symbols on the RHS of the reduced | |
1921f1d7 | 1067 | rule. */ |
e9955c83 AD |
1068 | int yylen; |
1069 | ||
1070 | YYDPRINTF ((stderr, "Starting parse\n")); | |
1071 | ||
1072 | yystate = 0; | |
1073 | yyerrstatus = 0; | |
1074 | yynerrs = 0; | |
73521d9f | 1075 | yychar = YYEMPTY; /* Cause a token to be read. */ |
e9955c83 AD |
1076 | |
1077 | /* Initialize stack pointers. | |
1078 | Waste one element of value and location stack | |
1079 | so that they stay on the same level as the state stack. | |
1080 | The wasted elements are never initialized. */ | |
1081 | ||
1082 | yyssp = yyss; | |
1083 | yyvsp = yyvs; | |
e9955c83 | 1084 | yylsp = yyls; |
cd3684cf AD |
1085 | |
1086 | /* User initialization code. */ | |
584bbcd8 | 1087 | #line 70 "parse-gram.y" |
cd3684cf AD |
1088 | { |
1089 | /* Bison's grammar can initial empty locations, hence a default | |
1090 | location is needed. */ | |
1091 | (*yylsp).start.file = (*yylsp).end.file = current_file; | |
1092 | (*yylsp).start.line = (*yylsp).end.line = 1; | |
1093 | (*yylsp).start.column = (*yylsp).end.column = 0; | |
1094 | } | |
1095 | /* Line 818 of yacc.c. */ | |
584bbcd8 | 1096 | #line 1097 "parse-gram.c" |
e9955c83 AD |
1097 | goto yysetstate; |
1098 | ||
1099 | /*------------------------------------------------------------. | |
1100 | | yynewstate -- Push a new state, which is found in yystate. | | |
1101 | `------------------------------------------------------------*/ | |
1102 | yynewstate: | |
1103 | /* In all cases, when you get here, the value and location stacks | |
1104 | have just been pushed. so pushing a state here evens the stacks. | |
1105 | */ | |
1106 | yyssp++; | |
1107 | ||
1108 | yysetstate: | |
1109 | *yyssp = yystate; | |
1110 | ||
d33cb3ae | 1111 | if (yyss + yystacksize - 1 <= yyssp) |
e9955c83 AD |
1112 | { |
1113 | /* Get the current used size of the three stacks, in elements. */ | |
1114 | YYSIZE_T yysize = yyssp - yyss + 1; | |
1115 | ||
1116 | #ifdef yyoverflow | |
1117 | { | |
1118 | /* Give user a chance to reallocate the stack. Use copies of | |
1119 | these so that the &'s don't force the real ones into | |
1120 | memory. */ | |
1121 | YYSTYPE *yyvs1 = yyvs; | |
584bbcd8 | 1122 | short int *yyss1 = yyss; |
366eea36 | 1123 | YYLTYPE *yyls1 = yyls; |
e9955c83 AD |
1124 | |
1125 | /* Each stack pointer address is followed by the size of the | |
366eea36 AD |
1126 | data in use in that stack, in bytes. This used to be a |
1127 | conditional around just the two extra args, but that might | |
1128 | be undefined if yyoverflow is a macro. */ | |
e9955c83 AD |
1129 | yyoverflow ("parser stack overflow", |
1130 | &yyss1, yysize * sizeof (*yyssp), | |
1131 | &yyvs1, yysize * sizeof (*yyvsp), | |
1132 | &yyls1, yysize * sizeof (*yylsp), | |
1133 | &yystacksize); | |
1134 | yyls = yyls1; | |
e9955c83 AD |
1135 | yyss = yyss1; |
1136 | yyvs = yyvs1; | |
1137 | } | |
1138 | #else /* no yyoverflow */ | |
1139 | # ifndef YYSTACK_RELOCATE | |
1140 | goto yyoverflowlab; | |
1141 | # else | |
1142 | /* Extend the stack our own way. */ | |
d33cb3ae | 1143 | if (YYMAXDEPTH <= yystacksize) |
e9955c83 AD |
1144 | goto yyoverflowlab; |
1145 | yystacksize *= 2; | |
d33cb3ae | 1146 | if (YYMAXDEPTH < yystacksize) |
e9955c83 AD |
1147 | yystacksize = YYMAXDEPTH; |
1148 | ||
1149 | { | |
584bbcd8 | 1150 | short int *yyss1 = yyss; |
e9955c83 AD |
1151 | union yyalloc *yyptr = |
1152 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | |
1153 | if (! yyptr) | |
1154 | goto yyoverflowlab; | |
1155 | YYSTACK_RELOCATE (yyss); | |
1156 | YYSTACK_RELOCATE (yyvs); | |
e9955c83 | 1157 | YYSTACK_RELOCATE (yyls); |
1921f1d7 | 1158 | # undef YYSTACK_RELOCATE |
e9955c83 AD |
1159 | if (yyss1 != yyssa) |
1160 | YYSTACK_FREE (yyss1); | |
1161 | } | |
1162 | # endif | |
1163 | #endif /* no yyoverflow */ | |
1164 | ||
1165 | yyssp = yyss + yysize - 1; | |
1166 | yyvsp = yyvs + yysize - 1; | |
e9955c83 | 1167 | yylsp = yyls + yysize - 1; |
e9955c83 AD |
1168 | |
1169 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | |
1170 | (unsigned long int) yystacksize)); | |
1171 | ||
d33cb3ae | 1172 | if (yyss + yystacksize - 1 <= yyssp) |
e9955c83 AD |
1173 | YYABORT; |
1174 | } | |
1175 | ||
1176 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | |
1177 | ||
1178 | goto yybackup; | |
1179 | ||
1180 | /*-----------. | |
1181 | | yybackup. | | |
1182 | `-----------*/ | |
1183 | yybackup: | |
1184 | ||
1185 | /* Do appropriate processing given the current state. */ | |
1186 | /* Read a lookahead token if we need one and don't already have one. */ | |
1187 | /* yyresume: */ | |
1188 | ||
1189 | /* First try to decide what to do without reference to lookahead token. */ | |
1190 | ||
1191 | yyn = yypact[yystate]; | |
04b6e11e | 1192 | if (yyn == YYPACT_NINF) |
e9955c83 AD |
1193 | goto yydefault; |
1194 | ||
1195 | /* Not known => get a lookahead token if don't already have one. */ | |
1196 | ||
73521d9f PE |
1197 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1198 | if (yychar == YYEMPTY) | |
e9955c83 AD |
1199 | { |
1200 | YYDPRINTF ((stderr, "Reading a token: ")); | |
1201 | yychar = YYLEX; | |
1202 | } | |
1203 | ||
73521d9f | 1204 | if (yychar <= YYEOF) |
e9955c83 | 1205 | { |
73521d9f | 1206 | yychar = yytoken = YYEOF; |
e9955c83 AD |
1207 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
1208 | } | |
1209 | else | |
1210 | { | |
73521d9f | 1211 | yytoken = YYTRANSLATE (yychar); |
f0616f0b | 1212 | YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); |
e9955c83 AD |
1213 | } |
1214 | ||
886b69d1 | 1215 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
ae7453f2 | 1216 | detect an error, take that action. */ |
886b69d1 AD |
1217 | yyn += yytoken; |
1218 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | |
e9955c83 | 1219 | goto yydefault; |
e9955c83 | 1220 | yyn = yytable[yyn]; |
ae7453f2 | 1221 | if (yyn <= 0) |
e9955c83 | 1222 | { |
ae7453f2 | 1223 | if (yyn == 0 || yyn == YYTABLE_NINF) |
e9955c83 AD |
1224 | goto yyerrlab; |
1225 | yyn = -yyn; | |
1226 | goto yyreduce; | |
1227 | } | |
e9955c83 AD |
1228 | |
1229 | if (yyn == YYFINAL) | |
1230 | YYACCEPT; | |
1231 | ||
1232 | /* Shift the lookahead token. */ | |
f0616f0b | 1233 | YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); |
e9955c83 AD |
1234 | |
1235 | /* Discard the token being shifted unless it is eof. */ | |
73521d9f PE |
1236 | if (yychar != YYEOF) |
1237 | yychar = YYEMPTY; | |
e9955c83 AD |
1238 | |
1239 | *++yyvsp = yylval; | |
e9955c83 | 1240 | *++yylsp = yylloc; |
e9955c83 AD |
1241 | |
1242 | /* Count tokens shifted since error; after three, turn off error | |
1243 | status. */ | |
1244 | if (yyerrstatus) | |
1245 | yyerrstatus--; | |
1246 | ||
1247 | yystate = yyn; | |
1248 | goto yynewstate; | |
1249 | ||
1250 | ||
1251 | /*-----------------------------------------------------------. | |
1252 | | yydefault -- do the default action for the current state. | | |
1253 | `-----------------------------------------------------------*/ | |
1254 | yydefault: | |
1255 | yyn = yydefact[yystate]; | |
1256 | if (yyn == 0) | |
1257 | goto yyerrlab; | |
1258 | goto yyreduce; | |
1259 | ||
1260 | ||
1261 | /*-----------------------------. | |
1262 | | yyreduce -- Do a reduction. | | |
1263 | `-----------------------------*/ | |
1264 | yyreduce: | |
1265 | /* yyn is the number of a rule to reduce with. */ | |
1266 | yylen = yyr2[yyn]; | |
1267 | ||
1268 | /* If YYLEN is nonzero, implement the default value of the action: | |
1269 | `$$ = $1'. | |
1270 | ||
04b6e11e PE |
1271 | Otherwise, the following line sets YYVAL to garbage. |
1272 | This behavior is undocumented and Bison | |
e9955c83 AD |
1273 | users should not rely upon it. Assigning to YYVAL |
1274 | unconditionally makes the parser a bit smaller, and it avoids a | |
1275 | GCC warning that YYVAL may be used uninitialized. */ | |
1276 | yyval = yyvsp[1-yylen]; | |
1277 | ||
1921f1d7 | 1278 | /* Default location. */ |
cd3684cf | 1279 | YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen); |
05d18c24 | 1280 | YY_REDUCE_PRINT (yyn); |
1921f1d7 AD |
1281 | switch (yyn) |
1282 | { | |
05d18c24 | 1283 | case 6: |
584bbcd8 | 1284 | #line 188 "parse-gram.y" |
05d18c24 | 1285 | { prologue_augment (yyvsp[0].chars, yylsp[0]); } |
1921f1d7 AD |
1286 | break; |
1287 | ||
8efe435c | 1288 | case 7: |
584bbcd8 | 1289 | #line 189 "parse-gram.y" |
83a457be | 1290 | { debug_flag = true; } |
1921f1d7 AD |
1291 | break; |
1292 | ||
8efe435c | 1293 | case 8: |
584bbcd8 | 1294 | #line 190 "parse-gram.y" |
05d18c24 | 1295 | { muscle_insert (yyvsp[-1].chars, yyvsp[0].chars); } |
1921f1d7 AD |
1296 | break; |
1297 | ||
8efe435c | 1298 | case 9: |
584bbcd8 | 1299 | #line 191 "parse-gram.y" |
83a457be | 1300 | { defines_flag = true; } |
e9955c83 | 1301 | break; |
1921f1d7 | 1302 | |
8efe435c | 1303 | case 10: |
584bbcd8 | 1304 | #line 192 "parse-gram.y" |
83a457be | 1305 | { error_verbose = true; } |
e9955c83 | 1306 | break; |
1921f1d7 | 1307 | |
8efe435c | 1308 | case 11: |
584bbcd8 | 1309 | #line 193 "parse-gram.y" |
d6328241 | 1310 | { expected_sr_conflicts = yyvsp[0].integer; } |
e9955c83 | 1311 | break; |
1921f1d7 | 1312 | |
8efe435c | 1313 | case 12: |
584bbcd8 | 1314 | #line 194 "parse-gram.y" |
d6328241 | 1315 | { expected_rr_conflicts = yyvsp[0].integer; } |
e9955c83 | 1316 | break; |
1921f1d7 | 1317 | |
8efe435c | 1318 | case 13: |
584bbcd8 | 1319 | #line 195 "parse-gram.y" |
d6328241 PH |
1320 | { spec_file_prefix = yyvsp[0].chars; } |
1321 | break; | |
1322 | ||
1323 | case 14: | |
584bbcd8 | 1324 | #line 197 "parse-gram.y" |
cd3684cf AD |
1325 | { |
1326 | nondeterministic_parser = true; | |
1327 | glr_parser = true; | |
1328 | } | |
e9955c83 | 1329 | break; |
1921f1d7 | 1330 | |
d6328241 | 1331 | case 15: |
584bbcd8 | 1332 | #line 202 "parse-gram.y" |
cd3684cf AD |
1333 | { |
1334 | muscle_code_grow ("initial_action", yyvsp[0].chars, yylsp[0]); | |
1335 | } | |
e9955c83 | 1336 | break; |
1921f1d7 | 1337 | |
d6328241 | 1338 | case 16: |
584bbcd8 | 1339 | #line 205 "parse-gram.y" |
cd3684cf | 1340 | { add_param ("lex_param", yyvsp[0].chars, yylsp[0]); } |
e9955c83 | 1341 | break; |
1921f1d7 | 1342 | |
d6328241 | 1343 | case 17: |
584bbcd8 | 1344 | #line 206 "parse-gram.y" |
cd3684cf | 1345 | { locations_flag = true; } |
e9955c83 | 1346 | break; |
1921f1d7 | 1347 | |
d6328241 | 1348 | case 18: |
584bbcd8 | 1349 | #line 207 "parse-gram.y" |
cd3684cf | 1350 | { spec_name_prefix = yyvsp[0].chars; } |
e9955c83 | 1351 | break; |
1921f1d7 | 1352 | |
d6328241 | 1353 | case 19: |
584bbcd8 | 1354 | #line 208 "parse-gram.y" |
cd3684cf | 1355 | { no_lines_flag = true; } |
4cdb01db | 1356 | break; |
1921f1d7 | 1357 | |
d6328241 | 1358 | case 20: |
584bbcd8 | 1359 | #line 209 "parse-gram.y" |
cd3684cf | 1360 | { nondeterministic_parser = true; } |
4cdb01db | 1361 | break; |
1921f1d7 | 1362 | |
d6328241 | 1363 | case 21: |
584bbcd8 | 1364 | #line 210 "parse-gram.y" |
cd3684cf | 1365 | { spec_outfile = yyvsp[0].chars; } |
4cdb01db | 1366 | break; |
1921f1d7 | 1367 | |
d6328241 | 1368 | case 22: |
584bbcd8 | 1369 | #line 211 "parse-gram.y" |
cd3684cf | 1370 | { add_param ("parse_param", yyvsp[0].chars, yylsp[0]); } |
676385e2 PH |
1371 | break; |
1372 | ||
d6328241 | 1373 | case 23: |
584bbcd8 | 1374 | #line 212 "parse-gram.y" |
cd3684cf | 1375 | { pure_parser = true; } |
ae7453f2 AD |
1376 | break; |
1377 | ||
d6328241 | 1378 | case 24: |
584bbcd8 | 1379 | #line 213 "parse-gram.y" |
cd3684cf | 1380 | { skeleton = yyvsp[0].chars; } |
ae7453f2 AD |
1381 | break; |
1382 | ||
d6328241 | 1383 | case 25: |
584bbcd8 | 1384 | #line 214 "parse-gram.y" |
cd3684cf | 1385 | { token_table_flag = true; } |
916708d5 AD |
1386 | break; |
1387 | ||
d6328241 | 1388 | case 26: |
584bbcd8 | 1389 | #line 215 "parse-gram.y" |
cd3684cf AD |
1390 | { report_flag = report_states; } |
1391 | break; | |
1392 | ||
d6328241 | 1393 | case 27: |
584bbcd8 | 1394 | #line 216 "parse-gram.y" |
83a457be | 1395 | { yacc_flag = true; } |
4cdb01db | 1396 | break; |
1921f1d7 | 1397 | |
d6328241 | 1398 | case 31: |
584bbcd8 | 1399 | #line 224 "parse-gram.y" |
1921f1d7 | 1400 | { |
8efe435c | 1401 | grammar_start_symbol_set (yyvsp[0].symbol, yylsp[0]); |
4cdb01db | 1402 | } |
e9955c83 | 1403 | break; |
1921f1d7 | 1404 | |
d6328241 | 1405 | case 32: |
584bbcd8 | 1406 | #line 228 "parse-gram.y" |
1921f1d7 | 1407 | { |
83a457be | 1408 | typed = true; |
05d18c24 PE |
1409 | MUSCLE_INSERT_INT ("stype_line", yylsp[0].start.line); |
1410 | muscle_insert ("stype", yyvsp[0].chars); | |
4cdb01db | 1411 | } |
e9955c83 | 1412 | break; |
1921f1d7 | 1413 | |
d6328241 | 1414 | case 33: |
584bbcd8 | 1415 | #line 234 "parse-gram.y" |
1921f1d7 | 1416 | { |
05d18c24 | 1417 | symbol_list *list; |
9280d3ef | 1418 | for (list = yyvsp[0].list; list; list = list->next) |
05d18c24 | 1419 | symbol_destructor_set (list->sym, yyvsp[-1].chars, yylsp[-1]); |
9280d3ef | 1420 | symbol_list_free (yyvsp[0].list); |
4cdb01db | 1421 | } |
e9955c83 | 1422 | break; |
1921f1d7 | 1423 | |
d6328241 | 1424 | case 34: |
584bbcd8 | 1425 | #line 241 "parse-gram.y" |
1921f1d7 | 1426 | { |
05d18c24 | 1427 | symbol_list *list; |
366eea36 | 1428 | for (list = yyvsp[0].list; list; list = list->next) |
05d18c24 | 1429 | symbol_printer_set (list->sym, yyvsp[-1].chars, list->location); |
366eea36 | 1430 | symbol_list_free (yyvsp[0].list); |
4cdb01db | 1431 | } |
e9955c83 | 1432 | break; |
1921f1d7 | 1433 | |
d6328241 | 1434 | case 35: |
584bbcd8 | 1435 | #line 248 "parse-gram.y" |
92f5e991 | 1436 | { |
66ef8b9d | 1437 | default_prec = true; |
92f5e991 | 1438 | } |
9280d3ef AD |
1439 | break; |
1440 | ||
d6328241 | 1441 | case 36: |
584bbcd8 | 1442 | #line 252 "parse-gram.y" |
66ef8b9d PE |
1443 | { |
1444 | default_prec = false; | |
1445 | } | |
92f5e991 AD |
1446 | break; |
1447 | ||
d6328241 | 1448 | case 37: |
584bbcd8 | 1449 | #line 258 "parse-gram.y" |
66ef8b9d PE |
1450 | { current_class = nterm_sym; } |
1451 | break; | |
1452 | ||
d6328241 | 1453 | case 38: |
584bbcd8 | 1454 | #line 259 "parse-gram.y" |
9280d3ef AD |
1455 | { |
1456 | current_class = unknown_sym; | |
1457 | current_type = NULL; | |
1458 | } | |
1459 | break; | |
1460 | ||
d6328241 | 1461 | case 39: |
584bbcd8 | 1462 | #line 263 "parse-gram.y" |
366eea36 AD |
1463 | { current_class = token_sym; } |
1464 | break; | |
1465 | ||
d6328241 | 1466 | case 40: |
584bbcd8 | 1467 | #line 264 "parse-gram.y" |
366eea36 AD |
1468 | { |
1469 | current_class = unknown_sym; | |
1470 | current_type = NULL; | |
1471 | } | |
1472 | break; | |
1473 | ||
d6328241 | 1474 | case 41: |
584bbcd8 | 1475 | #line 269 "parse-gram.y" |
1e0bab92 | 1476 | { |
05d18c24 | 1477 | symbol_list *list; |
1e0bab92 | 1478 | for (list = yyvsp[0].list; list; list = list->next) |
05d18c24 | 1479 | symbol_type_set (list->sym, yyvsp[-1].uniqstr, yylsp[-1]); |
dafdc66f | 1480 | symbol_list_free (yyvsp[0].list); |
1e0bab92 | 1481 | } |
e9955c83 | 1482 | break; |
1921f1d7 | 1483 | |
d6328241 | 1484 | case 42: |
584bbcd8 | 1485 | #line 279 "parse-gram.y" |
1921f1d7 | 1486 | { |
05d18c24 | 1487 | symbol_list *list; |
1e0bab92 AD |
1488 | ++current_prec; |
1489 | for (list = yyvsp[0].list; list; list = list->next) | |
1490 | { | |
1a31ed21 AD |
1491 | symbol_type_set (list->sym, current_type, yylsp[-1]); |
1492 | symbol_precedence_set (list->sym, current_prec, yyvsp[-2].assoc, yylsp[-2]); | |
1e0bab92 | 1493 | } |
dafdc66f | 1494 | symbol_list_free (yyvsp[0].list); |
2c569025 AD |
1495 | current_type = NULL; |
1496 | } | |
e9955c83 | 1497 | break; |
1921f1d7 | 1498 | |
d6328241 | 1499 | case 43: |
584bbcd8 | 1500 | #line 293 "parse-gram.y" |
1e0bab92 | 1501 | { yyval.assoc = left_assoc; } |
e9955c83 | 1502 | break; |
1921f1d7 | 1503 | |
d6328241 | 1504 | case 44: |
584bbcd8 | 1505 | #line 294 "parse-gram.y" |
1e0bab92 | 1506 | { yyval.assoc = right_assoc; } |
e9955c83 | 1507 | break; |
1921f1d7 | 1508 | |
d6328241 | 1509 | case 45: |
584bbcd8 | 1510 | #line 295 "parse-gram.y" |
1e0bab92 | 1511 | { yyval.assoc = non_assoc; } |
4cdb01db | 1512 | break; |
1921f1d7 | 1513 | |
d6328241 | 1514 | case 46: |
584bbcd8 | 1515 | #line 299 "parse-gram.y" |
62ddaef6 | 1516 | { current_type = NULL; } |
e9955c83 | 1517 | break; |
1921f1d7 | 1518 | |
d6328241 | 1519 | case 47: |
584bbcd8 | 1520 | #line 300 "parse-gram.y" |
05d18c24 | 1521 | { current_type = yyvsp[0].uniqstr; } |
e9955c83 | 1522 | break; |
1921f1d7 | 1523 | |
d6328241 | 1524 | case 48: |
584bbcd8 | 1525 | #line 306 "parse-gram.y" |
1e0bab92 | 1526 | { yyval.list = symbol_list_new (yyvsp[0].symbol, yylsp[0]); } |
4cdb01db | 1527 | break; |
1921f1d7 | 1528 | |
d6328241 | 1529 | case 49: |
584bbcd8 | 1530 | #line 307 "parse-gram.y" |
1e0bab92 | 1531 | { yyval.list = symbol_list_prepend (yyvsp[-1].list, yyvsp[0].symbol, yylsp[0]); } |
4cdb01db | 1532 | break; |
1921f1d7 | 1533 | |
d6328241 | 1534 | case 50: |
584bbcd8 | 1535 | #line 313 "parse-gram.y" |
1921f1d7 | 1536 | { |
05d18c24 | 1537 | current_type = yyvsp[0].uniqstr; |
4cdb01db | 1538 | } |
e9955c83 | 1539 | break; |
1921f1d7 | 1540 | |
d6328241 | 1541 | case 51: |
584bbcd8 | 1542 | #line 317 "parse-gram.y" |
1921f1d7 | 1543 | { |
e776192e | 1544 | symbol_class_set (yyvsp[0].symbol, current_class, yylsp[0]); |
1a31ed21 | 1545 | symbol_type_set (yyvsp[0].symbol, current_type, yylsp[0]); |
4cdb01db | 1546 | } |
e9955c83 | 1547 | break; |
1921f1d7 | 1548 | |
d6328241 | 1549 | case 52: |
584bbcd8 | 1550 | #line 322 "parse-gram.y" |
1921f1d7 | 1551 | { |
e776192e | 1552 | symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]); |
1a31ed21 | 1553 | symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]); |
e776192e | 1554 | symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer, yylsp[0]); |
4cdb01db | 1555 | } |
e9955c83 | 1556 | break; |
1921f1d7 | 1557 | |
d6328241 | 1558 | case 53: |
584bbcd8 | 1559 | #line 328 "parse-gram.y" |
1921f1d7 | 1560 | { |
e776192e | 1561 | symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]); |
1a31ed21 | 1562 | symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]); |
a5d50994 | 1563 | symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol, yyloc); |
4cdb01db | 1564 | } |
e9955c83 | 1565 | break; |
1921f1d7 | 1566 | |
d6328241 | 1567 | case 54: |
584bbcd8 | 1568 | #line 334 "parse-gram.y" |
1921f1d7 | 1569 | { |
e776192e | 1570 | symbol_class_set (yyvsp[-2].symbol, current_class, yylsp[-2]); |
1a31ed21 | 1571 | symbol_type_set (yyvsp[-2].symbol, current_type, yylsp[-2]); |
e776192e | 1572 | symbol_user_token_number_set (yyvsp[-2].symbol, yyvsp[-1].integer, yylsp[-1]); |
a5d50994 | 1573 | symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol, yyloc); |
4cdb01db | 1574 | } |
e9955c83 | 1575 | break; |
1921f1d7 | 1576 | |
d6328241 | 1577 | case 60: |
584bbcd8 | 1578 | #line 363 "parse-gram.y" |
b275314e AD |
1579 | { |
1580 | if (yacc_flag) | |
1581 | complain_at (yyloc, _("POSIX forbids declarations in the grammar")); | |
1582 | } | |
1583 | break; | |
1584 | ||
d6328241 | 1585 | case 61: |
584bbcd8 | 1586 | #line 368 "parse-gram.y" |
b275314e AD |
1587 | { |
1588 | yyerrok; | |
1589 | } | |
e9955c83 | 1590 | break; |
1921f1d7 | 1591 | |
d6328241 | 1592 | case 62: |
584bbcd8 | 1593 | #line 374 "parse-gram.y" |
05d18c24 | 1594 | { current_lhs = yyvsp[0].symbol; current_lhs_location = yylsp[0]; } |
e9955c83 | 1595 | break; |
1921f1d7 | 1596 | |
d6328241 | 1597 | case 64: |
584bbcd8 | 1598 | #line 378 "parse-gram.y" |
916708d5 | 1599 | { grammar_rule_end (yylsp[0]); } |
e9955c83 | 1600 | break; |
1921f1d7 | 1601 | |
d6328241 | 1602 | case 65: |
584bbcd8 | 1603 | #line 379 "parse-gram.y" |
66ef8b9d | 1604 | { grammar_rule_end (yylsp[0]); } |
4cdb01db | 1605 | break; |
1921f1d7 | 1606 | |
d6328241 | 1607 | case 67: |
584bbcd8 | 1608 | #line 385 "parse-gram.y" |
66ef8b9d | 1609 | { grammar_rule_begin (current_lhs, current_lhs_location); } |
e9955c83 | 1610 | break; |
1921f1d7 | 1611 | |
d6328241 | 1612 | case 68: |
584bbcd8 | 1613 | #line 387 "parse-gram.y" |
66ef8b9d | 1614 | { grammar_current_rule_symbol_append (yyvsp[0].symbol, yylsp[0]); } |
4cdb01db | 1615 | break; |
1921f1d7 | 1616 | |
d6328241 | 1617 | case 69: |
584bbcd8 | 1618 | #line 389 "parse-gram.y" |
66ef8b9d | 1619 | { grammar_current_rule_action_append (yyvsp[0].chars, yylsp[0]); } |
0c15323d | 1620 | break; |
1921f1d7 | 1621 | |
d6328241 | 1622 | case 70: |
584bbcd8 | 1623 | #line 391 "parse-gram.y" |
66ef8b9d | 1624 | { grammar_current_rule_prec_set (yyvsp[0].symbol, yylsp[0]); } |
2c569025 | 1625 | break; |
1921f1d7 | 1626 | |
d6328241 | 1627 | case 71: |
584bbcd8 | 1628 | #line 393 "parse-gram.y" |
66ef8b9d | 1629 | { grammar_current_rule_dprec_set (yyvsp[0].integer, yylsp[0]); } |
676385e2 PH |
1630 | break; |
1631 | ||
d6328241 | 1632 | case 72: |
584bbcd8 | 1633 | #line 395 "parse-gram.y" |
66ef8b9d | 1634 | { grammar_current_rule_merge_set (yyvsp[0].uniqstr, yylsp[0]); } |
676385e2 PH |
1635 | break; |
1636 | ||
d6328241 | 1637 | case 73: |
584bbcd8 | 1638 | #line 399 "parse-gram.y" |
916708d5 | 1639 | { yyval.symbol = yyvsp[0].symbol; } |
b275314e AD |
1640 | break; |
1641 | ||
d6328241 | 1642 | case 74: |
584bbcd8 | 1643 | #line 400 "parse-gram.y" |
66ef8b9d | 1644 | { yyval.symbol = yyvsp[0].symbol; } |
916708d5 AD |
1645 | break; |
1646 | ||
d6328241 | 1647 | case 75: |
584bbcd8 | 1648 | #line 405 "parse-gram.y" |
66ef8b9d PE |
1649 | { yyval.chars = yyvsp[0].chars; } |
1650 | break; | |
1651 | ||
d6328241 | 1652 | case 76: |
584bbcd8 | 1653 | #line 411 "parse-gram.y" |
1921f1d7 | 1654 | { |
05d18c24 | 1655 | yyval.symbol = symbol_get (yyvsp[0].chars, yylsp[0]); |
e776192e | 1656 | symbol_class_set (yyval.symbol, token_sym, yylsp[0]); |
4cdb01db | 1657 | } |
e9955c83 | 1658 | break; |
1921f1d7 | 1659 | |
d6328241 | 1660 | case 77: |
584bbcd8 | 1661 | #line 420 "parse-gram.y" |
1921f1d7 | 1662 | { |
05d18c24 PE |
1663 | yyval.chars = yyvsp[0].chars + 1; |
1664 | yyval.chars[strlen (yyval.chars) - 1] = '\0'; | |
4cdb01db | 1665 | } |
e9955c83 | 1666 | break; |
1921f1d7 | 1667 | |
d6328241 | 1668 | case 79: |
584bbcd8 | 1669 | #line 429 "parse-gram.y" |
1921f1d7 | 1670 | { |
cd3684cf | 1671 | muscle_code_grow ("epilogue", yyvsp[0].chars, yylsp[0]); |
7ec2d4cd | 1672 | scanner_last_string_free (); |
4cdb01db | 1673 | } |
e9955c83 AD |
1674 | break; |
1675 | ||
1676 | ||
1921f1d7 AD |
1677 | } |
1678 | ||
cd3684cf | 1679 | /* Line 1010 of yacc.c. */ |
584bbcd8 | 1680 | #line 1681 "parse-gram.c" |
e9955c83 AD |
1681 | \f |
1682 | yyvsp -= yylen; | |
1683 | yyssp -= yylen; | |
e9955c83 | 1684 | yylsp -= yylen; |
e9955c83 | 1685 | |
05d18c24 | 1686 | YY_STACK_PRINT (yyss, yyssp); |
e9955c83 AD |
1687 | |
1688 | *++yyvsp = yyval; | |
e9955c83 | 1689 | *++yylsp = yyloc; |
e9955c83 AD |
1690 | |
1691 | /* Now `shift' the result of the reduction. Determine what state | |
1692 | that goes to, based on the state we popped back to and the rule | |
1693 | number reduced by. */ | |
1694 | ||
1695 | yyn = yyr1[yyn]; | |
1696 | ||
1921f1d7 | 1697 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
04b6e11e | 1698 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
e9955c83 AD |
1699 | yystate = yytable[yystate]; |
1700 | else | |
1921f1d7 | 1701 | yystate = yydefgoto[yyn - YYNTOKENS]; |
e9955c83 AD |
1702 | |
1703 | goto yynewstate; | |
1704 | ||
1705 | ||
1706 | /*------------------------------------. | |
1707 | | yyerrlab -- here on detecting error | | |
1708 | `------------------------------------*/ | |
1709 | yyerrlab: | |
1710 | /* If not already recovering from an error, report this error. */ | |
1711 | if (!yyerrstatus) | |
1712 | { | |
1713 | ++yynerrs; | |
ae7453f2 AD |
1714 | #if YYERROR_VERBOSE |
1715 | yyn = yypact[yystate]; | |
1716 | ||
1717 | if (YYPACT_NINF < yyn && yyn < YYLAST) | |
1718 | { | |
1719 | YYSIZE_T yysize = 0; | |
1720 | int yytype = YYTRANSLATE (yychar); | |
650aa2cf | 1721 | const char* yyprefix; |
ae7453f2 | 1722 | char *yymsg; |
6d5aa694 | 1723 | int yyx; |
ae7453f2 | 1724 | |
ae7453f2 AD |
1725 | /* Start YYX at -YYN if negative to avoid negative indexes in |
1726 | YYCHECK. */ | |
650aa2cf | 1727 | int yyxbegin = yyn < 0 ? -yyn : 0; |
6d5aa694 AD |
1728 | |
1729 | /* Stay within bounds of both yycheck and yytname. */ | |
1730 | int yychecklim = YYLAST - yyn; | |
650aa2cf | 1731 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
6d5aa694 AD |
1732 | int yycount = 0; |
1733 | ||
650aa2cf AD |
1734 | yyprefix = ", expecting "; |
1735 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | |
ae7453f2 | 1736 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
6d5aa694 | 1737 | { |
650aa2cf AD |
1738 | yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); |
1739 | yycount += 1; | |
6d5aa694 AD |
1740 | if (yycount == 5) |
1741 | { | |
1742 | yysize = 0; | |
1743 | break; | |
650aa2cf | 1744 | } |
6d5aa694 AD |
1745 | } |
1746 | yysize += (sizeof ("syntax error, unexpected ") | |
1747 | + yystrlen (yytname[yytype])); | |
ae7453f2 AD |
1748 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
1749 | if (yymsg != 0) | |
1750 | { | |
f0616f0b | 1751 | char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); |
ae7453f2 AD |
1752 | yyp = yystpcpy (yyp, yytname[yytype]); |
1753 | ||
1754 | if (yycount < 5) | |
1755 | { | |
650aa2cf AD |
1756 | yyprefix = ", expecting "; |
1757 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | |
ae7453f2 AD |
1758 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
1759 | { | |
650aa2cf | 1760 | yyp = yystpcpy (yyp, yyprefix); |
ae7453f2 | 1761 | yyp = yystpcpy (yyp, yytname[yyx]); |
650aa2cf | 1762 | yyprefix = " or "; |
ae7453f2 AD |
1763 | } |
1764 | } | |
1765 | yyerror (yymsg); | |
1766 | YYSTACK_FREE (yymsg); | |
1767 | } | |
1768 | else | |
f0616f0b | 1769 | yyerror ("syntax error; also virtual memory exhausted"); |
ae7453f2 AD |
1770 | } |
1771 | else | |
1772 | #endif /* YYERROR_VERBOSE */ | |
f0616f0b | 1773 | yyerror ("syntax error"); |
e9955c83 | 1774 | } |
e9955c83 | 1775 | |
78a00b7d PE |
1776 | yylerrsp = yylsp; |
1777 | ||
e9955c83 AD |
1778 | if (yyerrstatus == 3) |
1779 | { | |
1780 | /* If just tried and failed to reuse lookahead token after an | |
1781 | error, discard it. */ | |
1782 | ||
465b4444 | 1783 | if (yychar <= YYEOF) |
366eea36 | 1784 | { |
465b4444 PE |
1785 | /* If at end of input, pop the error token, |
1786 | then the rest of the stack, then return failure. */ | |
1787 | if (yychar == YYEOF) | |
1788 | for (;;) | |
1789 | { | |
1790 | YYPOPSTACK; | |
1791 | if (yyssp == yyss) | |
1792 | YYABORT; | |
1793 | YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); | |
1794 | yydestruct (yystos[*yyssp], yyvsp, yylsp); | |
1795 | } | |
366eea36 | 1796 | } |
465b4444 PE |
1797 | else |
1798 | { | |
1799 | YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); | |
1800 | yydestruct (yytoken, &yylval, &yylloc); | |
1801 | yychar = YYEMPTY; | |
1802 | *++yylerrsp = yylloc; | |
1803 | } | |
e9955c83 AD |
1804 | } |
1805 | ||
1806 | /* Else will try to reuse lookahead token after shifting the error | |
1807 | token. */ | |
6d5aa694 | 1808 | goto yyerrlab1; |
e9955c83 | 1809 | |
05d18c24 | 1810 | |
465b4444 PE |
1811 | /*---------------------------------------------------. |
1812 | | yyerrorlab -- error raised explicitly by YYERROR. | | |
1813 | `---------------------------------------------------*/ | |
1814 | yyerrorlab: | |
1815 | ||
1816 | #ifdef __GNUC__ | |
1817 | /* Pacify GCC when the user code never invokes YYERROR and the label | |
1818 | yyerrorlab therefore never appears in user code. */ | |
1819 | if (0) | |
1820 | goto yyerrorlab; | |
1821 | #endif | |
1822 | ||
1823 | yyvsp -= yylen; | |
1824 | yyssp -= yylen; | |
1825 | yystate = *yyssp; | |
1826 | yylerrsp = yylsp; | |
1827 | *++yylerrsp = yyloc; | |
1828 | yylsp -= yylen; | |
1829 | goto yyerrlab1; | |
1830 | ||
1831 | ||
1832 | /*-------------------------------------------------------------. | |
1833 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | |
1834 | `-------------------------------------------------------------*/ | |
05d18c24 | 1835 | yyerrlab1: |
1921f1d7 | 1836 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
e9955c83 | 1837 | |
1921f1d7 AD |
1838 | for (;;) |
1839 | { | |
1840 | yyn = yypact[yystate]; | |
04b6e11e | 1841 | if (yyn != YYPACT_NINF) |
1921f1d7 AD |
1842 | { |
1843 | yyn += YYTERROR; | |
1844 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | |
1845 | { | |
1846 | yyn = yytable[yyn]; | |
1847 | if (0 < yyn) | |
1848 | break; | |
1849 | } | |
1850 | } | |
4cdb01db | 1851 | |
1921f1d7 AD |
1852 | /* Pop the current state because it cannot handle the error token. */ |
1853 | if (yyssp == yyss) | |
1854 | YYABORT; | |
0c15323d | 1855 | |
f0616f0b | 1856 | YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); |
886b69d1 | 1857 | yydestruct (yystos[yystate], yyvsp, yylsp); |
465b4444 PE |
1858 | YYPOPSTACK; |
1859 | yystate = *yyssp; | |
05d18c24 | 1860 | YY_STACK_PRINT (yyss, yyssp); |
e9955c83 AD |
1861 | } |
1862 | ||
1863 | if (yyn == YYFINAL) | |
1864 | YYACCEPT; | |
1865 | ||
1866 | YYDPRINTF ((stderr, "Shifting error token, ")); | |
1867 | ||
1868 | *++yyvsp = yylval; | |
cd3684cf | 1869 | YYLLOC_DEFAULT (yyloc, yylsp, yylerrsp - yylsp); |
78a00b7d | 1870 | *++yylsp = yyloc; |
e9955c83 AD |
1871 | |
1872 | yystate = yyn; | |
1873 | goto yynewstate; | |
1874 | ||
1875 | ||
1876 | /*-------------------------------------. | |
1877 | | yyacceptlab -- YYACCEPT comes here. | | |
1878 | `-------------------------------------*/ | |
1879 | yyacceptlab: | |
1880 | yyresult = 0; | |
1881 | goto yyreturn; | |
1882 | ||
1883 | /*-----------------------------------. | |
1884 | | yyabortlab -- YYABORT comes here. | | |
1885 | `-----------------------------------*/ | |
1886 | yyabortlab: | |
1887 | yyresult = 1; | |
1888 | goto yyreturn; | |
1889 | ||
366eea36 AD |
1890 | #ifndef yyoverflow |
1891 | /*----------------------------------------------. | |
1892 | | yyoverflowlab -- parser overflow comes here. | | |
1893 | `----------------------------------------------*/ | |
e9955c83 AD |
1894 | yyoverflowlab: |
1895 | yyerror ("parser stack overflow"); | |
1896 | yyresult = 2; | |
1897 | /* Fall through. */ | |
366eea36 | 1898 | #endif |
e9955c83 AD |
1899 | |
1900 | yyreturn: | |
1901 | #ifndef yyoverflow | |
1902 | if (yyss != yyssa) | |
1903 | YYSTACK_FREE (yyss); | |
1904 | #endif | |
1905 | return yyresult; | |
1906 | } | |
1921f1d7 | 1907 | |
366eea36 | 1908 | |
584bbcd8 | 1909 | #line 435 "parse-gram.y" |
05d18c24 PE |
1910 | |
1911 | ||
1912 | ||
1913 | /* Return the location of the left-hand side of a rule whose | |
1914 | right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in | |
1915 | the right-hand side, and return an empty location equal to the end | |
1916 | boundary of RHS[0] if the right-hand side is empty. */ | |
1917 | ||
1918 | static YYLTYPE | |
1919 | lloc_default (YYLTYPE const *rhs, int n) | |
1920 | { | |
1921 | int i; | |
1d64f0ba AD |
1922 | YYLTYPE loc; |
1923 | loc.start = loc.end = rhs[n].end; | |
05d18c24 | 1924 | |
73521d9f PE |
1925 | /* Ignore empty nonterminals the start of the the right-hand side. |
1926 | Do not bother to ignore them at the end of the right-hand side, | |
1927 | since empty nonterminals have the same end as their predecessors. */ | |
05d18c24 PE |
1928 | for (i = 1; i <= n; i++) |
1929 | if (! equal_boundaries (rhs[i].start, rhs[i].end)) | |
1930 | { | |
1d64f0ba | 1931 | loc.start = rhs[i].start; |
05d18c24 PE |
1932 | break; |
1933 | } | |
1934 | ||
1d64f0ba | 1935 | return loc; |
05d18c24 PE |
1936 | } |
1937 | ||
1938 | ||
1939 | /* Add a lex-param or a parse-param (depending on TYPE) with | |
1940 | declaration DECL and location LOC. */ | |
1941 | ||
1942 | static void | |
73521d9f | 1943 | add_param (char const *type, char *decl, location loc) |
05d18c24 PE |
1944 | { |
1945 | static char const alphanum[] = | |
1946 | "0123456789" | |
1947 | "abcdefghijklmnopqrstuvwxyz" | |
1948 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
1949 | "_"; | |
1950 | char const *alpha = alphanum + 10; | |
1951 | char const *name_start = NULL; | |
73521d9f | 1952 | char *p; |
05d18c24 PE |
1953 | |
1954 | for (p = decl; *p; p++) | |
1955 | if ((p == decl || ! strchr (alphanum, p[-1])) && strchr (alpha, p[0])) | |
1956 | name_start = p; | |
1957 | ||
73521d9f PE |
1958 | /* Strip the surrounding '{' and '}'. */ |
1959 | decl++; | |
1960 | p[-1] = '\0'; | |
1961 | ||
05d18c24 PE |
1962 | if (! name_start) |
1963 | complain_at (loc, _("missing identifier in parameter declaration")); | |
1964 | else | |
1965 | { | |
1966 | char *name; | |
1967 | size_t name_len; | |
1968 | ||
1969 | for (name_len = 1; | |
1970 | name_start[name_len] && strchr (alphanum, name_start[name_len]); | |
1971 | name_len++) | |
1972 | continue; | |
1973 | ||
1974 | name = xmalloc (name_len + 1); | |
1975 | memcpy (name, name_start, name_len); | |
1976 | name[name_len] = '\0'; | |
1977 | muscle_pair_list_grow (type, decl, name); | |
1978 | free (name); | |
1979 | } | |
1980 | ||
1981 | scanner_last_string_free (); | |
1982 | } | |
e9955c83 | 1983 | |
73521d9f PE |
1984 | /*----------------------------------------------------. |
1985 | | When debugging the parser, display tokens' values. | | |
1986 | `----------------------------------------------------*/ | |
e9955c83 AD |
1987 | |
1988 | static void | |
05d18c24 | 1989 | print_token_value (FILE *file, int type, YYSTYPE const *value) |
e9955c83 | 1990 | { |
e776192e | 1991 | fputc (' ', file); |
e9955c83 AD |
1992 | switch (type) |
1993 | { | |
e9955c83 AD |
1994 | case ID: |
1995 | fprintf (file, " = %s", value->symbol->tag); | |
1996 | break; | |
1997 | ||
1998 | case INT: | |
1999 | fprintf (file, " = %d", value->integer); | |
2000 | break; | |
2001 | ||
2002 | case STRING: | |
05d18c24 | 2003 | fprintf (file, " = \"%s\"", value->chars); |
e9955c83 AD |
2004 | break; |
2005 | ||
2006 | case TYPE: | |
05d18c24 | 2007 | fprintf (file, " = <%s>", value->uniqstr); |
e9955c83 AD |
2008 | break; |
2009 | ||
2010 | case BRACED_CODE: | |
73521d9f PE |
2011 | case PERCENT_DESTRUCTOR: |
2012 | case PERCENT_LEX_PARAM: | |
2013 | case PERCENT_PARSE_PARAM: | |
2014 | case PERCENT_PRINTER: | |
2015 | case PERCENT_UNION: | |
e9955c83 AD |
2016 | case PROLOGUE: |
2017 | case EPILOGUE: | |
05d18c24 | 2018 | fprintf (file, " = {{ %s }}", value->chars); |
e9955c83 | 2019 | break; |
7ec2d4cd AD |
2020 | |
2021 | default: | |
2022 | fprintf (file, "unknown token type"); | |
2023 | break; | |
e9955c83 AD |
2024 | } |
2025 | } | |
2026 | ||
05d18c24 PE |
2027 | static void |
2028 | gram_error (location const *loc, char const *msg) | |
e9955c83 | 2029 | { |
05d18c24 | 2030 | complain_at (*loc, "%s", msg); |
e9955c83 | 2031 | } |
1921f1d7 | 2032 | |
73521d9f PE |
2033 | char const * |
2034 | token_name (int type) | |
2035 | { | |
2036 | return yytname[type]; | |
2037 | } | |
2038 |