4
|
1 /* A Bison parser, made by GNU Bison 2.3. */
|
|
2
|
|
3 /* Skeleton implementation for Bison LALR(1) parsers in C++
|
|
4
|
|
5 Copyright (C) 2002, 2003, 2004, 2005, 2006 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 2, or (at your option)
|
|
10 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, write to the Free Software
|
|
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
20 Boston, MA 02110-1301, USA. */
|
|
21
|
|
22 /* As a special exception, you may create a larger work that contains
|
|
23 part or all of the Bison parser skeleton and distribute that work
|
|
24 under terms of your choice, so long as that work isn't itself a
|
|
25 parser generator using the skeleton or a modified version thereof
|
|
26 as a parser skeleton. Alternatively, if you modify or redistribute
|
|
27 the parser skeleton itself, you may (at your option) remove this
|
|
28 special exception, which will cause the skeleton and the resulting
|
|
29 Bison output files to be licensed under the GNU General Public
|
|
30 License without this special exception.
|
|
31
|
|
32 This special exception was added by the Free Software Foundation in
|
|
33 version 2.2 of Bison. */
|
|
34
|
|
35
|
|
36 #include "script-parser.hh"
|
|
37
|
|
38 /* User implementation prologue. */
|
|
39 #line 36 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
40
|
|
41 #include "compiler.h"
|
|
42
|
|
43
|
|
44 /* Line 317 of lalr1.cc. */
|
|
45 #line 46 "script-parser.cc"
|
|
46
|
|
47 #ifndef YY_
|
|
48 # if YYENABLE_NLS
|
|
49 # if ENABLE_NLS
|
|
50 # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
|
|
51 # define YY_(msgid) dgettext ("bison-runtime", msgid)
|
|
52 # endif
|
|
53 # endif
|
|
54 # ifndef YY_
|
|
55 # define YY_(msgid) msgid
|
|
56 # endif
|
|
57 #endif
|
|
58
|
|
59 /* Suppress unused-variable warnings by "using" E. */
|
|
60 #define YYUSE(e) ((void) (e))
|
|
61
|
|
62 /* A pseudo ostream that takes yydebug_ into account. */
|
|
63 # define YYCDEBUG \
|
|
64 for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
|
|
65 (*yycdebug_)
|
|
66
|
|
67 /* Enable debugging if requested. */
|
|
68 #if YYDEBUG
|
|
69
|
|
70 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
|
71 do { \
|
|
72 if (yydebug_) \
|
|
73 { \
|
|
74 *yycdebug_ << Title << ' '; \
|
|
75 yy_symbol_print_ ((Type), (Value), (Location)); \
|
|
76 *yycdebug_ << std::endl; \
|
|
77 } \
|
|
78 } while (false)
|
|
79
|
|
80 # define YY_REDUCE_PRINT(Rule) \
|
|
81 do { \
|
|
82 if (yydebug_) \
|
|
83 yy_reduce_print_ (Rule); \
|
|
84 } while (false)
|
|
85
|
|
86 # define YY_STACK_PRINT() \
|
|
87 do { \
|
|
88 if (yydebug_) \
|
|
89 yystack_print_ (); \
|
|
90 } while (false)
|
|
91
|
|
92 #else /* !YYDEBUG */
|
|
93
|
|
94 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
|
95 # define YY_REDUCE_PRINT(Rule)
|
|
96 # define YY_STACK_PRINT()
|
|
97
|
|
98 #endif /* !YYDEBUG */
|
|
99
|
|
100 #define YYACCEPT goto yyacceptlab
|
|
101 #define YYABORT goto yyabortlab
|
|
102 #define YYERROR goto yyerrorlab
|
|
103
|
|
104 namespace yy
|
|
105 {
|
|
106 #if YYERROR_VERBOSE
|
|
107
|
|
108 /* Return YYSTR after stripping away unnecessary quotes and
|
|
109 backslashes, so that it's suitable for yyerror. The heuristic is
|
|
110 that double-quoting is unnecessary unless the string contains an
|
|
111 apostrophe, a comma, or backslash (other than backslash-backslash).
|
|
112 YYSTR is taken from yytname. */
|
|
113 std::string
|
|
114 script_parser::yytnamerr_ (const char *yystr)
|
|
115 {
|
|
116 if (*yystr == '"')
|
|
117 {
|
|
118 std::string yyr = "";
|
|
119 char const *yyp = yystr;
|
|
120
|
|
121 for (;;)
|
|
122 switch (*++yyp)
|
|
123 {
|
|
124 case '\'':
|
|
125 case ',':
|
|
126 goto do_not_strip_quotes;
|
|
127
|
|
128 case '\\':
|
|
129 if (*++yyp != '\\')
|
|
130 goto do_not_strip_quotes;
|
|
131 /* Fall through. */
|
|
132 default:
|
|
133 yyr += *yyp;
|
|
134 break;
|
|
135
|
|
136 case '"':
|
|
137 return yyr;
|
|
138 }
|
|
139 do_not_strip_quotes: ;
|
|
140 }
|
|
141
|
|
142 return yystr;
|
|
143 }
|
|
144
|
|
145 #endif
|
|
146
|
|
147 /// Build a parser object.
|
|
148 script_parser::script_parser (compiler& driver_yyarg)
|
|
149 : yydebug_ (false),
|
|
150 yycdebug_ (&std::cerr),
|
|
151 driver (driver_yyarg)
|
|
152 {
|
|
153 }
|
|
154
|
|
155 script_parser::~script_parser ()
|
|
156 {
|
|
157 }
|
|
158
|
|
159 #if YYDEBUG
|
|
160 /*--------------------------------.
|
|
161 | Print this symbol on YYOUTPUT. |
|
|
162 `--------------------------------*/
|
|
163
|
|
164 inline void
|
|
165 script_parser::yy_symbol_value_print_ (int yytype,
|
|
166 const semantic_type* yyvaluep, const location_type* yylocationp)
|
|
167 {
|
|
168 YYUSE (yylocationp);
|
|
169 YYUSE (yyvaluep);
|
|
170 switch (yytype)
|
|
171 {
|
|
172 default:
|
|
173 break;
|
|
174 }
|
|
175 }
|
|
176
|
|
177
|
|
178 void
|
|
179 script_parser::yy_symbol_print_ (int yytype,
|
|
180 const semantic_type* yyvaluep, const location_type* yylocationp)
|
|
181 {
|
|
182 *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
|
|
183 << ' ' << yytname_[yytype] << " ("
|
|
184 << *yylocationp << ": ";
|
|
185 yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
|
|
186 *yycdebug_ << ')';
|
|
187 }
|
|
188 #endif /* ! YYDEBUG */
|
|
189
|
|
190 void
|
|
191 script_parser::yydestruct_ (const char* yymsg,
|
|
192 int yytype, semantic_type* yyvaluep, location_type* yylocationp)
|
|
193 {
|
|
194 YYUSE (yylocationp);
|
|
195 YYUSE (yymsg);
|
|
196 YYUSE (yyvaluep);
|
|
197
|
|
198 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
|
199
|
|
200 switch (yytype)
|
|
201 {
|
|
202 case 4: /* "\"identifier\"" */
|
|
203 #line 68 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
204 { delete (yyvaluep->sval); };
|
|
205 #line 206 "script-parser.cc"
|
|
206 break;
|
|
207 case 39: /* "assign" */
|
|
208 #line 71 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
209 { delete (yyvaluep->assign); };
|
|
210 #line 211 "script-parser.cc"
|
|
211 break;
|
|
212 case 40: /* "comp_expr" */
|
|
213 #line 74 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
214 { delete (yyvaluep->expr); };
|
|
215 #line 216 "script-parser.cc"
|
|
216 break;
|
|
217 case 41: /* "expr" */
|
|
218 #line 73 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
219 { delete (yyvaluep->expr); };
|
|
220 #line 221 "script-parser.cc"
|
|
221 break;
|
|
222 case 42: /* "value" */
|
|
223 #line 72 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
224 { delete (yyvaluep->expr); };
|
|
225 #line 226 "script-parser.cc"
|
|
226 break;
|
|
227 case 43: /* "args" */
|
|
228 #line 70 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
229 { delete (yyvaluep->args); };
|
|
230 #line 231 "script-parser.cc"
|
|
231 break;
|
|
232
|
|
233 default:
|
|
234 break;
|
|
235 }
|
|
236 }
|
|
237
|
|
238 void
|
|
239 script_parser::yypop_ (unsigned int n)
|
|
240 {
|
|
241 yystate_stack_.pop (n);
|
|
242 yysemantic_stack_.pop (n);
|
|
243 yylocation_stack_.pop (n);
|
|
244 }
|
|
245
|
|
246 std::ostream&
|
|
247 script_parser::debug_stream () const
|
|
248 {
|
|
249 return *yycdebug_;
|
|
250 }
|
|
251
|
|
252 void
|
|
253 script_parser::set_debug_stream (std::ostream& o)
|
|
254 {
|
|
255 yycdebug_ = &o;
|
|
256 }
|
|
257
|
|
258
|
|
259 script_parser::debug_level_type
|
|
260 script_parser::debug_level () const
|
|
261 {
|
|
262 return yydebug_;
|
|
263 }
|
|
264
|
|
265 void
|
|
266 script_parser::set_debug_level (debug_level_type l)
|
|
267 {
|
|
268 yydebug_ = l;
|
|
269 }
|
|
270
|
|
271
|
|
272 int
|
|
273 script_parser::parse ()
|
|
274 {
|
|
275 /// Look-ahead and look-ahead in internal form.
|
|
276 int yychar = yyempty_;
|
|
277 int yytoken = 0;
|
|
278
|
|
279 /* State. */
|
|
280 int yyn;
|
|
281 int yylen = 0;
|
|
282 int yystate = 0;
|
|
283
|
|
284 /* Error handling. */
|
|
285 int yynerrs_ = 0;
|
|
286 int yyerrstatus_ = 0;
|
|
287
|
|
288 /// Semantic value of the look-ahead.
|
|
289 semantic_type yylval;
|
|
290 /// Location of the look-ahead.
|
|
291 location_type yylloc;
|
|
292 /// The locations where the error started and ended.
|
|
293 location yyerror_range[2];
|
|
294
|
|
295 /// $$.
|
|
296 semantic_type yyval;
|
|
297 /// @$.
|
|
298 location_type yyloc;
|
|
299
|
|
300 int yyresult;
|
|
301
|
|
302 YYCDEBUG << "Starting parse" << std::endl;
|
|
303
|
|
304
|
|
305 /* User initialization code. */
|
|
306 #line 20 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
307 {
|
|
308 // ƒƒP[ƒVƒ‡ƒ“‰Šú‰»
|
|
309 yylloc.begin.filename = yylloc.end.filename = &driver.get_filename();
|
|
310 }
|
|
311 /* Line 555 of yacc.c. */
|
|
312 #line 313 "script-parser.cc"
|
|
313 /* Initialize the stacks. The initial state will be pushed in
|
|
314 yynewstate, since the latter expects the semantical and the
|
|
315 location values to have been already stored, initialize these
|
|
316 stacks with a primary value. */
|
|
317 yystate_stack_ = state_stack_type (0);
|
|
318 yysemantic_stack_ = semantic_stack_type (0);
|
|
319 yylocation_stack_ = location_stack_type (0);
|
|
320 yysemantic_stack_.push (yylval);
|
|
321 yylocation_stack_.push (yylloc);
|
|
322
|
|
323 /* New state. */
|
|
324 yynewstate:
|
|
325 yystate_stack_.push (yystate);
|
|
326 YYCDEBUG << "Entering state " << yystate << std::endl;
|
|
327 goto yybackup;
|
|
328
|
|
329 /* Backup. */
|
|
330 yybackup:
|
|
331
|
|
332 /* Try to take a decision without look-ahead. */
|
|
333 yyn = yypact_[yystate];
|
|
334 if (yyn == yypact_ninf_)
|
|
335 goto yydefault;
|
|
336
|
|
337 /* Read a look-ahead token. */
|
|
338 if (yychar == yyempty_)
|
|
339 {
|
|
340 YYCDEBUG << "Reading a token: ";
|
|
341 yychar = yylex (&yylval, &yylloc, driver);
|
|
342 }
|
|
343
|
|
344
|
|
345 /* Convert token to internal form. */
|
|
346 if (yychar <= yyeof_)
|
|
347 {
|
|
348 yychar = yytoken = yyeof_;
|
|
349 YYCDEBUG << "Now at end of input." << std::endl;
|
|
350 }
|
|
351 else
|
|
352 {
|
|
353 yytoken = yytranslate_ (yychar);
|
|
354 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
|
355 }
|
|
356
|
|
357 /* If the proper action on seeing token YYTOKEN is to reduce or to
|
|
358 detect an error, take that action. */
|
|
359 yyn += yytoken;
|
|
360 if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
|
361 goto yydefault;
|
|
362
|
|
363 /* Reduce or error. */
|
|
364 yyn = yytable_[yyn];
|
|
365 if (yyn <= 0)
|
|
366 {
|
|
367 if (yyn == 0 || yyn == yytable_ninf_)
|
|
368 goto yyerrlab;
|
|
369 yyn = -yyn;
|
|
370 goto yyreduce;
|
|
371 }
|
|
372
|
|
373 /* Accept? */
|
|
374 if (yyn == yyfinal_)
|
|
375 goto yyacceptlab;
|
|
376
|
|
377 /* Shift the look-ahead token. */
|
|
378 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
|
379
|
|
380 /* Discard the token being shifted unless it is eof. */
|
|
381 if (yychar != yyeof_)
|
|
382 yychar = yyempty_;
|
|
383
|
|
384 yysemantic_stack_.push (yylval);
|
|
385 yylocation_stack_.push (yylloc);
|
|
386
|
|
387 /* Count tokens shifted since error; after three, turn off error
|
|
388 status. */
|
|
389 if (yyerrstatus_)
|
|
390 --yyerrstatus_;
|
|
391
|
|
392 yystate = yyn;
|
|
393 goto yynewstate;
|
|
394
|
|
395 /*-----------------------------------------------------------.
|
|
396 | yydefault -- do the default action for the current state. |
|
|
397 `-----------------------------------------------------------*/
|
|
398 yydefault:
|
|
399 yyn = yydefact_[yystate];
|
|
400 if (yyn == 0)
|
|
401 goto yyerrlab;
|
|
402 goto yyreduce;
|
|
403
|
|
404 /*-----------------------------.
|
|
405 | yyreduce -- Do a reduction. |
|
|
406 `-----------------------------*/
|
|
407 yyreduce:
|
|
408 yylen = yyr2_[yyn];
|
|
409 /* If YYLEN is nonzero, implement the default value of the action:
|
|
410 `$$ = $1'. Otherwise, use the top of the stack.
|
|
411
|
|
412 Otherwise, the following line sets YYVAL to garbage.
|
|
413 This behavior is undocumented and Bison
|
|
414 users should not rely upon it. */
|
|
415 if (yylen)
|
|
416 yyval = yysemantic_stack_[yylen - 1];
|
|
417 else
|
|
418 yyval = yysemantic_stack_[0];
|
|
419
|
|
420 {
|
|
421 slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
|
|
422 YYLLOC_DEFAULT (yyloc, slice, yylen);
|
|
423 }
|
|
424 YY_REDUCE_PRINT (yyn);
|
|
425 switch (yyn)
|
|
426 {
|
|
427 case 6:
|
|
428 #line 90 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
429 { driver.EndStatement((yylocation_stack_[(1) - (1)])); ;}
|
|
430 break;
|
|
431
|
|
432 case 7:
|
|
433 #line 91 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
434 { driver.AssignStatement((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].assign)); ;}
|
|
435 break;
|
|
436
|
|
437 case 8:
|
|
438 #line 92 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
439 { driver.IfStatement((yylocation_stack_[(3) - (1)]), (yysemantic_stack_[(3) - (2)].expr)); ;}
|
|
440 break;
|
|
441
|
|
442 case 9:
|
|
443 #line 93 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
444 { driver.ElseStatement((yylocation_stack_[(1) - (1)])); ;}
|
|
445 break;
|
|
446
|
|
447 case 10:
|
|
448 #line 94 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
449 { driver.EndifStatement((yylocation_stack_[(1) - (1)])); ;}
|
|
450 break;
|
|
451
|
|
452 case 11:
|
|
453 #line 95 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
454 { driver.ForStatement((yylocation_stack_[(6) - (1)]), (yysemantic_stack_[(6) - (2)].assign), (yysemantic_stack_[(6) - (4)].expr), (yysemantic_stack_[(6) - (6)].expr)); ;}
|
|
455 break;
|
|
456
|
|
457 case 12:
|
|
458 #line 96 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
459 { driver.ForStatement((yylocation_stack_[(4) - (1)]), (yysemantic_stack_[(4) - (2)].assign), (yysemantic_stack_[(4) - (4)].expr), NULL); ;}
|
|
460 break;
|
|
461
|
|
462 case 13:
|
|
463 #line 97 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
464 { driver.NextStatement((yylocation_stack_[(1) - (1)])); ;}
|
|
465 break;
|
|
466
|
|
467 case 14:
|
|
468 #line 98 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
469 { driver.WhileStatement((yylocation_stack_[(2) - (1)]), (yysemantic_stack_[(2) - (2)].expr)); ;}
|
|
470 break;
|
|
471
|
|
472 case 15:
|
|
473 #line 99 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
474 { driver.WendStatement((yylocation_stack_[(1) - (1)])); ;}
|
|
475 break;
|
|
476
|
|
477 case 16:
|
|
478 #line 100 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
479 { driver.PrintStatement((yylocation_stack_[(2) - (1)]), (yysemantic_stack_[(2) - (2)].args)); ;}
|
|
480 break;
|
|
481
|
|
482 case 18:
|
|
483 #line 104 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
484 { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '=', (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
485 break;
|
|
486
|
|
487 case 19:
|
|
488 #line 107 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
489 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_EQ, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
490 break;
|
|
491
|
|
492 case 20:
|
|
493 #line 108 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
494 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_NE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
495 break;
|
|
496
|
|
497 case 21:
|
|
498 #line 109 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
499 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_GT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
500 break;
|
|
501
|
|
502 case 22:
|
|
503 #line 110 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
504 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_GE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
505 break;
|
|
506
|
|
507 case 23:
|
|
508 #line 111 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
509 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_LT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
510 break;
|
|
511
|
|
512 case 24:
|
|
513 #line 112 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
514 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_LE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
515 break;
|
|
516
|
|
517 case 25:
|
|
518 #line 115 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
519 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_MINUS, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
520 break;
|
|
521
|
|
522 case 26:
|
|
523 #line 116 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
524 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_PLUS, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
525 break;
|
|
526
|
|
527 case 27:
|
|
528 #line 117 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
529 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_TIMES, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
530 break;
|
|
531
|
|
532 case 28:
|
|
533 #line 118 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
534 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_DIVIDE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
535 break;
|
|
536
|
|
537 case 29:
|
|
538 #line 119 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
539 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (1)]), OP_MOD, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
540 break;
|
|
541
|
|
542 case 30:
|
|
543 #line 120 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
544 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(2) - (1)]), OP_NEG, (yysemantic_stack_[(2) - (2)].expr)); ;}
|
|
545 break;
|
|
546
|
|
547 case 31:
|
|
548 #line 121 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
549 { (yyval.expr) = (yysemantic_stack_[(3) - (2)].expr); ;}
|
|
550 break;
|
|
551
|
|
552 case 32:
|
|
553 #line 122 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
554 { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); ;}
|
|
555 break;
|
|
556
|
|
557 case 33:
|
|
558 #line 123 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
559 { (yyval.expr) = new CNode((yylocation_stack_[(1) - (1)]), OP_CONST, (yysemantic_stack_[(1) - (1)].ival)); ;}
|
|
560 break;
|
|
561
|
|
562 case 34:
|
|
563 #line 124 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
564 { (yyval.expr) = new CNode((yylocation_stack_[(4) - (1)]), OP_RANDFUNC, (yysemantic_stack_[(4) - (3)].expr)); ;}
|
|
565 break;
|
|
566
|
|
567 case 35:
|
|
568 #line 127 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
569 { (yyval.expr) = new CValueNode((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].sval)); ;}
|
|
570 break;
|
|
571
|
|
572 case 36:
|
|
573 #line 130 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
574 { (yyval.args) = new CArgs((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].expr)); ;}
|
|
575 break;
|
|
576
|
|
577 case 37:
|
|
578 #line 131 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
579 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args)->Add((yylocation_stack_[(3) - (3)]), (yysemantic_stack_[(3) - (3)].expr)); ;}
|
|
580 break;
|
|
581
|
|
582
|
|
583 /* Line 675 of lalr1.cc. */
|
|
584 #line 585 "script-parser.cc"
|
|
585 default: break;
|
|
586 }
|
|
587 YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
|
|
588
|
|
589 yypop_ (yylen);
|
|
590 yylen = 0;
|
|
591 YY_STACK_PRINT ();
|
|
592
|
|
593 yysemantic_stack_.push (yyval);
|
|
594 yylocation_stack_.push (yyloc);
|
|
595
|
|
596 /* Shift the result of the reduction. */
|
|
597 yyn = yyr1_[yyn];
|
|
598 yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
|
|
599 if (0 <= yystate && yystate <= yylast_
|
|
600 && yycheck_[yystate] == yystate_stack_[0])
|
|
601 yystate = yytable_[yystate];
|
|
602 else
|
|
603 yystate = yydefgoto_[yyn - yyntokens_];
|
|
604 goto yynewstate;
|
|
605
|
|
606 /*------------------------------------.
|
|
607 | yyerrlab -- here on detecting error |
|
|
608 `------------------------------------*/
|
|
609 yyerrlab:
|
|
610 /* If not already recovering from an error, report this error. */
|
|
611 if (!yyerrstatus_)
|
|
612 {
|
|
613 ++yynerrs_;
|
|
614 error (yylloc, yysyntax_error_ (yystate, yytoken));
|
|
615 }
|
|
616
|
|
617 yyerror_range[0] = yylloc;
|
|
618 if (yyerrstatus_ == 3)
|
|
619 {
|
|
620 /* If just tried and failed to reuse look-ahead token after an
|
|
621 error, discard it. */
|
|
622
|
|
623 if (yychar <= yyeof_)
|
|
624 {
|
|
625 /* Return failure if at end of input. */
|
|
626 if (yychar == yyeof_)
|
|
627 YYABORT;
|
|
628 }
|
|
629 else
|
|
630 {
|
|
631 yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
|
|
632 yychar = yyempty_;
|
|
633 }
|
|
634 }
|
|
635
|
|
636 /* Else will try to reuse look-ahead token after shifting the error
|
|
637 token. */
|
|
638 goto yyerrlab1;
|
|
639
|
|
640
|
|
641 /*---------------------------------------------------.
|
|
642 | yyerrorlab -- error raised explicitly by YYERROR. |
|
|
643 `---------------------------------------------------*/
|
|
644 yyerrorlab:
|
|
645
|
|
646 /* Pacify compilers like GCC when the user code never invokes
|
|
647 YYERROR and the label yyerrorlab therefore never appears in user
|
|
648 code. */
|
|
649 if (false)
|
|
650 goto yyerrorlab;
|
|
651
|
|
652 yyerror_range[0] = yylocation_stack_[yylen - 1];
|
|
653 /* Do not reclaim the symbols of the rule which action triggered
|
|
654 this YYERROR. */
|
|
655 yypop_ (yylen);
|
|
656 yylen = 0;
|
|
657 yystate = yystate_stack_[0];
|
|
658 goto yyerrlab1;
|
|
659
|
|
660 /*-------------------------------------------------------------.
|
|
661 | yyerrlab1 -- common code for both syntax error and YYERROR. |
|
|
662 `-------------------------------------------------------------*/
|
|
663 yyerrlab1:
|
|
664 yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
|
665
|
|
666 for (;;)
|
|
667 {
|
|
668 yyn = yypact_[yystate];
|
|
669 if (yyn != yypact_ninf_)
|
|
670 {
|
|
671 yyn += yyterror_;
|
|
672 if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
|
673 {
|
|
674 yyn = yytable_[yyn];
|
|
675 if (0 < yyn)
|
|
676 break;
|
|
677 }
|
|
678 }
|
|
679
|
|
680 /* Pop the current state because it cannot handle the error token. */
|
|
681 if (yystate_stack_.height () == 1)
|
|
682 YYABORT;
|
|
683
|
|
684 yyerror_range[0] = yylocation_stack_[0];
|
|
685 yydestruct_ ("Error: popping",
|
|
686 yystos_[yystate],
|
|
687 &yysemantic_stack_[0], &yylocation_stack_[0]);
|
|
688 yypop_ ();
|
|
689 yystate = yystate_stack_[0];
|
|
690 YY_STACK_PRINT ();
|
|
691 }
|
|
692
|
|
693 if (yyn == yyfinal_)
|
|
694 goto yyacceptlab;
|
|
695
|
|
696 yyerror_range[1] = yylloc;
|
|
697 // Using YYLLOC is tempting, but would change the location of
|
|
698 // the look-ahead. YYLOC is available though.
|
|
699 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
|
|
700 yysemantic_stack_.push (yylval);
|
|
701 yylocation_stack_.push (yyloc);
|
|
702
|
|
703 /* Shift the error token. */
|
|
704 YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
|
|
705 &yysemantic_stack_[0], &yylocation_stack_[0]);
|
|
706
|
|
707 yystate = yyn;
|
|
708 goto yynewstate;
|
|
709
|
|
710 /* Accept. */
|
|
711 yyacceptlab:
|
|
712 yyresult = 0;
|
|
713 goto yyreturn;
|
|
714
|
|
715 /* Abort. */
|
|
716 yyabortlab:
|
|
717 yyresult = 1;
|
|
718 goto yyreturn;
|
|
719
|
|
720 yyreturn:
|
|
721 if (yychar != yyeof_ && yychar != yyempty_)
|
|
722 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
|
|
723
|
|
724 /* Do not reclaim the symbols of the rule which action triggered
|
|
725 this YYABORT or YYACCEPT. */
|
|
726 yypop_ (yylen);
|
|
727 while (yystate_stack_.height () != 1)
|
|
728 {
|
|
729 yydestruct_ ("Cleanup: popping",
|
|
730 yystos_[yystate_stack_[0]],
|
|
731 &yysemantic_stack_[0],
|
|
732 &yylocation_stack_[0]);
|
|
733 yypop_ ();
|
|
734 }
|
|
735
|
|
736 return yyresult;
|
|
737 }
|
|
738
|
|
739 // Generate an error message.
|
|
740 std::string
|
|
741 script_parser::yysyntax_error_ (int yystate, int tok)
|
|
742 {
|
|
743 std::string res;
|
|
744 YYUSE (yystate);
|
|
745 #if YYERROR_VERBOSE
|
|
746 int yyn = yypact_[yystate];
|
|
747 if (yypact_ninf_ < yyn && yyn <= yylast_)
|
|
748 {
|
|
749 /* Start YYX at -YYN if negative to avoid negative indexes in
|
|
750 YYCHECK. */
|
|
751 int yyxbegin = yyn < 0 ? -yyn : 0;
|
|
752
|
|
753 /* Stay within bounds of both yycheck and yytname. */
|
|
754 int yychecklim = yylast_ - yyn + 1;
|
|
755 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
|
756 int count = 0;
|
|
757 for (int x = yyxbegin; x < yyxend; ++x)
|
|
758 if (yycheck_[x + yyn] == x && x != yyterror_)
|
|
759 ++count;
|
|
760
|
|
761 // FIXME: This method of building the message is not compatible
|
|
762 // with internationalization. It should work like yacc.c does it.
|
|
763 // That is, first build a string that looks like this:
|
|
764 // "syntax error, unexpected %s or %s or %s"
|
|
765 // Then, invoke YY_ on this string.
|
|
766 // Finally, use the string as a format to output
|
|
767 // yytname_[tok], etc.
|
|
768 // Until this gets fixed, this message appears in English only.
|
|
769 res = "syntax error, unexpected ";
|
|
770 res += yytnamerr_ (yytname_[tok]);
|
|
771 if (count < 5)
|
|
772 {
|
|
773 count = 0;
|
|
774 for (int x = yyxbegin; x < yyxend; ++x)
|
|
775 if (yycheck_[x + yyn] == x && x != yyterror_)
|
|
776 {
|
|
777 res += (!count++) ? ", expecting " : " or ";
|
|
778 res += yytnamerr_ (yytname_[x]);
|
|
779 }
|
|
780 }
|
|
781 }
|
|
782 else
|
|
783 #endif
|
|
784 res = YY_("syntax error");
|
|
785 return res;
|
|
786 }
|
|
787
|
|
788
|
|
789 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
|
790 STATE-NUM. */
|
|
791 const signed char script_parser::yypact_ninf_ = -23;
|
|
792 const signed char
|
|
793 script_parser::yypact_[] =
|
|
794 {
|
|
795 85, -23, -23, -23, 19, -23, -23, -3, -23, 19,
|
|
796 -23, -23, 19, 66, -23, -7, -23, -22, -23, -14,
|
|
797 19, 19, 8, 38, -23, 9, -23, 103, 4, -23,
|
|
798 -23, -23, 19, 19, -23, 86, -23, 19, 19, 19,
|
|
799 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
|
800 103, 91, -23, 103, 103, 103, 103, -20, -20, -23,
|
|
801 -23, -23, 103, 103, -11, 103, -23, 19, 103
|
|
802 };
|
|
803
|
|
804 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
|
805 doesn't specify something else to do. Zero means the default is an
|
|
806 error. */
|
|
807 const unsigned char
|
|
808 script_parser::yydefact_[] =
|
|
809 {
|
|
810 0, 17, 35, 5, 0, 9, 10, 0, 13, 0,
|
|
811 15, 6, 0, 0, 2, 0, 7, 0, 33, 0,
|
|
812 0, 0, 0, 0, 32, 0, 14, 36, 16, 1,
|
|
813 3, 4, 0, 0, 30, 0, 8, 0, 0, 0,
|
|
814 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
815 18, 0, 31, 19, 20, 22, 24, 26, 25, 27,
|
|
816 28, 29, 21, 23, 12, 37, 34, 0, 11
|
|
817 };
|
|
818
|
|
819 /* YYPGOTO[NTERM-NUM]. */
|
|
820 const signed char
|
|
821 script_parser::yypgoto_[] =
|
|
822 {
|
|
823 -23, -23, 27, -23, 34, 39, -12, 3, -23
|
|
824 };
|
|
825
|
|
826 /* YYDEFGOTO[NTERM-NUM]. */
|
|
827 const signed char
|
|
828 script_parser::yydefgoto_[] =
|
|
829 {
|
|
830 -1, 13, 14, 15, 16, 22, 23, 24, 28
|
|
831 };
|
|
832
|
|
833 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
|
834 positive, shift that token. If negative, reduce the rule which
|
|
835 number is the opposite. If zero, do what YYDEFACT says. */
|
|
836 const signed char script_parser::yytable_ninf_ = -1;
|
|
837 const unsigned char
|
|
838 script_parser::yytable_[] =
|
|
839 {
|
|
840 27, 2, 31, 17, 43, 44, 45, 32, 34, 35,
|
|
841 17, 41, 42, 43, 44, 45, 17, 67, 33, 36,
|
|
842 50, 51, 18, 2, 48, 53, 54, 55, 56, 57,
|
|
843 58, 59, 60, 61, 62, 63, 64, 65, 49, 19,
|
|
844 30, 25, 20, 37, 38, 39, 40, 0, 26, 0,
|
|
845 0, 21, 0, 0, 0, 68, 0, 0, 0, 0,
|
|
846 41, 42, 43, 44, 45, 0, 29, 1, 46, 47,
|
|
847 2, 0, 0, 0, 0, 3, 4, 0, 5, 6,
|
|
848 7, 0, 8, 9, 10, 11, 1, 12, 0, 2,
|
|
849 0, 0, 0, 0, 3, 4, 0, 5, 6, 7,
|
|
850 0, 8, 9, 10, 11, 0, 12, 0, 41, 42,
|
|
851 43, 44, 45, 41, 42, 43, 44, 45, 0, 52,
|
|
852 0, 0, 0, 0, 66, 41, 42, 43, 44, 45
|
|
853 };
|
|
854
|
|
855 /* YYCHECK. */
|
|
856 const signed char
|
|
857 script_parser::yycheck_[] =
|
|
858 {
|
|
859 12, 4, 9, 0, 24, 25, 26, 29, 20, 21,
|
|
860 7, 22, 23, 24, 25, 26, 13, 28, 32, 11,
|
|
861 32, 33, 3, 4, 15, 37, 38, 39, 40, 41,
|
|
862 42, 43, 44, 45, 46, 47, 48, 49, 34, 20,
|
|
863 13, 7, 23, 5, 6, 7, 8, -1, 9, -1,
|
|
864 -1, 32, -1, -1, -1, 67, -1, -1, -1, -1,
|
|
865 22, 23, 24, 25, 26, -1, 0, 1, 30, 31,
|
|
866 4, -1, -1, -1, -1, 9, 10, -1, 12, 13,
|
|
867 14, -1, 16, 17, 18, 19, 1, 21, -1, 4,
|
|
868 -1, -1, -1, -1, 9, 10, -1, 12, 13, 14,
|
|
869 -1, 16, 17, 18, 19, -1, 21, -1, 22, 23,
|
|
870 24, 25, 26, 22, 23, 24, 25, 26, -1, 33,
|
|
871 -1, -1, -1, -1, 33, 22, 23, 24, 25, 26
|
|
872 };
|
|
873
|
|
874 /* STOS_[STATE-NUM] -- The (internal number of the) accessing
|
|
875 symbol of state STATE-NUM. */
|
|
876 const unsigned char
|
|
877 script_parser::yystos_[] =
|
|
878 {
|
|
879 0, 1, 4, 9, 10, 12, 13, 14, 16, 17,
|
|
880 18, 19, 21, 36, 37, 38, 39, 42, 3, 20,
|
|
881 23, 32, 40, 41, 42, 39, 40, 41, 43, 0,
|
|
882 37, 9, 29, 32, 41, 41, 11, 5, 6, 7,
|
|
883 8, 22, 23, 24, 25, 26, 30, 31, 15, 34,
|
|
884 41, 41, 33, 41, 41, 41, 41, 41, 41, 41,
|
|
885 41, 41, 41, 41, 41, 41, 33, 28, 41
|
|
886 };
|
|
887
|
|
888 #if YYDEBUG
|
|
889 /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
|
890 to YYLEX-NUM. */
|
|
891 const unsigned short int
|
|
892 script_parser::yytoken_number_[] =
|
|
893 {
|
|
894 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
|
895 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
|
|
896 275, 276, 43, 45, 42, 47, 37, 277, 278, 61,
|
|
897 62, 60, 40, 41, 44
|
|
898 };
|
|
899 #endif
|
|
900
|
|
901 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
|
902 const unsigned char
|
|
903 script_parser::yyr1_[] =
|
|
904 {
|
|
905 0, 35, 36, 36, 37, 37, 38, 38, 38, 38,
|
|
906 38, 38, 38, 38, 38, 38, 38, 38, 39, 40,
|
|
907 40, 40, 40, 40, 40, 41, 41, 41, 41, 41,
|
|
908 41, 41, 41, 41, 41, 42, 43, 43
|
|
909 };
|
|
910
|
|
911 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
|
912 const unsigned char
|
|
913 script_parser::yyr2_[] =
|
|
914 {
|
|
915 0, 2, 1, 2, 2, 1, 1, 1, 3, 1,
|
|
916 1, 6, 4, 1, 2, 1, 2, 1, 3, 3,
|
|
917 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
918 2, 3, 1, 1, 4, 1, 1, 3
|
|
919 };
|
|
920
|
|
921 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
|
922 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
|
923 First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
|
924 const char*
|
|
925 const script_parser::yytname_[] =
|
|
926 {
|
|
927 "\"end of file\"", "error", "$undefined", "\"ival\"", "\"identifier\"",
|
|
928 "\"==\"", "\"!=\"", "\">=\"", "\"<=\"", "\"\\n\"", "\"if\"", "\"then\"",
|
|
929 "\"else\"", "\"endif\"", "\"for\"", "\"to\"", "\"next\"", "\"while\"",
|
|
930 "\"wend\"", "\"end\"", "\"rand\"", "\"print\"", "'+'", "'-'", "'*'",
|
|
931 "'/'", "'%'", "NEG", "\"step\"", "'='", "'>'", "'<'", "'('", "')'",
|
|
932 "','", "$accept", "unit", "states", "statement", "assign", "comp_expr",
|
|
933 "expr", "value", "args", 0
|
|
934 };
|
|
935 #endif
|
|
936
|
|
937 #if YYDEBUG
|
|
938 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
|
939 const script_parser::rhs_number_type
|
|
940 script_parser::yyrhs_[] =
|
|
941 {
|
|
942 36, 0, -1, 37, -1, 36, 37, -1, 38, 9,
|
|
943 -1, 9, -1, 19, -1, 39, -1, 10, 40, 11,
|
|
944 -1, 12, -1, 13, -1, 14, 39, 15, 41, 28,
|
|
945 41, -1, 14, 39, 15, 41, -1, 16, -1, 17,
|
|
946 40, -1, 18, -1, 21, 43, -1, 1, -1, 42,
|
|
947 29, 41, -1, 41, 5, 41, -1, 41, 6, 41,
|
|
948 -1, 41, 30, 41, -1, 41, 7, 41, -1, 41,
|
|
949 31, 41, -1, 41, 8, 41, -1, 41, 23, 41,
|
|
950 -1, 41, 22, 41, -1, 41, 24, 41, -1, 41,
|
|
951 25, 41, -1, 41, 26, 41, -1, 23, 41, -1,
|
|
952 32, 41, 33, -1, 42, -1, 3, -1, 20, 32,
|
|
953 41, 33, -1, 4, -1, 41, -1, 43, 34, 41,
|
|
954 -1
|
|
955 };
|
|
956
|
|
957 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
|
958 YYRHS. */
|
|
959 const unsigned char
|
|
960 script_parser::yyprhs_[] =
|
|
961 {
|
|
962 0, 0, 3, 5, 8, 11, 13, 15, 17, 21,
|
|
963 23, 25, 32, 37, 39, 42, 44, 47, 49, 53,
|
|
964 57, 61, 65, 69, 73, 77, 81, 85, 89, 93,
|
|
965 97, 100, 104, 106, 108, 113, 115, 117
|
|
966 };
|
|
967
|
|
968 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
|
969 const unsigned char
|
|
970 script_parser::yyrline_[] =
|
|
971 {
|
|
972 0, 82, 82, 83, 86, 87, 90, 91, 92, 93,
|
|
973 94, 95, 96, 97, 98, 99, 100, 101, 104, 107,
|
|
974 108, 109, 110, 111, 112, 115, 116, 117, 118, 119,
|
|
975 120, 121, 122, 123, 124, 127, 130, 131
|
|
976 };
|
|
977
|
|
978 // Print the state stack on the debug stream.
|
|
979 void
|
|
980 script_parser::yystack_print_ ()
|
|
981 {
|
|
982 *yycdebug_ << "Stack now";
|
|
983 for (state_stack_type::const_iterator i = yystate_stack_.begin ();
|
|
984 i != yystate_stack_.end (); ++i)
|
|
985 *yycdebug_ << ' ' << *i;
|
|
986 *yycdebug_ << std::endl;
|
|
987 }
|
|
988
|
|
989 // Report on the debug stream that the rule \a yyrule is going to be reduced.
|
|
990 void
|
|
991 script_parser::yy_reduce_print_ (int yyrule)
|
|
992 {
|
|
993 unsigned int yylno = yyrline_[yyrule];
|
|
994 int yynrhs = yyr2_[yyrule];
|
|
995 /* Print the symbols being reduced, and their result. */
|
|
996 *yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
|
997 << " (line " << yylno << "), ";
|
|
998 /* The symbols being reduced. */
|
|
999 for (int yyi = 0; yyi < yynrhs; yyi++)
|
|
1000 YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
|
|
1001 yyrhs_[yyprhs_[yyrule] + yyi],
|
|
1002 &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
|
|
1003 &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
|
|
1004 }
|
|
1005 #endif // YYDEBUG
|
|
1006
|
|
1007 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
|
1008 script_parser::token_number_type
|
|
1009 script_parser::yytranslate_ (int t)
|
|
1010 {
|
|
1011 static
|
|
1012 const token_number_type
|
|
1013 translate_table[] =
|
|
1014 {
|
|
1015 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1016 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1017 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1018 2, 2, 2, 2, 2, 2, 2, 26, 2, 2,
|
|
1019 32, 33, 24, 22, 34, 23, 2, 25, 2, 2,
|
|
1020 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1021 31, 29, 30, 2, 2, 2, 2, 2, 2, 2,
|
|
1022 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1023 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1024 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1025 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1026 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1027 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1028 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1029 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1030 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1031 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1032 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1033 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1034 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1035 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1036 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1037 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1038 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1039 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
1040 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
|
|
1041 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
1042 15, 16, 17, 18, 19, 20, 21, 27, 28
|
|
1043 };
|
|
1044 if ((unsigned int) t <= yyuser_token_number_max_)
|
|
1045 return translate_table[t];
|
|
1046 else
|
|
1047 return yyundef_token_;
|
|
1048 }
|
|
1049
|
|
1050 const int script_parser::yyeof_ = 0;
|
|
1051 const int script_parser::yylast_ = 129;
|
|
1052 const int script_parser::yynnts_ = 9;
|
|
1053 const int script_parser::yyempty_ = -2;
|
|
1054 const int script_parser::yyfinal_ = 29;
|
|
1055 const int script_parser::yyterror_ = 1;
|
|
1056 const int script_parser::yyerrcode_ = 256;
|
|
1057 const int script_parser::yyntokens_ = 35;
|
|
1058
|
|
1059 const unsigned int script_parser::yyuser_token_number_max_ = 278;
|
|
1060 const script_parser::token_number_type script_parser::yyundef_token_ = 2;
|
|
1061
|
|
1062 } // namespace yy
|
|
1063
|
|
1064 #line 134 "d:\\Work\\ScriptEngine\\Sample Source\\Bison-Flex\\BasicCompiler-MemoryBase\\script-parser.yy"
|
|
1065
|
|
1066 void yy::script_parser::error(const yy::script_parser::location_type& l, const std::string& m)
|
|
1067 {
|
|
1068 driver.error(l, m);
|
|
1069 }
|
|
1070
|