Mercurial > hg > Members > nobuyasu > SampleSource
comparison WindowsOnly/WinScript/script-parser.cc @ 0:db40c85cad7a default tip
upload sample source
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 May 2011 03:11:59 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:db40c85cad7a |
---|---|
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 44 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\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 92 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
204 { delete (yyvaluep->sval); }; | |
205 #line 206 "script-parser.cc" | |
206 break; | |
207 case 5: /* "\"sval\"" */ | |
208 #line 93 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
209 { delete (yyvaluep->sval); }; | |
210 #line 211 "script-parser.cc" | |
211 break; | |
212 case 55: /* "value_list" */ | |
213 #line 95 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
214 { delete (yyvaluep->value_list); }; | |
215 #line 216 "script-parser.cc" | |
216 break; | |
217 case 56: /* "arglist" */ | |
218 #line 96 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
219 { delete (yyvaluep->arglist); }; | |
220 #line 221 "script-parser.cc" | |
221 break; | |
222 case 57: /* "arg" */ | |
223 #line 97 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
224 { delete (yyvaluep->argdef); }; | |
225 #line 226 "script-parser.cc" | |
226 break; | |
227 case 60: /* "block" */ | |
228 #line 101 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
229 { delete (yyvaluep->block); }; | |
230 #line 231 "script-parser.cc" | |
231 break; | |
232 case 61: /* "decl_list" */ | |
233 #line 98 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
234 { delete (yyvaluep->decls); }; | |
235 #line 236 "script-parser.cc" | |
236 break; | |
237 case 62: /* "state_list" */ | |
238 #line 99 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
239 { delete (yyvaluep->states); }; | |
240 #line 241 "script-parser.cc" | |
241 break; | |
242 case 63: /* "decls" */ | |
243 #line 98 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
244 { delete (yyvaluep->decls); }; | |
245 #line 246 "script-parser.cc" | |
246 break; | |
247 case 64: /* "states" */ | |
248 #line 99 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
249 { delete (yyvaluep->states); }; | |
250 #line 251 "script-parser.cc" | |
251 break; | |
252 case 65: /* "statement" */ | |
253 #line 103 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
254 { delete (yyvaluep->statement); }; | |
255 #line 256 "script-parser.cc" | |
256 break; | |
257 case 66: /* "assign" */ | |
258 #line 102 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
259 { delete (yyvaluep->assign); }; | |
260 #line 261 "script-parser.cc" | |
261 break; | |
262 case 67: /* "expr" */ | |
263 #line 105 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
264 { delete (yyvaluep->expr); }; | |
265 #line 266 "script-parser.cc" | |
266 break; | |
267 case 68: /* "value" */ | |
268 #line 104 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
269 { delete (yyvaluep->value); }; | |
270 #line 271 "script-parser.cc" | |
271 break; | |
272 case 69: /* "args" */ | |
273 #line 100 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
274 { delete (yyvaluep->args); }; | |
275 #line 276 "script-parser.cc" | |
276 break; | |
277 | |
278 default: | |
279 break; | |
280 } | |
281 } | |
282 | |
283 void | |
284 script_parser::yypop_ (unsigned int n) | |
285 { | |
286 yystate_stack_.pop (n); | |
287 yysemantic_stack_.pop (n); | |
288 yylocation_stack_.pop (n); | |
289 } | |
290 | |
291 std::ostream& | |
292 script_parser::debug_stream () const | |
293 { | |
294 return *yycdebug_; | |
295 } | |
296 | |
297 void | |
298 script_parser::set_debug_stream (std::ostream& o) | |
299 { | |
300 yycdebug_ = &o; | |
301 } | |
302 | |
303 | |
304 script_parser::debug_level_type | |
305 script_parser::debug_level () const | |
306 { | |
307 return yydebug_; | |
308 } | |
309 | |
310 void | |
311 script_parser::set_debug_level (debug_level_type l) | |
312 { | |
313 yydebug_ = l; | |
314 } | |
315 | |
316 | |
317 int | |
318 script_parser::parse () | |
319 { | |
320 /// Look-ahead and look-ahead in internal form. | |
321 int yychar = yyempty_; | |
322 int yytoken = 0; | |
323 | |
324 /* State. */ | |
325 int yyn; | |
326 int yylen = 0; | |
327 int yystate = 0; | |
328 | |
329 /* Error handling. */ | |
330 int yynerrs_ = 0; | |
331 int yyerrstatus_ = 0; | |
332 | |
333 /// Semantic value of the look-ahead. | |
334 semantic_type yylval; | |
335 /// Location of the look-ahead. | |
336 location_type yylloc; | |
337 /// The locations where the error started and ended. | |
338 location yyerror_range[2]; | |
339 | |
340 /// $$. | |
341 semantic_type yyval; | |
342 /// @$. | |
343 location_type yyloc; | |
344 | |
345 int yyresult; | |
346 | |
347 YYCDEBUG << "Starting parse" << std::endl; | |
348 | |
349 | |
350 /* User initialization code. */ | |
351 #line 19 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
352 { | |
353 // ロケーション初期化 | |
354 yylloc.begin.filename = yylloc.end.filename = &driver.get_filename(); | |
355 } | |
356 /* Line 547 of yacc.c. */ | |
357 #line 358 "script-parser.cc" | |
358 /* Initialize the stacks. The initial state will be pushed in | |
359 yynewstate, since the latter expects the semantical and the | |
360 location values to have been already stored, initialize these | |
361 stacks with a primary value. */ | |
362 yystate_stack_ = state_stack_type (0); | |
363 yysemantic_stack_ = semantic_stack_type (0); | |
364 yylocation_stack_ = location_stack_type (0); | |
365 yysemantic_stack_.push (yylval); | |
366 yylocation_stack_.push (yylloc); | |
367 | |
368 /* New state. */ | |
369 yynewstate: | |
370 yystate_stack_.push (yystate); | |
371 YYCDEBUG << "Entering state " << yystate << std::endl; | |
372 goto yybackup; | |
373 | |
374 /* Backup. */ | |
375 yybackup: | |
376 | |
377 /* Try to take a decision without look-ahead. */ | |
378 yyn = yypact_[yystate]; | |
379 if (yyn == yypact_ninf_) | |
380 goto yydefault; | |
381 | |
382 /* Read a look-ahead token. */ | |
383 if (yychar == yyempty_) | |
384 { | |
385 YYCDEBUG << "Reading a token: "; | |
386 yychar = yylex (&yylval, &yylloc, driver); | |
387 } | |
388 | |
389 | |
390 /* Convert token to internal form. */ | |
391 if (yychar <= yyeof_) | |
392 { | |
393 yychar = yytoken = yyeof_; | |
394 YYCDEBUG << "Now at end of input." << std::endl; | |
395 } | |
396 else | |
397 { | |
398 yytoken = yytranslate_ (yychar); | |
399 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | |
400 } | |
401 | |
402 /* If the proper action on seeing token YYTOKEN is to reduce or to | |
403 detect an error, take that action. */ | |
404 yyn += yytoken; | |
405 if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) | |
406 goto yydefault; | |
407 | |
408 /* Reduce or error. */ | |
409 yyn = yytable_[yyn]; | |
410 if (yyn <= 0) | |
411 { | |
412 if (yyn == 0 || yyn == yytable_ninf_) | |
413 goto yyerrlab; | |
414 yyn = -yyn; | |
415 goto yyreduce; | |
416 } | |
417 | |
418 /* Accept? */ | |
419 if (yyn == yyfinal_) | |
420 goto yyacceptlab; | |
421 | |
422 /* Shift the look-ahead token. */ | |
423 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | |
424 | |
425 /* Discard the token being shifted unless it is eof. */ | |
426 if (yychar != yyeof_) | |
427 yychar = yyempty_; | |
428 | |
429 yysemantic_stack_.push (yylval); | |
430 yylocation_stack_.push (yylloc); | |
431 | |
432 /* Count tokens shifted since error; after three, turn off error | |
433 status. */ | |
434 if (yyerrstatus_) | |
435 --yyerrstatus_; | |
436 | |
437 yystate = yyn; | |
438 goto yynewstate; | |
439 | |
440 /*-----------------------------------------------------------. | |
441 | yydefault -- do the default action for the current state. | | |
442 `-----------------------------------------------------------*/ | |
443 yydefault: | |
444 yyn = yydefact_[yystate]; | |
445 if (yyn == 0) | |
446 goto yyerrlab; | |
447 goto yyreduce; | |
448 | |
449 /*-----------------------------. | |
450 | yyreduce -- Do a reduction. | | |
451 `-----------------------------*/ | |
452 yyreduce: | |
453 yylen = yyr2_[yyn]; | |
454 /* If YYLEN is nonzero, implement the default value of the action: | |
455 `$$ = $1'. Otherwise, use the top of the stack. | |
456 | |
457 Otherwise, the following line sets YYVAL to garbage. | |
458 This behavior is undocumented and Bison | |
459 users should not rely upon it. */ | |
460 if (yylen) | |
461 yyval = yysemantic_stack_[yylen - 1]; | |
462 else | |
463 yyval = yysemantic_stack_[0]; | |
464 | |
465 { | |
466 slice<location_type, location_stack_type> slice (yylocation_stack_, yylen); | |
467 YYLLOC_DEFAULT (yyloc, slice, yylen); | |
468 } | |
469 YY_REDUCE_PRINT (yyn); | |
470 switch (yyn) | |
471 { | |
472 case 7: | |
473 #line 127 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
474 { driver.DefineValue((yylocation_stack_[(3) - (2)]), (yysemantic_stack_[(3) - (1)].type), (yysemantic_stack_[(3) - (2)].value_list)); ;} | |
475 break; | |
476 | |
477 case 8: | |
478 #line 128 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
479 { driver.DefineFunction((yylocation_stack_[(5) - (2)]), (yysemantic_stack_[(5) - (1)].type), (yysemantic_stack_[(5) - (2)].sval), NULL); ;} | |
480 break; | |
481 | |
482 case 9: | |
483 #line 129 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
484 { driver.DefineFunction((yylocation_stack_[(6) - (2)]), (yysemantic_stack_[(6) - (1)].type), (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist)); ;} | |
485 break; | |
486 | |
487 case 10: | |
488 #line 130 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
489 { driver.DefineFunction((yylocation_stack_[(5) - (2)]), TYPE_VOID, (yysemantic_stack_[(5) - (2)].sval), NULL); ;} | |
490 break; | |
491 | |
492 case 11: | |
493 #line 131 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
494 { driver.DefineFunction((yylocation_stack_[(6) - (2)]), TYPE_VOID, (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist)); ;} | |
495 break; | |
496 | |
497 case 12: | |
498 #line 134 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
499 { (yyval.value_list) = new CValueList((yysemantic_stack_[(1) - (1)].value)); ;} | |
500 break; | |
501 | |
502 case 13: | |
503 #line 135 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
504 { (yyval.value_list) = (yysemantic_stack_[(3) - (1)].value_list)->Add((yysemantic_stack_[(3) - (3)].value)); ;} | |
505 break; | |
506 | |
507 case 14: | |
508 #line 138 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
509 { (yyval.arglist) = new CArgList((yysemantic_stack_[(1) - (1)].argdef)); ;} | |
510 break; | |
511 | |
512 case 15: | |
513 #line 139 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
514 { (yyval.arglist) = (yysemantic_stack_[(3) - (1)].arglist)->Add((yysemantic_stack_[(3) - (3)].argdef)); ;} | |
515 break; | |
516 | |
517 case 16: | |
518 #line 142 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
519 { (yyval.argdef) = new CArgDef((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].type), NULL); ;} | |
520 break; | |
521 | |
522 case 17: | |
523 #line 143 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
524 { (yyval.argdef) = new CArgDef((yylocation_stack_[(2) - (1)]), TypeToRef((yysemantic_stack_[(2) - (1)].type)), NULL); ;} | |
525 break; | |
526 | |
527 case 18: | |
528 #line 144 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
529 { (yyval.argdef) = new CArgDef((yylocation_stack_[(2) - (1)]), (yysemantic_stack_[(2) - (1)].type), (yysemantic_stack_[(2) - (2)].sval)); ;} | |
530 break; | |
531 | |
532 case 19: | |
533 #line 145 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
534 { (yyval.argdef) = new CArgDef((yylocation_stack_[(3) - (1)]), TypeToRef((yysemantic_stack_[(3) - (1)].type)), (yysemantic_stack_[(3) - (3)].sval)); ;} | |
535 break; | |
536 | |
537 case 20: | |
538 #line 146 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
539 { (yyval.argdef) = new CArgDef((yylocation_stack_[(4) - (1)]), TypeToRef((yysemantic_stack_[(4) - (1)].type)), (yysemantic_stack_[(4) - (2)].sval)); ;} | |
540 break; | |
541 | |
542 case 21: | |
543 #line 147 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
544 { (yyval.argdef) = new CArgDef((yylocation_stack_[(5) - (1)]), TypeToRef((yysemantic_stack_[(5) - (1)].type)), (yysemantic_stack_[(5) - (3)].sval)); ;} | |
545 break; | |
546 | |
547 case 22: | |
548 #line 150 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
549 { driver.AddFunction((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (1)].type), (yysemantic_stack_[(5) - (2)].sval), NULL, (yysemantic_stack_[(5) - (5)].block)); ;} | |
550 break; | |
551 | |
552 case 23: | |
553 #line 151 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
554 { driver.AddFunction((yylocation_stack_[(6) - (1)]), (yysemantic_stack_[(6) - (1)].type), (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist), (yysemantic_stack_[(6) - (6)].block)); ;} | |
555 break; | |
556 | |
557 case 24: | |
558 #line 152 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
559 { driver.AddFunction((yylocation_stack_[(5) - (1)]), TYPE_VOID, (yysemantic_stack_[(5) - (2)].sval), NULL, (yysemantic_stack_[(5) - (5)].block)); ;} | |
560 break; | |
561 | |
562 case 25: | |
563 #line 153 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
564 { driver.AddFunction((yylocation_stack_[(6) - (1)]), TYPE_VOID, (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist), (yysemantic_stack_[(6) - (6)].block)); ;} | |
565 break; | |
566 | |
567 case 26: | |
568 #line 156 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
569 { (yyval.type) = TYPE_INTEGER; ;} | |
570 break; | |
571 | |
572 case 27: | |
573 #line 157 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
574 { (yyval.type) = TYPE_STRING; ;} | |
575 break; | |
576 | |
577 case 28: | |
578 #line 160 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
579 { (yyval.block) = new CStateBlock((yysemantic_stack_[(4) - (2)].decls), (yysemantic_stack_[(4) - (3)].states)); ;} | |
580 break; | |
581 | |
582 case 29: | |
583 #line 163 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
584 { (yyval.decls) = NULL ;} | |
585 break; | |
586 | |
587 case 30: | |
588 #line 164 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
589 { (yyval.decls) = (yysemantic_stack_[(1) - (1)].decls) ;} | |
590 break; | |
591 | |
592 case 31: | |
593 #line 167 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
594 { (yyval.states) = NULL ;} | |
595 break; | |
596 | |
597 case 32: | |
598 #line 168 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
599 { (yyval.states) = (yysemantic_stack_[(1) - (1)].states) ;} | |
600 break; | |
601 | |
602 case 33: | |
603 #line 171 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
604 { (yyval.decls) = new CDeclList(new CDecl((yysemantic_stack_[(3) - (1)].type), (yysemantic_stack_[(3) - (2)].value_list))); ;} | |
605 break; | |
606 | |
607 case 34: | |
608 #line 172 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
609 { (yyval.decls) = (yysemantic_stack_[(4) - (1)].decls)->Add(new CDecl((yysemantic_stack_[(4) - (2)].type), (yysemantic_stack_[(4) - (3)].value_list))); ;} | |
610 break; | |
611 | |
612 case 35: | |
613 #line 175 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
614 { (yyval.states) = new CStateList((yysemantic_stack_[(1) - (1)].statement)); ;} | |
615 break; | |
616 | |
617 case 36: | |
618 #line 176 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
619 { (yyval.states) = (yysemantic_stack_[(2) - (1)].states)->Add((yysemantic_stack_[(2) - (2)].statement)); ;} | |
620 break; | |
621 | |
622 case 37: | |
623 #line 179 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
624 { (yyval.statement) = new CNopStatement((yylocation_stack_[(1) - (1)])); ;} | |
625 break; | |
626 | |
627 case 38: | |
628 #line 180 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
629 { (yyval.statement) = new CAssignStatement((yylocation_stack_[(2) - (1)]), (yysemantic_stack_[(2) - (1)].assign)); ;} | |
630 break; | |
631 | |
632 case 39: | |
633 #line 181 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
634 { (yyval.statement) = new CFunctionStatement((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (1)].sval), (yysemantic_stack_[(5) - (3)].args)); ;} | |
635 break; | |
636 | |
637 case 40: | |
638 #line 182 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
639 { (yyval.statement) = new CFunctionStatement((yylocation_stack_[(4) - (1)]), (yysemantic_stack_[(4) - (1)].sval), NULL); ;} | |
640 break; | |
641 | |
642 case 41: | |
643 #line 183 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
644 { (yyval.statement) = new CCaseStatement((yylocation_stack_[(3) - (1)]), (yysemantic_stack_[(3) - (2)].expr)); ;} | |
645 break; | |
646 | |
647 case 42: | |
648 #line 184 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
649 { (yyval.statement) = new CDefaultStatement((yylocation_stack_[(2) - (1)])); ;} | |
650 break; | |
651 | |
652 case 43: | |
653 #line 185 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
654 { (yyval.statement) = new CBreakStatement((yylocation_stack_[(2) - (1)])); ;} | |
655 break; | |
656 | |
657 case 44: | |
658 #line 186 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
659 { (yyval.statement) = new CReturnStatement((yylocation_stack_[(2) - (1)]), NULL); ;} | |
660 break; | |
661 | |
662 case 45: | |
663 #line 187 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
664 { (yyval.statement) = new CReturnStatement((yylocation_stack_[(3) - (1)]), (yysemantic_stack_[(3) - (2)].expr)); ;} | |
665 break; | |
666 | |
667 case 46: | |
668 #line 188 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
669 { (yyval.statement) = new CIfStatement((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (3)].expr), (yysemantic_stack_[(5) - (5)].statement)); ;} | |
670 break; | |
671 | |
672 case 47: | |
673 #line 189 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
674 { (yyval.statement) = new CIfStatement((yylocation_stack_[(7) - (1)]), (yysemantic_stack_[(7) - (3)].expr), (yysemantic_stack_[(7) - (5)].statement), (yysemantic_stack_[(7) - (7)].statement)); ;} | |
675 break; | |
676 | |
677 case 48: | |
678 #line 191 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
679 { (yyval.statement) = new CForStatement((yylocation_stack_[(9) - (1)]), (yysemantic_stack_[(9) - (3)].assign), (yysemantic_stack_[(9) - (5)].expr), (yysemantic_stack_[(9) - (7)].assign), (yysemantic_stack_[(9) - (9)].statement)); ;} | |
680 break; | |
681 | |
682 case 49: | |
683 #line 192 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
684 { (yyval.statement) = new CWhileStatement((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (3)].expr), (yysemantic_stack_[(5) - (5)].statement)); ;} | |
685 break; | |
686 | |
687 case 50: | |
688 #line 193 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
689 { (yyval.statement) = new CSwitchStatement((yylocation_stack_[(7) - (1)]), (yysemantic_stack_[(7) - (3)].expr), (yysemantic_stack_[(7) - (6)].states)); ;} | |
690 break; | |
691 | |
692 case 51: | |
693 #line 194 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
694 { (yyval.statement) = new CBlockStatement((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].block)); ;} | |
695 break; | |
696 | |
697 case 52: | |
698 #line 197 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
699 { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '=', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
700 break; | |
701 | |
702 case 53: | |
703 #line 198 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
704 { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '+', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
705 break; | |
706 | |
707 case 54: | |
708 #line 199 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
709 { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '-', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
710 break; | |
711 | |
712 case 55: | |
713 #line 200 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
714 { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '*', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
715 break; | |
716 | |
717 case 56: | |
718 #line 201 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
719 { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '/', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
720 break; | |
721 | |
722 case 57: | |
723 #line 202 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
724 { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '%', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
725 break; | |
726 | |
727 case 58: | |
728 #line 205 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
729 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LOGAND, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
730 break; | |
731 | |
732 case 59: | |
733 #line 206 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
734 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LOGOR, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
735 break; | |
736 | |
737 case 60: | |
738 #line 207 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
739 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_EQ, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
740 break; | |
741 | |
742 case 61: | |
743 #line 208 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
744 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_NE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
745 break; | |
746 | |
747 case 62: | |
748 #line 209 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
749 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_GT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
750 break; | |
751 | |
752 case 63: | |
753 #line 210 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
754 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_GE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
755 break; | |
756 | |
757 case 64: | |
758 #line 211 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
759 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
760 break; | |
761 | |
762 case 65: | |
763 #line 212 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
764 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
765 break; | |
766 | |
767 case 66: | |
768 #line 213 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
769 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_AND, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
770 break; | |
771 | |
772 case 67: | |
773 #line 214 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
774 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_OR, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
775 break; | |
776 | |
777 case 68: | |
778 #line 215 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
779 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LSHIFT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
780 break; | |
781 | |
782 case 69: | |
783 #line 216 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
784 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_RSHIFT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
785 break; | |
786 | |
787 case 70: | |
788 #line 217 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
789 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_MINUS, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
790 break; | |
791 | |
792 case 71: | |
793 #line 218 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
794 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_PLUS, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
795 break; | |
796 | |
797 case 72: | |
798 #line 219 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
799 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_TIMES, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
800 break; | |
801 | |
802 case 73: | |
803 #line 220 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
804 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_DIVIDE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
805 break; | |
806 | |
807 case 74: | |
808 #line 221 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
809 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_MOD, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;} | |
810 break; | |
811 | |
812 case 75: | |
813 #line 222 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
814 { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(2) - (2)]), OP_NEG, (yysemantic_stack_[(2) - (2)].expr)); ;} | |
815 break; | |
816 | |
817 case 76: | |
818 #line 223 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
819 { (yyval.expr) = (yysemantic_stack_[(3) - (2)].expr); ;} | |
820 break; | |
821 | |
822 case 77: | |
823 #line 224 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
824 { (yyval.expr) = (yysemantic_stack_[(1) - (1)].value); ;} | |
825 break; | |
826 | |
827 case 78: | |
828 #line 225 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
829 { (yyval.expr) = new CNode((yylocation_stack_[(1) - (1)]), OP_CONST, (yysemantic_stack_[(1) - (1)].ival)); ;} | |
830 break; | |
831 | |
832 case 79: | |
833 #line 226 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
834 { (yyval.expr) = new CNode((yylocation_stack_[(1) - (1)]), OP_STRING, (yysemantic_stack_[(1) - (1)].sval)); ;} | |
835 break; | |
836 | |
837 case 80: | |
838 #line 227 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
839 { (yyval.expr) = new CFunctionNode((yylocation_stack_[(4) - (1)]), (yysemantic_stack_[(4) - (1)].sval), (yysemantic_stack_[(4) - (3)].args)); ;} | |
840 break; | |
841 | |
842 case 81: | |
843 #line 228 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
844 { (yyval.expr) = new CFunctionNode((yylocation_stack_[(3) - (1)]), (yysemantic_stack_[(3) - (1)].sval), NULL); ;} | |
845 break; | |
846 | |
847 case 82: | |
848 #line 231 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
849 { (yyval.value) = new CValueNode((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].sval)); ;} | |
850 break; | |
851 | |
852 case 83: | |
853 #line 232 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
854 { (yyval.value) = new CValueNode((yylocation_stack_[(4) - (1)]), (yysemantic_stack_[(4) - (1)].sval), (yysemantic_stack_[(4) - (3)].expr)); ;} | |
855 break; | |
856 | |
857 case 84: | |
858 #line 235 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
859 { (yyval.args) = new CArgs((yysemantic_stack_[(1) - (1)].expr)); ;} | |
860 break; | |
861 | |
862 case 85: | |
863 #line 236 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
864 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args)->Add((yysemantic_stack_[(3) - (3)].expr)); ;} | |
865 break; | |
866 | |
867 | |
868 /* Line 675 of lalr1.cc. */ | |
869 #line 870 "script-parser.cc" | |
870 default: break; | |
871 } | |
872 YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); | |
873 | |
874 yypop_ (yylen); | |
875 yylen = 0; | |
876 YY_STACK_PRINT (); | |
877 | |
878 yysemantic_stack_.push (yyval); | |
879 yylocation_stack_.push (yyloc); | |
880 | |
881 /* Shift the result of the reduction. */ | |
882 yyn = yyr1_[yyn]; | |
883 yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0]; | |
884 if (0 <= yystate && yystate <= yylast_ | |
885 && yycheck_[yystate] == yystate_stack_[0]) | |
886 yystate = yytable_[yystate]; | |
887 else | |
888 yystate = yydefgoto_[yyn - yyntokens_]; | |
889 goto yynewstate; | |
890 | |
891 /*------------------------------------. | |
892 | yyerrlab -- here on detecting error | | |
893 `------------------------------------*/ | |
894 yyerrlab: | |
895 /* If not already recovering from an error, report this error. */ | |
896 if (!yyerrstatus_) | |
897 { | |
898 ++yynerrs_; | |
899 error (yylloc, yysyntax_error_ (yystate, yytoken)); | |
900 } | |
901 | |
902 yyerror_range[0] = yylloc; | |
903 if (yyerrstatus_ == 3) | |
904 { | |
905 /* If just tried and failed to reuse look-ahead token after an | |
906 error, discard it. */ | |
907 | |
908 if (yychar <= yyeof_) | |
909 { | |
910 /* Return failure if at end of input. */ | |
911 if (yychar == yyeof_) | |
912 YYABORT; | |
913 } | |
914 else | |
915 { | |
916 yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc); | |
917 yychar = yyempty_; | |
918 } | |
919 } | |
920 | |
921 /* Else will try to reuse look-ahead token after shifting the error | |
922 token. */ | |
923 goto yyerrlab1; | |
924 | |
925 | |
926 /*---------------------------------------------------. | |
927 | yyerrorlab -- error raised explicitly by YYERROR. | | |
928 `---------------------------------------------------*/ | |
929 yyerrorlab: | |
930 | |
931 /* Pacify compilers like GCC when the user code never invokes | |
932 YYERROR and the label yyerrorlab therefore never appears in user | |
933 code. */ | |
934 if (false) | |
935 goto yyerrorlab; | |
936 | |
937 yyerror_range[0] = yylocation_stack_[yylen - 1]; | |
938 /* Do not reclaim the symbols of the rule which action triggered | |
939 this YYERROR. */ | |
940 yypop_ (yylen); | |
941 yylen = 0; | |
942 yystate = yystate_stack_[0]; | |
943 goto yyerrlab1; | |
944 | |
945 /*-------------------------------------------------------------. | |
946 | yyerrlab1 -- common code for both syntax error and YYERROR. | | |
947 `-------------------------------------------------------------*/ | |
948 yyerrlab1: | |
949 yyerrstatus_ = 3; /* Each real token shifted decrements this. */ | |
950 | |
951 for (;;) | |
952 { | |
953 yyn = yypact_[yystate]; | |
954 if (yyn != yypact_ninf_) | |
955 { | |
956 yyn += yyterror_; | |
957 if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) | |
958 { | |
959 yyn = yytable_[yyn]; | |
960 if (0 < yyn) | |
961 break; | |
962 } | |
963 } | |
964 | |
965 /* Pop the current state because it cannot handle the error token. */ | |
966 if (yystate_stack_.height () == 1) | |
967 YYABORT; | |
968 | |
969 yyerror_range[0] = yylocation_stack_[0]; | |
970 yydestruct_ ("Error: popping", | |
971 yystos_[yystate], | |
972 &yysemantic_stack_[0], &yylocation_stack_[0]); | |
973 yypop_ (); | |
974 yystate = yystate_stack_[0]; | |
975 YY_STACK_PRINT (); | |
976 } | |
977 | |
978 if (yyn == yyfinal_) | |
979 goto yyacceptlab; | |
980 | |
981 yyerror_range[1] = yylloc; | |
982 // Using YYLLOC is tempting, but would change the location of | |
983 // the look-ahead. YYLOC is available though. | |
984 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); | |
985 yysemantic_stack_.push (yylval); | |
986 yylocation_stack_.push (yyloc); | |
987 | |
988 /* Shift the error token. */ | |
989 YY_SYMBOL_PRINT ("Shifting", yystos_[yyn], | |
990 &yysemantic_stack_[0], &yylocation_stack_[0]); | |
991 | |
992 yystate = yyn; | |
993 goto yynewstate; | |
994 | |
995 /* Accept. */ | |
996 yyacceptlab: | |
997 yyresult = 0; | |
998 goto yyreturn; | |
999 | |
1000 /* Abort. */ | |
1001 yyabortlab: | |
1002 yyresult = 1; | |
1003 goto yyreturn; | |
1004 | |
1005 yyreturn: | |
1006 if (yychar != yyeof_ && yychar != yyempty_) | |
1007 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); | |
1008 | |
1009 /* Do not reclaim the symbols of the rule which action triggered | |
1010 this YYABORT or YYACCEPT. */ | |
1011 yypop_ (yylen); | |
1012 while (yystate_stack_.height () != 1) | |
1013 { | |
1014 yydestruct_ ("Cleanup: popping", | |
1015 yystos_[yystate_stack_[0]], | |
1016 &yysemantic_stack_[0], | |
1017 &yylocation_stack_[0]); | |
1018 yypop_ (); | |
1019 } | |
1020 | |
1021 return yyresult; | |
1022 } | |
1023 | |
1024 // Generate an error message. | |
1025 std::string | |
1026 script_parser::yysyntax_error_ (int yystate, int tok) | |
1027 { | |
1028 std::string res; | |
1029 YYUSE (yystate); | |
1030 #if YYERROR_VERBOSE | |
1031 int yyn = yypact_[yystate]; | |
1032 if (yypact_ninf_ < yyn && yyn <= yylast_) | |
1033 { | |
1034 /* Start YYX at -YYN if negative to avoid negative indexes in | |
1035 YYCHECK. */ | |
1036 int yyxbegin = yyn < 0 ? -yyn : 0; | |
1037 | |
1038 /* Stay within bounds of both yycheck and yytname. */ | |
1039 int yychecklim = yylast_ - yyn + 1; | |
1040 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; | |
1041 int count = 0; | |
1042 for (int x = yyxbegin; x < yyxend; ++x) | |
1043 if (yycheck_[x + yyn] == x && x != yyterror_) | |
1044 ++count; | |
1045 | |
1046 // FIXME: This method of building the message is not compatible | |
1047 // with internationalization. It should work like yacc.c does it. | |
1048 // That is, first build a string that looks like this: | |
1049 // "syntax error, unexpected %s or %s or %s" | |
1050 // Then, invoke YY_ on this string. | |
1051 // Finally, use the string as a format to output | |
1052 // yytname_[tok], etc. | |
1053 // Until this gets fixed, this message appears in English only. | |
1054 res = "syntax error, unexpected "; | |
1055 res += yytnamerr_ (yytname_[tok]); | |
1056 if (count < 5) | |
1057 { | |
1058 count = 0; | |
1059 for (int x = yyxbegin; x < yyxend; ++x) | |
1060 if (yycheck_[x + yyn] == x && x != yyterror_) | |
1061 { | |
1062 res += (!count++) ? ", expecting " : " or "; | |
1063 res += yytnamerr_ (yytname_[x]); | |
1064 } | |
1065 } | |
1066 } | |
1067 else | |
1068 #endif | |
1069 res = YY_("syntax error"); | |
1070 return res; | |
1071 } | |
1072 | |
1073 | |
1074 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | |
1075 STATE-NUM. */ | |
1076 const signed char script_parser::yypact_ninf_ = -121; | |
1077 const short int | |
1078 script_parser::yypact_[] = | |
1079 { | |
1080 54, -24, -121, -121, 27, 158, -121, -121, -121, 84, | |
1081 -121, 16, -121, -121, -16, -14, -121, 36, 111, 143, | |
1082 -121, 100, -37, 93, -121, 24, -32, 99, -121, 47, | |
1083 -121, 143, 143, 162, -121, 21, -121, -121, 122, -121, | |
1084 39, 122, 78, 124, -121, -121, 44, 20, -121, 203, | |
1085 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, | |
1086 143, 143, 143, 143, 143, 143, 143, -121, 100, 108, | |
1087 122, -121, -121, -121, 98, 120, -121, -121, -121, 352, | |
1088 133, -121, 361, 393, 402, 402, 402, 402, 182, 182, | |
1089 402, 402, 168, 168, -31, -31, -121, -121, -121, 69, | |
1090 96, 114, 136, 142, 149, 143, 117, 161, 73, -121, | |
1091 -121, 183, 108, -121, 189, 4, 100, -121, 144, -121, | |
1092 143, -121, 121, 143, 143, 100, 143, 62, -121, -121, | |
1093 -121, 305, -121, -121, -121, 143, 143, 143, 143, 143, | |
1094 143, 148, -121, 352, 191, 139, 216, 254, 192, 267, | |
1095 -121, -121, 352, 352, 352, 352, 352, 352, -121, -121, | |
1096 202, 108, 108, 143, 197, -121, 225, -121, 316, 108, | |
1097 108, 100, 208, -121, 214, -121, 108, -121 | |
1098 }; | |
1099 | |
1100 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE | |
1101 doesn't specify something else to do. Zero means the default is an | |
1102 error. */ | |
1103 const unsigned char | |
1104 script_parser::yydefact_[] = | |
1105 { | |
1106 0, 0, 26, 27, 0, 0, 2, 6, 5, 0, | |
1107 4, 0, 1, 3, 82, 0, 12, 0, 0, 0, | |
1108 7, 0, 0, 0, 14, 16, 0, 0, 78, 82, | |
1109 79, 0, 0, 0, 77, 82, 13, 10, 29, 24, | |
1110 0, 0, 18, 17, 8, 22, 0, 0, 75, 0, | |
1111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1112 0, 0, 0, 0, 0, 0, 0, 83, 0, 31, | |
1113 30, 11, 25, 15, 0, 19, 9, 23, 81, 84, | |
1114 0, 76, 59, 58, 60, 61, 63, 65, 68, 69, | |
1115 62, 64, 66, 67, 71, 70, 72, 73, 74, 0, | |
1116 82, 0, 0, 0, 0, 0, 0, 0, 0, 37, | |
1117 51, 0, 32, 35, 0, 0, 0, 20, 0, 80, | |
1118 0, 33, 0, 0, 0, 0, 0, 0, 42, 43, | |
1119 44, 0, 28, 36, 38, 0, 0, 0, 0, 0, | |
1120 0, 0, 21, 85, 0, 0, 0, 0, 0, 0, | |
1121 41, 45, 53, 54, 55, 56, 57, 52, 34, 40, | |
1122 0, 0, 0, 0, 0, 39, 46, 49, 0, 31, | |
1123 0, 0, 0, 47, 0, 50, 0, 48 | |
1124 }; | |
1125 | |
1126 /* YYPGOTO[NTERM-NUM]. */ | |
1127 const short int | |
1128 script_parser::yypgoto_[] = | |
1129 { | |
1130 -121, -121, 253, -121, -66, 250, 228, -121, 11, 420, | |
1131 -121, 101, -121, -121, -109, -120, -18, -9, 150 | |
1132 }; | |
1133 | |
1134 /* YYDEFGOTO[NTERM-NUM]. */ | |
1135 const signed char | |
1136 script_parser::yydefgoto_[] = | |
1137 { | |
1138 -1, 5, 6, 7, 15, 23, 24, 8, 25, 110, | |
1139 69, 111, 70, 112, 113, 114, 79, 34, 80 | |
1140 }; | |
1141 | |
1142 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | |
1143 positive, shift that token. If negative, reduce the rule which | |
1144 number is the opposite. If zero, do what YYDEFACT says. */ | |
1145 const signed char script_parser::yytable_ninf_ = -1; | |
1146 const short int | |
1147 script_parser::yytable_[] = | |
1148 { | |
1149 16, 33, 99, 133, 37, 148, 64, 65, 66, 44, | |
1150 38, 9, 36, 48, 49, 38, 9, 10, 135, 136, | |
1151 137, 138, 139, 28, 29, 30, 18, 20, 42, 19, | |
1152 21, 11, 82, 83, 84, 85, 86, 87, 88, 89, | |
1153 90, 91, 92, 93, 94, 95, 96, 97, 98, 68, | |
1154 141, 174, 166, 167, 140, 1, 31, 43, 17, 16, | |
1155 115, 173, 32, 78, 2, 3, 19, 177, 50, 51, | |
1156 52, 53, 54, 55, 56, 57, 28, 29, 30, 22, | |
1157 71, 116, 2, 3, 4, 76, 38, 127, 14, 47, | |
1158 131, 38, 19, 58, 59, 60, 61, 62, 63, 64, | |
1159 65, 66, 143, 115, 35, 146, 147, 16, 149, 31, | |
1160 121, 150, 100, 21, 130, 32, 115, 152, 153, 154, | |
1161 155, 156, 157, 74, 28, 29, 30, 101, 75, 102, | |
1162 103, 104, 105, 106, 107, 108, 40, 41, 122, 2, | |
1163 3, 19, 46, 41, 117, 168, 28, 29, 30, 109, | |
1164 2, 3, 115, 115, 26, 38, 123, 31, 12, 1, | |
1165 115, 115, 115, 32, 144, 118, 128, 115, 50, 51, | |
1166 52, 53, 54, 55, 56, 57, 119, 120, 124, 31, | |
1167 56, 57, 160, 120, 125, 32, 2, 3, 4, 158, | |
1168 142, 126, 21, 58, 59, 60, 61, 62, 63, 64, | |
1169 65, 66, 129, 62, 63, 64, 65, 66, 67, 50, | |
1170 51, 52, 53, 54, 55, 56, 57, 62, 63, 64, | |
1171 65, 66, 50, 51, 52, 53, 54, 55, 56, 57, | |
1172 134, 132, 159, 163, 58, 59, 60, 61, 62, 63, | |
1173 64, 65, 66, 165, 169, 170, 81, 58, 59, 60, | |
1174 61, 62, 63, 64, 65, 66, 175, 176, 13, 161, | |
1175 50, 51, 52, 53, 54, 55, 56, 57, 27, 73, | |
1176 172, 0, 145, 50, 51, 52, 53, 54, 55, 56, | |
1177 57, 0, 0, 0, 0, 58, 59, 60, 61, 62, | |
1178 63, 64, 65, 66, 0, 0, 0, 162, 58, 59, | |
1179 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, | |
1180 164, 50, 51, 52, 53, 54, 55, 56, 57, 0, | |
1181 0, 0, 50, 51, 52, 53, 54, 55, 56, 57, | |
1182 0, 0, 0, 0, 0, 0, 58, 59, 60, 61, | |
1183 62, 63, 64, 65, 66, 0, 151, 58, 59, 60, | |
1184 61, 62, 63, 64, 65, 66, 0, 171, 50, 51, | |
1185 52, 53, 54, 55, 56, 57, 0, 0, 51, 52, | |
1186 53, 54, 55, 56, 57, 0, 0, 0, 0, 0, | |
1187 0, 0, 0, 58, 59, 60, 61, 62, 63, 64, | |
1188 65, 66, 58, 59, 60, 61, 62, 63, 64, 65, | |
1189 66, 52, 53, 54, 55, 56, 57, 0, 0, 0, | |
1190 -1, -1, -1, -1, 56, 57, 0, 0, 0, 0, | |
1191 0, 0, 0, 0, 58, 59, 60, 61, 62, 63, | |
1192 64, 65, 66, -1, -1, 60, 61, 62, 63, 64, | |
1193 65, 66, 39, 0, 0, 0, 45, 0, 0, 0, | |
1194 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1195 72, 0, 0, 0, 0, 0, 77 | |
1196 }; | |
1197 | |
1198 /* YYCHECK. */ | |
1199 const short int | |
1200 script_parser::yycheck_[] = | |
1201 { | |
1202 9, 19, 68, 112, 41, 125, 37, 38, 39, 41, | |
1203 47, 0, 21, 31, 32, 47, 5, 41, 14, 15, | |
1204 16, 17, 18, 3, 4, 5, 42, 41, 4, 45, | |
1205 44, 4, 50, 51, 52, 53, 54, 55, 56, 57, | |
1206 58, 59, 60, 61, 62, 63, 64, 65, 66, 38, | |
1207 116, 171, 161, 162, 50, 1, 36, 33, 42, 68, | |
1208 69, 170, 42, 43, 28, 29, 45, 176, 6, 7, | |
1209 8, 9, 10, 11, 12, 13, 3, 4, 5, 43, | |
1210 41, 70, 28, 29, 30, 41, 47, 105, 4, 42, | |
1211 108, 47, 45, 31, 32, 33, 34, 35, 36, 37, | |
1212 38, 39, 120, 112, 4, 123, 124, 116, 126, 36, | |
1213 41, 49, 4, 44, 41, 42, 125, 135, 136, 137, | |
1214 138, 139, 140, 45, 3, 4, 5, 19, 4, 21, | |
1215 22, 23, 24, 25, 26, 27, 43, 44, 42, 28, | |
1216 29, 45, 43, 44, 46, 163, 3, 4, 5, 41, | |
1217 28, 29, 161, 162, 43, 47, 42, 36, 0, 1, | |
1218 169, 170, 171, 42, 43, 45, 49, 176, 6, 7, | |
1219 8, 9, 10, 11, 12, 13, 43, 44, 42, 36, | |
1220 12, 13, 43, 44, 42, 42, 28, 29, 30, 41, | |
1221 46, 42, 44, 31, 32, 33, 34, 35, 36, 37, | |
1222 38, 39, 41, 35, 36, 37, 38, 39, 46, 6, | |
1223 7, 8, 9, 10, 11, 12, 13, 35, 36, 37, | |
1224 38, 39, 6, 7, 8, 9, 10, 11, 12, 13, | |
1225 41, 48, 41, 41, 31, 32, 33, 34, 35, 36, | |
1226 37, 38, 39, 41, 47, 20, 43, 31, 32, 33, | |
1227 34, 35, 36, 37, 38, 39, 48, 43, 5, 43, | |
1228 6, 7, 8, 9, 10, 11, 12, 13, 18, 41, | |
1229 169, -1, 122, 6, 7, 8, 9, 10, 11, 12, | |
1230 13, -1, -1, -1, -1, 31, 32, 33, 34, 35, | |
1231 36, 37, 38, 39, -1, -1, -1, 43, 31, 32, | |
1232 33, 34, 35, 36, 37, 38, 39, -1, -1, -1, | |
1233 43, 6, 7, 8, 9, 10, 11, 12, 13, -1, | |
1234 -1, -1, 6, 7, 8, 9, 10, 11, 12, 13, | |
1235 -1, -1, -1, -1, -1, -1, 31, 32, 33, 34, | |
1236 35, 36, 37, 38, 39, -1, 41, 31, 32, 33, | |
1237 34, 35, 36, 37, 38, 39, -1, 41, 6, 7, | |
1238 8, 9, 10, 11, 12, 13, -1, -1, 7, 8, | |
1239 9, 10, 11, 12, 13, -1, -1, -1, -1, -1, | |
1240 -1, -1, -1, 31, 32, 33, 34, 35, 36, 37, | |
1241 38, 39, 31, 32, 33, 34, 35, 36, 37, 38, | |
1242 39, 8, 9, 10, 11, 12, 13, -1, -1, -1, | |
1243 8, 9, 10, 11, 12, 13, -1, -1, -1, -1, | |
1244 -1, -1, -1, -1, 31, 32, 33, 34, 35, 36, | |
1245 37, 38, 39, 31, 32, 33, 34, 35, 36, 37, | |
1246 38, 39, 22, -1, -1, -1, 26, -1, -1, -1, | |
1247 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
1248 40, -1, -1, -1, -1, -1, 46 | |
1249 }; | |
1250 | |
1251 /* STOS_[STATE-NUM] -- The (internal number of the) accessing | |
1252 symbol of state STATE-NUM. */ | |
1253 const unsigned char | |
1254 script_parser::yystos_[] = | |
1255 { | |
1256 0, 1, 28, 29, 30, 52, 53, 54, 58, 59, | |
1257 41, 4, 0, 53, 4, 55, 68, 42, 42, 45, | |
1258 41, 44, 43, 56, 57, 59, 43, 56, 3, 4, | |
1259 5, 36, 42, 67, 68, 4, 68, 41, 47, 60, | |
1260 43, 44, 4, 33, 41, 60, 43, 42, 67, 67, | |
1261 6, 7, 8, 9, 10, 11, 12, 13, 31, 32, | |
1262 33, 34, 35, 36, 37, 38, 39, 46, 59, 61, | |
1263 63, 41, 60, 57, 45, 4, 41, 60, 43, 67, | |
1264 69, 43, 67, 67, 67, 67, 67, 67, 67, 67, | |
1265 67, 67, 67, 67, 67, 67, 67, 67, 67, 55, | |
1266 4, 19, 21, 22, 23, 24, 25, 26, 27, 41, | |
1267 60, 62, 64, 65, 66, 68, 59, 46, 45, 43, | |
1268 44, 41, 42, 42, 42, 42, 42, 67, 49, 41, | |
1269 41, 67, 48, 65, 41, 14, 15, 16, 17, 18, | |
1270 50, 55, 46, 67, 43, 69, 67, 67, 66, 67, | |
1271 49, 41, 67, 67, 67, 67, 67, 67, 41, 41, | |
1272 43, 43, 43, 41, 43, 41, 65, 65, 67, 47, | |
1273 20, 41, 62, 65, 66, 48, 43, 65 | |
1274 }; | |
1275 | |
1276 #if YYDEBUG | |
1277 /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding | |
1278 to YYLEX-NUM. */ | |
1279 const unsigned short int | |
1280 script_parser::yytoken_number_[] = | |
1281 { | |
1282 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | |
1283 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | |
1284 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | |
1285 285, 62, 60, 38, 124, 43, 45, 42, 47, 37, | |
1286 286, 59, 40, 41, 44, 91, 93, 123, 125, 58, | |
1287 61 | |
1288 }; | |
1289 #endif | |
1290 | |
1291 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | |
1292 const unsigned char | |
1293 script_parser::yyr1_[] = | |
1294 { | |
1295 0, 51, 52, 52, 53, 53, 53, 54, 54, 54, | |
1296 54, 54, 55, 55, 56, 56, 57, 57, 57, 57, | |
1297 57, 57, 58, 58, 58, 58, 59, 59, 60, 61, | |
1298 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, | |
1299 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | |
1300 65, 65, 66, 66, 66, 66, 66, 66, 67, 67, | |
1301 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | |
1302 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | |
1303 67, 67, 68, 68, 69, 69 | |
1304 }; | |
1305 | |
1306 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | |
1307 const unsigned char | |
1308 script_parser::yyr2_[] = | |
1309 { | |
1310 0, 2, 1, 2, 2, 1, 1, 3, 5, 6, | |
1311 5, 6, 1, 3, 1, 3, 1, 2, 2, 3, | |
1312 4, 5, 5, 6, 5, 6, 1, 1, 4, 0, | |
1313 1, 0, 1, 3, 4, 1, 2, 1, 2, 5, | |
1314 4, 3, 2, 2, 2, 3, 5, 7, 9, 5, | |
1315 7, 1, 3, 3, 3, 3, 3, 3, 3, 3, | |
1316 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
1317 3, 3, 3, 3, 3, 2, 3, 1, 1, 1, | |
1318 4, 3, 1, 4, 1, 3 | |
1319 }; | |
1320 | |
1321 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE | |
1322 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | |
1323 First, the terminals, then, starting at \a yyntokens_, nonterminals. */ | |
1324 const char* | |
1325 const script_parser::yytname_[] = | |
1326 { | |
1327 "\"end of file\"", "error", "$undefined", "\"ival\"", "\"identifier\"", | |
1328 "\"sval\"", "\"||\"", "\"&&\"", "\"==\"", "\"!=\"", "\">=\"", "\"<=\"", | |
1329 "\"<<\"", "\">>\"", "\"+=\"", "\"-=\"", "\"*=\"", "\"/=\"", "\"%=\"", | |
1330 "\"if\"", "\"else\"", "\"while\"", "\"for\"", "\"switch\"", "\"case\"", | |
1331 "\"default\"", "\"break\"", "\"return\"", "\"int\"", "\"string\"", | |
1332 "\"void\"", "'>'", "'<'", "'&'", "'|'", "'+'", "'-'", "'*'", "'/'", | |
1333 "'%'", "NEG", "';'", "'('", "')'", "','", "'['", "']'", "'{'", "'}'", | |
1334 "':'", "'='", "$accept", "unit", "define_or_state", "declaration", | |
1335 "value_list", "arglist", "arg", "function", "type", "block", "decl_list", | |
1336 "state_list", "decls", "states", "statement", "assign", "expr", "value", | |
1337 "args", 0 | |
1338 }; | |
1339 #endif | |
1340 | |
1341 #if YYDEBUG | |
1342 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | |
1343 const script_parser::rhs_number_type | |
1344 script_parser::yyrhs_[] = | |
1345 { | |
1346 52, 0, -1, 53, -1, 52, 53, -1, 1, 41, | |
1347 -1, 58, -1, 54, -1, 59, 55, 41, -1, 59, | |
1348 4, 42, 43, 41, -1, 59, 4, 42, 56, 43, | |
1349 41, -1, 30, 4, 42, 43, 41, -1, 30, 4, | |
1350 42, 56, 43, 41, -1, 68, -1, 55, 44, 68, | |
1351 -1, 57, -1, 56, 44, 57, -1, 59, -1, 59, | |
1352 33, -1, 59, 4, -1, 59, 33, 4, -1, 59, | |
1353 4, 45, 46, -1, 59, 33, 4, 45, 46, -1, | |
1354 59, 4, 42, 43, 60, -1, 59, 4, 42, 56, | |
1355 43, 60, -1, 30, 4, 42, 43, 60, -1, 30, | |
1356 4, 42, 56, 43, 60, -1, 28, -1, 29, -1, | |
1357 47, 61, 62, 48, -1, -1, 63, -1, -1, 64, | |
1358 -1, 59, 55, 41, -1, 63, 59, 55, 41, -1, | |
1359 65, -1, 64, 65, -1, 41, -1, 66, 41, -1, | |
1360 4, 42, 69, 43, 41, -1, 4, 42, 43, 41, | |
1361 -1, 24, 67, 49, -1, 25, 49, -1, 26, 41, | |
1362 -1, 27, 41, -1, 27, 67, 41, -1, 19, 42, | |
1363 67, 43, 65, -1, 19, 42, 67, 43, 65, 20, | |
1364 65, -1, 22, 42, 66, 41, 67, 41, 66, 43, | |
1365 65, -1, 21, 42, 67, 43, 65, -1, 23, 42, | |
1366 67, 43, 47, 62, 48, -1, 60, -1, 68, 50, | |
1367 67, -1, 68, 14, 67, -1, 68, 15, 67, -1, | |
1368 68, 16, 67, -1, 68, 17, 67, -1, 68, 18, | |
1369 67, -1, 67, 7, 67, -1, 67, 6, 67, -1, | |
1370 67, 8, 67, -1, 67, 9, 67, -1, 67, 31, | |
1371 67, -1, 67, 10, 67, -1, 67, 32, 67, -1, | |
1372 67, 11, 67, -1, 67, 33, 67, -1, 67, 34, | |
1373 67, -1, 67, 12, 67, -1, 67, 13, 67, -1, | |
1374 67, 36, 67, -1, 67, 35, 67, -1, 67, 37, | |
1375 67, -1, 67, 38, 67, -1, 67, 39, 67, -1, | |
1376 36, 67, -1, 42, 67, 43, -1, 68, -1, 3, | |
1377 -1, 5, -1, 4, 42, 69, 43, -1, 4, 42, | |
1378 43, -1, 4, -1, 4, 45, 67, 46, -1, 67, | |
1379 -1, 69, 44, 67, -1 | |
1380 }; | |
1381 | |
1382 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | |
1383 YYRHS. */ | |
1384 const unsigned short int | |
1385 script_parser::yyprhs_[] = | |
1386 { | |
1387 0, 0, 3, 5, 8, 11, 13, 15, 19, 25, | |
1388 32, 38, 45, 47, 51, 53, 57, 59, 62, 65, | |
1389 69, 74, 80, 86, 93, 99, 106, 108, 110, 115, | |
1390 116, 118, 119, 121, 125, 130, 132, 135, 137, 140, | |
1391 146, 151, 155, 158, 161, 164, 168, 174, 182, 192, | |
1392 198, 206, 208, 212, 216, 220, 224, 228, 232, 236, | |
1393 240, 244, 248, 252, 256, 260, 264, 268, 272, 276, | |
1394 280, 284, 288, 292, 296, 300, 303, 307, 309, 311, | |
1395 313, 318, 322, 324, 329, 331 | |
1396 }; | |
1397 | |
1398 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ | |
1399 const unsigned char | |
1400 script_parser::yyrline_[] = | |
1401 { | |
1402 0, 118, 118, 119, 122, 123, 124, 127, 128, 129, | |
1403 130, 131, 134, 135, 138, 139, 142, 143, 144, 145, | |
1404 146, 147, 150, 151, 152, 153, 156, 157, 160, 163, | |
1405 164, 167, 168, 171, 172, 175, 176, 179, 180, 181, | |
1406 182, 183, 184, 185, 186, 187, 188, 189, 190, 192, | |
1407 193, 194, 197, 198, 199, 200, 201, 202, 205, 206, | |
1408 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, | |
1409 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, | |
1410 227, 228, 231, 232, 235, 236 | |
1411 }; | |
1412 | |
1413 // Print the state stack on the debug stream. | |
1414 void | |
1415 script_parser::yystack_print_ () | |
1416 { | |
1417 *yycdebug_ << "Stack now"; | |
1418 for (state_stack_type::const_iterator i = yystate_stack_.begin (); | |
1419 i != yystate_stack_.end (); ++i) | |
1420 *yycdebug_ << ' ' << *i; | |
1421 *yycdebug_ << std::endl; | |
1422 } | |
1423 | |
1424 // Report on the debug stream that the rule \a yyrule is going to be reduced. | |
1425 void | |
1426 script_parser::yy_reduce_print_ (int yyrule) | |
1427 { | |
1428 unsigned int yylno = yyrline_[yyrule]; | |
1429 int yynrhs = yyr2_[yyrule]; | |
1430 /* Print the symbols being reduced, and their result. */ | |
1431 *yycdebug_ << "Reducing stack by rule " << yyrule - 1 | |
1432 << " (line " << yylno << "), "; | |
1433 /* The symbols being reduced. */ | |
1434 for (int yyi = 0; yyi < yynrhs; yyi++) | |
1435 YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", | |
1436 yyrhs_[yyprhs_[yyrule] + yyi], | |
1437 &(yysemantic_stack_[(yynrhs) - (yyi + 1)]), | |
1438 &(yylocation_stack_[(yynrhs) - (yyi + 1)])); | |
1439 } | |
1440 #endif // YYDEBUG | |
1441 | |
1442 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | |
1443 script_parser::token_number_type | |
1444 script_parser::yytranslate_ (int t) | |
1445 { | |
1446 static | |
1447 const token_number_type | |
1448 translate_table[] = | |
1449 { | |
1450 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1453 2, 2, 2, 2, 2, 2, 2, 39, 33, 2, | |
1454 42, 43, 37, 35, 44, 36, 2, 38, 2, 2, | |
1455 2, 2, 2, 2, 2, 2, 2, 2, 49, 41, | |
1456 32, 50, 31, 2, 2, 2, 2, 2, 2, 2, | |
1457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1459 2, 45, 2, 46, 2, 2, 2, 2, 2, 2, | |
1460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1462 2, 2, 2, 47, 34, 48, 2, 2, 2, 2, | |
1463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1475 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | |
1476 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | |
1477 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | |
1478 25, 26, 27, 28, 29, 30, 40 | |
1479 }; | |
1480 if ((unsigned int) t <= yyuser_token_number_max_) | |
1481 return translate_table[t]; | |
1482 else | |
1483 return yyundef_token_; | |
1484 } | |
1485 | |
1486 const int script_parser::yyeof_ = 0; | |
1487 const int script_parser::yylast_ = 466; | |
1488 const int script_parser::yynnts_ = 19; | |
1489 const int script_parser::yyempty_ = -2; | |
1490 const int script_parser::yyfinal_ = 12; | |
1491 const int script_parser::yyterror_ = 1; | |
1492 const int script_parser::yyerrcode_ = 256; | |
1493 const int script_parser::yyntokens_ = 51; | |
1494 | |
1495 const unsigned int script_parser::yyuser_token_number_max_ = 286; | |
1496 const script_parser::token_number_type script_parser::yyundef_token_ = 2; | |
1497 | |
1498 } // namespace yy | |
1499 | |
1500 #line 239 "d:\\work\\ScriptEngine\\Sample Source\\WindowsOnly\\WinScript\\script-parser.yy" | |
1501 | |
1502 void yy::script_parser::error(const yy::script_parser::location_type& l, const std::string& m) | |
1503 { | |
1504 driver.error(l, m); | |
1505 } | |
1506 |