|
|
| version 1.129, 2009/05/01 12:09:58 | version 1.137, 2009/06/02 10:24:34 |
|---|---|
| Line 129 | Line 129 |
| /** @file | /** @file |
| Parser: compiler(lexical parser and grammar). | Parser: compiler(lexical parser and grammar). |
| Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) | Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) |
| $Id$ | $Id$ |
| Line 171 | Line 171 |
| #define OPTIONS_CONTROL_METHOD_NAME "OPTIONS" | #define OPTIONS_CONTROL_METHOD_NAME "OPTIONS" |
| #define OPTION_ALL_VARS_LOCAL_NAME "locals" | #define OPTION_ALL_VARS_LOCAL_NAME "locals" |
| #define OPTION_PARTIAL_CLASS "partial" | #define OPTION_PARTIAL_CLASS "partial" |
| #define REM_OPERATOR_NAME "rem" | |
| // forwards | // forwards |
| Line 216 typedef int YYSTYPE; | Line 217 typedef int YYSTYPE; |
| /* Line 214 of yacc.c. */ | /* Line 214 of yacc.c. */ |
| #line 220 "compile.tab.C" | #line 221 "compile.tab.C" |
| #if ! defined (yyoverflow) || YYERROR_VERBOSE | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| Line 455 static const short int yyrhs[] = | Line 456 static const short int yyrhs[] = |
| /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| static const unsigned short int yyrline[] = | static const unsigned short int yyrline[] = |
| { | { |
| 0, 131, 131, 138, 140, 140, 141, 143, 143, 145, | 0, 132, 132, 139, 141, 141, 142, 144, 144, 146, |
| 246, 246, 247, 247, 248, 249, 249, 251, 251, 301, | 247, 247, 248, 248, 249, 250, 250, 252, 252, 302, |
| 301, 302, 303, 303, 304, 304, 306, 306, 310, 310, | 302, 303, 304, 304, 305, 305, 307, 307, 311, 311, |
| 312, 312, 313, 313, 314, 314, 314, 318, 328, 329, | 313, 313, 314, 314, 315, 315, 315, 319, 348, 349, |
| 329, 330, 332, 333, 334, 373, 374, 374, 378, 383, | 349, 350, 352, 353, 354, 405, 406, 406, 410, 423, |
| 384, 385, 386, 403, 408, 411, 412, 413, 415, 418, | 424, 425, 426, 443, 448, 451, 452, 453, 455, 458, |
| 415, 426, 434, 441, 442, 443, 445, 451, 452, 452, | 455, 466, 474, 481, 482, 483, 485, 491, 492, 492, |
| 456, 462, 465, 462, 481, 483, 483, 485, 486, 487, | 496, 507, 510, 507, 538, 540, 540, 542, 543, 544, |
| 489, 492, 489, 495, 496, 498, 499, 502, 503, 506, | 546, 549, 546, 552, 553, 555, 556, 559, 560, 563, |
| 507, 509, 512, 526, 531, 532, 533, 538, 538, 540, | 564, 566, 569, 583, 588, 589, 590, 595, 595, 597, |
| 540, 541, 542, 550, 555, 558, 559, 560, 561, 563, | 597, 598, 599, 607, 612, 615, 616, 617, 618, 620, |
| 567, 576, 579, 576, 587, 592, 592, 593, 599, 600, | 624, 633, 636, 633, 644, 649, 649, 650, 656, 657, |
| 602, 619, 631, 633, 634, 635, 636, 637, 638, 639, | 659, 676, 688, 690, 691, 692, 693, 694, 695, 696, |
| 640, 642, 643, 644, 645, 646, 647, 648, 649, 651, | 697, 699, 700, 701, 702, 703, 704, 705, 706, 708, |
| 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, | 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, |
| 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, | 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, |
| 672, 673, 674, 675, 676, 677, 680, 685, 694, 699, | 729, 730, 731, 732, 733, 734, 737, 742, 763, 768, |
| 700, 701, 703 | 769, 770, 772 |
| }; | }; |
| #endif | #endif |
| Line 1427 yyreduce: | Line 1428 yyreduce: |
| switch (yyn) | switch (yyn) |
| { | { |
| case 2: | case 2: |
| #line 131 "compile.y" | #line 132 "compile.y" |
| { | { |
| Method& method=*new Method(Method::CT_ANY, | Method& method=*new Method(Method::CT_ANY, |
| 0, 0, /*min, max numbered_params_count*/ | 0, 0, /*min, max numbered_params_count*/ |
| Line 1438 yyreduce: | Line 1439 yyreduce: |
| break; | break; |
| case 9: | case 9: |
| #line 146 "compile.y" | #line 147 "compile.y" |
| { | { |
| const String& command=*LA2S(*yyvsp[-2]); | const String& command=*LA2S(*yyvsp[-2]); |
| YYSTYPE strings_code=yyvsp[0]; | YYSTYPE strings_code=yyvsp[0]; |
| Line 1542 yyreduce: | Line 1543 yyreduce: |
| break; | break; |
| case 13: | case 13: |
| #line 247 "compile.y" | #line 248 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 17: | case 17: |
| #line 251 "compile.y" | #line 252 "compile.y" |
| { | { |
| PC.class_add(); | PC.class_add(); |
| PC.explicit_result=false; | PC.explicit_result=false; |
| Line 1592 yyreduce: | Line 1593 yyreduce: |
| break; | break; |
| case 18: | case 18: |
| #line 291 "compile.y" | #line 292 "compile.y" |
| { | { |
| Method& method=*reinterpret_cast<Method*>(yyvsp[-1]); | Method& method=*reinterpret_cast<Method*>(yyvsp[-1]); |
| // fill in the code | // fill in the code |
| Line 1605 yyreduce: | Line 1606 yyreduce: |
| break; | break; |
| case 21: | case 21: |
| #line 302 "compile.y" | #line 303 "compile.y" |
| {yyval=yyvsp[-1];} | {yyval=yyvsp[-1];} |
| break; | break; |
| case 25: | case 25: |
| #line 304 "compile.y" | #line 305 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 31: | case 31: |
| #line 312 "compile.y" | #line 313 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 37: | case 37: |
| #line 318 "compile.y" | #line 319 "compile.y" |
| { | { |
| yyval=yyvsp[0]; /* stack: resulting value */ | yyval=N(); |
| YYSTYPE code=yyvsp[0]; | |
| #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT | #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT |
| if(!replace_top_opcode(*yyval, OP::OP_VALUE__GET_ELEMENT, OP::OP_VALUE__GET_ELEMENT__WRITE)) | if(!maybe_change_first_opcode(*code, OP::OP_VALUE__GET_ELEMENT, /*=>*/OP::OP_VALUE__GET_ELEMENT__WRITE)) |
| #endif | #endif |
| changetail_or_append(*yyval, | |
| OP::OP_GET_ELEMENT, false, /*->*/OP::OP_GET_ELEMENT__WRITE, | #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT |
| /*or */OP::OP_WRITE_VALUE | if( |
| ); /* value=pop; wcontext.write(value) */ | code->count()!=5 |
| || !maybe_change_first_opcode(*code, OP::OP_GET_OBJECT_ELEMENT, /*=>*/OP::OP_GET_OBJECT_ELEMENT__WRITE) | |
| ) | |
| #endif | |
| #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT | |
| if( | |
| code->count()!=5 | |
| || !maybe_change_first_opcode(*code, OP::OP_GET_OBJECT_VAR_ELEMENT, /*=>*/OP::OP_GET_OBJECT_VAR_ELEMENT__WRITE) | |
| ) | |
| #endif | |
| { | |
| changetail_or_append(*code, | |
| OP::OP_GET_ELEMENT, false, /*=>*/OP::OP_GET_ELEMENT__WRITE, | |
| /*or */OP::OP_WRITE_VALUE | |
| ); /* value=pop; wcontext.write(value) */ | |
| } | |
| P(*yyval, *code); | |
| ;} | ;} |
| break; | break; |
| case 38: | case 38: |
| #line 328 "compile.y" | #line 348 "compile.y" |
| { yyval=yyvsp[0] ;} | { yyval=yyvsp[0] ;} |
| break; | break; |
| case 41: | case 41: |
| #line 330 "compile.y" | #line 350 "compile.y" |
| { yyval=yyvsp[-1] ;} | { yyval=yyvsp[-1] ;} |
| break; | break; |
| case 44: | case 44: |
| #line 334 "compile.y" | #line 354 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| ArrayOperation* diving_code=yyvsp[0]; | YYSTYPE diving_code=yyvsp[0]; |
| const String* first_name=LA2S(*diving_code); | const String* first_name=LA2S(*diving_code); |
| // self.xxx... -> xxx... | size_t count=diving_code->count(); |
| // self.xxx... => xxx... | |
| // OP_VALUE+origin+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+... | // OP_VALUE+origin+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+... |
| if(first_name && *first_name==SELF_ELEMENT_NAME) { | if(first_name && *first_name==SELF_ELEMENT_NAME) { |
| O(*yyval, OP::OP_WITH_SELF); /* stack: starting context */ | O(*yyval, OP::OP_WITH_SELF); /* stack: starting context */ |
| P(*yyval, *diving_code, | P(*yyval, *diving_code, |
| /* skip over... */ | /* skip over... */ |
| diving_code->count()>=4?4/*OP::OP_VALUE+origin+string+OP::OP_GET_ELEMENTx*/:3/*OP::OP_+origin+string*/); | count>=4?4/*OP_VALUE+origin+string+OP_GET_ELEMENTx*/:3/*OP::OP_+origin+string*/); |
| } else { | } |
| #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT | |
| else if(maybe_make_get_object_element(*yyval, *diving_code, count)){ | |
| // optimisation for $object.field + ^object.method[ | |
| } | |
| #endif | |
| #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT | |
| else if(maybe_make_get_object_var_element(*yyval, *diving_code, count)){ | |
| // optimisation for $object.$var | |
| } | |
| #endif | |
| #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT | #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT |
| size_t count=diving_code->count(); | else if(count==4){ // optimization |
| if(count==4 || (count>4 && PC.in_call_value)){ // optimisations for popular simple cases | O(*yyval, |
| O(*yyval, | (PC.in_call_value) |
| (count==4 && PC.in_call_value) // ^call | ? OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR // ^object[ : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT_OR_OPERATOR+origin+string |
| ? OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR // OP_VALUE+origin+string+OP_GET_ELEMENT -> OP_VALUE__GET_ELEMENT_OR_OPERATOR+origin+string | : OP::OP_VALUE__GET_ELEMENT // $object : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT+origin+string |
| : OP::OP_VALUE__GET_ELEMENT // OP_VALUE+origin+string+OP_GET_ELEMENT -> OP_VALUE__GET_ELEMENT+origin+string | ); |
| ); | P(*yyval, *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value |
| P(*yyval, *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value | } else { |
| if(count>4) | O(*yyval, OP::OP_WITH_READ); /* stack: starting context */ |
| P(*yyval, *diving_code, 4/*offset*/); // copy tail | P(*yyval, *diving_code); |
| } else { | } |
| O(*yyval, OP::OP_WITH_READ); /* stack: starting context */ | |
| P(*yyval, *diving_code); | |
| } | |
| #else | #else |
| else { | |
| O(*yyval, OP::OP_WITH_READ); /* stack: starting context */ | O(*yyval, OP::OP_WITH_READ); /* stack: starting context */ |
| // ^if ELEMENT -> ^if ELEMENT_OR_OPERATOR | // ^if OP_ELEMENT => ^if OP_ELEMENT_OR_OPERATOR |
| // OP_VALUE+origin+string+OP_GET_ELEMENT. -> OP_VALUE+origin+string+OP_GET_ELEMENT_OR_OPERATOR. | // optimized OP_VALUE+origin+string+OP_GET_ELEMENT. => OP_VALUE+origin+string+OP_GET_ELEMENT_OR_OPERATOR. |
| if(PC.in_call_value && diving_code->count()==4) | if(PC.in_call_value && count==4) |
| diving_code->put(4-1, OP::OP_GET_ELEMENT_OR_OPERATOR); | diving_code->put(count-1, OP::OP_GET_ELEMENT_OR_OPERATOR); |
| P(*yyval, *diving_code); | P(*yyval, *diving_code); |
| #endif | |
| } | } |
| #endif | |
| /* diving code; stack: current context */ | /* diving code; stack: current context */ |
| ;} | ;} |
| break; | break; |
| case 45: | case 45: |
| #line 373 "compile.y" | #line 405 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 47: | case 47: |
| #line 374 "compile.y" | #line 406 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 48: | case 48: |
| #line 378 "compile.y" | #line 410 "compile.y" |
| { | { |
| yyval=yyvsp[-1]; /* stack: context,name */ | yyval=N(); |
| P(*yyval, *yyvsp[0]); /* stack: context,name,constructor_value */ | #ifdef OPTIMIZE_BYTECODE_CONSTRUCT |
| if(maybe_optimize_construct(*yyval, *yyvsp[-1], *yyvsp[0])){ | |
| // $a(expr), $.a(expr), $a[value], $.a[value] | |
| } else | |
| #endif | |
| { | |
| P(*yyval, *yyvsp[-1]); /* stack: context,name */ | |
| P(*yyval, *yyvsp[0]); /* stack: context,name,constructor_value */ | |
| } | |
| ;} | ;} |
| break; | break; |
| case 52: | case 52: |
| #line 386 "compile.y" | #line 426 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| ArrayOperation* diving_code=yyvsp[0]; | YYSTYPE diving_code=yyvsp[0]; |
| const String* first_name=LA2S(*diving_code); | const String* first_name=LA2S(*diving_code); |
| // $self.xxx... -> $xxx... | // $self.xxx... => $xxx... |
| // OP_VALUE+origin+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+... | // OP_VALUE+origin+string+OP_GET_ELEMENT+... => OP_WITH_SELF+... |
| if(first_name && *first_name==SELF_ELEMENT_NAME) { | if(first_name && *first_name==SELF_ELEMENT_NAME) { |
| O(*yyval, OP::OP_WITH_SELF); /* stack: starting context */ | O(*yyval, OP::OP_WITH_SELF); /* stack: starting context */ |
| P(*yyval, *diving_code, | P(*yyval, *diving_code, |
| Line 1726 yyreduce: | Line 1766 yyreduce: |
| break; | break; |
| case 53: | case 53: |
| #line 403 "compile.y" | #line 443 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| O(*yyval, OP::OP_WITH_WRITE); /* stack: starting context */ | O(*yyval, OP::OP_WITH_WRITE); /* stack: starting context */ |
| Line 1735 yyreduce: | Line 1775 yyreduce: |
| break; | break; |
| case 54: | case 54: |
| #line 408 "compile.y" | #line 448 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 58: | case 58: |
| #line 415 "compile.y" | #line 455 "compile.y" |
| { | { |
| // allow $result_or_other_variable[ letters here any time ] | // allow $result_or_other_variable[ letters here any time ] |
| *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false; | *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false; |
| Line 1748 yyreduce: | Line 1788 yyreduce: |
| break; | break; |
| case 59: | case 59: |
| #line 418 "compile.y" | #line 458 "compile.y" |
| { | { |
| PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]); | PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]); |
| ;} | ;} |
| break; | break; |
| case 60: | case 60: |
| #line 420 "compile.y" | #line 460 "compile.y" |
| { | { |
| // stack: context, name | // stack: context, name |
| yyval=yyvsp[-2]; // stack: context, name, value | yyval=yyvsp[-2]; // stack: context, name, value |
| Line 1764 yyreduce: | Line 1804 yyreduce: |
| break; | break; |
| case 61: | case 61: |
| #line 426 "compile.y" | #line 466 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| O(*yyval, OP::OP_PREPARE_TO_EXPRESSION); | O(*yyval, OP::OP_PREPARE_TO_EXPRESSION); |
| Line 1775 yyreduce: | Line 1815 yyreduce: |
| break; | break; |
| case 62: | case 62: |
| #line 434 "compile.y" | #line 474 "compile.y" |
| { | { |
| // stack: context, name | // stack: context, name |
| yyval=N(); | yyval=N(); |
| Line 1784 yyreduce: | Line 1824 yyreduce: |
| break; | break; |
| case 66: | case 66: |
| #line 445 "compile.y" | #line 485 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| OA(*yyval, OP::OP_OBJECT_POOL, yyvsp[0]); /* stack: empty write context */ | OA(*yyval, OP::OP_OBJECT_POOL, yyvsp[0]); /* stack: empty write context */ |
| Line 1794 yyreduce: | Line 1834 yyreduce: |
| break; | break; |
| case 69: | case 69: |
| #line 452 "compile.y" | #line 492 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 70: | case 70: |
| #line 456 "compile.y" | #line 496 "compile.y" |
| { | { |
| yyval=yyvsp[0]; /* stack: value */ | #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR |
| changetail_or_append(*yyval, | if((*yyvsp[0]).count()) |
| OP::OP_CALL, true, /*->*/ OP::OP_CALL__WRITE, | #endif |
| /*or */OP::OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */ | { |
| yyval=yyvsp[0]; /* stack: value */ | |
| changetail_or_append(*yyval, | |
| OP::OP_CALL, true, /*=>*/ OP::OP_CALL__WRITE, | |
| /*or */OP::OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */ | |
| } | |
| ;} | ;} |
| break; | break; |
| case 71: | case 71: |
| #line 462 "compile.y" | #line 507 "compile.y" |
| { | { |
| PC.in_call_value=true; | PC.in_call_value=true; |
| ;} | ;} |
| break; | break; |
| case 72: | case 72: |
| #line 465 "compile.y" | #line 510 "compile.y" |
| { | { |
| PC.in_call_value=false; | PC.in_call_value=false; |
| ;} | ;} |
| break; | break; |
| case 73: | case 73: |
| #line 468 "compile.y" | #line 513 "compile.y" |
| { /* ^field.$method{vasya} */ | { /* ^field.$method{vasya} */ |
| yyval=yyvsp[-3]; /* with_xxx,diving code; stack: context,method_junction */ | #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR |
| #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT | |
| const String* operator_name=LA2S(*yyvsp[-3], 0, OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR); | |
| #else | |
| const String* operator_name=LA2S(*yyvsp[-3], 1); | |
| #endif | |
| if(operator_name && *operator_name == REM_OPERATOR_NAME){ | |
| yyval=N(); | |
| } else | |
| #endif | |
| { | |
| yyval=yyvsp[-3]; /* with_xxx,diving code; stack: context,method_junction */ | |
| YYSTYPE params_code=yyvsp[-1]; | YYSTYPE params_code=yyvsp[-1]; |
| if(params_code->count()==3) { // probably [] case. [OP::OP_VALUE+origin+Void] | if(params_code->count()==3) { // probably [] case. [OP::OP_VALUE+origin+Void] |
| if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value? | if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value? |
| if(value->is_void()) // value is VVoid? | if(value->is_void()) // value is VVoid? |
| params_code=0; // ^zzz[] case. don't append lone empty param. | params_code=0; // ^zzz[] case. don't append lone empty param. |
| } | } |
| /* stack: context, method_junction */ | /* stack: context, method_junction */ |
| OA(*yyval, OP::OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value | OA(*yyval, OP::OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value |
| } | |
| ;} | ;} |
| break; | break; |
| case 76: | case 76: |
| #line 483 "compile.y" | #line 540 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 80: | case 80: |
| #line 489 "compile.y" | #line 546 "compile.y" |
| { | { |
| // allow ^call[ letters here any time ] | // allow ^call[ letters here any time ] |
| *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false; | *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false; |
| Line 1852 yyreduce: | Line 1909 yyreduce: |
| break; | break; |
| case 81: | case 81: |
| #line 492 "compile.y" | #line 549 "compile.y" |
| { | { |
| PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]); | PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]); |
| ;} | ;} |
| break; | break; |
| case 82: | case 82: |
| #line 494 "compile.y" | #line 551 "compile.y" |
| {yyval=yyvsp[-2];} | {yyval=yyvsp[-2];} |
| break; | break; |
| case 83: | case 83: |
| #line 495 "compile.y" | #line 552 "compile.y" |
| {yyval=yyvsp[-1];} | {yyval=yyvsp[-1];} |
| break; | break; |
| case 84: | case 84: |
| #line 496 "compile.y" | #line 553 "compile.y" |
| {yyval=yyvsp[-1];} | {yyval=yyvsp[-1];} |
| break; | break; |
| case 86: | case 86: |
| #line 499 "compile.y" | #line 556 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 88: | case 88: |
| #line 503 "compile.y" | #line 560 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 90: | case 90: |
| #line 507 "compile.y" | #line 564 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 91: | case 91: |
| #line 509 "compile.y" | #line 566 "compile.y" |
| { | { |
| yyval=yyvsp[0]; | yyval=yyvsp[0]; |
| ;} | ;} |
| break; | break; |
| case 92: | case 92: |
| #line 512 "compile.y" | #line 569 "compile.y" |
| { | { |
| YYSTYPE expr_code=yyvsp[0]; | YYSTYPE expr_code=yyvsp[0]; |
| if(expr_code->count()==3 | if(expr_code->count()==3 |
| && (*expr_code)[0].code==OP::OP_VALUE) { // optimizing (double/bool/incidently 'string' too) case. [OP::OP_VALUE+origin+Double]. no evaluating | && (*expr_code)[0].code==OP::OP_VALUE) { // optimizing (double/bool/incidently 'string' too) case. [OP::OP_VALUE+origin+Double]. no evaluating |
| yyval=expr_code; | yyval=expr_code; |
| } else { | } else { |
| ArrayOperation* code=N(); | YYSTYPE code=N(); |
| O(*code, OP::OP_PREPARE_TO_EXPRESSION); | O(*code, OP::OP_PREPARE_TO_EXPRESSION); |
| P(*code, *expr_code); | P(*code, *expr_code); |
| O(*code, OP::OP_WRITE_EXPR_RESULT); | O(*code, OP::OP_WRITE_EXPR_RESULT); |
| Line 1914 yyreduce: | Line 1971 yyreduce: |
| break; | break; |
| case 93: | case 93: |
| #line 526 "compile.y" | #line 583 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| OA(*yyval, OP::OP_CURLY_CODE__STORE_PARAM, yyvsp[0]); | OA(*yyval, OP::OP_CURLY_CODE__STORE_PARAM, yyvsp[0]); |
| Line 1922 yyreduce: | Line 1979 yyreduce: |
| break; | break; |
| case 98: | case 98: |
| #line 538 "compile.y" | #line 595 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 100: | case 100: |
| #line 540 "compile.y" | #line 597 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 102: | case 102: |
| #line 542 "compile.y" | #line 599 "compile.y" |
| { | { |
| // we know that name_advance1 not called from ^xxx context | // we know that name_advance1 not called from ^xxx context |
| // so we'll not check for operator call possibility as we do in name_advance2 | // so we'll not check for operator call possibility as we do in name_advance2 |
| Line 1944 yyreduce: | Line 2001 yyreduce: |
| break; | break; |
| case 103: | case 103: |
| #line 550 "compile.y" | #line 607 "compile.y" |
| { | { |
| /* stack: context */ | /* stack: context */ |
| yyval=yyvsp[0]; /* stack: context,name */ | yyval=yyvsp[0]; /* stack: context,name */ |
| Line 1953 yyreduce: | Line 2010 yyreduce: |
| break; | break; |
| case 109: | case 109: |
| #line 563 "compile.y" | #line 620 "compile.y" |
| { | { |
| yyval=yyvsp[0]; | yyval=yyvsp[0]; |
| O(*yyval, OP::OP_GET_ELEMENT); | O(*yyval, OP::OP_GET_ELEMENT); |
| Line 1961 yyreduce: | Line 2018 yyreduce: |
| break; | break; |
| case 110: | case 110: |
| #line 567 "compile.y" | #line 624 "compile.y" |
| { | { |
| ArrayOperation* code; | YYSTYPE code; |
| { | { |
| change_string_literal_to_write_string_literal(*(code=yyvsp[-1])); | change_string_literal_to_write_string_literal(*(code=yyvsp[-1])); |
| P(*code, *yyvsp[0]); | P(*code, *yyvsp[0]); |
| Line 1974 yyreduce: | Line 2031 yyreduce: |
| break; | break; |
| case 111: | case 111: |
| #line 576 "compile.y" | #line 633 "compile.y" |
| { | { |
| // allow $result_or_other_variable[ letters here any time ] | // allow $result_or_other_variable[ letters here any time ] |
| *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false; | *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false; |
| Line 1982 yyreduce: | Line 2039 yyreduce: |
| break; | break; |
| case 112: | case 112: |
| #line 579 "compile.y" | #line 636 "compile.y" |
| { | { |
| PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]); | PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]); |
| ;} | ;} |
| break; | break; |
| case 113: | case 113: |
| #line 581 "compile.y" | #line 638 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| OA(*yyval, OP::OP_OBJECT_POOL, yyvsp[-2]); /* stack: empty write context */ | OA(*yyval, OP::OP_OBJECT_POOL, yyvsp[-2]); /* stack: empty write context */ |
| Line 1999 yyreduce: | Line 2056 yyreduce: |
| break; | break; |
| case 114: | case 114: |
| #line 587 "compile.y" | #line 644 "compile.y" |
| { | { |
| yyval=N(); | yyval=N(); |
| O(*yyval, OP::OP_WITH_READ); | O(*yyval, OP::OP_WITH_READ); |
| Line 2008 yyreduce: | Line 2065 yyreduce: |
| break; | break; |
| case 116: | case 116: |
| #line 592 "compile.y" | #line 649 "compile.y" |
| { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} | { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} |
| break; | break; |
| case 117: | case 117: |
| #line 593 "compile.y" | #line 650 "compile.y" |
| { | { |
| yyval=yyvsp[0]; | yyval=yyvsp[0]; |
| O(*yyval, OP::OP_GET_ELEMENT__WRITE); | O(*yyval, OP::OP_GET_ELEMENT__WRITE); |
| Line 2021 yyreduce: | Line 2078 yyreduce: |
| break; | break; |
| case 120: | case 120: |
| #line 602 "compile.y" | #line 659 "compile.y" |
| { | { |
| yyval=yyvsp[-1]; // stack: class name string | yyval=yyvsp[-1]; // stack: class name string |
| if(*LA2S(*yyval) == BASE_NAME) { // pseudo BASE class | if(*LA2S(*yyval) == BASE_NAME) { // pseudo BASE class |
| Line 2033 yyreduce: | Line 2090 yyreduce: |
| } | } |
| } | } |
| #ifdef OPTIMIZE_BYTECODE_GET_CLASS | #ifdef OPTIMIZE_BYTECODE_GET_CLASS |
| // OP_VALUE+origin+string+OP_GET_CLASS -> OP_VALUE__GET_CLASS+origin+string | // optimized OP_VALUE+origin+string+OP_GET_CLASS => OP_VALUE__GET_CLASS+origin+string |
| replace_top_opcode(*yyval, OP::OP_VALUE, OP::OP_VALUE__GET_CLASS, true/*assert if top opcode != OP_VALUE*/) | maybe_change_first_opcode(*yyval, OP::OP_VALUE, OP::OP_VALUE__GET_CLASS, true/*assert if top opcode != OP_VALUE*/) |
| #else | #else |
| O(*yyval, OP::OP_GET_CLASS); | O(*yyval, OP::OP_GET_CLASS); |
| #endif | #endif |
| Line 2042 yyreduce: | Line 2099 yyreduce: |
| break; | break; |
| case 121: | case 121: |
| #line 619 "compile.y" | #line 676 "compile.y" |
| { | { |
| yyval=yyvsp[-1]; | yyval=yyvsp[-1]; |
| if(!PC.in_call_value) { | if(!PC.in_call_value) { |
| Line 2054 yyreduce: | Line 2111 yyreduce: |
| break; | break; |
| case 128: | case 128: |
| #line 638 "compile.y" | #line 695 "compile.y" |
| { yyval = yyvsp[-1] ;} | { yyval = yyvsp[-1] ;} |
| break; | break; |
| case 129: | case 129: |
| #line 639 "compile.y" | #line 696 "compile.y" |
| { yyval = yyvsp[-1] ;} | { yyval = yyvsp[-1] ;} |
| break; | break; |
| case 130: | case 130: |
| #line 640 "compile.y" | #line 697 "compile.y" |
| { yyval = yyvsp[-1]; ;} | { yyval = yyvsp[-1]; ;} |
| break; | break; |
| case 131: | case 131: |
| #line 642 "compile.y" | #line 699 "compile.y" |
| { yyval=yyvsp[0]; O(*yyval, OP::OP_NEG) ;} | { yyval=yyvsp[0]; O(*yyval, OP::OP_NEG) ;} |
| break; | break; |
| case 132: | case 132: |
| #line 643 "compile.y" | #line 700 "compile.y" |
| { yyval=yyvsp[0] ;} | { yyval=yyvsp[0] ;} |
| break; | break; |
| case 133: | case 133: |
| #line 644 "compile.y" | #line 701 "compile.y" |
| { yyval=yyvsp[0]; O(*yyval, OP::OP_INV) ;} | { yyval=yyvsp[0]; O(*yyval, OP::OP_INV) ;} |
| break; | break; |
| case 134: | case 134: |
| #line 645 "compile.y" | #line 702 "compile.y" |
| { yyval=yyvsp[0]; O(*yyval, OP::OP_NOT) ;} | { yyval=yyvsp[0]; O(*yyval, OP::OP_NOT) ;} |
| break; | break; |
| case 135: | case 135: |
| #line 646 "compile.y" | #line 703 "compile.y" |
| { yyval=yyvsp[0]; O(*yyval, OP::OP_DEF) ;} | { yyval=yyvsp[0]; O(*yyval, OP::OP_DEF) ;} |
| break; | break; |
| case 136: | case 136: |
| #line 647 "compile.y" | #line 704 "compile.y" |
| { yyval=yyvsp[0]; O(*yyval, OP::OP_IN) ;} | { yyval=yyvsp[0]; O(*yyval, OP::OP_IN) ;} |
| break; | break; |
| case 137: | case 137: |
| #line 648 "compile.y" | #line 705 "compile.y" |
| { yyval=yyvsp[0]; O(*yyval, OP::OP_FEXISTS) ;} | { yyval=yyvsp[0]; O(*yyval, OP::OP_FEXISTS) ;} |
| break; | break; |
| case 138: | case 138: |
| #line 649 "compile.y" | #line 706 "compile.y" |
| { yyval=yyvsp[0]; O(*yyval, OP::OP_DEXISTS) ;} | { yyval=yyvsp[0]; O(*yyval, OP::OP_DEXISTS) ;} |
| break; | break; |
| case 139: | case 139: |
| #line 651 "compile.y" | #line 708 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_SUB) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_SUB) ;} |
| break; | break; |
| case 140: | case 140: |
| #line 652 "compile.y" | #line 709 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_ADD) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_ADD) ;} |
| break; | break; |
| case 141: | case 141: |
| #line 653 "compile.y" | #line 710 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_MUL) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_MUL) ;} |
| break; | break; |
| case 142: | case 142: |
| #line 654 "compile.y" | #line 711 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_DIV) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_DIV) ;} |
| break; | break; |
| case 143: | case 143: |
| #line 655 "compile.y" | #line 712 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_MOD) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_MOD) ;} |
| break; | break; |
| case 144: | case 144: |
| #line 656 "compile.y" | #line 713 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_INTDIV) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_INTDIV) ;} |
| break; | break; |
| case 145: | case 145: |
| #line 657 "compile.y" | #line 714 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_SL) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_SL) ;} |
| break; | break; |
| case 146: | case 146: |
| #line 658 "compile.y" | #line 715 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_SR) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_SR) ;} |
| break; | break; |
| case 147: | case 147: |
| #line 659 "compile.y" | #line 716 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_AND) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_AND) ;} |
| break; | break; |
| case 148: | case 148: |
| #line 660 "compile.y" | #line 717 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_OR) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_OR) ;} |
| break; | break; |
| case 149: | case 149: |
| #line 661 "compile.y" | #line 718 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_XOR) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_XOR) ;} |
| break; | break; |
| case 150: | case 150: |
| #line 662 "compile.y" | #line 719 "compile.y" |
| { yyval=yyvsp[-2]; OA(*yyval, OP::OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP::OP_LOG_AND) ;} | { yyval=yyvsp[-2]; OA(*yyval, OP::OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP::OP_LOG_AND) ;} |
| break; | break; |
| case 151: | case 151: |
| #line 663 "compile.y" | #line 720 "compile.y" |
| { yyval=yyvsp[-2]; OA(*yyval, OP::OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP::OP_LOG_OR) ;} | { yyval=yyvsp[-2]; OA(*yyval, OP::OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP::OP_LOG_OR) ;} |
| break; | break; |
| case 152: | case 152: |
| #line 664 "compile.y" | #line 721 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_LOG_XOR) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_LOG_XOR) ;} |
| break; | break; |
| case 153: | case 153: |
| #line 665 "compile.y" | #line 722 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_LT) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_LT) ;} |
| break; | break; |
| case 154: | case 154: |
| #line 666 "compile.y" | #line 723 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_GT) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_GT) ;} |
| break; | break; |
| case 155: | case 155: |
| #line 667 "compile.y" | #line 724 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_LE) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_LE) ;} |
| break; | break; |
| case 156: | case 156: |
| #line 668 "compile.y" | #line 725 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_GE) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_GE) ;} |
| break; | break; |
| case 157: | case 157: |
| #line 669 "compile.y" | #line 726 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_EQ) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_EQ) ;} |
| break; | break; |
| case 158: | case 158: |
| #line 670 "compile.y" | #line 727 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_NE) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_NE) ;} |
| break; | break; |
| case 159: | case 159: |
| #line 671 "compile.y" | #line 728 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_LT) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_LT) ;} |
| break; | break; |
| case 160: | case 160: |
| #line 672 "compile.y" | #line 729 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_GT) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_GT) ;} |
| break; | break; |
| case 161: | case 161: |
| #line 673 "compile.y" | #line 730 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_LE) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_LE) ;} |
| break; | break; |
| case 162: | case 162: |
| #line 674 "compile.y" | #line 731 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_GE) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_GE) ;} |
| break; | break; |
| case 163: | case 163: |
| #line 675 "compile.y" | #line 732 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_EQ) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_EQ) ;} |
| break; | break; |
| case 164: | case 164: |
| #line 676 "compile.y" | #line 733 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_NE) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_NE) ;} |
| break; | break; |
| case 165: | case 165: |
| #line 677 "compile.y" | #line 734 "compile.y" |
| { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_IS) ;} | { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_IS) ;} |
| break; | break; |
| case 166: | case 166: |
| #line 680 "compile.y" | #line 737 "compile.y" |
| { | { |
| // optimized from OP_STRING->OP_VALUE for doubles | // optimized OP_STRING => OP_VALUE for doubles |
| maybe_change_string_literal_to_double_literal(*(yyval=yyvsp[0])); | maybe_change_string_literal_to_double_literal(*(yyval=yyvsp[0])); |
| ;} | ;} |
| break; | break; |
| case 167: | case 167: |
| #line 685 "compile.y" | #line 742 "compile.y" |
| { | { |
| #ifdef OPTIMIZE_BYTECODE_STRING_POOL | |
| // it brakes ^if(" 09 "){...} | |
| YYSTYPE code=yyvsp[0]; | |
| yyval=N(); | |
| if(code->count()==3 && maybe_change_first_opcode(*code, OP::OP_STRING__WRITE, OP::OP_VALUE)){ | |
| // optimized OP_STRING__WRITE+origin+value => OP_VALUE+origin+value without starting OP_STRING_POOL | |
| P(*yyval, *code); | |
| } else { | |
| OA(*yyval, OP::OP_STRING_POOL, code); /* stack: empty write context */ | |
| } | |
| #else | |
| yyval=N(); | yyval=N(); |
| OA(*yyval, OP::OP_STRING_POOL, yyvsp[0]); /* stack: empty write context */ | OA(*yyval, OP::OP_STRING_POOL, yyvsp[0]); /* stack: empty write context */ |
| #endif | |
| /* some code that writes to that context */ | /* some code that writes to that context */ |
| /* context=pop; stack: context.get_string() */ | /* context=pop; stack: context.get_string() */ |
| ;} | ;} |
| break; | break; |
| case 168: | case 168: |
| #line 694 "compile.y" | #line 763 "compile.y" |
| { | { |
| // optimized from OP_STRING+OP_WRITE_VALUE to OP_STRING__WRITE | // optimized OP_STRING+OP_WRITE_VALUE => OP_STRING__WRITE |
| change_string_literal_to_write_string_literal(*(yyval=yyvsp[0])) | change_string_literal_to_write_string_literal(*(yyval=yyvsp[0])) |
| ;} | ;} |
| break; | break; |
| case 169: | case 169: |
| #line 699 "compile.y" | #line 768 "compile.y" |
| { yyval=VL(/*we know that we will not change it*/const_cast<VVoid*>(&vvoid), 0, 0, 0) ;} | { yyval=VL(/*we know that we will not change it*/const_cast<VVoid*>(&vvoid), 0, 0, 0) ;} |
| break; | break; |
| case 170: | case 170: |
| #line 700 "compile.y" | #line 769 "compile.y" |
| { yyval = VL(/*we know that we will not change it*/const_cast<VBool*>(&vtrue), 0, 0, 0) ;} | { yyval = VL(/*we know that we will not change it*/const_cast<VBool*>(&vtrue), 0, 0, 0) ;} |
| break; | break; |
| case 171: | case 171: |
| #line 701 "compile.y" | #line 770 "compile.y" |
| { yyval = VL(/*we know that we will not change it*/const_cast<VBool*>(&vfalse), 0, 0, 0) ;} | { yyval = VL(/*we know that we will not change it*/const_cast<VBool*>(&vfalse), 0, 0, 0) ;} |
| break; | break; |
| case 172: | case 172: |
| #line 703 "compile.y" | #line 772 "compile.y" |
| { yyval=N() ;} | { yyval=N() ;} |
| break; | break; |
| Line 2293 yyreduce: | Line 2362 yyreduce: |
| } | } |
| /* Line 1010 of yacc.c. */ | /* Line 1010 of yacc.c. */ |
| #line 2297 "compile.tab.C" | #line 2366 "compile.tab.C" |
| yyvsp -= yylen; | yyvsp -= yylen; |
| yyssp -= yylen; | yyssp -= yylen; |
| Line 2518 yyreturn: | Line 2587 yyreturn: |
| } | } |
| #line 705 "compile.y" | #line 774 "compile.y" |
| #endif | #endif |