Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /* A Bison parser, made by GNU Bison 3.0.4. */ |
2 | |||
3 | /* Bison implementation for Yacc-like parsers in C |
||
4 | |||
5 | Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. |
||
6 | |||
7 | This program is free software: you can redistribute it and/or modify |
||
8 | it under the terms of the GNU General Public License as published by |
||
9 | the Free Software Foundation, either version 3 of the License, or |
||
10 | (at your option) any later version. |
||
11 | |||
12 | This program is distributed in the hope that it will be useful, |
||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
15 | GNU General Public License for more details. |
||
16 | |||
17 | You should have received a copy of the GNU General Public License |
||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
||
19 | |||
20 | /* As a special exception, you may create a larger work that contains |
||
21 | part or all of the Bison parser skeleton and distribute that work |
||
22 | under terms of your choice, so long as that work isn't itself a |
||
23 | parser generator using the skeleton or a modified version thereof |
||
24 | as a parser skeleton. Alternatively, if you modify or redistribute |
||
25 | the parser skeleton itself, you may (at your option) remove this |
||
26 | special exception, which will cause the skeleton and the resulting |
||
27 | Bison output files to be licensed under the GNU General Public |
||
28 | License without this special exception. |
||
29 | |||
30 | This special exception was added by the Free Software Foundation in |
||
31 | version 2.2 of Bison. */ |
||
32 | |||
33 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
||
34 | simplifying the original so-called "semantic" parser. */ |
||
35 | |||
36 | /* All symbols defined below should begin with yy or YY, to avoid |
||
37 | infringing on user name space. This should be done even for local |
||
38 | variables, as they might otherwise be expanded by user macros. |
||
39 | There are some unavoidable exceptions within include files to |
||
40 | define necessary library symbols; they are noted "INFRINGES ON |
||
41 | USER NAME SPACE" below. */ |
||
42 | |||
43 | /* Identify Bison output. */ |
||
44 | #define YYBISON 1 |
||
45 | |||
46 | /* Bison version. */ |
||
47 | #define YYBISON_VERSION "3.0.4" |
||
48 | |||
49 | /* Skeleton name. */ |
||
50 | #define YYSKELETON_NAME "yacc.c" |
||
51 | |||
52 | /* Pure parsers. */ |
||
53 | #define YYPURE 0 |
||
54 | |||
55 | /* Push parsers. */ |
||
56 | #define YYPUSH 0 |
||
57 | |||
58 | /* Pull parsers. */ |
||
59 | #define YYPULL 1 |
||
60 | |||
61 | /* Copy the first part of user declarations. */ |
||
62 | #line 1 "protel_yacc.y" /* yacc.c:339 */ |
||
63 | |||
64 | /* |
||
65 | * $Id: eagle_yacc.y,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $ |
||
66 | * |
||
67 | * $Log: eagle_yacc.y,v $ |
||
68 | * |
||
69 | * */ |
||
70 | |||
71 | #include "database.h" |
||
72 | #include "expression.h" |
||
73 | #include "generic.h" |
||
74 | |||
75 | #include <stdio.h> |
||
76 | #include <stdlib.h> |
||
77 | #include <string.h> |
||
78 | |||
79 | #ident \ |
||
80 | "@(#)$Header: C:/cvsroot/Vert03/protel_src/protel_yacc.y,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $" |
||
81 | |||
82 | static char text_buff[1024]; |
||
83 | |||
84 | static socket_t *current_chip; |
||
85 | static char curr_net_nam[MAXIDLEN]; |
||
86 | |||
87 | #line 95 "protel_yacc.c" /* yacc.c:339 */ |
||
88 | |||
89 | #ifndef YY_NULLPTR |
||
90 | #if defined __cplusplus && 201103L <= __cplusplus |
||
91 | #define YY_NULLPTR nullptr |
||
92 | #else |
||
93 | #define YY_NULLPTR 0 |
||
94 | #endif |
||
95 | #endif |
||
96 | |||
97 | /* Enabling verbose error messages. */ |
||
98 | #ifdef YYERROR_VERBOSE |
||
99 | #undef YYERROR_VERBOSE |
||
100 | #define YYERROR_VERBOSE 1 |
||
101 | #else |
||
102 | #define YYERROR_VERBOSE 0 |
||
103 | #endif |
||
104 | |||
105 | /* In a future release of Bison, this section will be replaced |
||
106 | by #include "protel_yacc.h". */ |
||
107 | #ifndef YY_YY_PROTEL_YACC_H_INCLUDED |
||
108 | #define YY_YY_PROTEL_YACC_H_INCLUDED |
||
109 | /* Debug traces. */ |
||
110 | #ifndef YYDEBUG |
||
111 | #define YYDEBUG 0 |
||
112 | #endif |
||
113 | #if YYDEBUG |
||
114 | extern int yydebug; |
||
115 | #endif |
||
116 | |||
117 | /* Token type. */ |
||
118 | #ifndef YYTOKENTYPE |
||
119 | #define YYTOKENTYPE |
||
120 | enum yytokentype |
||
121 | { |
||
122 | SPC = 258, |
||
123 | NL = 259, |
||
124 | LBRK = 260, |
||
125 | RBRK = 261, |
||
126 | LB2 = 262, |
||
127 | RB2 = 263, |
||
128 | MINUS = 264, |
||
129 | ASTERISK = 265, |
||
130 | PROTEL = 266, |
||
131 | NETLIST = 267, |
||
132 | VERSION = 268, |
||
133 | ASTRING = 269 |
||
134 | }; |
||
135 | #endif |
||
136 | /* Tokens. */ |
||
137 | #define SPC 258 |
||
138 | #define NL 259 |
||
139 | #define LBRK 260 |
||
140 | #define RBRK 261 |
||
141 | #define LB2 262 |
||
142 | #define RB2 263 |
||
143 | #define MINUS 264 |
||
144 | #define ASTERISK 265 |
||
145 | #define PROTEL 266 |
||
146 | #define NETLIST 267 |
||
147 | #define VERSION 268 |
||
148 | #define ASTRING 269 |
||
149 | |||
150 | /* Value type. */ |
||
151 | #if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED |
||
152 | |||
153 | union YYSTYPE |
||
154 | { |
||
155 | #line 29 "protel_yacc.y" /* yacc.c:355 */ |
||
156 | char *string; |
||
157 | |||
158 | #line 166 "protel_yacc.c" /* yacc.c:355 */ |
||
159 | }; |
||
160 | |||
161 | typedef union YYSTYPE YYSTYPE; |
||
162 | #define YYSTYPE_IS_TRIVIAL 1 |
||
163 | #define YYSTYPE_IS_DECLARED 1 |
||
164 | #endif |
||
165 | |||
166 | extern YYSTYPE yylval; |
||
167 | |||
168 | int yyparse (void); |
||
169 | |||
170 | #endif /* !YY_YY_PROTEL_YACC_H_INCLUDED */ |
||
171 | |||
172 | /* Copy the second part of user declarations. */ |
||
173 | |||
174 | #line 183 "protel_yacc.c" /* yacc.c:358 */ |
||
175 | |||
176 | #ifdef short |
||
177 | #undef short |
||
178 | #endif |
||
179 | |||
180 | #ifdef YYTYPE_UINT8 |
||
181 | typedef YYTYPE_UINT8 yytype_uint8; |
||
182 | #else |
||
183 | typedef unsigned char yytype_uint8; |
||
184 | #endif |
||
185 | |||
186 | #ifdef YYTYPE_INT8 |
||
187 | typedef YYTYPE_INT8 yytype_int8; |
||
188 | #else |
||
189 | typedef signed char yytype_int8; |
||
190 | #endif |
||
191 | |||
192 | #ifdef YYTYPE_UINT16 |
||
193 | typedef YYTYPE_UINT16 yytype_uint16; |
||
194 | #else |
||
195 | typedef unsigned short int yytype_uint16; |
||
196 | #endif |
||
197 | |||
198 | #ifdef YYTYPE_INT16 |
||
199 | typedef YYTYPE_INT16 yytype_int16; |
||
200 | #else |
||
201 | typedef short int yytype_int16; |
||
202 | #endif |
||
203 | |||
204 | #ifndef YYSIZE_T |
||
205 | #ifdef __SIZE_TYPE__ |
||
206 | #define YYSIZE_T __SIZE_TYPE__ |
||
207 | #elif defined size_t |
||
208 | #define YYSIZE_T size_t |
||
209 | #elif !defined YYSIZE_T |
||
210 | #include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
||
211 | #define YYSIZE_T size_t |
||
212 | #else |
||
213 | #define YYSIZE_T unsigned int |
||
214 | #endif |
||
215 | #endif |
||
216 | |||
217 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
||
218 | |||
219 | #ifndef YY_ |
||
220 | #if defined YYENABLE_NLS && YYENABLE_NLS |
||
221 | #if ENABLE_NLS |
||
222 | #include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
||
223 | #define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
||
224 | #endif |
||
225 | #endif |
||
226 | #ifndef YY_ |
||
227 | #define YY_(Msgid) Msgid |
||
228 | #endif |
||
229 | #endif |
||
230 | |||
231 | #ifndef YY_ATTRIBUTE |
||
232 | #if (defined __GNUC__ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) || \ |
||
233 | defined __SUNPRO_C && 0x5110 <= __SUNPRO_C |
||
234 | #define YY_ATTRIBUTE(Spec) __attribute__ (Spec) |
||
235 | #else |
||
236 | #define YY_ATTRIBUTE(Spec) /* empty */ |
||
237 | #endif |
||
238 | #endif |
||
239 | |||
240 | #ifndef YY_ATTRIBUTE_PURE |
||
241 | #define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) |
||
242 | #endif |
||
243 | |||
244 | #ifndef YY_ATTRIBUTE_UNUSED |
||
245 | #define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) |
||
246 | #endif |
||
247 | |||
248 | #if !defined _Noreturn && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) |
||
249 | #if defined _MSC_VER && 1200 <= _MSC_VER |
||
250 | #define _Noreturn __declspec(noreturn) |
||
251 | #else |
||
252 | #define _Noreturn YY_ATTRIBUTE((__noreturn__)) |
||
253 | #endif |
||
254 | #endif |
||
255 | |||
256 | /* Suppress unused-variable warnings by "using" E. */ |
||
257 | #if !defined lint || defined __GNUC__ |
||
258 | #define YYUSE(E) ((void) (E)) |
||
259 | #else |
||
260 | #define YYUSE(E) /* empty */ |
||
261 | #endif |
||
262 | |||
263 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ |
||
264 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
||
265 | #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
||
266 | _Pragma ("GCC diagnostic push") _Pragma ("GCC diagnostic ignored " \ |
||
267 | "\"-Wuninitialized\"") \ |
||
268 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
||
269 | #define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma ("GCC diagnostic pop") |
||
270 | #else |
||
271 | #define YY_INITIAL_VALUE(Value) Value |
||
272 | #endif |
||
273 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
||
274 | #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
||
275 | #define YY_IGNORE_MAYBE_UNINITIALIZED_END |
||
276 | #endif |
||
277 | #ifndef YY_INITIAL_VALUE |
||
278 | #define YY_INITIAL_VALUE(Value) /* Nothing. */ |
||
279 | #endif |
||
280 | |||
281 | #if !defined yyoverflow || YYERROR_VERBOSE |
||
282 | |||
283 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
||
284 | |||
285 | #ifdef YYSTACK_USE_ALLOCA |
||
286 | #if YYSTACK_USE_ALLOCA |
||
287 | #ifdef __GNUC__ |
||
288 | #define YYSTACK_ALLOC __builtin_alloca |
||
289 | #elif defined __BUILTIN_VA_ARG_INCR |
||
290 | #include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
||
291 | #elif defined _AIX |
||
292 | #define YYSTACK_ALLOC __alloca |
||
293 | #elif defined _MSC_VER |
||
294 | #include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
||
295 | #define alloca _alloca |
||
296 | #else |
||
297 | #define YYSTACK_ALLOC alloca |
||
298 | #if !defined _ALLOCA_H && !defined EXIT_SUCCESS |
||
299 | #include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
||
300 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
||
301 | #ifndef EXIT_SUCCESS |
||
302 | #define EXIT_SUCCESS 0 |
||
303 | #endif |
||
304 | #endif |
||
305 | #endif |
||
306 | #endif |
||
307 | #endif |
||
308 | |||
309 | #ifdef YYSTACK_ALLOC |
||
310 | /* Pacify GCC's 'empty if-body' warning. */ |
||
311 | #define YYSTACK_FREE(Ptr) \ |
||
312 | do \ |
||
313 | { /* empty */ \ |
||
314 | ; \ |
||
315 | } while (0) |
||
316 | #ifndef YYSTACK_ALLOC_MAXIMUM |
||
317 | /* The OS might guarantee only one guard page at the bottom of the stack, |
||
318 | and a page size can be as small as 4096 bytes. So we cannot safely |
||
319 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
||
320 | to allow for a few compiler-allocated temporary stack slots. */ |
||
321 | #define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
||
322 | #endif |
||
323 | #else |
||
324 | #define YYSTACK_ALLOC YYMALLOC |
||
325 | #define YYSTACK_FREE YYFREE |
||
326 | #ifndef YYSTACK_ALLOC_MAXIMUM |
||
327 | #define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
||
328 | #endif |
||
329 | #if ( \ |
||
330 | defined __cplusplus && !defined EXIT_SUCCESS && \ |
||
331 | !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free))) |
||
332 | #include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
||
333 | #ifndef EXIT_SUCCESS |
||
334 | #define EXIT_SUCCESS 0 |
||
335 | #endif |
||
336 | #endif |
||
337 | #ifndef YYMALLOC |
||
338 | #define YYMALLOC malloc |
||
339 | #if !defined malloc && !defined EXIT_SUCCESS |
||
340 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
||
341 | #endif |
||
342 | #endif |
||
343 | #ifndef YYFREE |
||
344 | #define YYFREE free |
||
345 | #if !defined free && !defined EXIT_SUCCESS |
||
346 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
||
347 | #endif |
||
348 | #endif |
||
349 | #endif |
||
350 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
||
351 | |||
352 | #if ( \ |
||
353 | !defined yyoverflow && \ |
||
354 | (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
||
355 | |||
356 | /* A type that is properly aligned for any stack member. */ |
||
357 | union yyalloc |
||
358 | { |
||
359 | yytype_int16 yyss_alloc; |
||
360 | YYSTYPE yyvs_alloc; |
||
361 | }; |
||
362 | |||
363 | /* The size of the maximum gap between one aligned stack and the next. */ |
||
364 | #define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
||
365 | |||
366 | /* The size of an array large to enough to hold all stacks, each with |
||
367 | N elements. */ |
||
368 | #define YYSTACK_BYTES(N) \ |
||
369 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) + YYSTACK_GAP_MAXIMUM) |
||
370 | |||
371 | #define YYCOPY_NEEDED 1 |
||
372 | |||
373 | /* Relocate STACK from its old location to the new one. The |
||
374 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
||
375 | elements in the stack, and YYPTR gives the new location of the |
||
376 | stack. Advance YYPTR to a properly aligned location for the next |
||
377 | stack. */ |
||
378 | #define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
||
379 | do \ |
||
380 | { \ |
||
381 | YYSIZE_T yynewbytes; \ |
||
382 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
||
383 | Stack = &yyptr->Stack_alloc; \ |
||
384 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
||
385 | yyptr += yynewbytes / sizeof (*yyptr); \ |
||
386 | } while (0) |
||
387 | |||
388 | #endif |
||
389 | |||
390 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
||
391 | /* Copy COUNT objects from SRC to DST. The source and destination do |
||
392 | not overlap. */ |
||
393 | #ifndef YYCOPY |
||
394 | #if defined __GNUC__ && 1 < __GNUC__ |
||
395 | #define YYCOPY(Dst, Src, Count) __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) |
||
396 | #else |
||
397 | #define YYCOPY(Dst, Src, Count) \ |
||
398 | do \ |
||
399 | { \ |
||
400 | YYSIZE_T yyi; \ |
||
401 | for (yyi = 0; yyi < (Count); yyi++) \ |
||
402 | (Dst)[yyi] = (Src)[yyi]; \ |
||
403 | } while (0) |
||
404 | #endif |
||
405 | #endif |
||
406 | #endif /* !YYCOPY_NEEDED */ |
||
407 | |||
408 | /* YYFINAL -- State number of the termination state. */ |
||
409 | #define YYFINAL 5 |
||
410 | /* YYLAST -- Last index in YYTABLE. */ |
||
411 | #define YYLAST 46 |
||
412 | |||
413 | /* YYNTOKENS -- Number of terminals. */ |
||
414 | #define YYNTOKENS 15 |
||
415 | /* YYNNTS -- Number of nonterminals. */ |
||
416 | #define YYNNTS 16 |
||
417 | /* YYNRULES -- Number of rules. */ |
||
418 | #define YYNRULES 24 |
||
419 | /* YYNSTATES -- Number of states. */ |
||
420 | #define YYNSTATES 58 |
||
421 | |||
422 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned |
||
423 | by yylex, with out-of-bounds checking. */ |
||
424 | #define YYUNDEFTOK 2 |
||
425 | #define YYMAXUTOK 269 |
||
426 | |||
427 | #define YYTRANSLATE(YYX) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
||
428 | |||
429 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
||
430 | as returned by yylex, without out-of-bounds checking. */ |
||
431 | static const yytype_uint8 yytranslate[] = { |
||
432 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
433 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
434 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
435 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
436 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
437 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
438 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
439 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
440 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||
441 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; |
||
442 | |||
443 | #if YYDEBUG |
||
444 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
||
445 | static const yytype_uint8 yyrline[] = {0, 35, 35, 37, 39, 40, 44, 45, 49, 52, 54, 57, 61, |
||
446 | 64, 65, 66, 69, 70, 74, 75, 78, 79, 80, 86, 92}; |
||
447 | #endif |
||
448 | |||
449 | #if YYDEBUG || YYERROR_VERBOSE || 0 |
||
450 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
||
451 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
||
452 | static const char *const yytname[] = { |
||
453 | "$end", "error", "$undefined", "SPC", "NL", "LBRK", |
||
454 | "RBRK", "LB2", "RB2", "MINUS", "ASTERISK", "PROTEL", |
||
455 | "NETLIST", "VERSION", "ASTRING", "$accept", "protelfile", "version", |
||
456 | "objects", "object", "component_obj", "comp_ident", "comp_type", "comp_value", |
||
457 | "net_obj", "pin_list", "net_ident", "skip_line", "skip_lines", "socket_pin", |
||
458 | "socket_ident", YY_NULLPTR}; |
||
459 | #endif |
||
460 | |||
461 | #ifdef YYPRINT |
||
462 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
||
463 | (internal) symbol number NUM (which must be that of a token). */ |
||
464 | static const yytype_uint16 yytoknum[] = { |
||
465 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269}; |
||
466 | #endif |
||
467 | |||
468 | #define YYPACT_NINF -28 |
||
469 | |||
470 | #define yypact_value_is_default(Yystate) (!!((Yystate) == (-28))) |
||
471 | |||
472 | #define YYTABLE_NINF -1 |
||
473 | |||
474 | #define yytable_value_is_error(Yytable_value) 0 |
||
475 | |||
476 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
||
477 | STATE-NUM. */ |
||
478 | static const yytype_int8 yypact[] = { |
||
479 | -7, 3, 11, -2, 0, -28, -1, 10, -2, -28, -28, -28, 12, 13, 2, -28, 5, 7, 14, 15, |
||
480 | 16, -28, 18, 17, 19, -28, 20, -28, -28, -6, -28, 21, 22, 23, -28, 24, 25, -28, 28, -28, |
||
481 | 31, -28, 26, 32, 27, -28, 33, 6, 38, -28, -28, -3, -28, 39, -28, 40, 41, -28}; |
||
482 | |||
483 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
||
484 | Performed when YYTABLE does not specify something else to do. Zero |
||
485 | means the default is an error. */ |
||
486 | static const yytype_uint8 yydefact[] = {0, 0, 0, 0, 0, 1, 0, 0, 2, 5, 6, 7, 0, 0, 0, |
||
487 | 4, 0, 0, 16, 0, 0, 9, 0, 0, 15, 3, 0, 17, 24, 0, |
||
488 | 14, 0, 0, 0, 13, 0, 0, 12, 0, 11, 0, 23, 0, 0, 0, |
||
489 | 10, 0, 22, 0, 18, 21, 0, 19, 0, 20, 0, 0, 8}; |
||
490 | |||
491 | /* YYPGOTO[NTERM-NUM]. */ |
||
492 | static const yytype_int8 yypgoto[] = { |
||
493 | -28, -28, -28, -28, 36, -28, -28, -28, -28, -28, -28, -28, -27, -28, -4, -28}; |
||
494 | |||
495 | /* YYDEFGOTO[NTERM-NUM]. */ |
||
496 | static const yytype_int8 yydefgoto[] = { |
||
497 | -1, 2, 3, 8, 9, 10, 22, 46, 40, 11, 29, 19, 50, 51, 30, 31}; |
||
498 | |||
499 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
||
500 | positive, shift that token. If negative, reduce the rule whose |
||
501 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
||
502 | static const yytype_uint8 yytable[] = {48, 49, 33, 6, 1, 7, 4, 53, 28, 48, 49, 5, |
||
503 | 12, 13, 14, 16, 18, 17, 20, 24, 25, 21, 26, 23, |
||
504 | 54, 34, 36, 37, 0, 0, 35, 27, 41, 28, 32, 42, |
||
505 | 44, 47, 38, 39, 43, 45, 52, 55, 15, 57, 56}; |
||
506 | |||
507 | static const yytype_int8 yycheck[] = { |
||
508 | 3, 4, 8, 5, 11, 7, 3, 10, 14, 3, 4, 0, 12, 14, 4, 3, 14, 4, 13, 4, 4, 14, 4, 9, |
||
509 | 51, 29, 4, 4, -1, -1, 9, 14, 4, 14, 14, 4, 4, 4, 14, 14, 14, 14, 4, 4, 8, 4, 6}; |
||
510 | |||
511 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
||
512 | symbol of state STATE-NUM. */ |
||
513 | static const yytype_uint8 yystos[] = { |
||
514 | 0, 11, 16, 17, 3, 0, 5, 7, 18, 19, 20, 24, 12, 14, 4, 19, 3, 4, 14, 26, |
||
515 | 13, 14, 21, 9, 4, 4, 4, 14, 14, 25, 29, 30, 14, 8, 29, 9, 4, 4, 14, 14, |
||
516 | 23, 4, 4, 14, 4, 14, 22, 4, 3, 4, 27, 28, 4, 10, 27, 4, 6, 4}; |
||
517 | |||
518 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
||
519 | static const yytype_uint8 yyr1[] = {0, 15, 16, 17, 18, 18, 19, 19, 20, 21, 22, 23, 24, |
||
520 | 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 29, 30}; |
||
521 | |||
522 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
||
523 | static const yytype_uint8 yyr2[] = {0, 2, 2, 6, 2, 1, 1, 1, 18, 1, 1, 1, 7, |
||
524 | 2, 1, 0, 1, 3, 1, 2, 2, 1, 0, 4, 1}; |
||
525 | |||
526 | #define yyerrok (yyerrstatus = 0) |
||
527 | #define yyclearin (yychar = YYEMPTY) |
||
528 | #define YYEMPTY (-2) |
||
529 | #define YYEOF 0 |
||
530 | |||
531 | #define YYACCEPT goto yyacceptlab |
||
532 | #define YYABORT goto yyabortlab |
||
533 | #define YYERROR goto yyerrorlab |
||
534 | |||
535 | #define YYRECOVERING() (!!yyerrstatus) |
||
536 | |||
537 | #define YYBACKUP(Token, Value) \ |
||
538 | do \ |
||
539 | if (yychar == YYEMPTY) \ |
||
540 | { \ |
||
541 | yychar = (Token); \ |
||
542 | yylval = (Value); \ |
||
543 | YYPOPSTACK (yylen); \ |
||
544 | yystate = *yyssp; \ |
||
545 | goto yybackup; \ |
||
546 | } \ |
||
547 | else \ |
||
548 | { \ |
||
549 | yyerror (YY_ ("syntax error: cannot back up")); \ |
||
550 | YYERROR; \ |
||
551 | } \ |
||
552 | while (0) |
||
553 | |||
554 | /* Error token number */ |
||
555 | #define YYTERROR 1 |
||
556 | #define YYERRCODE 256 |
||
557 | |||
558 | /* Enable debugging if requested. */ |
||
559 | #if YYDEBUG |
||
560 | |||
561 | #ifndef YYFPRINTF |
||
562 | #include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
||
563 | #define YYFPRINTF fprintf |
||
564 | #endif |
||
565 | |||
566 | #define YYDPRINTF(Args) \ |
||
567 | do \ |
||
568 | { \ |
||
569 | if (yydebug) \ |
||
570 | YYFPRINTF Args; \ |
||
571 | } while (0) |
||
572 | |||
573 | /* This macro is provided for backward compatibility. */ |
||
574 | #ifndef YY_LOCATION_PRINT |
||
575 | #define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
||
576 | #endif |
||
577 | |||
578 | #define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
||
579 | do \ |
||
580 | { \ |
||
581 | if (yydebug) \ |
||
582 | { \ |
||
583 | YYFPRINTF (stderr, "%s ", Title); \ |
||
584 | yy_symbol_print (stderr, Type, Value); \ |
||
585 | YYFPRINTF (stderr, "\n"); \ |
||
586 | } \ |
||
587 | } while (0) |
||
588 | |||
589 | /*----------------------------------------. |
||
590 | | Print this symbol's value on YYOUTPUT. | |
||
591 | `----------------------------------------*/ |
||
592 | |||
593 | static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep) |
||
594 | { |
||
595 | FILE *yyo = yyoutput; |
||
596 | YYUSE (yyo); |
||
597 | if (!yyvaluep) |
||
598 | return; |
||
599 | #ifdef YYPRINT |
||
600 | if (yytype < YYNTOKENS) |
||
601 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
||
602 | #endif |
||
603 | YYUSE (yytype); |
||
604 | } |
||
605 | |||
606 | /*--------------------------------. |
||
607 | | Print this symbol on YYOUTPUT. | |
||
608 | `--------------------------------*/ |
||
609 | |||
610 | static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep) |
||
611 | { |
||
612 | YYFPRINTF ( |
||
613 | yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); |
||
614 | |||
615 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
||
616 | YYFPRINTF (yyoutput, ")"); |
||
617 | } |
||
618 | |||
619 | /*------------------------------------------------------------------. |
||
620 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
||
621 | | TOP (included). | |
||
622 | `------------------------------------------------------------------*/ |
||
623 | |||
624 | static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
||
625 | { |
||
626 | YYFPRINTF (stderr, "Stack now"); |
||
627 | for (; yybottom <= yytop; yybottom++) |
||
628 | { |
||
629 | int yybot = *yybottom; |
||
630 | YYFPRINTF (stderr, " %d", yybot); |
||
631 | } |
||
632 | YYFPRINTF (stderr, "\n"); |
||
633 | } |
||
634 | |||
635 | #define YY_STACK_PRINT(Bottom, Top) \ |
||
636 | do \ |
||
637 | { \ |
||
638 | if (yydebug) \ |
||
639 | yy_stack_print ((Bottom), (Top)); \ |
||
640 | } while (0) |
||
641 | |||
642 | /*------------------------------------------------. |
||
643 | | Report that the YYRULE is going to be reduced. | |
||
644 | `------------------------------------------------*/ |
||
645 | |||
646 | static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) |
||
647 | { |
||
648 | unsigned long int yylno = yyrline[yyrule]; |
||
649 | int yynrhs = yyr2[yyrule]; |
||
650 | int yyi; |
||
651 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); |
||
652 | /* The symbols being reduced. */ |
||
653 | for (yyi = 0; yyi < yynrhs; yyi++) |
||
654 | { |
||
655 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
||
656 | yy_symbol_print ( |
||
657 | stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)])); |
||
658 | YYFPRINTF (stderr, "\n"); |
||
659 | } |
||
660 | } |
||
661 | |||
662 | #define YY_REDUCE_PRINT(Rule) \ |
||
663 | do \ |
||
664 | { \ |
||
665 | if (yydebug) \ |
||
666 | yy_reduce_print (yyssp, yyvsp, Rule); \ |
||
667 | } while (0) |
||
668 | |||
669 | /* Nonzero means print parse trace. It is left uninitialized so that |
||
670 | multiple parsers can coexist. */ |
||
671 | int yydebug; |
||
672 | #else /* !YYDEBUG */ |
||
673 | #define YYDPRINTF(Args) |
||
674 | #define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
||
675 | #define YY_STACK_PRINT(Bottom, Top) |
||
676 | #define YY_REDUCE_PRINT(Rule) |
||
677 | #endif /* !YYDEBUG */ |
||
678 | |||
679 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
||
680 | #ifndef YYINITDEPTH |
||
681 | #define YYINITDEPTH 200 |
||
682 | #endif |
||
683 | |||
684 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
||
685 | if the built-in stack extension method is used). |
||
686 | |||
687 | Do not make this value too large; the results are undefined if |
||
688 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
||
689 | evaluated with infinite-precision integer arithmetic. */ |
||
690 | |||
691 | #ifndef YYMAXDEPTH |
||
692 | #define YYMAXDEPTH 10000 |
||
693 | #endif |
||
694 | |||
695 | #if YYERROR_VERBOSE |
||
696 | |||
697 | #ifndef yystrlen |
||
698 | #if defined __GLIBC__ && defined _STRING_H |
||
699 | #define yystrlen strlen |
||
700 | #else |
||
701 | /* Return the length of YYSTR. */ |
||
702 | static YYSIZE_T yystrlen (const char *yystr) |
||
703 | { |
||
704 | YYSIZE_T yylen; |
||
705 | for (yylen = 0; yystr[yylen]; yylen++) |
||
706 | continue; |
||
707 | return yylen; |
||
708 | } |
||
709 | #endif |
||
710 | #endif |
||
711 | |||
712 | #ifndef yystpcpy |
||
713 | #if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
||
714 | #define yystpcpy stpcpy |
||
715 | #else |
||
716 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
||
717 | YYDEST. */ |
||
718 | static char *yystpcpy (char *yydest, const char *yysrc) |
||
719 | { |
||
720 | char *yyd = yydest; |
||
721 | const char *yys = yysrc; |
||
722 | |||
723 | while ((*yyd++ = *yys++) != '\0') |
||
724 | continue; |
||
725 | |||
726 | return yyd - 1; |
||
727 | } |
||
728 | #endif |
||
729 | #endif |
||
730 | |||
731 | #ifndef yytnamerr |
||
732 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
||
733 | quotes and backslashes, so that it's suitable for yyerror. The |
||
734 | heuristic is that double-quoting is unnecessary unless the string |
||
735 | contains an apostrophe, a comma, or backslash (other than |
||
736 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
||
737 | null, do not copy; instead, return the length of what the result |
||
738 | would have been. */ |
||
739 | static YYSIZE_T yytnamerr (char *yyres, const char *yystr) |
||
740 | { |
||
741 | if (*yystr == '"') |
||
742 | { |
||
743 | YYSIZE_T yyn = 0; |
||
744 | char const *yyp = yystr; |
||
745 | |||
746 | for (;;) |
||
747 | switch (*++yyp) |
||
748 | { |
||
749 | case '\'': |
||
750 | case ',': |
||
751 | goto do_not_strip_quotes; |
||
752 | |||
753 | case '\\': |
||
754 | if (*++yyp != '\\') |
||
755 | goto do_not_strip_quotes; |
||
756 | /* Fall through. */ |
||
757 | default: |
||
758 | if (yyres) |
||
759 | yyres[yyn] = *yyp; |
||
760 | yyn++; |
||
761 | break; |
||
762 | |||
763 | case '"': |
||
764 | if (yyres) |
||
765 | yyres[yyn] = '\0'; |
||
766 | return yyn; |
||
767 | } |
||
768 | do_not_strip_quotes:; |
||
769 | } |
||
770 | |||
771 | if (!yyres) |
||
772 | return yystrlen (yystr); |
||
773 | |||
774 | return yystpcpy (yyres, yystr) - yyres; |
||
775 | } |
||
776 | #endif |
||
777 | |||
778 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
||
779 | about the unexpected token YYTOKEN for the state stack whose top is |
||
780 | YYSSP. |
||
781 | |||
782 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
||
783 | not large enough to hold the message. In that case, also set |
||
784 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
||
785 | required number of bytes is too large to store. */ |
||
786 | static int |
||
787 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) |
||
788 | { |
||
789 | YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); |
||
790 | YYSIZE_T yysize = yysize0; |
||
791 | enum |
||
792 | { |
||
793 | YYERROR_VERBOSE_ARGS_MAXIMUM = 5 |
||
794 | }; |
||
795 | /* Internationalized format string. */ |
||
796 | const char *yyformat = YY_NULLPTR; |
||
797 | /* Arguments of yyformat. */ |
||
798 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
||
799 | /* Number of reported tokens (one for the "unexpected", one per |
||
800 | "expected"). */ |
||
801 | int yycount = 0; |
||
802 | |||
803 | /* There are many possibilities here to consider: |
||
804 | - If this state is a consistent state with a default action, then |
||
805 | the only way this function was invoked is if the default action |
||
806 | is an error action. In that case, don't check for expected |
||
807 | tokens because there are none. |
||
808 | - The only way there can be no lookahead present (in yychar) is if |
||
809 | this state is a consistent state with a default action. Thus, |
||
810 | detecting the absence of a lookahead is sufficient to determine |
||
811 | that there is no unexpected or expected token to report. In that |
||
812 | case, just report a simple "syntax error". |
||
813 | - Don't assume there isn't a lookahead just because this state is a |
||
814 | consistent state with a default action. There might have been a |
||
815 | previous inconsistent state, consistent state with a non-default |
||
816 | action, or user semantic action that manipulated yychar. |
||
817 | - Of course, the expected token list depends on states to have |
||
818 | correct lookahead information, and it depends on the parser not |
||
819 | to perform extra reductions after fetching a lookahead from the |
||
820 | scanner and before detecting a syntax error. Thus, state merging |
||
821 | (from LALR or IELR) and default reductions corrupt the expected |
||
822 | token list. However, the list is correct for canonical LR with |
||
823 | one exception: it will still contain any token that will not be |
||
824 | accepted due to an error action in a later state. |
||
825 | */ |
||
826 | if (yytoken != YYEMPTY) |
||
827 | { |
||
828 | int yyn = yypact[*yyssp]; |
||
829 | yyarg[yycount++] = yytname[yytoken]; |
||
830 | if (!yypact_value_is_default (yyn)) |
||
831 | { |
||
832 | /* Start YYX at -YYN if negative to avoid negative indexes in |
||
833 | YYCHECK. In other words, skip the first -YYN actions for |
||
834 | this state because they are default actions. */ |
||
835 | int yyxbegin = yyn < 0 ? -yyn : 0; |
||
836 | /* Stay within bounds of both yycheck and yytname. */ |
||
837 | int yychecklim = YYLAST - yyn + 1; |
||
838 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
||
839 | int yyx; |
||
840 | |||
841 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
||
842 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && |
||
843 | !yytable_value_is_error (yytable[yyx + yyn])) |
||
844 | { |
||
845 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
||
846 | { |
||
847 | yycount = 1; |
||
848 | yysize = yysize0; |
||
849 | break; |
||
850 | } |
||
851 | yyarg[yycount++] = yytname[yyx]; |
||
852 | { |
||
853 | YYSIZE_T yysize1 = |
||
854 | yysize + |
||
855 | yytnamerr (YY_NULLPTR, yytname[yyx]); |
||
856 | if (!(yysize <= yysize1 && |
||
857 | yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
||
858 | return 2; |
||
859 | yysize = yysize1; |
||
860 | } |
||
861 | } |
||
862 | } |
||
863 | } |
||
864 | |||
865 | switch (yycount) |
||
866 | { |
||
867 | #define YYCASE_(N, S) \ |
||
868 | case N: \ |
||
869 | yyformat = S; \ |
||
870 | break |
||
871 | YYCASE_ (0, YY_ ("syntax error")); |
||
872 | YYCASE_ (1, YY_ ("syntax error, unexpected %s")); |
||
873 | YYCASE_ (2, YY_ ("syntax error, unexpected %s, expecting %s")); |
||
874 | YYCASE_ (3, YY_ ("syntax error, unexpected %s, expecting %s or %s")); |
||
875 | YYCASE_ (4, YY_ ("syntax error, unexpected %s, expecting %s or %s or %s")); |
||
876 | YYCASE_ ( |
||
877 | 5, YY_ ("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
||
878 | #undef YYCASE_ |
||
879 | } |
||
880 | |||
881 | { |
||
882 | YYSIZE_T yysize1 = yysize + yystrlen (yyformat); |
||
883 | if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
||
884 | return 2; |
||
885 | yysize = yysize1; |
||
886 | } |
||
887 | |||
888 | if (*yymsg_alloc < yysize) |
||
889 | { |
||
890 | *yymsg_alloc = 2 * yysize; |
||
891 | if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
||
892 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
||
893 | return 1; |
||
894 | } |
||
895 | |||
896 | /* Avoid sprintf, as that infringes on the user's name space. |
||
897 | Don't have undefined behavior even if the translation |
||
898 | produced a string with the wrong number of "%s"s. */ |
||
899 | { |
||
900 | char *yyp = *yymsg; |
||
901 | int yyi = 0; |
||
902 | while ((*yyp = *yyformat) != '\0') |
||
903 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
||
904 | { |
||
905 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
||
906 | yyformat += 2; |
||
907 | } |
||
908 | else |
||
909 | { |
||
910 | yyp++; |
||
911 | yyformat++; |
||
912 | } |
||
913 | } |
||
914 | return 0; |
||
915 | } |
||
916 | #endif /* YYERROR_VERBOSE */ |
||
917 | |||
918 | /*-----------------------------------------------. |
||
919 | | Release the memory associated to this symbol. | |
||
920 | `-----------------------------------------------*/ |
||
921 | |||
922 | static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
||
923 | { |
||
924 | YYUSE (yyvaluep); |
||
925 | if (!yymsg) |
||
926 | yymsg = "Deleting"; |
||
927 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
||
928 | |||
929 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
||
930 | YYUSE (yytype); |
||
931 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
||
932 | } |
||
933 | |||
934 | /* The lookahead symbol. */ |
||
935 | int yychar; |
||
936 | |||
937 | /* The semantic value of the lookahead symbol. */ |
||
938 | YYSTYPE yylval; |
||
939 | /* Number of syntax errors so far. */ |
||
940 | int yynerrs; |
||
941 | |||
942 | /*----------. |
||
943 | | yyparse. | |
||
944 | `----------*/ |
||
945 | |||
946 | int yyparse (void) |
||
947 | { |
||
948 | int yystate; |
||
949 | /* Number of tokens to shift before error messages enabled. */ |
||
950 | int yyerrstatus; |
||
951 | |||
952 | /* The stacks and their tools: |
||
953 | 'yyss': related to states. |
||
954 | 'yyvs': related to semantic values. |
||
955 | |||
956 | Refer to the stacks through separate pointers, to allow yyoverflow |
||
957 | to reallocate them elsewhere. */ |
||
958 | |||
959 | /* The state stack. */ |
||
960 | yytype_int16 yyssa[YYINITDEPTH]; |
||
961 | yytype_int16 *yyss; |
||
962 | yytype_int16 *yyssp; |
||
963 | |||
964 | /* The semantic value stack. */ |
||
965 | YYSTYPE yyvsa[YYINITDEPTH]; |
||
966 | YYSTYPE *yyvs; |
||
967 | YYSTYPE *yyvsp; |
||
968 | |||
969 | YYSIZE_T yystacksize; |
||
970 | |||
971 | int yyn; |
||
972 | int yyresult; |
||
973 | /* Lookahead token as an internal (translated) token number. */ |
||
974 | int yytoken = 0; |
||
975 | /* The variables used to return semantic value and location from the |
||
976 | action routines. */ |
||
977 | YYSTYPE yyval; |
||
978 | |||
979 | #if YYERROR_VERBOSE |
||
980 | /* Buffer for error messages, and its allocated size. */ |
||
981 | char yymsgbuf[128]; |
||
982 | char *yymsg = yymsgbuf; |
||
983 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
||
984 | #endif |
||
985 | |||
986 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
||
987 | |||
988 | /* The number of symbols on the RHS of the reduced rule. |
||
989 | Keep to zero when no symbol should be popped. */ |
||
990 | int yylen = 0; |
||
991 | |||
992 | yyssp = yyss = yyssa; |
||
993 | yyvsp = yyvs = yyvsa; |
||
994 | yystacksize = YYINITDEPTH; |
||
995 | |||
996 | YYDPRINTF ((stderr, "Starting parse\n")); |
||
997 | |||
998 | yystate = 0; |
||
999 | yyerrstatus = 0; |
||
1000 | yynerrs = 0; |
||
1001 | yychar = YYEMPTY; /* Cause a token to be read. */ |
||
1002 | goto yysetstate; |
||
1003 | |||
1004 | /*------------------------------------------------------------. |
||
1005 | | yynewstate -- Push a new state, which is found in yystate. | |
||
1006 | `------------------------------------------------------------*/ |
||
1007 | yynewstate: |
||
1008 | /* In all cases, when you get here, the value and location stacks |
||
1009 | have just been pushed. So pushing a state here evens the stacks. */ |
||
1010 | yyssp++; |
||
1011 | |||
1012 | yysetstate: |
||
1013 | *yyssp = yystate; |
||
1014 | |||
1015 | if (yyss + yystacksize - 1 <= yyssp) |
||
1016 | { |
||
1017 | /* Get the current used size of the three stacks, in elements. */ |
||
1018 | YYSIZE_T yysize = yyssp - yyss + 1; |
||
1019 | |||
1020 | #ifdef yyoverflow |
||
1021 | { |
||
1022 | /* Give user a chance to reallocate the stack. Use copies of |
||
1023 | these so that the &'s don't force the real ones into |
||
1024 | memory. */ |
||
1025 | YYSTYPE *yyvs1 = yyvs; |
||
1026 | yytype_int16 *yyss1 = yyss; |
||
1027 | |||
1028 | /* Each stack pointer address is followed by the size of the |
||
1029 | data in use in that stack, in bytes. This used to be a |
||
1030 | conditional around just the two extra args, but that might |
||
1031 | be undefined if yyoverflow is a macro. */ |
||
1032 | yyoverflow ( |
||
1033 | YY_ ("memory exhausted"), |
||
1034 | &yyss1, |
||
1035 | yysize * sizeof (*yyssp), |
||
1036 | &yyvs1, |
||
1037 | yysize * sizeof (*yyvsp), |
||
1038 | &yystacksize); |
||
1039 | |||
1040 | yyss = yyss1; |
||
1041 | yyvs = yyvs1; |
||
1042 | } |
||
1043 | #else /* no yyoverflow */ |
||
1044 | #ifndef YYSTACK_RELOCATE |
||
1045 | goto yyexhaustedlab; |
||
1046 | #else |
||
1047 | /* Extend the stack our own way. */ |
||
1048 | if (YYMAXDEPTH <= yystacksize) |
||
1049 | goto yyexhaustedlab; |
||
1050 | yystacksize *= 2; |
||
1051 | if (YYMAXDEPTH < yystacksize) |
||
1052 | yystacksize = YYMAXDEPTH; |
||
1053 | |||
1054 | { |
||
1055 | yytype_int16 *yyss1 = yyss; |
||
1056 | union yyalloc *yyptr = |
||
1057 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
||
1058 | if (!yyptr) |
||
1059 | goto yyexhaustedlab; |
||
1060 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
||
1061 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
||
1062 | #undef YYSTACK_RELOCATE |
||
1063 | if (yyss1 != yyssa) |
||
1064 | YYSTACK_FREE (yyss1); |
||
1065 | } |
||
1066 | #endif |
||
1067 | #endif /* no yyoverflow */ |
||
1068 | |||
1069 | yyssp = yyss + yysize - 1; |
||
1070 | yyvsp = yyvs + yysize - 1; |
||
1071 | |||
1072 | YYDPRINTF (( |
||
1073 | stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); |
||
1074 | |||
1075 | if (yyss + yystacksize - 1 <= yyssp) |
||
1076 | YYABORT; |
||
1077 | } |
||
1078 | |||
1079 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
||
1080 | |||
1081 | if (yystate == YYFINAL) |
||
1082 | YYACCEPT; |
||
1083 | |||
1084 | goto yybackup; |
||
1085 | |||
1086 | /*-----------. |
||
1087 | | yybackup. | |
||
1088 | `-----------*/ |
||
1089 | yybackup: |
||
1090 | |||
1091 | /* Do appropriate processing given the current state. Read a |
||
1092 | lookahead token if we need one and don't already have one. */ |
||
1093 | |||
1094 | /* First try to decide what to do without reference to lookahead token. */ |
||
1095 | yyn = yypact[yystate]; |
||
1096 | if (yypact_value_is_default (yyn)) |
||
1097 | goto yydefault; |
||
1098 | |||
1099 | /* Not known => get a lookahead token if don't already have one. */ |
||
1100 | |||
1101 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
||
1102 | if (yychar == YYEMPTY) |
||
1103 | { |
||
1104 | YYDPRINTF ((stderr, "Reading a token: ")); |
||
1105 | yychar = yylex (); |
||
1106 | } |
||
1107 | |||
1108 | if (yychar <= YYEOF) |
||
1109 | { |
||
1110 | yychar = yytoken = YYEOF; |
||
1111 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
||
1112 | } |
||
1113 | else |
||
1114 | { |
||
1115 | yytoken = YYTRANSLATE (yychar); |
||
1116 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
||
1117 | } |
||
1118 | |||
1119 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
||
1120 | detect an error, take that action. */ |
||
1121 | yyn += yytoken; |
||
1122 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
||
1123 | goto yydefault; |
||
1124 | yyn = yytable[yyn]; |
||
1125 | if (yyn <= 0) |
||
1126 | { |
||
1127 | if (yytable_value_is_error (yyn)) |
||
1128 | goto yyerrlab; |
||
1129 | yyn = -yyn; |
||
1130 | goto yyreduce; |
||
1131 | } |
||
1132 | |||
1133 | /* Count tokens shifted since error; after three, turn off error |
||
1134 | status. */ |
||
1135 | if (yyerrstatus) |
||
1136 | yyerrstatus--; |
||
1137 | |||
1138 | /* Shift the lookahead token. */ |
||
1139 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
||
1140 | |||
1141 | /* Discard the shifted token. */ |
||
1142 | yychar = YYEMPTY; |
||
1143 | |||
1144 | yystate = yyn; |
||
1145 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
||
1146 | *++yyvsp = yylval; |
||
1147 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
||
1148 | |||
1149 | goto yynewstate; |
||
1150 | |||
1151 | /*-----------------------------------------------------------. |
||
1152 | | yydefault -- do the default action for the current state. | |
||
1153 | `-----------------------------------------------------------*/ |
||
1154 | yydefault: |
||
1155 | yyn = yydefact[yystate]; |
||
1156 | if (yyn == 0) |
||
1157 | goto yyerrlab; |
||
1158 | goto yyreduce; |
||
1159 | |||
1160 | /*-----------------------------. |
||
1161 | | yyreduce -- Do a reduction. | |
||
1162 | `-----------------------------*/ |
||
1163 | yyreduce: |
||
1164 | /* yyn is the number of a rule to reduce with. */ |
||
1165 | yylen = yyr2[yyn]; |
||
1166 | |||
1167 | /* If YYLEN is nonzero, implement the default value of the action: |
||
1168 | '$$ = $1'. |
||
1169 | |||
1170 | Otherwise, the following line sets YYVAL to garbage. |
||
1171 | This behavior is undocumented and Bison |
||
1172 | users should not rely upon it. Assigning to YYVAL |
||
1173 | unconditionally makes the parser a bit smaller, and it avoids a |
||
1174 | GCC warning that YYVAL may be used uninitialized. */ |
||
1175 | yyval = yyvsp[1 - yylen]; |
||
1176 | |||
1177 | YY_REDUCE_PRINT (yyn); |
||
1178 | switch (yyn) |
||
1179 | { |
||
1180 | case 8: |
||
1181 | #line 49 "protel_yacc.y" /* yacc.c:1646 */ |
||
1182 | { |
||
1183 | free_lex_strings (); |
||
1184 | } |
||
1185 | #line 1284 "protel_yacc.c" /* yacc.c:1646 */ |
||
1186 | break; |
||
1187 | |||
1188 | case 9: |
||
1189 | #line 52 "protel_yacc.y" /* yacc.c:1646 */ |
||
1190 | { |
||
1191 | current_chip = find_socket (Ident, (yyvsp[0].string), Create, &socket_head); |
||
1192 | } |
||
1193 | #line 1290 "protel_yacc.c" /* yacc.c:1646 */ |
||
1194 | break; |
||
1195 | |||
1196 | case 10: |
||
1197 | #line 54 "protel_yacc.y" /* yacc.c:1646 */ |
||
1198 | { |
||
1199 | set_socket (current_chip, Type, (yyvsp[0].string)); /* same type as Ident so |
||
1200 | can pick up later */ |
||
1201 | } |
||
1202 | #line 1297 "protel_yacc.c" /* yacc.c:1646 */ |
||
1203 | break; |
||
1204 | |||
1205 | case 11: |
||
1206 | #line 57 "protel_yacc.y" /* yacc.c:1646 */ |
||
1207 | { |
||
1208 | set_socket (current_chip, Value, (yyvsp[0].string)); |
||
1209 | } |
||
1210 | #line 1304 "protel_yacc.c" /* yacc.c:1646 */ |
||
1211 | break; |
||
1212 | |||
1213 | case 16: |
||
1214 | #line 69 "protel_yacc.y" /* yacc.c:1646 */ |
||
1215 | { |
||
1216 | strcpy (curr_net_nam, (yyvsp[0].string)); |
||
1217 | free_lex_strings (); |
||
1218 | } |
||
1219 | #line 1310 "protel_yacc.c" /* yacc.c:1646 */ |
||
1220 | break; |
||
1221 | |||
1222 | case 17: |
||
1223 | #line 70 "protel_yacc.y" /* yacc.c:1646 */ |
||
1224 | { |
||
1225 | sprintf (curr_net_nam, "%s-%s", (yyvsp[-2].string), (yyvsp[0].string)); |
||
1226 | } |
||
1227 | #line 1316 "protel_yacc.c" /* yacc.c:1646 */ |
||
1228 | break; |
||
1229 | |||
1230 | case 23: |
||
1231 | #line 86 "protel_yacc.y" /* yacc.c:1646 */ |
||
1232 | { |
||
1233 | define_pin ( |
||
1234 | &routed_list, |
||
1235 | current_chip, |
||
1236 | curr_net_nam, |
||
1237 | BIDIR, |
||
1238 | 0, |
||
1239 | (yyvsp[-1].string), |
||
1240 | default_vhdl_datatype, |
||
1241 | NULL); |
||
1242 | } |
||
1243 | #line 1325 "protel_yacc.c" /* yacc.c:1646 */ |
||
1244 | break; |
||
1245 | |||
1246 | case 24: |
||
1247 | #line 92 "protel_yacc.y" /* yacc.c:1646 */ |
||
1248 | { |
||
1249 | current_chip = find_socket (Ident, (yyvsp[0].string), Create, &socket_head); |
||
1250 | set_socket (current_chip, Type, (yyvsp[0].string)); /* same type as Ident so |
||
1251 | can pick up later */ |
||
1252 | } |
||
1253 | #line 1333 "protel_yacc.c" /* yacc.c:1646 */ |
||
1254 | break; |
||
1255 | |||
1256 | #line 1337 "protel_yacc.c" /* yacc.c:1646 */ |
||
1257 | default: |
||
1258 | break; |
||
1259 | } |
||
1260 | /* User semantic actions sometimes alter yychar, and that requires |
||
1261 | that yytoken be updated with the new translation. We take the |
||
1262 | approach of translating immediately before every use of yytoken. |
||
1263 | One alternative is translating here after every semantic action, |
||
1264 | but that translation would be missed if the semantic action invokes |
||
1265 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
||
1266 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
||
1267 | incorrect destructor might then be invoked immediately. In the |
||
1268 | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
||
1269 | to an incorrect destructor call or verbose syntax error message |
||
1270 | before the lookahead is translated. */ |
||
1271 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
||
1272 | |||
1273 | YYPOPSTACK (yylen); |
||
1274 | yylen = 0; |
||
1275 | YY_STACK_PRINT (yyss, yyssp); |
||
1276 | |||
1277 | *++yyvsp = yyval; |
||
1278 | |||
1279 | /* Now 'shift' the result of the reduction. Determine what state |
||
1280 | that goes to, based on the state we popped back to and the rule |
||
1281 | number reduced by. */ |
||
1282 | |||
1283 | yyn = yyr1[yyn]; |
||
1284 | |||
1285 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
||
1286 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
||
1287 | yystate = yytable[yystate]; |
||
1288 | else |
||
1289 | yystate = yydefgoto[yyn - YYNTOKENS]; |
||
1290 | |||
1291 | goto yynewstate; |
||
1292 | |||
1293 | /*--------------------------------------. |
||
1294 | | yyerrlab -- here on detecting error. | |
||
1295 | `--------------------------------------*/ |
||
1296 | yyerrlab: |
||
1297 | /* Make sure we have latest lookahead translation. See comments at |
||
1298 | user semantic actions for why this is necessary. */ |
||
1299 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); |
||
1300 | |||
1301 | /* If not already recovering from an error, report this error. */ |
||
1302 | if (!yyerrstatus) |
||
1303 | { |
||
1304 | ++yynerrs; |
||
1305 | #if !YYERROR_VERBOSE |
||
1306 | yyerror (YY_ ("syntax error")); |
||
1307 | #else |
||
1308 | #define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, yyssp, yytoken) |
||
1309 | { |
||
1310 | char const *yymsgp = YY_ ("syntax error"); |
||
1311 | int yysyntax_error_status; |
||
1312 | yysyntax_error_status = YYSYNTAX_ERROR; |
||
1313 | if (yysyntax_error_status == 0) |
||
1314 | yymsgp = yymsg; |
||
1315 | else if (yysyntax_error_status == 1) |
||
1316 | { |
||
1317 | if (yymsg != yymsgbuf) |
||
1318 | YYSTACK_FREE (yymsg); |
||
1319 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); |
||
1320 | if (!yymsg) |
||
1321 | { |
||
1322 | yymsg = yymsgbuf; |
||
1323 | yymsg_alloc = sizeof yymsgbuf; |
||
1324 | yysyntax_error_status = 2; |
||
1325 | } |
||
1326 | else |
||
1327 | { |
||
1328 | yysyntax_error_status = YYSYNTAX_ERROR; |
||
1329 | yymsgp = yymsg; |
||
1330 | } |
||
1331 | } |
||
1332 | yyerror (yymsgp); |
||
1333 | if (yysyntax_error_status == 2) |
||
1334 | goto yyexhaustedlab; |
||
1335 | } |
||
1336 | #undef YYSYNTAX_ERROR |
||
1337 | #endif |
||
1338 | } |
||
1339 | |||
1340 | if (yyerrstatus == 3) |
||
1341 | { |
||
1342 | /* If just tried and failed to reuse lookahead token after an |
||
1343 | error, discard it. */ |
||
1344 | |||
1345 | if (yychar <= YYEOF) |
||
1346 | { |
||
1347 | /* Return failure if at end of input. */ |
||
1348 | if (yychar == YYEOF) |
||
1349 | YYABORT; |
||
1350 | } |
||
1351 | else |
||
1352 | { |
||
1353 | yydestruct ("Error: discarding", yytoken, &yylval); |
||
1354 | yychar = YYEMPTY; |
||
1355 | } |
||
1356 | } |
||
1357 | |||
1358 | /* Else will try to reuse lookahead token after shifting the error |
||
1359 | token. */ |
||
1360 | goto yyerrlab1; |
||
1361 | |||
1362 | /*---------------------------------------------------. |
||
1363 | | yyerrorlab -- error raised explicitly by YYERROR. | |
||
1364 | `---------------------------------------------------*/ |
||
1365 | yyerrorlab: |
||
1366 | |||
1367 | /* Pacify compilers like GCC when the user code never invokes |
||
1368 | YYERROR and the label yyerrorlab therefore never appears in user |
||
1369 | code. */ |
||
1370 | if (/*CONSTCOND*/ 0) |
||
1371 | goto yyerrorlab; |
||
1372 | |||
1373 | /* Do not reclaim the symbols of the rule whose action triggered |
||
1374 | this YYERROR. */ |
||
1375 | YYPOPSTACK (yylen); |
||
1376 | yylen = 0; |
||
1377 | YY_STACK_PRINT (yyss, yyssp); |
||
1378 | yystate = *yyssp; |
||
1379 | goto yyerrlab1; |
||
1380 | |||
1381 | /*-------------------------------------------------------------. |
||
1382 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
||
1383 | `-------------------------------------------------------------*/ |
||
1384 | yyerrlab1: |
||
1385 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
||
1386 | |||
1387 | for (;;) |
||
1388 | { |
||
1389 | yyn = yypact[yystate]; |
||
1390 | if (!yypact_value_is_default (yyn)) |
||
1391 | { |
||
1392 | yyn += YYTERROR; |
||
1393 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
||
1394 | { |
||
1395 | yyn = yytable[yyn]; |
||
1396 | if (0 < yyn) |
||
1397 | break; |
||
1398 | } |
||
1399 | } |
||
1400 | |||
1401 | /* Pop the current state because it cannot handle the error token. */ |
||
1402 | if (yyssp == yyss) |
||
1403 | YYABORT; |
||
1404 | |||
1405 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
||
1406 | YYPOPSTACK (1); |
||
1407 | yystate = *yyssp; |
||
1408 | YY_STACK_PRINT (yyss, yyssp); |
||
1409 | } |
||
1410 | |||
1411 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
||
1412 | *++yyvsp = yylval; |
||
1413 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
||
1414 | |||
1415 | /* Shift the error token. */ |
||
1416 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
||
1417 | |||
1418 | yystate = yyn; |
||
1419 | goto yynewstate; |
||
1420 | |||
1421 | /*-------------------------------------. |
||
1422 | | yyacceptlab -- YYACCEPT comes here. | |
||
1423 | `-------------------------------------*/ |
||
1424 | yyacceptlab: |
||
1425 | yyresult = 0; |
||
1426 | goto yyreturn; |
||
1427 | |||
1428 | /*-----------------------------------. |
||
1429 | | yyabortlab -- YYABORT comes here. | |
||
1430 | `-----------------------------------*/ |
||
1431 | yyabortlab: |
||
1432 | yyresult = 1; |
||
1433 | goto yyreturn; |
||
1434 | |||
1435 | #if !defined yyoverflow || YYERROR_VERBOSE |
||
1436 | /*-------------------------------------------------. |
||
1437 | | yyexhaustedlab -- memory exhaustion comes here. | |
||
1438 | `-------------------------------------------------*/ |
||
1439 | yyexhaustedlab: |
||
1440 | yyerror (YY_ ("memory exhausted")); |
||
1441 | yyresult = 2; |
||
1442 | /* Fall through. */ |
||
1443 | #endif |
||
1444 | |||
1445 | yyreturn: |
||
1446 | if (yychar != YYEMPTY) |
||
1447 | { |
||
1448 | /* Make sure we have latest lookahead translation. See comments at |
||
1449 | user semantic actions for why this is necessary. */ |
||
1450 | yytoken = YYTRANSLATE (yychar); |
||
1451 | yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); |
||
1452 | } |
||
1453 | /* Do not reclaim the symbols of the rule whose action triggered |
||
1454 | this YYABORT or YYACCEPT. */ |
||
1455 | YYPOPSTACK (yylen); |
||
1456 | YY_STACK_PRINT (yyss, yyssp); |
||
1457 | while (yyssp != yyss) |
||
1458 | { |
||
1459 | yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); |
||
1460 | YYPOPSTACK (1); |
||
1461 | } |
||
1462 | #ifndef yyoverflow |
||
1463 | if (yyss != yyssa) |
||
1464 | YYSTACK_FREE (yyss); |
||
1465 | #endif |
||
1466 | #if YYERROR_VERBOSE |
||
1467 | if (yymsg != yymsgbuf) |
||
1468 | YYSTACK_FREE (yymsg); |
||
1469 | #endif |
||
1470 | return yyresult; |
||
1471 | } |
||
1472 | #line 97 "protel_yacc.y" /* yacc.c:1906 */ |
||
1473 | |||
1474 | /* defining lineno here */ |
||
1475 | |||
1476 | int lineno; |
||
1477 | extern char *yytext; |
||
1478 | |||
1479 | int yyerror (char *x) |
||
1480 | { |
||
1481 | int token; |
||
1482 | printf ("-- Error --> %s near string (%s) at line %d\n", x, yytext, lineno); |
||
1483 | /* for(token = yylex();token >= 0 && token!=NL;token = yylex()); */ |
||
1484 | return 1; |
||
1485 | } |
||
1486 | |||
1487 | int yywrap (void) |
||
1488 | { |
||
1489 | return 1; |
||
1490 | } |