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