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