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