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