1 | /* A Bison parser, made from vs1.0_grammar.y
|
---|
2 | by GNU bison 1.35. */
|
---|
3 |
|
---|
4 | #define YYBISON 1 /* Identify Bison output. */
|
---|
5 |
|
---|
6 | #define yyparse vs10_parse
|
---|
7 | #define yylex vs10_lex
|
---|
8 | #define yyerror vs10_error
|
---|
9 | #define yylval vs10_lval
|
---|
10 | #define yychar vs10_char
|
---|
11 | #define yydebug vs10_debug
|
---|
12 | #define yynerrs vs10_nerrs
|
---|
13 | # define VERTEX_SHADER 257
|
---|
14 | # define ADD_INSTR 258
|
---|
15 | # define DP3_INSTR 259
|
---|
16 | # define DP4_INSTR 260
|
---|
17 | # define DST_INSTR 261
|
---|
18 | # define EXP_INSTR 262
|
---|
19 | # define EXPP_INSTR 263
|
---|
20 | # define FRC_INSTR 264
|
---|
21 | # define LIT_INSTR 265
|
---|
22 | # define LOG_INSTR 266
|
---|
23 | # define LOGP_INSTR 267
|
---|
24 | # define M3X2_INSTR 268
|
---|
25 | # define M3X3_INSTR 269
|
---|
26 | # define M3X4_INSTR 270
|
---|
27 | # define M4X3_INSTR 271
|
---|
28 | # define M4X4_INSTR 272
|
---|
29 | # define MAD_INSTR 273
|
---|
30 | # define MAX_INSTR 274
|
---|
31 | # define MIN_INSTR 275
|
---|
32 | # define MOV_INSTR 276
|
---|
33 | # define MUL_INSTR 277
|
---|
34 | # define NOP_INSTR 278
|
---|
35 | # define RCP_INSTR 279
|
---|
36 | # define RSQ_INSTR 280
|
---|
37 | # define SGE_INSTR 281
|
---|
38 | # define SLT_INSTR 282
|
---|
39 | # define SUB_INSTR 283
|
---|
40 | # define ILLEGAL 284
|
---|
41 | # define UNKNOWN_STRING 285
|
---|
42 | # define INTVAL 286
|
---|
43 | # define REGISTER 287
|
---|
44 | # define XYZW_MODIFIER 288
|
---|
45 | # define COMMENT 289
|
---|
46 |
|
---|
47 | #line 2 "vs1.0_grammar.y"
|
---|
48 |
|
---|
49 | void yyerror(char *s);
|
---|
50 | int yylex(void);
|
---|
51 |
|
---|
52 | #include <math.h>
|
---|
53 | #include <string>
|
---|
54 |
|
---|
55 | #include <stdlib.h>
|
---|
56 | #include "vs1.0_inst_list.h"
|
---|
57 | #include "nvparse_errors.h"
|
---|
58 | #include "nvparse_externs.h"
|
---|
59 |
|
---|
60 | //extern bool gbTempInsideMacro;
|
---|
61 | //extern unsigned int &base_linenumber;
|
---|
62 | void LexError(char *format, ...);
|
---|
63 | extern int line_incr;
|
---|
64 |
|
---|
65 | #define do_linenum_incr() { line_number+=line_incr; line_incr = 0; }
|
---|
66 | //int get_linenum() { return( gbTempInsideMacro ? base_linenumber : line_number ); }
|
---|
67 | int get_linenum() { return( line_number ); }
|
---|
68 |
|
---|
69 | #define YYDEBUG 1
|
---|
70 |
|
---|
71 |
|
---|
72 | #line 26 "vs1.0_grammar.y"
|
---|
73 | #ifndef YYSTYPE
|
---|
74 | typedef union {
|
---|
75 | int ival;
|
---|
76 | unsigned int lval;
|
---|
77 | float fval;
|
---|
78 | char mask[4];
|
---|
79 | char *comment;
|
---|
80 | VS10Reg reg;
|
---|
81 | VS10InstPtr inst;
|
---|
82 | VS10InstListPtr instList;
|
---|
83 | } yystype;
|
---|
84 | # define YYSTYPE yystype
|
---|
85 | # define YYSTYPE_IS_TRIVIAL 1
|
---|
86 | #endif
|
---|
87 | #ifndef YYDEBUG
|
---|
88 | # define YYDEBUG 0
|
---|
89 | #endif
|
---|
90 |
|
---|
91 |
|
---|
92 |
|
---|
93 | #define YYFINAL 103
|
---|
94 | #define YYFLAG -32768
|
---|
95 | #define YYNTBASE 44
|
---|
96 |
|
---|
97 | /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
---|
98 | #define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 61)
|
---|
99 |
|
---|
100 | /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
---|
101 | static const char yytranslate[] =
|
---|
102 | {
|
---|
103 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
104 | 36, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
105 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
106 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
107 | 2, 2, 2, 43, 37, 38, 39, 2, 2, 2,
|
---|
108 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
109 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
110 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
111 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
112 | 2, 41, 2, 42, 2, 2, 2, 2, 2, 40,
|
---|
113 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
114 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
115 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
116 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
117 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
118 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
119 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
120 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
121 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
122 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
123 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
124 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
125 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
126 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
127 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
128 | 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
|
---|
129 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
---|
130 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
---|
131 | 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
|
---|
132 | };
|
---|
133 |
|
---|
134 | #if YYDEBUG
|
---|
135 | static const short yyprhs[] =
|
---|
136 | {
|
---|
137 | 0, 0, 2, 5, 7, 9, 11, 13, 15, 17,
|
---|
138 | 19, 21, 23, 25, 27, 32, 37, 41, 44, 46,
|
---|
139 | 48, 50, 55, 62, 71, 76, 83, 89, 97, 105,
|
---|
140 | 115, 120, 125, 132, 141, 143, 145, 147, 149, 151,
|
---|
141 | 153, 155, 157, 159, 161, 163, 165, 167, 169, 171,
|
---|
142 | 173, 175, 177, 179, 181, 183, 185, 187, 189
|
---|
143 | };
|
---|
144 | static const short yyrhs[] =
|
---|
145 | {
|
---|
146 | 45, 0, 45, 46, 0, 46, 0, 47, 0, 36,
|
---|
147 | 0, 48, 0, 52, 0, 53, 0, 54, 0, 55,
|
---|
148 | 0, 24, 0, 35, 0, 3, 0, 56, 49, 37,
|
---|
149 | 49, 0, 38, 50, 39, 34, 0, 50, 39, 34,
|
---|
150 | 0, 38, 50, 0, 50, 0, 33, 0, 51, 0,
|
---|
151 | 40, 41, 32, 42, 0, 40, 41, 33, 39, 34,
|
---|
152 | 42, 0, 40, 41, 33, 39, 34, 43, 32, 42,
|
---|
153 | 0, 40, 41, 33, 42, 0, 40, 41, 33, 43,
|
---|
154 | 32, 42, 0, 40, 41, 38, 33, 42, 0, 40,
|
---|
155 | 41, 38, 33, 43, 32, 42, 0, 40, 41, 38,
|
---|
156 | 33, 39, 34, 42, 0, 40, 41, 38, 33, 39,
|
---|
157 | 34, 43, 32, 42, 0, 57, 49, 37, 49, 0,
|
---|
158 | 58, 49, 37, 49, 0, 59, 49, 37, 49, 37,
|
---|
159 | 49, 0, 60, 49, 37, 49, 37, 49, 37, 49,
|
---|
160 | 0, 22, 0, 11, 0, 25, 0, 26, 0, 8,
|
---|
161 | 0, 9, 0, 12, 0, 13, 0, 10, 0, 23,
|
---|
162 | 0, 4, 0, 5, 0, 6, 0, 7, 0, 21,
|
---|
163 | 0, 20, 0, 28, 0, 27, 0, 14, 0, 15,
|
---|
164 | 0, 16, 0, 17, 0, 18, 0, 29, 0, 19,
|
---|
165 | 0
|
---|
166 | };
|
---|
167 |
|
---|
168 | #endif
|
---|
169 |
|
---|
170 | #if YYDEBUG
|
---|
171 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
---|
172 | static const short yyrline[] =
|
---|
173 | {
|
---|
174 | 0, 95, 103, 109, 121, 126, 133, 134, 135, 136,
|
---|
175 | 137, 138, 142, 146, 152, 158, 168, 178, 188, 199,
|
---|
176 | 199, 203, 210, 245, 281, 286, 291, 296, 301, 306,
|
---|
177 | 313, 319, 325, 331, 338, 342, 348, 352, 356, 360,
|
---|
178 | 364, 368, 374, 380, 384, 388, 392, 396, 400, 404,
|
---|
179 | 408, 412, 416, 420, 424, 428, 432, 436, 442
|
---|
180 | };
|
---|
181 | #endif
|
---|
182 |
|
---|
183 |
|
---|
184 | #if (YYDEBUG) || defined YYERROR_VERBOSE
|
---|
185 |
|
---|
186 | /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
|
---|
187 | static const char *const yytname[] =
|
---|
188 | {
|
---|
189 | "$", "error", "$undefined.", "VERTEX_SHADER", "ADD_INSTR", "DP3_INSTR",
|
---|
190 | "DP4_INSTR", "DST_INSTR", "EXP_INSTR", "EXPP_INSTR", "FRC_INSTR",
|
---|
191 | "LIT_INSTR", "LOG_INSTR", "LOGP_INSTR", "M3X2_INSTR", "M3X3_INSTR",
|
---|
192 | "M3X4_INSTR", "M4X3_INSTR", "M4X4_INSTR", "MAD_INSTR", "MAX_INSTR",
|
---|
193 | "MIN_INSTR", "MOV_INSTR", "MUL_INSTR", "NOP_INSTR", "RCP_INSTR",
|
---|
194 | "RSQ_INSTR", "SGE_INSTR", "SLT_INSTR", "SUB_INSTR", "ILLEGAL",
|
---|
195 | "UNKNOWN_STRING", "INTVAL", "REGISTER", "XYZW_MODIFIER", "COMMENT",
|
---|
196 | "'\\n'", "','", "'-'", "'.'", "'c'", "'['", "']'", "'+'", "VS10Program",
|
---|
197 | "InstSequence", "InstLine", "Instruction", "VECTORopinstruction",
|
---|
198 | "genericReg", "genReg", "constantReg", "SCALARopinstruction",
|
---|
199 | "UNARYopinstruction", "BINopinstruction", "TRIopinstruction",
|
---|
200 | "VECTORop", "SCALARop", "UNARYop", "BINop", "TRIop", 0
|
---|
201 | };
|
---|
202 | #endif
|
---|
203 |
|
---|
204 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
---|
205 | static const short yyr1[] =
|
---|
206 | {
|
---|
207 | 0, 44, 45, 45, 46, 46, 47, 47, 47, 47,
|
---|
208 | 47, 47, 47, 47, 48, 49, 49, 49, 49, 50,
|
---|
209 | 50, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
---|
210 | 52, 53, 54, 55, 56, 56, 57, 57, 57, 57,
|
---|
211 | 57, 57, 58, 59, 59, 59, 59, 59, 59, 59,
|
---|
212 | 59, 59, 59, 59, 59, 59, 59, 59, 60
|
---|
213 | };
|
---|
214 |
|
---|
215 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
---|
216 | static const short yyr2[] =
|
---|
217 | {
|
---|
218 | 0, 1, 2, 1, 1, 1, 1, 1, 1, 1,
|
---|
219 | 1, 1, 1, 1, 4, 4, 3, 2, 1, 1,
|
---|
220 | 1, 4, 6, 8, 4, 6, 5, 7, 7, 9,
|
---|
221 | 4, 4, 6, 8, 1, 1, 1, 1, 1, 1,
|
---|
222 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
223 | 1, 1, 1, 1, 1, 1, 1, 1, 1
|
---|
224 | };
|
---|
225 |
|
---|
226 | /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
---|
227 | doesn't specify something else to do. Zero means the default is an
|
---|
228 | error. */
|
---|
229 | static const short yydefact[] =
|
---|
230 | {
|
---|
231 | 0, 13, 44, 45, 46, 47, 38, 39, 42, 35,
|
---|
232 | 40, 41, 52, 53, 54, 55, 56, 58, 49, 48,
|
---|
233 | 34, 43, 11, 36, 37, 51, 50, 57, 12, 5,
|
---|
234 | 1, 3, 4, 6, 7, 8, 9, 10, 0, 0,
|
---|
235 | 0, 0, 0, 2, 19, 0, 0, 0, 18, 20,
|
---|
236 | 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
|
---|
237 | 0, 0, 0, 0, 0, 0, 14, 16, 30, 31,
|
---|
238 | 0, 0, 15, 21, 0, 24, 0, 0, 0, 0,
|
---|
239 | 0, 0, 0, 26, 0, 32, 0, 22, 0, 25,
|
---|
240 | 0, 0, 0, 0, 28, 0, 27, 33, 23, 0,
|
---|
241 | 29, 0, 0, 0
|
---|
242 | };
|
---|
243 |
|
---|
244 | static const short yydefgoto[] =
|
---|
245 | {
|
---|
246 | 101, 30, 31, 32, 33, 47, 48, 49, 34, 35,
|
---|
247 | 36, 37, 38, 39, 40, 41, 42
|
---|
248 | };
|
---|
249 |
|
---|
250 | static const short yypact[] =
|
---|
251 | {
|
---|
252 | 51,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
---|
253 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
---|
254 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
---|
255 | 51,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -29, -29,
|
---|
256 | -29, -29, -29,-32768,-32768, -28, -35, -23, -21,-32768,
|
---|
257 | -13, -5, -4, -3, -2, -25, -29, -24, -29, -29,
|
---|
258 | -29, -29, 1, -6, -16, 5,-32768,-32768,-32768,-32768,
|
---|
259 | 4, 6,-32768,-32768, 8,-32768, 12, -14, -29, -29,
|
---|
260 | -27, 3, 13,-32768, 14,-32768, 11,-32768, 17,-32768,
|
---|
261 | -12, 9, -29, 10,-32768, 18,-32768,-32768,-32768, 39,
|
---|
262 | -32768, 82, 83,-32768
|
---|
263 | };
|
---|
264 |
|
---|
265 | static const short yypgoto[] =
|
---|
266 | {
|
---|
267 | -32768,-32768, 54,-32768,-32768, -39, 40,-32768,-32768,-32768,
|
---|
268 | -32768,-32768,-32768,-32768,-32768,-32768,-32768
|
---|
269 | };
|
---|
270 |
|
---|
271 |
|
---|
272 | #define YYLAST 87
|
---|
273 |
|
---|
274 |
|
---|
275 | static const short yytable[] =
|
---|
276 | {
|
---|
277 | 50, 51, 52, 53, 44, 44, 55, 63, 64, 45,
|
---|
278 | 67, 46, 46, 65, 56, 87, 88, 66, 57, 68,
|
---|
279 | 69, 70, 71, 74, 58, 82, 75, 76, 83, 84,
|
---|
280 | 94, 95, 59, 60, 61, 72, 73, 62, 77, 85,
|
---|
281 | 86, 78, 80, 79, 81, 89, 91, 90, 92, 93,
|
---|
282 | 99, 96, 98, 97, 1, 2, 3, 4, 5, 6,
|
---|
283 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
---|
284 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
---|
285 | 27, 100, 102, 103, 43, 54, 28, 29
|
---|
286 | };
|
---|
287 |
|
---|
288 | static const short yycheck[] =
|
---|
289 | {
|
---|
290 | 39, 40, 41, 42, 33, 33, 41, 32, 33, 38,
|
---|
291 | 34, 40, 40, 38, 37, 42, 43, 56, 39, 58,
|
---|
292 | 59, 60, 61, 39, 37, 39, 42, 43, 42, 43,
|
---|
293 | 42, 43, 37, 37, 37, 34, 42, 39, 33, 78,
|
---|
294 | 79, 37, 34, 37, 32, 42, 32, 34, 37, 32,
|
---|
295 | 32, 42, 42, 92, 3, 4, 5, 6, 7, 8,
|
---|
296 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
---|
297 | 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
---|
298 | 29, 42, 0, 0, 30, 45, 35, 36
|
---|
299 | };
|
---|
300 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
---|
301 | #line 3 "/usr/share/bison/bison.simple"
|
---|
302 |
|
---|
303 | /* Skeleton output parser for bison,
|
---|
304 |
|
---|
305 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
|
---|
306 | Foundation, Inc.
|
---|
307 |
|
---|
308 | This program is free software; you can redistribute it and/or modify
|
---|
309 | it under the terms of the GNU General Public License as published by
|
---|
310 | the Free Software Foundation; either version 2, or (at your option)
|
---|
311 | any later version.
|
---|
312 |
|
---|
313 | This program is distributed in the hope that it will be useful,
|
---|
314 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
315 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
316 | GNU General Public License for more details.
|
---|
317 |
|
---|
318 | You should have received a copy of the GNU General Public License
|
---|
319 | along with this program; if not, write to the Free Software
|
---|
320 | Foundation, Inc., 59 Temple Place - Suite 330,
|
---|
321 | Boston, MA 02111-1307, USA. */
|
---|
322 |
|
---|
323 | /* As a special exception, when this file is copied by Bison into a
|
---|
324 | Bison output file, you may use that output file without restriction.
|
---|
325 | This special exception was added by the Free Software Foundation
|
---|
326 | in version 1.24 of Bison. */
|
---|
327 |
|
---|
328 | /* This is the parser code that is written into each bison parser when
|
---|
329 | the %semantic_parser declaration is not specified in the grammar.
|
---|
330 | It was written by Richard Stallman by simplifying the hairy parser
|
---|
331 | used when %semantic_parser is specified. */
|
---|
332 |
|
---|
333 | /* All symbols defined below should begin with yy or YY, to avoid
|
---|
334 | infringing on user name space. This should be done even for local
|
---|
335 | variables, as they might otherwise be expanded by user macros.
|
---|
336 | There are some unavoidable exceptions within include files to
|
---|
337 | define necessary library symbols; they are noted "INFRINGES ON
|
---|
338 | USER NAME SPACE" below. */
|
---|
339 |
|
---|
340 | #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
|
---|
341 |
|
---|
342 | /* The parser invokes alloca or malloc; define the necessary symbols. */
|
---|
343 |
|
---|
344 | # if YYSTACK_USE_ALLOCA
|
---|
345 | # define YYSTACK_ALLOC alloca
|
---|
346 | # else
|
---|
347 | # ifndef YYSTACK_USE_ALLOCA
|
---|
348 | # if defined (alloca) || defined (_ALLOCA_H)
|
---|
349 | # define YYSTACK_ALLOC alloca
|
---|
350 | # else
|
---|
351 | # ifdef __GNUC__
|
---|
352 | # define YYSTACK_ALLOC __builtin_alloca
|
---|
353 | # endif
|
---|
354 | # endif
|
---|
355 | # endif
|
---|
356 | # endif
|
---|
357 |
|
---|
358 | # ifdef YYSTACK_ALLOC
|
---|
359 | /* Pacify GCC's `empty if-body' warning. */
|
---|
360 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
|
---|
361 | # else
|
---|
362 | # if defined (__STDC__) || defined (__cplusplus)
|
---|
363 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
---|
364 | # define YYSIZE_T size_t
|
---|
365 | # endif
|
---|
366 | # define YYSTACK_ALLOC malloc
|
---|
367 | # define YYSTACK_FREE free
|
---|
368 | # endif
|
---|
369 | #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
|
---|
370 |
|
---|
371 |
|
---|
372 | #if (! defined (yyoverflow) \
|
---|
373 | && (! defined (__cplusplus) \
|
---|
374 | || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
---|
375 |
|
---|
376 | /* A type that is properly aligned for any stack member. */
|
---|
377 | union yyalloc
|
---|
378 | {
|
---|
379 | short yyss;
|
---|
380 | YYSTYPE yyvs;
|
---|
381 | # if YYLSP_NEEDED
|
---|
382 | YYLTYPE yyls;
|
---|
383 | # endif
|
---|
384 | };
|
---|
385 |
|
---|
386 | /* The size of the maximum gap between one aligned stack and the next. */
|
---|
387 | # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
|
---|
388 |
|
---|
389 | /* The size of an array large to enough to hold all stacks, each with
|
---|
390 | N elements. */
|
---|
391 | # if YYLSP_NEEDED
|
---|
392 | # define YYSTACK_BYTES(N) \
|
---|
393 | ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
|
---|
394 | + 2 * YYSTACK_GAP_MAX)
|
---|
395 | # else
|
---|
396 | # define YYSTACK_BYTES(N) \
|
---|
397 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
|
---|
398 | + YYSTACK_GAP_MAX)
|
---|
399 | # endif
|
---|
400 |
|
---|
401 | /* Copy COUNT objects from FROM to TO. The source and destination do
|
---|
402 | not overlap. */
|
---|
403 | # ifndef YYCOPY
|
---|
404 | # if 1 < __GNUC__
|
---|
405 | # define YYCOPY(To, From, Count) \
|
---|
406 | __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
|
---|
407 | # else
|
---|
408 | # define YYCOPY(To, From, Count) \
|
---|
409 | do \
|
---|
410 | { \
|
---|
411 | register YYSIZE_T yyi; \
|
---|
412 | for (yyi = 0; yyi < (Count); yyi++) \
|
---|
413 | (To)[yyi] = (From)[yyi]; \
|
---|
414 | } \
|
---|
415 | while (0)
|
---|
416 | # endif
|
---|
417 | # endif
|
---|
418 |
|
---|
419 | /* Relocate STACK from its old location to the new one. The
|
---|
420 | local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
---|
421 | elements in the stack, and YYPTR gives the new location of the
|
---|
422 | stack. Advance YYPTR to a properly aligned location for the next
|
---|
423 | stack. */
|
---|
424 | # define YYSTACK_RELOCATE(Stack) \
|
---|
425 | do \
|
---|
426 | { \
|
---|
427 | YYSIZE_T yynewbytes; \
|
---|
428 | YYCOPY (&yyptr->Stack, Stack, yysize); \
|
---|
429 | Stack = &yyptr->Stack; \
|
---|
430 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
|
---|
431 | yyptr += yynewbytes / sizeof (*yyptr); \
|
---|
432 | } \
|
---|
433 | while (0)
|
---|
434 |
|
---|
435 | #endif
|
---|
436 |
|
---|
437 |
|
---|
438 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
|
---|
439 | # define YYSIZE_T __SIZE_TYPE__
|
---|
440 | #endif
|
---|
441 | #if ! defined (YYSIZE_T) && defined (size_t)
|
---|
442 | # define YYSIZE_T size_t
|
---|
443 | #endif
|
---|
444 | #if ! defined (YYSIZE_T)
|
---|
445 | # if defined (__STDC__) || defined (__cplusplus)
|
---|
446 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
---|
447 | # define YYSIZE_T size_t
|
---|
448 | # endif
|
---|
449 | #endif
|
---|
450 | #if ! defined (YYSIZE_T)
|
---|
451 | # define YYSIZE_T unsigned int
|
---|
452 | #endif
|
---|
453 |
|
---|
454 | #define yyerrok (yyerrstatus = 0)
|
---|
455 | #define yyclearin (yychar = YYEMPTY)
|
---|
456 | #define YYEMPTY -2
|
---|
457 | #define YYEOF 0
|
---|
458 | #define YYACCEPT goto yyacceptlab
|
---|
459 | #define YYABORT goto yyabortlab
|
---|
460 | #define YYERROR goto yyerrlab1
|
---|
461 | /* Like YYERROR except do call yyerror. This remains here temporarily
|
---|
462 | to ease the transition to the new meaning of YYERROR, for GCC.
|
---|
463 | Once GCC version 2 has supplanted version 1, this can go. */
|
---|
464 | #define YYFAIL goto yyerrlab
|
---|
465 | #define YYRECOVERING() (!!yyerrstatus)
|
---|
466 | #define YYBACKUP(Token, Value) \
|
---|
467 | do \
|
---|
468 | if (yychar == YYEMPTY && yylen == 1) \
|
---|
469 | { \
|
---|
470 | yychar = (Token); \
|
---|
471 | yylval = (Value); \
|
---|
472 | yychar1 = YYTRANSLATE (yychar); \
|
---|
473 | YYPOPSTACK; \
|
---|
474 | goto yybackup; \
|
---|
475 | } \
|
---|
476 | else \
|
---|
477 | { \
|
---|
478 | yyerror ("syntax error: cannot back up"); \
|
---|
479 | YYERROR; \
|
---|
480 | } \
|
---|
481 | while (0)
|
---|
482 |
|
---|
483 | #define YYTERROR 1
|
---|
484 | #define YYERRCODE 256
|
---|
485 |
|
---|
486 |
|
---|
487 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions
|
---|
488 | are run).
|
---|
489 |
|
---|
490 | When YYLLOC_DEFAULT is run, CURRENT is set the location of the
|
---|
491 | first token. By default, to implement support for ranges, extend
|
---|
492 | its range to the last symbol. */
|
---|
493 |
|
---|
494 | #ifndef YYLLOC_DEFAULT
|
---|
495 | # define YYLLOC_DEFAULT(Current, Rhs, N) \
|
---|
496 | Current.last_line = Rhs[N].last_line; \
|
---|
497 | Current.last_column = Rhs[N].last_column;
|
---|
498 | #endif
|
---|
499 |
|
---|
500 |
|
---|
501 | /* YYLEX -- calling `yylex' with the right arguments. */
|
---|
502 |
|
---|
503 | #if YYPURE
|
---|
504 | # if YYLSP_NEEDED
|
---|
505 | # ifdef YYLEX_PARAM
|
---|
506 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
|
---|
507 | # else
|
---|
508 | # define YYLEX yylex (&yylval, &yylloc)
|
---|
509 | # endif
|
---|
510 | # else /* !YYLSP_NEEDED */
|
---|
511 | # ifdef YYLEX_PARAM
|
---|
512 | # define YYLEX yylex (&yylval, YYLEX_PARAM)
|
---|
513 | # else
|
---|
514 | # define YYLEX yylex (&yylval)
|
---|
515 | # endif
|
---|
516 | # endif /* !YYLSP_NEEDED */
|
---|
517 | #else /* !YYPURE */
|
---|
518 | # define YYLEX yylex ()
|
---|
519 | #endif /* !YYPURE */
|
---|
520 |
|
---|
521 |
|
---|
522 | /* Enable debugging if requested. */
|
---|
523 | #if YYDEBUG
|
---|
524 |
|
---|
525 | # ifndef YYFPRINTF
|
---|
526 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
---|
527 | # define YYFPRINTF fprintf
|
---|
528 | # endif
|
---|
529 |
|
---|
530 | # define YYDPRINTF(Args) \
|
---|
531 | do { \
|
---|
532 | if (yydebug) \
|
---|
533 | YYFPRINTF Args; \
|
---|
534 | } while (0)
|
---|
535 | /* Nonzero means print parse trace. It is left uninitialized so that
|
---|
536 | multiple parsers can coexist. */
|
---|
537 | int yydebug;
|
---|
538 | #else /* !YYDEBUG */
|
---|
539 | # define YYDPRINTF(Args)
|
---|
540 | #endif /* !YYDEBUG */
|
---|
541 |
|
---|
542 | /* YYINITDEPTH -- initial size of the parser's stacks. */
|
---|
543 | #ifndef YYINITDEPTH
|
---|
544 | # define YYINITDEPTH 200
|
---|
545 | #endif
|
---|
546 |
|
---|
547 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
|
---|
548 | if the built-in stack extension method is used).
|
---|
549 |
|
---|
550 | Do not make this value too large; the results are undefined if
|
---|
551 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
|
---|
552 | evaluated with infinite-precision integer arithmetic. */
|
---|
553 |
|
---|
554 | #if YYMAXDEPTH == 0
|
---|
555 | # undef YYMAXDEPTH
|
---|
556 | #endif
|
---|
557 |
|
---|
558 | #ifndef YYMAXDEPTH
|
---|
559 | # define YYMAXDEPTH 10000
|
---|
560 | #endif
|
---|
561 |
|
---|
562 | #ifdef YYERROR_VERBOSE
|
---|
563 |
|
---|
564 | # ifndef yystrlen
|
---|
565 | # if defined (__GLIBC__) && defined (_STRING_H)
|
---|
566 | # define yystrlen strlen
|
---|
567 | # else
|
---|
568 | /* Return the length of YYSTR. */
|
---|
569 | static YYSIZE_T
|
---|
570 | # if defined (__STDC__) || defined (__cplusplus)
|
---|
571 | yystrlen (const char *yystr)
|
---|
572 | # else
|
---|
573 | yystrlen (yystr)
|
---|
574 | const char *yystr;
|
---|
575 | # endif
|
---|
576 | {
|
---|
577 | register const char *yys = yystr;
|
---|
578 |
|
---|
579 | while (*yys++ != '\0')
|
---|
580 | continue;
|
---|
581 |
|
---|
582 | return yys - yystr - 1;
|
---|
583 | }
|
---|
584 | # endif
|
---|
585 | # endif
|
---|
586 |
|
---|
587 | # ifndef yystpcpy
|
---|
588 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
|
---|
589 | # define yystpcpy stpcpy
|
---|
590 | # else
|
---|
591 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
|
---|
592 | YYDEST. */
|
---|
593 | static char *
|
---|
594 | # if defined (__STDC__) || defined (__cplusplus)
|
---|
595 | yystpcpy (char *yydest, const char *yysrc)
|
---|
596 | # else
|
---|
597 | yystpcpy (yydest, yysrc)
|
---|
598 | char *yydest;
|
---|
599 | const char *yysrc;
|
---|
600 | # endif
|
---|
601 | {
|
---|
602 | register char *yyd = yydest;
|
---|
603 | register const char *yys = yysrc;
|
---|
604 |
|
---|
605 | while ((*yyd++ = *yys++) != '\0')
|
---|
606 | continue;
|
---|
607 |
|
---|
608 | return yyd - 1;
|
---|
609 | }
|
---|
610 | # endif
|
---|
611 | # endif
|
---|
612 | #endif
|
---|
613 |
|
---|
614 | #line 315 "/usr/share/bison/bison.simple"
|
---|
615 |
|
---|
616 |
|
---|
617 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
---|
618 | into yyparse. The argument should have type void *.
|
---|
619 | It should actually point to an object.
|
---|
620 | Grammar actions can access the variable by casting it
|
---|
621 | to the proper pointer type. */
|
---|
622 |
|
---|
623 | #ifdef YYPARSE_PARAM
|
---|
624 | # if defined (__STDC__) || defined (__cplusplus)
|
---|
625 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
|
---|
626 | # define YYPARSE_PARAM_DECL
|
---|
627 | # else
|
---|
628 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM
|
---|
629 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
|
---|
630 | # endif
|
---|
631 | #else /* !YYPARSE_PARAM */
|
---|
632 | # define YYPARSE_PARAM_ARG
|
---|
633 | # define YYPARSE_PARAM_DECL
|
---|
634 | #endif /* !YYPARSE_PARAM */
|
---|
635 |
|
---|
636 | /* Prevent warning if -Wstrict-prototypes. */
|
---|
637 | #ifdef __GNUC__
|
---|
638 | # ifdef YYPARSE_PARAM
|
---|
639 | int yyparse (void *);
|
---|
640 | # else
|
---|
641 | int yyparse (void);
|
---|
642 | # endif
|
---|
643 | #endif
|
---|
644 |
|
---|
645 | /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
|
---|
646 | variables are global, or local to YYPARSE. */
|
---|
647 |
|
---|
648 | #define YY_DECL_NON_LSP_VARIABLES \
|
---|
649 | /* The lookahead symbol. */ \
|
---|
650 | int yychar; \
|
---|
651 | \
|
---|
652 | /* The semantic value of the lookahead symbol. */ \
|
---|
653 | YYSTYPE yylval; \
|
---|
654 | \
|
---|
655 | /* Number of parse errors so far. */ \
|
---|
656 | int yynerrs;
|
---|
657 |
|
---|
658 | #if YYLSP_NEEDED
|
---|
659 | # define YY_DECL_VARIABLES \
|
---|
660 | YY_DECL_NON_LSP_VARIABLES \
|
---|
661 | \
|
---|
662 | /* Location data for the lookahead symbol. */ \
|
---|
663 | YYLTYPE yylloc;
|
---|
664 | #else
|
---|
665 | # define YY_DECL_VARIABLES \
|
---|
666 | YY_DECL_NON_LSP_VARIABLES
|
---|
667 | #endif
|
---|
668 |
|
---|
669 |
|
---|
670 | /* If nonreentrant, generate the variables here. */
|
---|
671 |
|
---|
672 | #if !YYPURE
|
---|
673 | YY_DECL_VARIABLES
|
---|
674 | #endif /* !YYPURE */
|
---|
675 |
|
---|
676 | int
|
---|
677 | yyparse (YYPARSE_PARAM_ARG)
|
---|
678 | YYPARSE_PARAM_DECL
|
---|
679 | {
|
---|
680 | /* If reentrant, generate the variables here. */
|
---|
681 | #if YYPURE
|
---|
682 | YY_DECL_VARIABLES
|
---|
683 | #endif /* !YYPURE */
|
---|
684 |
|
---|
685 | register int yystate;
|
---|
686 | register int yyn;
|
---|
687 | int yyresult;
|
---|
688 | /* Number of tokens to shift before error messages enabled. */
|
---|
689 | int yyerrstatus;
|
---|
690 | /* Lookahead token as an internal (translated) token number. */
|
---|
691 | int yychar1 = 0;
|
---|
692 |
|
---|
693 | /* Three stacks and their tools:
|
---|
694 | `yyss': related to states,
|
---|
695 | `yyvs': related to semantic values,
|
---|
696 | `yyls': related to locations.
|
---|
697 |
|
---|
698 | Refer to the stacks thru separate pointers, to allow yyoverflow
|
---|
699 | to reallocate them elsewhere. */
|
---|
700 |
|
---|
701 | /* The state stack. */
|
---|
702 | short yyssa[YYINITDEPTH];
|
---|
703 | short *yyss = yyssa;
|
---|
704 | register short *yyssp;
|
---|
705 |
|
---|
706 | /* The semantic value stack. */
|
---|
707 | YYSTYPE yyvsa[YYINITDEPTH];
|
---|
708 | YYSTYPE *yyvs = yyvsa;
|
---|
709 | register YYSTYPE *yyvsp;
|
---|
710 |
|
---|
711 | #if YYLSP_NEEDED
|
---|
712 | /* The location stack. */
|
---|
713 | YYLTYPE yylsa[YYINITDEPTH];
|
---|
714 | YYLTYPE *yyls = yylsa;
|
---|
715 | YYLTYPE *yylsp;
|
---|
716 | #endif
|
---|
717 |
|
---|
718 | #if YYLSP_NEEDED
|
---|
719 | # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
|
---|
720 | #else
|
---|
721 | # define YYPOPSTACK (yyvsp--, yyssp--)
|
---|
722 | #endif
|
---|
723 |
|
---|
724 | YYSIZE_T yystacksize = YYINITDEPTH;
|
---|
725 |
|
---|
726 |
|
---|
727 | /* The variables used to return semantic value and location from the
|
---|
728 | action routines. */
|
---|
729 | YYSTYPE yyval;
|
---|
730 | #if YYLSP_NEEDED
|
---|
731 | YYLTYPE yyloc;
|
---|
732 | #endif
|
---|
733 |
|
---|
734 | /* When reducing, the number of symbols on the RHS of the reduced
|
---|
735 | rule. */
|
---|
736 | int yylen;
|
---|
737 |
|
---|
738 | YYDPRINTF ((stderr, "Starting parse\n"));
|
---|
739 |
|
---|
740 | yystate = 0;
|
---|
741 | yyerrstatus = 0;
|
---|
742 | yynerrs = 0;
|
---|
743 | yychar = YYEMPTY; /* Cause a token to be read. */
|
---|
744 |
|
---|
745 | /* Initialize stack pointers.
|
---|
746 | Waste one element of value and location stack
|
---|
747 | so that they stay on the same level as the state stack.
|
---|
748 | The wasted elements are never initialized. */
|
---|
749 |
|
---|
750 | yyssp = yyss;
|
---|
751 | yyvsp = yyvs;
|
---|
752 | #if YYLSP_NEEDED
|
---|
753 | yylsp = yyls;
|
---|
754 | #endif
|
---|
755 | goto yysetstate;
|
---|
756 |
|
---|
757 | /*------------------------------------------------------------.
|
---|
758 | | yynewstate -- Push a new state, which is found in yystate. |
|
---|
759 | `------------------------------------------------------------*/
|
---|
760 | yynewstate:
|
---|
761 | /* In all cases, when you get here, the value and location stacks
|
---|
762 | have just been pushed. so pushing a state here evens the stacks.
|
---|
763 | */
|
---|
764 | yyssp++;
|
---|
765 |
|
---|
766 | yysetstate:
|
---|
767 | *yyssp = yystate;
|
---|
768 |
|
---|
769 | if (yyssp >= yyss + yystacksize - 1)
|
---|
770 | {
|
---|
771 | /* Get the current used size of the three stacks, in elements. */
|
---|
772 | YYSIZE_T yysize = yyssp - yyss + 1;
|
---|
773 |
|
---|
774 | #ifdef yyoverflow
|
---|
775 | {
|
---|
776 | /* Give user a chance to reallocate the stack. Use copies of
|
---|
777 | these so that the &'s don't force the real ones into
|
---|
778 | memory. */
|
---|
779 | YYSTYPE *yyvs1 = yyvs;
|
---|
780 | short *yyss1 = yyss;
|
---|
781 |
|
---|
782 | /* Each stack pointer address is followed by the size of the
|
---|
783 | data in use in that stack, in bytes. */
|
---|
784 | # if YYLSP_NEEDED
|
---|
785 | YYLTYPE *yyls1 = yyls;
|
---|
786 | /* This used to be a conditional around just the two extra args,
|
---|
787 | but that might be undefined if yyoverflow is a macro. */
|
---|
788 | yyoverflow ("parser stack overflow",
|
---|
789 | &yyss1, yysize * sizeof (*yyssp),
|
---|
790 | &yyvs1, yysize * sizeof (*yyvsp),
|
---|
791 | &yyls1, yysize * sizeof (*yylsp),
|
---|
792 | &yystacksize);
|
---|
793 | yyls = yyls1;
|
---|
794 | # else
|
---|
795 | yyoverflow ("parser stack overflow",
|
---|
796 | &yyss1, yysize * sizeof (*yyssp),
|
---|
797 | &yyvs1, yysize * sizeof (*yyvsp),
|
---|
798 | &yystacksize);
|
---|
799 | # endif
|
---|
800 | yyss = yyss1;
|
---|
801 | yyvs = yyvs1;
|
---|
802 | }
|
---|
803 | #else /* no yyoverflow */
|
---|
804 | # ifndef YYSTACK_RELOCATE
|
---|
805 | goto yyoverflowlab;
|
---|
806 | # else
|
---|
807 | /* Extend the stack our own way. */
|
---|
808 | if (yystacksize >= YYMAXDEPTH)
|
---|
809 | goto yyoverflowlab;
|
---|
810 | yystacksize *= 2;
|
---|
811 | if (yystacksize > YYMAXDEPTH)
|
---|
812 | yystacksize = YYMAXDEPTH;
|
---|
813 |
|
---|
814 | {
|
---|
815 | short *yyss1 = yyss;
|
---|
816 | union yyalloc *yyptr =
|
---|
817 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
---|
818 | if (! yyptr)
|
---|
819 | goto yyoverflowlab;
|
---|
820 | YYSTACK_RELOCATE (yyss);
|
---|
821 | YYSTACK_RELOCATE (yyvs);
|
---|
822 | # if YYLSP_NEEDED
|
---|
823 | YYSTACK_RELOCATE (yyls);
|
---|
824 | # endif
|
---|
825 | # undef YYSTACK_RELOCATE
|
---|
826 | if (yyss1 != yyssa)
|
---|
827 | YYSTACK_FREE (yyss1);
|
---|
828 | }
|
---|
829 | # endif
|
---|
830 | #endif /* no yyoverflow */
|
---|
831 |
|
---|
832 | yyssp = yyss + yysize - 1;
|
---|
833 | yyvsp = yyvs + yysize - 1;
|
---|
834 | #if YYLSP_NEEDED
|
---|
835 | yylsp = yyls + yysize - 1;
|
---|
836 | #endif
|
---|
837 |
|
---|
838 | YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
---|
839 | (unsigned long int) yystacksize));
|
---|
840 |
|
---|
841 | if (yyssp >= yyss + yystacksize - 1)
|
---|
842 | YYABORT;
|
---|
843 | }
|
---|
844 |
|
---|
845 | YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
---|
846 |
|
---|
847 | goto yybackup;
|
---|
848 |
|
---|
849 |
|
---|
850 | /*-----------.
|
---|
851 | | yybackup. |
|
---|
852 | `-----------*/
|
---|
853 | yybackup:
|
---|
854 |
|
---|
855 | /* Do appropriate processing given the current state. */
|
---|
856 | /* Read a lookahead token if we need one and don't already have one. */
|
---|
857 | /* yyresume: */
|
---|
858 |
|
---|
859 | /* First try to decide what to do without reference to lookahead token. */
|
---|
860 |
|
---|
861 | yyn = yypact[yystate];
|
---|
862 | if (yyn == YYFLAG)
|
---|
863 | goto yydefault;
|
---|
864 |
|
---|
865 | /* Not known => get a lookahead token if don't already have one. */
|
---|
866 |
|
---|
867 | /* yychar is either YYEMPTY or YYEOF
|
---|
868 | or a valid token in external form. */
|
---|
869 |
|
---|
870 | if (yychar == YYEMPTY)
|
---|
871 | {
|
---|
872 | YYDPRINTF ((stderr, "Reading a token: "));
|
---|
873 | yychar = YYLEX;
|
---|
874 | }
|
---|
875 |
|
---|
876 | /* Convert token to internal form (in yychar1) for indexing tables with */
|
---|
877 |
|
---|
878 | if (yychar <= 0) /* This means end of input. */
|
---|
879 | {
|
---|
880 | yychar1 = 0;
|
---|
881 | yychar = YYEOF; /* Don't call YYLEX any more */
|
---|
882 |
|
---|
883 | YYDPRINTF ((stderr, "Now at end of input.\n"));
|
---|
884 | }
|
---|
885 | else
|
---|
886 | {
|
---|
887 | yychar1 = YYTRANSLATE (yychar);
|
---|
888 |
|
---|
889 | #if YYDEBUG
|
---|
890 | /* We have to keep this `#if YYDEBUG', since we use variables
|
---|
891 | which are defined only if `YYDEBUG' is set. */
|
---|
892 | if (yydebug)
|
---|
893 | {
|
---|
894 | YYFPRINTF (stderr, "Next token is %d (%s",
|
---|
895 | yychar, yytname[yychar1]);
|
---|
896 | /* Give the individual parser a way to print the precise
|
---|
897 | meaning of a token, for further debugging info. */
|
---|
898 | # ifdef YYPRINT
|
---|
899 | YYPRINT (stderr, yychar, yylval);
|
---|
900 | # endif
|
---|
901 | YYFPRINTF (stderr, ")\n");
|
---|
902 | }
|
---|
903 | #endif
|
---|
904 | }
|
---|
905 |
|
---|
906 | yyn += yychar1;
|
---|
907 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
|
---|
908 | goto yydefault;
|
---|
909 |
|
---|
910 | yyn = yytable[yyn];
|
---|
911 |
|
---|
912 | /* yyn is what to do for this token type in this state.
|
---|
913 | Negative => reduce, -yyn is rule number.
|
---|
914 | Positive => shift, yyn is new state.
|
---|
915 | New state is final state => don't bother to shift,
|
---|
916 | just return success.
|
---|
917 | 0, or most negative number => error. */
|
---|
918 |
|
---|
919 | if (yyn < 0)
|
---|
920 | {
|
---|
921 | if (yyn == YYFLAG)
|
---|
922 | goto yyerrlab;
|
---|
923 | yyn = -yyn;
|
---|
924 | goto yyreduce;
|
---|
925 | }
|
---|
926 | else if (yyn == 0)
|
---|
927 | goto yyerrlab;
|
---|
928 |
|
---|
929 | if (yyn == YYFINAL)
|
---|
930 | YYACCEPT;
|
---|
931 |
|
---|
932 | /* Shift the lookahead token. */
|
---|
933 | YYDPRINTF ((stderr, "Shifting token %d (%s), ",
|
---|
934 | yychar, yytname[yychar1]));
|
---|
935 |
|
---|
936 | /* Discard the token being shifted unless it is eof. */
|
---|
937 | if (yychar != YYEOF)
|
---|
938 | yychar = YYEMPTY;
|
---|
939 |
|
---|
940 | *++yyvsp = yylval;
|
---|
941 | #if YYLSP_NEEDED
|
---|
942 | *++yylsp = yylloc;
|
---|
943 | #endif
|
---|
944 |
|
---|
945 | /* Count tokens shifted since error; after three, turn off error
|
---|
946 | status. */
|
---|
947 | if (yyerrstatus)
|
---|
948 | yyerrstatus--;
|
---|
949 |
|
---|
950 | yystate = yyn;
|
---|
951 | goto yynewstate;
|
---|
952 |
|
---|
953 |
|
---|
954 | /*-----------------------------------------------------------.
|
---|
955 | | yydefault -- do the default action for the current state. |
|
---|
956 | `-----------------------------------------------------------*/
|
---|
957 | yydefault:
|
---|
958 | yyn = yydefact[yystate];
|
---|
959 | if (yyn == 0)
|
---|
960 | goto yyerrlab;
|
---|
961 | goto yyreduce;
|
---|
962 |
|
---|
963 |
|
---|
964 | /*-----------------------------.
|
---|
965 | | yyreduce -- Do a reduction. |
|
---|
966 | `-----------------------------*/
|
---|
967 | yyreduce:
|
---|
968 | /* yyn is the number of a rule to reduce with. */
|
---|
969 | yylen = yyr2[yyn];
|
---|
970 |
|
---|
971 | /* If YYLEN is nonzero, implement the default value of the action:
|
---|
972 | `$$ = $1'.
|
---|
973 |
|
---|
974 | Otherwise, the following line sets YYVAL to the semantic value of
|
---|
975 | the lookahead token. This behavior is undocumented and Bison
|
---|
976 | users should not rely upon it. Assigning to YYVAL
|
---|
977 | unconditionally makes the parser a bit smaller, and it avoids a
|
---|
978 | GCC warning that YYVAL may be used uninitialized. */
|
---|
979 | yyval = yyvsp[1-yylen];
|
---|
980 |
|
---|
981 | #if YYLSP_NEEDED
|
---|
982 | /* Similarly for the default location. Let the user run additional
|
---|
983 | commands if for instance locations are ranges. */
|
---|
984 | yyloc = yylsp[1-yylen];
|
---|
985 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
|
---|
986 | #endif
|
---|
987 |
|
---|
988 | #if YYDEBUG
|
---|
989 | /* We have to keep this `#if YYDEBUG', since we use variables which
|
---|
990 | are defined only if `YYDEBUG' is set. */
|
---|
991 | if (yydebug)
|
---|
992 | {
|
---|
993 | int yyi;
|
---|
994 |
|
---|
995 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
|
---|
996 | yyn, yyrline[yyn]);
|
---|
997 |
|
---|
998 | /* Print the symbols being reduced, and their result. */
|
---|
999 | for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
|
---|
1000 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
|
---|
1001 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
---|
1002 | }
|
---|
1003 | #endif
|
---|
1004 |
|
---|
1005 | switch (yyn) {
|
---|
1006 |
|
---|
1007 | case 1:
|
---|
1008 | #line 96 "vs1.0_grammar.y"
|
---|
1009 | {
|
---|
1010 | yyvsp[0].instList->Validate();
|
---|
1011 | yyvsp[0].instList->Translate();
|
---|
1012 | delete yyvsp[0].instList;
|
---|
1013 | ;
|
---|
1014 | break;}
|
---|
1015 | case 2:
|
---|
1016 | #line 104 "vs1.0_grammar.y"
|
---|
1017 | {
|
---|
1018 | *(yyvsp[-1].instList) += yyvsp[0].inst;
|
---|
1019 | delete yyvsp[0].inst;
|
---|
1020 | yyval.instList = yyvsp[-1].instList
|
---|
1021 | ;
|
---|
1022 | break;}
|
---|
1023 | case 3:
|
---|
1024 | #line 110 "vs1.0_grammar.y"
|
---|
1025 | {
|
---|
1026 | VS10InstListPtr instList = new VS10InstList;
|
---|
1027 | if ( yyvsp[0].inst != NULL )
|
---|
1028 | {
|
---|
1029 | *instList += yyvsp[0].inst;
|
---|
1030 | delete yyvsp[0].inst;
|
---|
1031 | }
|
---|
1032 | yyval.instList = instList;
|
---|
1033 | ;
|
---|
1034 | break;}
|
---|
1035 | case 4:
|
---|
1036 | #line 122 "vs1.0_grammar.y"
|
---|
1037 | {
|
---|
1038 | yyval.inst = yyvsp[0].inst;
|
---|
1039 | do_linenum_incr();
|
---|
1040 | ;
|
---|
1041 | break;}
|
---|
1042 | case 5:
|
---|
1043 | #line 127 "vs1.0_grammar.y"
|
---|
1044 | {
|
---|
1045 | yyval.inst = new VS10Inst( get_linenum() );
|
---|
1046 | do_linenum_incr();
|
---|
1047 | ;
|
---|
1048 | break;}
|
---|
1049 | case 11:
|
---|
1050 | #line 139 "vs1.0_grammar.y"
|
---|
1051 | {
|
---|
1052 | yyval.inst = new VS10Inst( get_linenum(), VS10_NOP );
|
---|
1053 | ;
|
---|
1054 | break;}
|
---|
1055 | case 12:
|
---|
1056 | #line 143 "vs1.0_grammar.y"
|
---|
1057 | {
|
---|
1058 | yyval.inst = new VS10Inst( get_linenum(), VS10_COMMENT, yyvsp[0].comment );
|
---|
1059 | ;
|
---|
1060 | break;}
|
---|
1061 | case 13:
|
---|
1062 | #line 147 "vs1.0_grammar.y"
|
---|
1063 | {
|
---|
1064 | yyval.inst = new VS10Inst( get_linenum(), VS10_HEADER );
|
---|
1065 | ;
|
---|
1066 | break;}
|
---|
1067 | case 14:
|
---|
1068 | #line 153 "vs1.0_grammar.y"
|
---|
1069 | {
|
---|
1070 | yyval.inst = new VS10Inst( get_linenum(), yyvsp[-3].ival, yyvsp[-2].reg, yyvsp[0].reg );
|
---|
1071 | ;
|
---|
1072 | break;}
|
---|
1073 | case 15:
|
---|
1074 | #line 159 "vs1.0_grammar.y"
|
---|
1075 | {
|
---|
1076 | VS10Reg reg;
|
---|
1077 | reg = yyvsp[-2].reg;
|
---|
1078 | reg.sign = -1;
|
---|
1079 | reg.type = yyvsp[-2].reg.type;
|
---|
1080 | reg.index = yyvsp[-2].reg.index;
|
---|
1081 | for ( int i = 0; i < 4; i++ ) reg.mask[i] = yyvsp[0].mask[i];
|
---|
1082 | yyval.reg = reg;
|
---|
1083 | ;
|
---|
1084 | break;}
|
---|
1085 | case 16:
|
---|
1086 | #line 169 "vs1.0_grammar.y"
|
---|
1087 | {
|
---|
1088 | VS10Reg reg;
|
---|
1089 | reg = yyvsp[-2].reg;
|
---|
1090 | reg.sign = 1;
|
---|
1091 | reg.type = yyvsp[-2].reg.type;
|
---|
1092 | reg.index = yyvsp[-2].reg.index;
|
---|
1093 | for ( int i = 0; i < 4; i++ ) reg.mask[i] = yyvsp[0].mask[i];
|
---|
1094 | yyval.reg = reg;
|
---|
1095 | ;
|
---|
1096 | break;}
|
---|
1097 | case 17:
|
---|
1098 | #line 179 "vs1.0_grammar.y"
|
---|
1099 | {
|
---|
1100 | VS10Reg reg;
|
---|
1101 | reg = yyvsp[0].reg;
|
---|
1102 | reg.sign = -1;
|
---|
1103 | reg.type = yyvsp[0].reg.type;
|
---|
1104 | reg.index = yyvsp[0].reg.index;
|
---|
1105 | for ( int i = 0; i < 4; i++ ) reg.mask[i] = 0;
|
---|
1106 | yyval.reg = reg;
|
---|
1107 | ;
|
---|
1108 | break;}
|
---|
1109 | case 18:
|
---|
1110 | #line 189 "vs1.0_grammar.y"
|
---|
1111 | {
|
---|
1112 | VS10Reg reg;
|
---|
1113 | reg = yyvsp[0].reg;
|
---|
1114 | reg.sign = 1;
|
---|
1115 | reg.type = yyvsp[0].reg.type;
|
---|
1116 | reg.index = yyvsp[0].reg.index;
|
---|
1117 | for ( int i = 0; i < 4; i++ ) reg.mask[i] = 0;
|
---|
1118 | yyval.reg = reg;
|
---|
1119 | ;
|
---|
1120 | break;}
|
---|
1121 | case 20:
|
---|
1122 | #line 200 "vs1.0_grammar.y"
|
---|
1123 | {
|
---|
1124 | ;
|
---|
1125 | break;}
|
---|
1126 | case 21:
|
---|
1127 | #line 204 "vs1.0_grammar.y"
|
---|
1128 | {
|
---|
1129 | VS10Reg reg;
|
---|
1130 | reg.type = TYPE_CONSTANT_MEM_REG;
|
---|
1131 | reg.index = yyvsp[-1].ival;
|
---|
1132 | yyval.reg = reg;
|
---|
1133 | ;
|
---|
1134 | break;}
|
---|
1135 | case 22:
|
---|
1136 | #line 211 "vs1.0_grammar.y"
|
---|
1137 | {
|
---|
1138 | // Register is valid only if
|
---|
1139 | // type = TYPE_ADDRESS_REG
|
---|
1140 | // index = 0
|
---|
1141 | // len(mask) = 1
|
---|
1142 | // mask[0] = 'x'
|
---|
1143 | VS10Reg reg;
|
---|
1144 | yyval.reg.type = TYPE_CONSTANT_A0_REG;
|
---|
1145 | if ( yyvsp[-3].reg.type != TYPE_ADDRESS_REG )
|
---|
1146 | {
|
---|
1147 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1148 | }
|
---|
1149 | else if ( yyvsp[-3].reg.index != 0 )
|
---|
1150 | {
|
---|
1151 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1152 | }
|
---|
1153 | else
|
---|
1154 | {
|
---|
1155 | int len = 0;
|
---|
1156 | while ( len < 2 )
|
---|
1157 | {
|
---|
1158 | if ( yyvsp[-1].mask[len] == 0 )
|
---|
1159 | break;
|
---|
1160 | len++;
|
---|
1161 | }
|
---|
1162 | if ( len != 1 || yyvsp[-1].mask[0] != 'x' )
|
---|
1163 | {
|
---|
1164 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1165 | }
|
---|
1166 |
|
---|
1167 | reg.type = TYPE_CONSTANT_A0_REG;
|
---|
1168 | yyval.reg = reg;
|
---|
1169 | }
|
---|
1170 | ;
|
---|
1171 | break;}
|
---|
1172 | case 23:
|
---|
1173 | #line 246 "vs1.0_grammar.y"
|
---|
1174 | {
|
---|
1175 | // Register is valid only if
|
---|
1176 | // type = TYPE_ADDRESS_REG
|
---|
1177 | // index = 0
|
---|
1178 | // len(mask) = 1
|
---|
1179 | // mask[0] = 'x'
|
---|
1180 | VS10Reg reg;
|
---|
1181 | yyval.reg.type = TYPE_CONSTANT_A0_OFFSET_REG;
|
---|
1182 | if ( yyvsp[-5].reg.type != TYPE_ADDRESS_REG )
|
---|
1183 | {
|
---|
1184 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1185 | }
|
---|
1186 | else if ( yyvsp[-5].reg.index != 0 )
|
---|
1187 | {
|
---|
1188 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1189 | }
|
---|
1190 | else
|
---|
1191 | {
|
---|
1192 | int len = 0;
|
---|
1193 | while ( len < 2 )
|
---|
1194 | {
|
---|
1195 | if ( yyvsp[-3].mask[len] == 0 )
|
---|
1196 | break;
|
---|
1197 | len++;
|
---|
1198 | }
|
---|
1199 | if ( len != 1 || yyvsp[-3].mask[0] != 'x' )
|
---|
1200 | {
|
---|
1201 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1202 | }
|
---|
1203 |
|
---|
1204 | reg.type = TYPE_CONSTANT_A0_OFFSET_REG;
|
---|
1205 | reg.index = yyvsp[-1].ival;
|
---|
1206 | yyval.reg = reg;
|
---|
1207 | }
|
---|
1208 | ;
|
---|
1209 | break;}
|
---|
1210 | case 24:
|
---|
1211 | #line 282 "vs1.0_grammar.y"
|
---|
1212 | {
|
---|
1213 | yyval.reg.type = TYPE_CONSTANT_A0_REG;
|
---|
1214 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1215 | ;
|
---|
1216 | break;}
|
---|
1217 | case 25:
|
---|
1218 | #line 287 "vs1.0_grammar.y"
|
---|
1219 | {
|
---|
1220 | yyval.reg.type = TYPE_CONSTANT_A0_REG;
|
---|
1221 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1222 | ;
|
---|
1223 | break;}
|
---|
1224 | case 26:
|
---|
1225 | #line 292 "vs1.0_grammar.y"
|
---|
1226 | {
|
---|
1227 | yyval.reg.type = TYPE_CONSTANT_A0_REG;
|
---|
1228 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1229 | ;
|
---|
1230 | break;}
|
---|
1231 | case 27:
|
---|
1232 | #line 297 "vs1.0_grammar.y"
|
---|
1233 | {
|
---|
1234 | yyval.reg.type = TYPE_CONSTANT_A0_REG;
|
---|
1235 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1236 | ;
|
---|
1237 | break;}
|
---|
1238 | case 28:
|
---|
1239 | #line 302 "vs1.0_grammar.y"
|
---|
1240 | {
|
---|
1241 | yyval.reg.type = TYPE_CONSTANT_A0_REG;
|
---|
1242 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1243 | ;
|
---|
1244 | break;}
|
---|
1245 | case 29:
|
---|
1246 | #line 307 "vs1.0_grammar.y"
|
---|
1247 | {
|
---|
1248 | yyval.reg.type = TYPE_CONSTANT_A0_REG;
|
---|
1249 | LexError( "constant register index must be:\t<int>, a0.x, or a0.x + <int>.\n" );
|
---|
1250 | ;
|
---|
1251 | break;}
|
---|
1252 | case 30:
|
---|
1253 | #line 314 "vs1.0_grammar.y"
|
---|
1254 | {
|
---|
1255 | yyval.inst = new VS10Inst( get_linenum(), yyvsp[-3].ival, yyvsp[-2].reg, yyvsp[0].reg );
|
---|
1256 | ;
|
---|
1257 | break;}
|
---|
1258 | case 31:
|
---|
1259 | #line 320 "vs1.0_grammar.y"
|
---|
1260 | {
|
---|
1261 | yyval.inst = new VS10Inst( get_linenum(), yyvsp[-3].ival, yyvsp[-2].reg, yyvsp[0].reg );
|
---|
1262 | ;
|
---|
1263 | break;}
|
---|
1264 | case 32:
|
---|
1265 | #line 326 "vs1.0_grammar.y"
|
---|
1266 | {
|
---|
1267 | yyval.inst = new VS10Inst( get_linenum(), yyvsp[-5].ival, yyvsp[-4].reg, yyvsp[-2].reg, yyvsp[0].reg );
|
---|
1268 | ;
|
---|
1269 | break;}
|
---|
1270 | case 33:
|
---|
1271 | #line 333 "vs1.0_grammar.y"
|
---|
1272 | {
|
---|
1273 | yyval.inst = new VS10Inst( get_linenum(), yyvsp[-7].ival, yyvsp[-6].reg, yyvsp[-4].reg, yyvsp[-2].reg, yyvsp[0].reg );
|
---|
1274 | ;
|
---|
1275 | break;}
|
---|
1276 | case 34:
|
---|
1277 | #line 339 "vs1.0_grammar.y"
|
---|
1278 | {
|
---|
1279 | yyval.ival = VS10_MOV;
|
---|
1280 | ;
|
---|
1281 | break;}
|
---|
1282 | case 35:
|
---|
1283 | #line 343 "vs1.0_grammar.y"
|
---|
1284 | {
|
---|
1285 | yyval.ival = VS10_LIT;
|
---|
1286 | ;
|
---|
1287 | break;}
|
---|
1288 | case 36:
|
---|
1289 | #line 349 "vs1.0_grammar.y"
|
---|
1290 | {
|
---|
1291 | yyval.ival = VS10_RCP;
|
---|
1292 | ;
|
---|
1293 | break;}
|
---|
1294 | case 37:
|
---|
1295 | #line 353 "vs1.0_grammar.y"
|
---|
1296 | {
|
---|
1297 | yyval.ival = VS10_RSQ;
|
---|
1298 | ;
|
---|
1299 | break;}
|
---|
1300 | case 38:
|
---|
1301 | #line 357 "vs1.0_grammar.y"
|
---|
1302 | {
|
---|
1303 | yyval.ival = VS10_EXP;
|
---|
1304 | ;
|
---|
1305 | break;}
|
---|
1306 | case 39:
|
---|
1307 | #line 361 "vs1.0_grammar.y"
|
---|
1308 | {
|
---|
1309 | yyval.ival = VS10_EXPP;
|
---|
1310 | ;
|
---|
1311 | break;}
|
---|
1312 | case 40:
|
---|
1313 | #line 365 "vs1.0_grammar.y"
|
---|
1314 | {
|
---|
1315 | yyval.ival = VS10_LOG;
|
---|
1316 | ;
|
---|
1317 | break;}
|
---|
1318 | case 41:
|
---|
1319 | #line 369 "vs1.0_grammar.y"
|
---|
1320 | {
|
---|
1321 | yyval.ival = VS10_LOGP;
|
---|
1322 | ;
|
---|
1323 | break;}
|
---|
1324 | case 42:
|
---|
1325 | #line 375 "vs1.0_grammar.y"
|
---|
1326 | {
|
---|
1327 | yyval.ival = VS10_FRC;
|
---|
1328 | ;
|
---|
1329 | break;}
|
---|
1330 | case 43:
|
---|
1331 | #line 381 "vs1.0_grammar.y"
|
---|
1332 | {
|
---|
1333 | yyval.ival = VS10_MUL;
|
---|
1334 | ;
|
---|
1335 | break;}
|
---|
1336 | case 44:
|
---|
1337 | #line 385 "vs1.0_grammar.y"
|
---|
1338 | {
|
---|
1339 | yyval.ival = VS10_ADD;
|
---|
1340 | ;
|
---|
1341 | break;}
|
---|
1342 | case 45:
|
---|
1343 | #line 389 "vs1.0_grammar.y"
|
---|
1344 | {
|
---|
1345 | yyval.ival = VS10_DP3;
|
---|
1346 | ;
|
---|
1347 | break;}
|
---|
1348 | case 46:
|
---|
1349 | #line 393 "vs1.0_grammar.y"
|
---|
1350 | {
|
---|
1351 | yyval.ival = VS10_DP4;
|
---|
1352 | ;
|
---|
1353 | break;}
|
---|
1354 | case 47:
|
---|
1355 | #line 397 "vs1.0_grammar.y"
|
---|
1356 | {
|
---|
1357 | yyval.ival = VS10_DST;
|
---|
1358 | ;
|
---|
1359 | break;}
|
---|
1360 | case 48:
|
---|
1361 | #line 401 "vs1.0_grammar.y"
|
---|
1362 | {
|
---|
1363 | yyval.ival = VS10_MIN;
|
---|
1364 | ;
|
---|
1365 | break;}
|
---|
1366 | case 49:
|
---|
1367 | #line 405 "vs1.0_grammar.y"
|
---|
1368 | {
|
---|
1369 | yyval.ival = VS10_MAX;
|
---|
1370 | ;
|
---|
1371 | break;}
|
---|
1372 | case 50:
|
---|
1373 | #line 409 "vs1.0_grammar.y"
|
---|
1374 | {
|
---|
1375 | yyval.ival = VS10_SLT;
|
---|
1376 | ;
|
---|
1377 | break;}
|
---|
1378 | case 51:
|
---|
1379 | #line 413 "vs1.0_grammar.y"
|
---|
1380 | {
|
---|
1381 | yyval.ival = VS10_SGE;
|
---|
1382 | ;
|
---|
1383 | break;}
|
---|
1384 | case 52:
|
---|
1385 | #line 417 "vs1.0_grammar.y"
|
---|
1386 | {
|
---|
1387 | yyval.ival = VS10_M3X2;
|
---|
1388 | ;
|
---|
1389 | break;}
|
---|
1390 | case 53:
|
---|
1391 | #line 421 "vs1.0_grammar.y"
|
---|
1392 | {
|
---|
1393 | yyval.ival = VS10_M3X3;
|
---|
1394 | ;
|
---|
1395 | break;}
|
---|
1396 | case 54:
|
---|
1397 | #line 425 "vs1.0_grammar.y"
|
---|
1398 | {
|
---|
1399 | yyval.ival = VS10_M3X4;
|
---|
1400 | ;
|
---|
1401 | break;}
|
---|
1402 | case 55:
|
---|
1403 | #line 429 "vs1.0_grammar.y"
|
---|
1404 | {
|
---|
1405 | yyval.ival = VS10_M4X3;
|
---|
1406 | ;
|
---|
1407 | break;}
|
---|
1408 | case 56:
|
---|
1409 | #line 433 "vs1.0_grammar.y"
|
---|
1410 | {
|
---|
1411 | yyval.ival = VS10_M4X4;
|
---|
1412 | ;
|
---|
1413 | break;}
|
---|
1414 | case 57:
|
---|
1415 | #line 437 "vs1.0_grammar.y"
|
---|
1416 | {
|
---|
1417 | yyval.ival = VS10_SUB;
|
---|
1418 | ;
|
---|
1419 | break;}
|
---|
1420 | case 58:
|
---|
1421 | #line 443 "vs1.0_grammar.y"
|
---|
1422 | {
|
---|
1423 | yyval.ival = VS10_MAD;
|
---|
1424 | ;
|
---|
1425 | break;}
|
---|
1426 | }
|
---|
1427 |
|
---|
1428 | #line 705 "/usr/share/bison/bison.simple"
|
---|
1429 |
|
---|
1430 |
|
---|
1431 | yyvsp -= yylen;
|
---|
1432 | yyssp -= yylen;
|
---|
1433 | #if YYLSP_NEEDED
|
---|
1434 | yylsp -= yylen;
|
---|
1435 | #endif
|
---|
1436 |
|
---|
1437 | #if YYDEBUG
|
---|
1438 | if (yydebug)
|
---|
1439 | {
|
---|
1440 | short *yyssp1 = yyss - 1;
|
---|
1441 | YYFPRINTF (stderr, "state stack now");
|
---|
1442 | while (yyssp1 != yyssp)
|
---|
1443 | YYFPRINTF (stderr, " %d", *++yyssp1);
|
---|
1444 | YYFPRINTF (stderr, "\n");
|
---|
1445 | }
|
---|
1446 | #endif
|
---|
1447 |
|
---|
1448 | *++yyvsp = yyval;
|
---|
1449 | #if YYLSP_NEEDED
|
---|
1450 | *++yylsp = yyloc;
|
---|
1451 | #endif
|
---|
1452 |
|
---|
1453 | /* Now `shift' the result of the reduction. Determine what state
|
---|
1454 | that goes to, based on the state we popped back to and the rule
|
---|
1455 | number reduced by. */
|
---|
1456 |
|
---|
1457 | yyn = yyr1[yyn];
|
---|
1458 |
|
---|
1459 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
|
---|
1460 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
---|
1461 | yystate = yytable[yystate];
|
---|
1462 | else
|
---|
1463 | yystate = yydefgoto[yyn - YYNTBASE];
|
---|
1464 |
|
---|
1465 | goto yynewstate;
|
---|
1466 |
|
---|
1467 |
|
---|
1468 | /*------------------------------------.
|
---|
1469 | | yyerrlab -- here on detecting error |
|
---|
1470 | `------------------------------------*/
|
---|
1471 | yyerrlab:
|
---|
1472 | /* If not already recovering from an error, report this error. */
|
---|
1473 | if (!yyerrstatus)
|
---|
1474 | {
|
---|
1475 | ++yynerrs;
|
---|
1476 |
|
---|
1477 | #ifdef YYERROR_VERBOSE
|
---|
1478 | yyn = yypact[yystate];
|
---|
1479 |
|
---|
1480 | if (yyn > YYFLAG && yyn < YYLAST)
|
---|
1481 | {
|
---|
1482 | YYSIZE_T yysize = 0;
|
---|
1483 | char *yymsg;
|
---|
1484 | int yyx, yycount;
|
---|
1485 |
|
---|
1486 | yycount = 0;
|
---|
1487 | /* Start YYX at -YYN if negative to avoid negative indexes in
|
---|
1488 | YYCHECK. */
|
---|
1489 | for (yyx = yyn < 0 ? -yyn : 0;
|
---|
1490 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
|
---|
1491 | if (yycheck[yyx + yyn] == yyx)
|
---|
1492 | yysize += yystrlen (yytname[yyx]) + 15, yycount++;
|
---|
1493 | yysize += yystrlen ("parse error, unexpected ") + 1;
|
---|
1494 | yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
|
---|
1495 | yymsg = (char *) YYSTACK_ALLOC (yysize);
|
---|
1496 | if (yymsg != 0)
|
---|
1497 | {
|
---|
1498 | char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
|
---|
1499 | yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
|
---|
1500 |
|
---|
1501 | if (yycount < 5)
|
---|
1502 | {
|
---|
1503 | yycount = 0;
|
---|
1504 | for (yyx = yyn < 0 ? -yyn : 0;
|
---|
1505 | yyx < (int) (sizeof (yytname) / sizeof (char *));
|
---|
1506 | yyx++)
|
---|
1507 | if (yycheck[yyx + yyn] == yyx)
|
---|
1508 | {
|
---|
1509 | const char *yyq = ! yycount ? ", expecting " : " or ";
|
---|
1510 | yyp = yystpcpy (yyp, yyq);
|
---|
1511 | yyp = yystpcpy (yyp, yytname[yyx]);
|
---|
1512 | yycount++;
|
---|
1513 | }
|
---|
1514 | }
|
---|
1515 | yyerror (yymsg);
|
---|
1516 | YYSTACK_FREE (yymsg);
|
---|
1517 | }
|
---|
1518 | else
|
---|
1519 | yyerror ("parse error; also virtual memory exhausted");
|
---|
1520 | }
|
---|
1521 | else
|
---|
1522 | #endif /* defined (YYERROR_VERBOSE) */
|
---|
1523 | yyerror ("parse error");
|
---|
1524 | }
|
---|
1525 | goto yyerrlab1;
|
---|
1526 |
|
---|
1527 |
|
---|
1528 | /*--------------------------------------------------.
|
---|
1529 | | yyerrlab1 -- error raised explicitly by an action |
|
---|
1530 | `--------------------------------------------------*/
|
---|
1531 | yyerrlab1:
|
---|
1532 | if (yyerrstatus == 3)
|
---|
1533 | {
|
---|
1534 | /* If just tried and failed to reuse lookahead token after an
|
---|
1535 | error, discard it. */
|
---|
1536 |
|
---|
1537 | /* return failure if at end of input */
|
---|
1538 | if (yychar == YYEOF)
|
---|
1539 | YYABORT;
|
---|
1540 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
|
---|
1541 | yychar, yytname[yychar1]));
|
---|
1542 | yychar = YYEMPTY;
|
---|
1543 | }
|
---|
1544 |
|
---|
1545 | /* Else will try to reuse lookahead token after shifting the error
|
---|
1546 | token. */
|
---|
1547 |
|
---|
1548 | yyerrstatus = 3; /* Each real token shifted decrements this */
|
---|
1549 |
|
---|
1550 | goto yyerrhandle;
|
---|
1551 |
|
---|
1552 |
|
---|
1553 | /*-------------------------------------------------------------------.
|
---|
1554 | | yyerrdefault -- current state does not do anything special for the |
|
---|
1555 | | error token. |
|
---|
1556 | `-------------------------------------------------------------------*/
|
---|
1557 | yyerrdefault:
|
---|
1558 | #if 0
|
---|
1559 | /* This is wrong; only states that explicitly want error tokens
|
---|
1560 | should shift them. */
|
---|
1561 |
|
---|
1562 | /* If its default is to accept any token, ok. Otherwise pop it. */
|
---|
1563 | yyn = yydefact[yystate];
|
---|
1564 | if (yyn)
|
---|
1565 | goto yydefault;
|
---|
1566 | #endif
|
---|
1567 |
|
---|
1568 |
|
---|
1569 | /*---------------------------------------------------------------.
|
---|
1570 | | yyerrpop -- pop the current state because it cannot handle the |
|
---|
1571 | | error token |
|
---|
1572 | `---------------------------------------------------------------*/
|
---|
1573 | yyerrpop:
|
---|
1574 | if (yyssp == yyss)
|
---|
1575 | YYABORT;
|
---|
1576 | yyvsp--;
|
---|
1577 | yystate = *--yyssp;
|
---|
1578 | #if YYLSP_NEEDED
|
---|
1579 | yylsp--;
|
---|
1580 | #endif
|
---|
1581 |
|
---|
1582 | #if YYDEBUG
|
---|
1583 | if (yydebug)
|
---|
1584 | {
|
---|
1585 | short *yyssp1 = yyss - 1;
|
---|
1586 | YYFPRINTF (stderr, "Error: state stack now");
|
---|
1587 | while (yyssp1 != yyssp)
|
---|
1588 | YYFPRINTF (stderr, " %d", *++yyssp1);
|
---|
1589 | YYFPRINTF (stderr, "\n");
|
---|
1590 | }
|
---|
1591 | #endif
|
---|
1592 |
|
---|
1593 | /*--------------.
|
---|
1594 | | yyerrhandle. |
|
---|
1595 | `--------------*/
|
---|
1596 | yyerrhandle:
|
---|
1597 | yyn = yypact[yystate];
|
---|
1598 | if (yyn == YYFLAG)
|
---|
1599 | goto yyerrdefault;
|
---|
1600 |
|
---|
1601 | yyn += YYTERROR;
|
---|
1602 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
|
---|
1603 | goto yyerrdefault;
|
---|
1604 |
|
---|
1605 | yyn = yytable[yyn];
|
---|
1606 | if (yyn < 0)
|
---|
1607 | {
|
---|
1608 | if (yyn == YYFLAG)
|
---|
1609 | goto yyerrpop;
|
---|
1610 | yyn = -yyn;
|
---|
1611 | goto yyreduce;
|
---|
1612 | }
|
---|
1613 | else if (yyn == 0)
|
---|
1614 | goto yyerrpop;
|
---|
1615 |
|
---|
1616 | if (yyn == YYFINAL)
|
---|
1617 | YYACCEPT;
|
---|
1618 |
|
---|
1619 | YYDPRINTF ((stderr, "Shifting error token, "));
|
---|
1620 |
|
---|
1621 | *++yyvsp = yylval;
|
---|
1622 | #if YYLSP_NEEDED
|
---|
1623 | *++yylsp = yylloc;
|
---|
1624 | #endif
|
---|
1625 |
|
---|
1626 | yystate = yyn;
|
---|
1627 | goto yynewstate;
|
---|
1628 |
|
---|
1629 |
|
---|
1630 | /*-------------------------------------.
|
---|
1631 | | yyacceptlab -- YYACCEPT comes here. |
|
---|
1632 | `-------------------------------------*/
|
---|
1633 | yyacceptlab:
|
---|
1634 | yyresult = 0;
|
---|
1635 | goto yyreturn;
|
---|
1636 |
|
---|
1637 | /*-----------------------------------.
|
---|
1638 | | yyabortlab -- YYABORT comes here. |
|
---|
1639 | `-----------------------------------*/
|
---|
1640 | yyabortlab:
|
---|
1641 | yyresult = 1;
|
---|
1642 | goto yyreturn;
|
---|
1643 |
|
---|
1644 | /*---------------------------------------------.
|
---|
1645 | | yyoverflowab -- parser overflow comes here. |
|
---|
1646 | `---------------------------------------------*/
|
---|
1647 | yyoverflowlab:
|
---|
1648 | yyerror ("parser stack overflow");
|
---|
1649 | yyresult = 2;
|
---|
1650 | /* Fall through. */
|
---|
1651 |
|
---|
1652 | yyreturn:
|
---|
1653 | #ifndef yyoverflow
|
---|
1654 | if (yyss != yyssa)
|
---|
1655 | YYSTACK_FREE (yyss);
|
---|
1656 | #endif
|
---|
1657 | return yyresult;
|
---|
1658 | }
|
---|
1659 | #line 449 "vs1.0_grammar.y"
|
---|
1660 |
|
---|
1661 | void yyerror(char* s)
|
---|
1662 | {
|
---|
1663 | LexError( "Syntax Error.\n" );
|
---|
1664 | //errors.set(s);
|
---|
1665 | //errors.set("unrecognized token");
|
---|
1666 | }
|
---|