--- parser3/src/main/compile.tab.C 2009/08/01 05:11:40 1.143 +++ parser3/src/main/compile.tab.C 2010/10/12 21:59:08 1.153 @@ -132,7 +132,7 @@ Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.tab.C,v 1.143 2009/08/01 05:11:40 misha Exp $ + $Id: compile.tab.C,v 1.153 2010/10/12 21:59:08 moko Exp $ */ /** @@ -162,7 +162,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 +180,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 +216,7 @@ typedef int YYSTYPE; /* Line 214 of yacc.c. */ -#line 221 "compile.tab.C" +#line 220 "compile.tab.C" #if ! defined (yyoverflow) || YYERROR_VERBOSE @@ -456,19 +455,19 @@ 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, + 0, 131, 131, 138, 140, 140, 141, 143, 143, 145, + 252, 252, 253, 253, 254, 255, 255, 257, 257, 305, + 305, 306, 307, 307, 308, 308, 310, 310, 314, 314, + 316, 316, 317, 317, 318, 318, 318, 322, 363, 364, + 364, 365, 367, 368, 369, 422, 423, 423, 427, 440, + 441, 442, 443, 469, 474, 477, 478, 479, 481, 484, + 481, 492, 500, 507, 508, 509, 511, 517, 518, 518, + 522, 534, 537, 534, 582, 584, 584, 586, 587, 588, + 590, 593, 590, 596, 597, 599, 600, 603, 604, 607, + 608, 610, 613, 627, 632, 633, 634, 639, 639, 641, + 641, 642, 643, 651, 656, 659, 660, 661, 662, 664, + 668, 677, 680, 677, 688, 693, 693, 694, 700, 701, + 703, 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, @@ -516,7 +515,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,20 +1427,20 @@ yyreduce: switch (yyn) { case 2: -#line 132 "compile.y" +#line 131 "compile.y" { - Method& method=*new Method(Method::CT_ANY, + Method* method=new Method(Method::CT_ANY, 0, 0, /*min, max numbered_params_count*/ 0/*param_names*/, 0/*local_names*/, yyvsp[0]/*parser_code*/, 0/*native_code*/); - PC.cclass->add_method(PC.alias_method(main_method_name), method); + PC.cclass->set_method(PC.alias_method(main_method_name), method); ;} break; case 9: -#line 147 "compile.y" +#line 146 "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, "@"); @@ -1452,7 +1451,7 @@ yyreduce: if(command==CLASS_NAME) { if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) { // 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; @@ -1463,7 +1462,7 @@ yyreduce: } } else if(command==USE_CONTROL_METHOD_NAME) { 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,8 +1478,8 @@ yyreduce: YYERROR; } if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) { - const String& base_name=*LA2S(*strings_code); - if(Value* base_class_value=PC.request.classes().get(base_name)) { + 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()) { if(PC.cclass==base_class) { @@ -1504,7 +1503,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 +1516,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 +1548,12 @@ yyreduce: break; case 13: -#line 248 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 253 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 17: -#line 252 "compile.y" +#line 257 "compile.y" { PC.class_add(); PC.explicit_result=false; @@ -1581,47 +1586,45 @@ 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 295 "compile.y" { - Method& method=*reinterpret_cast(yyvsp[-1]); + Method* method=reinterpret_cast(yyvsp[-1]); // fill in the code - method.parser_code=yyvsp[0]; + method->parser_code=yyvsp[0]; // register in class const String& name=*LA2S(*yyvsp[-6]); - PC.cclass->add_method(PC.alias_method(name), method); + PC.cclass->set_method(PC.alias_method(name), method); ;} break; case 21: -#line 303 "compile.y" - {yyval=yyvsp[-1];} +#line 306 "compile.y" + {yyval=yyvsp[-1];;} break; case 25: -#line 305 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} +#line 308 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); ;} break; case 31: -#line 313 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 316 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 37: -#line 319 "compile.y" +#line 322 "compile.y" { yyval=N(); YYSTYPE code=yyvsp[0]; @@ -1666,17 +1669,17 @@ yyreduce: break; case 38: -#line 360 "compile.y" - { yyval=yyvsp[0] ;} +#line 363 "compile.y" + { yyval=yyvsp[0]; ;} break; case 41: -#line 362 "compile.y" - { yyval=yyvsp[-1] ;} +#line 365 "compile.y" + { yyval=yyvsp[-1]; ;} break; case 44: -#line 366 "compile.y" +#line 369 "compile.y" { yyval=N(); YYSTYPE diving_code=yyvsp[0]; @@ -1733,17 +1736,17 @@ yyreduce: break; case 45: -#line 419 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 422 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 47: -#line 420 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 423 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 48: -#line 424 "compile.y" +#line 427 "compile.y" { yyval=N(); #ifdef OPTIMIZE_BYTECODE_CONSTRUCT @@ -1759,7 +1762,7 @@ yyreduce: break; case 52: -#line 440 "compile.y" +#line 443 "compile.y" { yyval=N(); YYSTYPE diving_code=yyvsp[0]; @@ -1789,7 +1792,7 @@ yyreduce: break; case 53: -#line 466 "compile.y" +#line 469 "compile.y" { yyval=N(); O(*yyval, OP::OP_WITH_WRITE); /* stack: starting context */ @@ -1798,12 +1801,12 @@ yyreduce: break; case 54: -#line 471 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 474 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 58: -#line 478 "compile.y" +#line 481 "compile.y" { // allow $result_or_other_variable[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -1811,14 +1814,14 @@ yyreduce: break; case 59: -#line 481 "compile.y" +#line 484 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 60: -#line 483 "compile.y" +#line 486 "compile.y" { // stack: context, name yyval=yyvsp[-2]; // stack: context, name, value @@ -1827,7 +1830,7 @@ yyreduce: break; case 61: -#line 489 "compile.y" +#line 492 "compile.y" { yyval=N(); O(*yyval, OP::OP_PREPARE_TO_EXPRESSION); @@ -1838,7 +1841,7 @@ yyreduce: break; case 62: -#line 497 "compile.y" +#line 500 "compile.y" { // stack: context, name yyval=N(); @@ -1847,7 +1850,7 @@ yyreduce: break; case 66: -#line 508 "compile.y" +#line 511 "compile.y" { yyval=N(); OA(*yyval, OP::OP_OBJECT_POOL, yyvsp[0]); /* stack: empty write context */ @@ -1857,12 +1860,12 @@ yyreduce: break; case 69: -#line 515 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 518 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 70: -#line 519 "compile.y" +#line 522 "compile.y" { #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR if((*yyvsp[0]).count()) @@ -1878,21 +1881,21 @@ yyreduce: break; case 71: -#line 531 "compile.y" +#line 534 "compile.y" { PC.in_call_value=true; ;} break; case 72: -#line 534 "compile.y" +#line 537 "compile.y" { PC.in_call_value=false; ;} break; case 73: -#line 537 "compile.y" +#line 540 "compile.y" { /* ^field.$method{vasya} */ #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT @@ -1908,8 +1911,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 +1940,12 @@ yyreduce: break; case 76: -#line 580 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 584 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 80: -#line 586 "compile.y" +#line 590 "compile.y" { // allow ^call[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -1949,51 +1953,51 @@ yyreduce: break; case 81: -#line 589 "compile.y" +#line 593 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 82: -#line 591 "compile.y" - {yyval=yyvsp[-2];} +#line 595 "compile.y" + {yyval=yyvsp[-2];;} break; case 83: -#line 592 "compile.y" - {yyval=yyvsp[-1];} +#line 596 "compile.y" + {yyval=yyvsp[-1];;} break; case 84: -#line 593 "compile.y" - {yyval=yyvsp[-1];} +#line 597 "compile.y" + {yyval=yyvsp[-1];;} break; case 86: -#line 596 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} +#line 600 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); ;} break; case 88: -#line 600 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} +#line 604 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); ;} break; case 90: -#line 604 "compile.y" - { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} +#line 608 "compile.y" + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); ;} break; case 91: -#line 606 "compile.y" +#line 610 "compile.y" { yyval=yyvsp[0]; ;} break; case 92: -#line 609 "compile.y" +#line 613 "compile.y" { YYSTYPE expr_code=yyvsp[0]; if(expr_code->count()==3 @@ -2011,7 +2015,7 @@ yyreduce: break; case 93: -#line 623 "compile.y" +#line 627 "compile.y" { yyval=N(); OA(*yyval, OP::OP_CURLY_CODE__STORE_PARAM, yyvsp[0]); @@ -2019,17 +2023,17 @@ yyreduce: break; case 98: -#line 635 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 639 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 100: -#line 637 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 641 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 102: -#line 639 "compile.y" +#line 643 "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 +2045,7 @@ yyreduce: break; case 103: -#line 647 "compile.y" +#line 651 "compile.y" { /* stack: context */ yyval=yyvsp[0]; /* stack: context,name */ @@ -2050,7 +2054,7 @@ yyreduce: break; case 109: -#line 660 "compile.y" +#line 664 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP::OP_GET_ELEMENT); @@ -2058,7 +2062,7 @@ yyreduce: break; case 110: -#line 664 "compile.y" +#line 668 "compile.y" { YYSTYPE code; { @@ -2071,7 +2075,7 @@ yyreduce: break; case 111: -#line 673 "compile.y" +#line 677 "compile.y" { // allow $result_or_other_variable[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -2079,14 +2083,14 @@ yyreduce: break; case 112: -#line 676 "compile.y" +#line 680 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 113: -#line 678 "compile.y" +#line 682 "compile.y" { yyval=N(); OA(*yyval, OP::OP_OBJECT_POOL, yyvsp[-2]); /* stack: empty write context */ @@ -2096,7 +2100,7 @@ yyreduce: break; case 114: -#line 684 "compile.y" +#line 688 "compile.y" { yyval=N(); O(*yyval, OP::OP_WITH_READ); @@ -2105,12 +2109,12 @@ yyreduce: break; case 116: -#line 689 "compile.y" - { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} +#line 693 "compile.y" + { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]); ;} break; case 117: -#line 690 "compile.y" +#line 694 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP::OP_GET_ELEMENT__WRITE); @@ -2118,7 +2122,7 @@ yyreduce: break; case 120: -#line 699 "compile.y" +#line 703 "compile.y" { yyval=yyvsp[-1]; // stack: class name string if(*LA2S(*yyval) == BASE_NAME) { // pseudo BASE class @@ -2129,12 +2133,8 @@ yyreduce: YYERROR; } } -#ifdef OPTIMIZE_BYTECODE_GET_CLASS // 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) -#else - O(*yyval, OP::OP_GET_CLASS); -#endif + maybe_change_first_opcode(*yyval, OP::OP_VALUE, OP::OP_VALUE__GET_CLASS); ;} break; @@ -2152,12 +2152,12 @@ yyreduce: case 128: #line 735 "compile.y" - { yyval = yyvsp[-1] ;} + { yyval = yyvsp[-1]; ;} break; case 129: #line 736 "compile.y" - { yyval = yyvsp[-1] ;} + { yyval = yyvsp[-1]; ;} break; case 130: @@ -2167,177 +2167,177 @@ yyreduce: case 131: #line 739 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_NEG) ;} + { yyval=yyvsp[0]; O(*yyval, OP::OP_NEG); ;} break; case 132: #line 740 "compile.y" - { yyval=yyvsp[0] ;} + { yyval=yyvsp[0]; ;} break; case 133: #line 741 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_INV) ;} + { yyval=yyvsp[0]; O(*yyval, OP::OP_INV); ;} break; case 134: #line 742 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_NOT) ;} + { yyval=yyvsp[0]; O(*yyval, OP::OP_NOT); ;} break; case 135: #line 743 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_DEF) ;} + { yyval=yyvsp[0]; O(*yyval, OP::OP_DEF); ;} break; case 136: #line 744 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_IN) ;} + { yyval=yyvsp[0]; O(*yyval, OP::OP_IN); ;} break; case 137: #line 745 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_FEXISTS) ;} + { yyval=yyvsp[0]; O(*yyval, OP::OP_FEXISTS); ;} break; case 138: #line 746 "compile.y" - { yyval=yyvsp[0]; O(*yyval, OP::OP_DEXISTS) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { 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) ;} + { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP::OP_IS); ;} break; case 166: @@ -2374,28 +2374,28 @@ yyreduce: #line 803 "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) ;} + { 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) ;} + { 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) ;} + { 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() ;} + { yyval=N(); ;} break; @@ -3167,7 +3167,7 @@ default: case ']': case '}': case ')': case '"': case '\'': case '<': case '>': // these stand for HTML brackets AND expression binary ops - case '+': case '*': case '/': case '%': + case '+': case '*': case '/': case '\\': case '%': case '&': case '|': case '=': case '!': // common delimiters @@ -3397,12 +3397,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;