--- parser3/src/main/compile.tab.C 2010/04/28 17:56:22 1.147 +++ parser3/src/main/compile.tab.C 2012/05/30 03:09:07 1.155 @@ -129,12 +129,14 @@ /** @file Parser: compiler(lexical parser and grammar). - Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.tab.C,v 1.147 2010/04/28 17:56:22 pretender Exp $ + */ +volatile const char * IDENT_COMPILE_Y = "$Id: compile.tab.C,v 1.155 2012/05/30 03:09:07 misha Exp $"; + /** @todo parser4: - cache compiled code from request to request. to do that... @@ -162,7 +164,6 @@ #include "pa_vobject.h" #include "pa_vdouble.h" #include "pa_globals.h" -#include "pa_vvoid.h" #include "pa_vmethod_frame.h" // defines @@ -181,7 +182,7 @@ static int yylex(YYSTYPE* lvalp, void* p static const VBool vfalse(false); static const VBool vtrue(true); -static const VVoid vvoid; +static const VString vempty; // local convinient inplace typecast & var #undef PC @@ -217,7 +218,7 @@ typedef int YYSTYPE; /* Line 214 of yacc.c. */ -#line 221 "compile.tab.C" +#line 222 "compile.tab.C" #if ! defined (yyoverflow) || YYERROR_VERBOSE @@ -456,24 +457,24 @@ static const short int yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 132, 132, 139, 141, 141, 142, 144, 144, 146, - 247, 247, 248, 248, 249, 250, 250, 252, 252, 302, - 302, 303, 304, 304, 305, 305, 307, 307, 311, 311, - 313, 313, 314, 314, 315, 315, 315, 319, 360, 361, - 361, 362, 364, 365, 366, 419, 420, 420, 424, 437, - 438, 439, 440, 466, 471, 474, 475, 476, 478, 481, - 478, 489, 497, 504, 505, 506, 508, 514, 515, 515, - 519, 531, 534, 531, 578, 580, 580, 582, 583, 584, - 586, 589, 586, 592, 593, 595, 596, 599, 600, 603, - 604, 606, 609, 623, 628, 629, 630, 635, 635, 637, - 637, 638, 639, 647, 652, 655, 656, 657, 658, 660, - 664, 673, 676, 673, 684, 689, 689, 690, 696, 697, - 699, 716, 728, 730, 731, 732, 733, 734, 735, 736, - 737, 739, 740, 741, 742, 743, 744, 745, 746, 748, - 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, - 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, - 769, 770, 771, 772, 773, 774, 777, 782, 803, 808, - 809, 810, 812 + 0, 133, 133, 140, 142, 142, 143, 145, 145, 147, + 256, 256, 257, 257, 258, 259, 259, 261, 261, 309, + 309, 310, 311, 311, 312, 312, 314, 314, 318, 318, + 320, 320, 321, 321, 322, 322, 322, 326, 367, 368, + 368, 369, 371, 372, 373, 426, 427, 427, 431, 444, + 445, 446, 447, 473, 478, 481, 482, 483, 485, 488, + 485, 496, 504, 511, 512, 513, 515, 521, 522, 522, + 526, 538, 541, 538, 586, 588, 588, 590, 591, 592, + 594, 597, 594, 600, 601, 603, 604, 607, 608, 611, + 612, 614, 617, 631, 636, 637, 638, 643, 643, 645, + 645, 646, 647, 655, 660, 663, 664, 665, 666, 668, + 672, 681, 684, 681, 692, 697, 697, 698, 704, 705, + 707, 720, 732, 734, 735, 736, 737, 738, 739, 740, + 741, 743, 744, 745, 746, 747, 748, 749, 750, 752, + 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, + 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, + 773, 774, 775, 776, 777, 778, 781, 786, 807, 812, + 813, 814, 816 }; #endif @@ -516,7 +517,7 @@ static const char *const yytname[] = "subvar_ref_name_rdive", "subvar_get_writes", "subvar__get_write", "class_prefix", "class_static_prefix", "class_constructor_prefix", "expr_value", "expr", "double_or_STRING", "string_inside_quotes_value", - "write_string", "void_value", "true_value", "false_value", "empty", 0 + "write_string", "empty_value", "true_value", "false_value", "empty", 0 }; #endif @@ -1428,7 +1429,7 @@ yyreduce: switch (yyn) { case 2: -#line 132 "compile.y" +#line 133 "compile.y" { Method* method=new Method(Method::CT_ANY, 0, 0, /*min, max numbered_params_count*/ @@ -1439,9 +1440,9 @@ yyreduce: break; case 9: -#line 147 "compile.y" +#line 148 "compile.y" { - const String& command=*LA2S(*yyvsp[-2]); + const String& command=LA2S(*yyvsp[-2])->trim(String::TRIM_END); YYSTYPE strings_code=yyvsp[0]; if(strings_code->count()<1*OPERATIONS_PER_OPVALUE) { strcpy(PC.error, "@"); @@ -1451,8 +1452,9 @@ yyreduce: } if(command==CLASS_NAME) { if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) { + PC.class_add(); // new class' name - const String& name=*LA2S(*strings_code); + const String& name=LA2S(*strings_code)->trim(String::TRIM_END); // creating the class VStateless_class* cclass=new VClass; PC.cclass_new=cclass; @@ -1462,8 +1464,9 @@ yyreduce: YYERROR; } } else if(command==USE_CONTROL_METHOD_NAME) { + PC.class_add(); for(size_t i=0; icount(); i+=OPERATIONS_PER_OPVALUE) - PC.request.use_file(PC.request.main_class, *LA2S(*strings_code, i)); + PC.request.use_file(PC.request.main_class, LA2S(*strings_code, i)->trim(String::TRIM_END), PC.request.get_used_filename(PC.file_no)); } else if(command==BASE_NAME) { if(PC.append){ strcpy(PC.error, "can't set base while appending methods to class '"); @@ -1479,7 +1482,7 @@ yyreduce: YYERROR; } if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) { - const String& base_name=*LA2S(*strings_code); + const String& base_name=LA2S(*strings_code)->trim(String::TRIM_END); if(Value* base_class_value=PC.request.get_class(base_name)) { // @CLASS == @BASE sanity check if(VStateless_class *base_class=base_class_value->get_class()) { @@ -1504,7 +1507,7 @@ yyreduce: } } else if(command==OPTIONS_CONTROL_METHOD_NAME) { for(size_t i=0; icount(); i+=OPERATIONS_PER_OPVALUE) { - const String& option=*LA2S(*strings_code, i); + const String& option=LA2S(*strings_code, i)->trim(String::TRIM_END); if(option==OPTION_ALL_VARS_LOCAL_NAME){ PC.set_all_vars_local(); } else if(option==OPTION_PARTIAL_CLASS){ @@ -1517,18 +1520,24 @@ yyreduce: YYERROR; } } else { - // mark new class as partial. we can add methods to it later. + // marks the new class as partial. we will be able to add methods here later. PC.cclass_new->set_partial(); } } else { strcpy(PC.error, "'"OPTION_PARTIAL_CLASS"' option should be used straight after @"CLASS_NAME); YYERROR; } + } else if(option==method_call_type_static){ + PC.set_methods_call_type(Method::CT_STATIC); + } else if(option==method_call_type_dynamic){ + PC.set_methods_call_type(Method::CT_DYNAMIC); } else { strcpy(PC.error, "'"); strncat(PC.error, option.cstr(), MAX_STRING/2); strcat(PC.error, "' invalid option. valid options are " - "'"OPTION_PARTIAL_CLASS"' and '"OPTION_ALL_VARS_LOCAL_NAME"'"); + "'"OPTION_PARTIAL_CLASS"', '"OPTION_ALL_VARS_LOCAL_NAME"'" + ", '"METHOD_CALL_TYPE_STATIC"' and '"METHOD_CALL_TYPE_DYNAMIC"'" + ); YYERROR; } } @@ -1543,12 +1552,12 @@ yyreduce: break; case 13: -#line 248 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 257 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 17: -#line 252 "compile.y" +#line 261 "compile.y" { PC.class_add(); PC.explicit_result=false; @@ -1581,19 +1590,17 @@ yyreduce: Method* method=new Method( //name, - Method::CT_ANY, + GetMethodCallType(PC, *yyvsp[-4]), 0, 0/*min,max numbered_params_count*/, params_names, locals_names, 0/*to be filled later in next {} */, 0, all_vars_local); *reinterpret_cast(&yyval)=method; - - // todo: check [][;result;] ;} break; case 18: -#line 292 "compile.y" +#line 299 "compile.y" { Method* method=reinterpret_cast(yyvsp[-1]); // fill in the code @@ -1606,22 +1613,22 @@ yyreduce: break; case 21: -#line 303 "compile.y" - {yyval=yyvsp[-1];} +#line 310 "compile.y" + {yyval=yyvsp[-1];;} break; case 25: -#line 305 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} +#line 312 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); ;} break; case 31: -#line 313 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 320 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 37: -#line 319 "compile.y" +#line 326 "compile.y" { yyval=N(); YYSTYPE code=yyvsp[0]; @@ -1666,17 +1673,17 @@ yyreduce: break; case 38: -#line 360 "compile.y" - { yyval=yyvsp[0] ;} +#line 367 "compile.y" + { yyval=yyvsp[0]; ;} break; case 41: -#line 362 "compile.y" - { yyval=yyvsp[-1] ;} +#line 369 "compile.y" + { yyval=yyvsp[-1]; ;} break; case 44: -#line 366 "compile.y" +#line 373 "compile.y" { yyval=N(); YYSTYPE diving_code=yyvsp[0]; @@ -1733,17 +1740,17 @@ yyreduce: break; case 45: -#line 419 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 426 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 47: -#line 420 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 427 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 48: -#line 424 "compile.y" +#line 431 "compile.y" { yyval=N(); #ifdef OPTIMIZE_BYTECODE_CONSTRUCT @@ -1759,7 +1766,7 @@ yyreduce: break; case 52: -#line 440 "compile.y" +#line 447 "compile.y" { yyval=N(); YYSTYPE diving_code=yyvsp[0]; @@ -1789,7 +1796,7 @@ yyreduce: break; case 53: -#line 466 "compile.y" +#line 473 "compile.y" { yyval=N(); O(*yyval, OP::OP_WITH_WRITE); /* stack: starting context */ @@ -1798,12 +1805,12 @@ yyreduce: break; case 54: -#line 471 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 478 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 58: -#line 478 "compile.y" +#line 485 "compile.y" { // allow $result_or_other_variable[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -1811,14 +1818,14 @@ yyreduce: break; case 59: -#line 481 "compile.y" +#line 488 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 60: -#line 483 "compile.y" +#line 490 "compile.y" { // stack: context, name yyval=yyvsp[-2]; // stack: context, name, value @@ -1827,7 +1834,7 @@ yyreduce: break; case 61: -#line 489 "compile.y" +#line 496 "compile.y" { yyval=N(); O(*yyval, OP::OP_PREPARE_TO_EXPRESSION); @@ -1838,7 +1845,7 @@ yyreduce: break; case 62: -#line 497 "compile.y" +#line 504 "compile.y" { // stack: context, name yyval=N(); @@ -1847,7 +1854,7 @@ yyreduce: break; case 66: -#line 508 "compile.y" +#line 515 "compile.y" { yyval=N(); OA(*yyval, OP::OP_OBJECT_POOL, yyvsp[0]); /* stack: empty write context */ @@ -1857,12 +1864,12 @@ yyreduce: break; case 69: -#line 515 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 522 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 70: -#line 519 "compile.y" +#line 526 "compile.y" { #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR if((*yyvsp[0]).count()) @@ -1878,21 +1885,21 @@ yyreduce: break; case 71: -#line 531 "compile.y" +#line 538 "compile.y" { PC.in_call_value=true; ;} break; case 72: -#line 534 "compile.y" +#line 541 "compile.y" { PC.in_call_value=false; ;} break; case 73: -#line 537 "compile.y" +#line 544 "compile.y" { /* ^field.$method{vasya} */ #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT @@ -1908,8 +1915,9 @@ yyreduce: YYSTYPE params_code=yyvsp[-1]; 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->is_void()) // value is VVoid? - params_code=0; // ^zzz[] case. don't append lone empty param. + if(const String * string=value->get_string()) + if(string->is_empty()) // value is empty string? + params_code=0; // ^zzz[] case. don't append lone empty param. } /* stack: context, method_junction */ @@ -1936,12 +1944,12 @@ yyreduce: break; case 76: -#line 580 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 588 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 80: -#line 586 "compile.y" +#line 594 "compile.y" { // allow ^call[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -1949,51 +1957,51 @@ yyreduce: break; case 81: -#line 589 "compile.y" +#line 597 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 82: -#line 591 "compile.y" - {yyval=yyvsp[-2];} +#line 599 "compile.y" + {yyval=yyvsp[-2];;} break; case 83: -#line 592 "compile.y" - {yyval=yyvsp[-1];} +#line 600 "compile.y" + {yyval=yyvsp[-1];;} break; case 84: -#line 593 "compile.y" - {yyval=yyvsp[-1];} +#line 601 "compile.y" + {yyval=yyvsp[-1];;} break; case 86: -#line 596 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} +#line 604 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); ;} break; case 88: -#line 600 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} +#line 608 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); ;} break; case 90: -#line 604 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} +#line 612 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); ;} break; case 91: -#line 606 "compile.y" +#line 614 "compile.y" { yyval=yyvsp[0]; ;} break; case 92: -#line 609 "compile.y" +#line 617 "compile.y" { YYSTYPE expr_code=yyvsp[0]; if(expr_code->count()==3 @@ -2011,7 +2019,7 @@ yyreduce: break; case 93: -#line 623 "compile.y" +#line 631 "compile.y" { yyval=N(); OA(*yyval, OP::OP_CURLY_CODE__STORE_PARAM, yyvsp[0]); @@ -2019,17 +2027,17 @@ yyreduce: break; case 98: -#line 635 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 643 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 100: -#line 637 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 645 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 102: -#line 639 "compile.y" +#line 647 "compile.y" { // 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 @@ -2041,7 +2049,7 @@ yyreduce: break; case 103: -#line 647 "compile.y" +#line 655 "compile.y" { /* stack: context */ yyval=yyvsp[0]; /* stack: context,name */ @@ -2050,7 +2058,7 @@ yyreduce: break; case 109: -#line 660 "compile.y" +#line 668 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP::OP_GET_ELEMENT); @@ -2058,7 +2066,7 @@ yyreduce: break; case 110: -#line 664 "compile.y" +#line 672 "compile.y" { YYSTYPE code; { @@ -2071,7 +2079,7 @@ yyreduce: break; case 111: -#line 673 "compile.y" +#line 681 "compile.y" { // allow $result_or_other_variable[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -2079,14 +2087,14 @@ yyreduce: break; case 112: -#line 676 "compile.y" +#line 684 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 113: -#line 678 "compile.y" +#line 686 "compile.y" { yyval=N(); OA(*yyval, OP::OP_OBJECT_POOL, yyvsp[-2]); /* stack: empty write context */ @@ -2096,7 +2104,7 @@ yyreduce: break; case 114: -#line 684 "compile.y" +#line 692 "compile.y" { yyval=N(); O(*yyval, OP::OP_WITH_READ); @@ -2105,12 +2113,12 @@ yyreduce: break; case 116: -#line 689 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 697 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 117: -#line 690 "compile.y" +#line 698 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP::OP_GET_ELEMENT__WRITE); @@ -2118,7 +2126,7 @@ yyreduce: break; case 120: -#line 699 "compile.y" +#line 707 "compile.y" { yyval=yyvsp[-1]; // stack: class name string if(*LA2S(*yyval) == BASE_NAME) { // pseudo BASE class @@ -2130,12 +2138,12 @@ yyreduce: } } // optimized OP_VALUE+origin+string+OP_GET_CLASS => OP_VALUE__GET_CLASS+origin+string - maybe_change_first_opcode(*yyval, OP::OP_VALUE, OP::OP_VALUE__GET_CLASS) + maybe_change_first_opcode(*yyval, OP::OP_VALUE, OP::OP_VALUE__GET_CLASS); ;} break; case 121: -#line 716 "compile.y" +#line 720 "compile.y" { yyval=yyvsp[-1]; if(!PC.in_call_value) { @@ -2147,197 +2155,197 @@ yyreduce: break; case 128: -#line 735 "compile.y" - { yyval = yyvsp[-1] ;} +#line 739 "compile.y" + { yyval = yyvsp[-1]; ;} break; case 129: -#line 736 "compile.y" - { yyval = yyvsp[-1] ;} +#line 740 "compile.y" + { yyval = yyvsp[-1]; ;} break; case 130: -#line 737 "compile.y" +#line 741 "compile.y" { yyval = yyvsp[-1]; ;} break; case 131: -#line 739 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_NEG) ;} +#line 743 "compile.y" + { yyval=yyvsp[0]; O(*yyval, OP::OP_NEG); ;} break; case 132: -#line 740 "compile.y" - { yyval=yyvsp[0] ;} +#line 744 "compile.y" + { yyval=yyvsp[0]; ;} break; case 133: -#line 741 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_INV) ;} +#line 745 "compile.y" + { yyval=yyvsp[0]; O(*yyval, OP::OP_INV); ;} break; case 134: -#line 742 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_NOT) ;} +#line 746 "compile.y" + { yyval=yyvsp[0]; O(*yyval, OP::OP_NOT); ;} break; case 135: -#line 743 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_DEF) ;} +#line 747 "compile.y" + { yyval=yyvsp[0]; O(*yyval, OP::OP_DEF); ;} break; case 136: -#line 744 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_IN) ;} +#line 748 "compile.y" + { yyval=yyvsp[0]; O(*yyval, OP::OP_IN); ;} break; case 137: -#line 745 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_FEXISTS) ;} +#line 749 "compile.y" + { yyval=yyvsp[0]; O(*yyval, OP::OP_FEXISTS); ;} break; case 138: -#line 746 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_DEXISTS) ;} +#line 750 "compile.y" + { yyval=yyvsp[0]; O(*yyval, OP::OP_DEXISTS); ;} break; case 139: -#line 748 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_SUB) ;} +#line 752 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_SUB); ;} break; case 140: -#line 749 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_ADD) ;} +#line 753 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_ADD); ;} break; case 141: -#line 750 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_MUL) ;} +#line 754 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_MUL); ;} break; case 142: -#line 751 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_DIV) ;} +#line 755 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_DIV); ;} break; case 143: -#line 752 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_MOD) ;} +#line 756 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_MOD); ;} break; case 144: -#line 753 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_INTDIV) ;} +#line 757 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_INTDIV); ;} break; case 145: -#line 754 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_SL) ;} +#line 758 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_SL); ;} break; case 146: -#line 755 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_SR) ;} +#line 759 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_SR); ;} break; case 147: -#line 756 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_AND) ;} +#line 760 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_AND); ;} break; case 148: -#line 757 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_OR) ;} +#line 761 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_OR); ;} break; case 149: -#line 758 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_XOR) ;} +#line 762 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_BIN_XOR); ;} break; case 150: -#line 759 "compile.y" - { yyval=yyvsp[-2]; OA(*yyval, OP::OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP::OP_LOG_AND) ;} +#line 763 "compile.y" + { yyval=yyvsp[-2]; OA(*yyval, OP::OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP::OP_LOG_AND); ;} break; case 151: -#line 760 "compile.y" - { yyval=yyvsp[-2]; OA(*yyval, OP::OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP::OP_LOG_OR) ;} +#line 764 "compile.y" + { yyval=yyvsp[-2]; OA(*yyval, OP::OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP::OP_LOG_OR); ;} break; case 152: -#line 761 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_LOG_XOR) ;} +#line 765 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_LOG_XOR); ;} break; case 153: -#line 762 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_LT) ;} +#line 766 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_LT); ;} break; case 154: -#line 763 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_GT) ;} +#line 767 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_GT); ;} break; case 155: -#line 764 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_LE) ;} +#line 768 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_LE); ;} break; case 156: -#line 765 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_GE) ;} +#line 769 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_GE); ;} break; case 157: -#line 766 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_EQ) ;} +#line 770 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_EQ); ;} break; case 158: -#line 767 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_NE) ;} +#line 771 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_NUM_NE); ;} break; case 159: -#line 768 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_LT) ;} +#line 772 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_LT); ;} break; case 160: -#line 769 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_GT) ;} +#line 773 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_GT); ;} break; case 161: -#line 770 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_LE) ;} +#line 774 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_LE); ;} break; case 162: -#line 771 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_GE) ;} +#line 775 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_GE); ;} break; case 163: -#line 772 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_EQ) ;} +#line 776 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_EQ); ;} break; case 164: -#line 773 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_NE) ;} +#line 777 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_STR_NE); ;} break; case 165: -#line 774 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_IS) ;} +#line 778 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_IS); ;} break; case 166: -#line 777 "compile.y" +#line 781 "compile.y" { // optimized OP_STRING => OP_VALUE for doubles maybe_change_string_literal_to_double_literal(*(yyval=yyvsp[0])); @@ -2345,7 +2353,7 @@ yyreduce: break; case 167: -#line 782 "compile.y" +#line 786 "compile.y" { #ifdef OPTIMIZE_BYTECODE_STRING_POOL // it brakes ^if(" 09 "){...} @@ -2367,38 +2375,38 @@ yyreduce: break; case 168: -#line 803 "compile.y" +#line 807 "compile.y" { // 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; case 169: -#line 808 "compile.y" - { yyval=VL(/*we know that we will not change it*/const_cast(&vvoid), 0, 0, 0) ;} +#line 812 "compile.y" + { yyval=VL(/*we know that we will not change it*/const_cast(&vempty), 0, 0, 0); ;} break; case 170: -#line 809 "compile.y" - { yyval = VL(/*we know that we will not change it*/const_cast(&vtrue), 0, 0, 0) ;} +#line 813 "compile.y" + { yyval = VL(/*we know that we will not change it*/const_cast(&vtrue), 0, 0, 0); ;} break; case 171: -#line 810 "compile.y" - { yyval = VL(/*we know that we will not change it*/const_cast(&vfalse), 0, 0, 0) ;} +#line 814 "compile.y" + { yyval = VL(/*we know that we will not change it*/const_cast(&vfalse), 0, 0, 0); ;} break; case 172: -#line 812 "compile.y" - { yyval=N() ;} +#line 816 "compile.y" + { yyval=N(); ;} break; } /* Line 1010 of yacc.c. */ -#line 2406 "compile.tab.C" +#line 2410 "compile.tab.C" yyvsp -= yylen; yyssp -= yylen; @@ -2623,7 +2631,7 @@ yyreturn: } -#line 814 "compile.y" +#line 818 "compile.y" #endif @@ -3393,12 +3401,9 @@ default: break2: if(end!=begin) { // there is last piece? - if((c=='@' || c==0) && end[-1]=='\n') { // we are before LS_DEF_NAME or EOF? - // strip last \n - end--; - if(end!=begin && end[-1]=='\n') // allow one empty line before LS_DEF_NAME + if(c=='@' || c==0) // we are before LS_DEF_NAME or EOF? + while(end!=begin && end[-1]=='\n') // trim all empty lines before LS_DEF_NAME and EOF end--; - } if(end!=begin && pc.ls!=LS_USER_COMMENT) { // last piece still alive and not comment? if(!pc.string_start) pc.string_start=begin_pos;