--- parser3/src/main/compile.tab.C 2005/11/22 15:56:02 1.108 +++ parser3/src/main/compile.tab.C 2007/10/25 10:52:48 1.115 @@ -131,6 +131,8 @@ Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) + + $Id: compile.tab.C,v 1.115 2007/10/25 10:52:48 misha Exp $ */ /** @@ -211,7 +213,7 @@ typedef int YYSTYPE; /* Line 214 of yacc.c. */ -#line 215 "compile.tab.C" +#line 217 "compile.tab.C" #if ! defined (yyoverflow) || YYERROR_VERBOSE @@ -450,24 +452,24 @@ static const short int yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 126, 126, 133, 135, 135, 136, 138, 138, 140, - 212, 212, 213, 213, 214, 215, 215, 217, 217, 257, - 257, 258, 259, 259, 260, 260, 262, 262, 266, 266, - 268, 268, 269, 269, 270, 270, 270, 274, 281, 282, - 282, 283, 285, 286, 287, 309, 310, 310, 314, 319, - 320, 321, 322, 339, 344, 347, 348, 349, 351, 354, - 351, 362, 370, 377, 378, 379, 381, 387, 388, 388, - 392, 398, 401, 398, 417, 419, 419, 421, 422, 423, - 425, 428, 425, 431, 432, 434, 435, 438, 439, 442, - 443, 445, 449, 464, 469, 470, 471, 476, 476, 478, - 478, 479, 480, 488, 493, 496, 497, 498, 499, 501, - 505, 514, 517, 514, 525, 530, 530, 531, 537, 538, - 540, 552, 564, 566, 567, 568, 569, 570, 571, 572, - 573, 575, 576, 577, 578, 579, 580, 581, 582, 584, - 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, - 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, - 605, 606, 607, 608, 609, 610, 613, 618, 627, 632, - 633, 634, 636 + 0, 128, 128, 135, 137, 137, 138, 140, 140, 142, + 214, 214, 215, 215, 216, 217, 217, 219, 219, 263, + 263, 264, 265, 265, 266, 266, 268, 268, 272, 272, + 274, 274, 275, 275, 276, 276, 276, 280, 287, 288, + 288, 289, 291, 292, 293, 315, 316, 316, 320, 325, + 326, 327, 328, 345, 350, 353, 354, 355, 357, 360, + 357, 368, 376, 383, 384, 385, 387, 393, 394, 394, + 398, 404, 407, 404, 423, 425, 425, 427, 428, 429, + 431, 434, 431, 437, 438, 440, 441, 444, 445, 448, + 449, 451, 455, 470, 475, 476, 477, 482, 482, 484, + 484, 485, 486, 494, 499, 502, 503, 504, 505, 507, + 511, 520, 523, 520, 531, 536, 536, 537, 543, 544, + 546, 558, 570, 572, 573, 574, 575, 576, 577, 578, + 579, 581, 582, 583, 584, 585, 586, 587, 588, 590, + 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, + 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, + 611, 612, 613, 614, 615, 616, 619, 624, 633, 638, + 639, 640, 642 }; #endif @@ -1422,7 +1424,7 @@ yyreduce: switch (yyn) { case 2: -#line 126 "compile.y" +#line 128 "compile.y" { Method& method=*new Method(Method::CT_ANY, 0, 0, /*min, max numbered_params_count*/ @@ -1433,7 +1435,7 @@ yyreduce: break; case 9: -#line 141 "compile.y" +#line 143 "compile.y" { const String& command=*LA2S(*yyvsp[-2]); YYSTYPE strings_code=yyvsp[0]; @@ -1508,15 +1510,15 @@ yyreduce: break; case 13: -#line 213 "compile.y" +#line 215 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 17: -#line 217 "compile.y" +#line 219 "compile.y" { PC.explicit_result=false; - const String& name=*LA2S(*yyvsp[-4]); +// const String& name=*LA2S(*$2); YYSTYPE params_names_code=yyvsp[-3]; ArrayString* params_names=0; @@ -1545,7 +1547,7 @@ yyreduce: 0, 0/*min,max numbered_params_count*/, params_names, locals_names, 0/*to be filled later in next {} */, 0); - PC.cclass->add_method(PC.alias_method(name), *method); + *reinterpret_cast(&yyval)=method; // todo: check [][;result;] @@ -1553,30 +1555,34 @@ yyreduce: break; case 18: -#line 252 "compile.y" +#line 254 "compile.y" { - // fill in the code - reinterpret_cast(yyvsp[-1])->parser_code=yyvsp[0]; + Method& method=*reinterpret_cast(yyvsp[-1]); + // fill in the code + method.parser_code=yyvsp[0]; + // register in class + const String& name=*LA2S(*yyvsp[-6]); + PC.cclass->add_method(PC.alias_method(name), method); ;} break; case 21: -#line 258 "compile.y" +#line 264 "compile.y" {yyval=yyvsp[-1];} break; case 25: -#line 260 "compile.y" +#line 266 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} break; case 31: -#line 268 "compile.y" +#line 274 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 37: -#line 274 "compile.y" +#line 280 "compile.y" { yyval=yyvsp[0]; /* stack: resulting value */ changetail_or_append(*yyval, @@ -1587,17 +1593,17 @@ yyreduce: break; case 38: -#line 281 "compile.y" +#line 287 "compile.y" { yyval=yyvsp[0] ;} break; case 41: -#line 283 "compile.y" +#line 289 "compile.y" { yyval=yyvsp[-1] ;} break; case 44: -#line 287 "compile.y" +#line 293 "compile.y" { yyval=N(); ArrayOperation* diving_code=yyvsp[0]; @@ -1623,17 +1629,17 @@ yyreduce: break; case 45: -#line 309 "compile.y" +#line 315 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 47: -#line 310 "compile.y" +#line 316 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 48: -#line 314 "compile.y" +#line 320 "compile.y" { yyval=yyvsp[-1]; /* stack: context,name */ P(*yyval, *yyvsp[0]); /* stack: context,name,constructor_value */ @@ -1641,7 +1647,7 @@ yyreduce: break; case 52: -#line 322 "compile.y" +#line 328 "compile.y" { yyval=N(); ArrayOperation* diving_code=yyvsp[0]; @@ -1662,7 +1668,7 @@ yyreduce: break; case 53: -#line 339 "compile.y" +#line 345 "compile.y" { yyval=N(); O(*yyval, OP_WITH_WRITE); /* stack: starting context */ @@ -1671,12 +1677,12 @@ yyreduce: break; case 54: -#line 344 "compile.y" +#line 350 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 58: -#line 351 "compile.y" +#line 357 "compile.y" { // allow $result_or_other_variable[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -1684,14 +1690,14 @@ yyreduce: break; case 59: -#line 354 "compile.y" +#line 360 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 60: -#line 356 "compile.y" +#line 362 "compile.y" { // stack: context, name yyval=yyvsp[-2]; // stack: context, name, value @@ -1700,7 +1706,7 @@ yyreduce: break; case 61: -#line 362 "compile.y" +#line 368 "compile.y" { yyval=N(); O(*yyval, OP_PREPARE_TO_EXPRESSION); @@ -1711,7 +1717,7 @@ yyreduce: break; case 62: -#line 370 "compile.y" +#line 376 "compile.y" { // stack: context, name yyval=N(); @@ -1720,7 +1726,7 @@ yyreduce: break; case 66: -#line 381 "compile.y" +#line 387 "compile.y" { yyval=N(); OA(*yyval, OP_OBJECT_POOL, yyvsp[0]); /* stack: empty write context */ @@ -1730,12 +1736,12 @@ yyreduce: break; case 69: -#line 388 "compile.y" +#line 394 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 70: -#line 392 "compile.y" +#line 398 "compile.y" { yyval=yyvsp[0]; /* stack: value */ changetail_or_append(*yyval, @@ -1745,28 +1751,28 @@ yyreduce: break; case 71: -#line 398 "compile.y" +#line 404 "compile.y" { PC.in_call_value=true; ;} break; case 72: -#line 401 "compile.y" +#line 407 "compile.y" { PC.in_call_value=false; ;} break; case 73: -#line 404 "compile.y" +#line 410 "compile.y" { /* ^field.$method{vasya} */ yyval=yyvsp[-3]; /* with_xxx,diving code; stack: context,method_junction */ YYSTYPE params_code=yyvsp[-1]; if(params_code->count()==4) { // probably [] case. [OP_VALUE+origin+Void+STORE_PARAM] if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value? - if(!value->is_defined()) // value is VVoid? + if(value->is_void()) // value is VVoid? params_code=0; // ^zzz[] case. don't append lone empty param. } /* stack: context, method_junction */ @@ -1775,12 +1781,12 @@ yyreduce: break; case 76: -#line 419 "compile.y" +#line 425 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 80: -#line 425 "compile.y" +#line 431 "compile.y" { // allow ^call[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -1788,44 +1794,44 @@ yyreduce: break; case 81: -#line 428 "compile.y" +#line 434 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 82: -#line 430 "compile.y" +#line 436 "compile.y" {yyval=yyvsp[-2];} break; case 83: -#line 431 "compile.y" +#line 437 "compile.y" {yyval=yyvsp[-1];} break; case 84: -#line 432 "compile.y" +#line 438 "compile.y" {yyval=yyvsp[-1];} break; case 86: -#line 435 "compile.y" +#line 441 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} break; case 88: -#line 439 "compile.y" +#line 445 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} break; case 90: -#line 443 "compile.y" +#line 449 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} break; case 91: -#line 445 "compile.y" +#line 451 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_STORE_PARAM); @@ -1833,7 +1839,7 @@ yyreduce: break; case 92: -#line 449 "compile.y" +#line 455 "compile.y" { YYSTYPE expr_code=yyvsp[0]; if(expr_code->count()==3 @@ -1852,7 +1858,7 @@ yyreduce: break; case 93: -#line 464 "compile.y" +#line 470 "compile.y" { yyval=N(); OA(*yyval, OP_CURLY_CODE__STORE_PARAM, yyvsp[0]); @@ -1860,17 +1866,17 @@ yyreduce: break; case 98: -#line 476 "compile.y" +#line 482 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 100: -#line 478 "compile.y" +#line 484 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 102: -#line 480 "compile.y" +#line 486 "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 @@ -1882,7 +1888,7 @@ yyreduce: break; case 103: -#line 488 "compile.y" +#line 494 "compile.y" { /* stack: context */ yyval=yyvsp[0]; /* stack: context,name */ @@ -1891,7 +1897,7 @@ yyreduce: break; case 109: -#line 501 "compile.y" +#line 507 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_GET_ELEMENT); @@ -1899,7 +1905,7 @@ yyreduce: break; case 110: -#line 505 "compile.y" +#line 511 "compile.y" { ArrayOperation* code; { @@ -1912,7 +1918,7 @@ yyreduce: break; case 111: -#line 514 "compile.y" +#line 520 "compile.y" { // allow $result_or_other_variable[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -1920,14 +1926,14 @@ yyreduce: break; case 112: -#line 517 "compile.y" +#line 523 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 113: -#line 519 "compile.y" +#line 525 "compile.y" { yyval=N(); OA(*yyval, OP_OBJECT_POOL, yyvsp[-2]); /* stack: empty write context */ @@ -1937,7 +1943,7 @@ yyreduce: break; case 114: -#line 525 "compile.y" +#line 531 "compile.y" { yyval=N(); O(*yyval, OP_WITH_READ); @@ -1946,12 +1952,12 @@ yyreduce: break; case 116: -#line 530 "compile.y" +#line 536 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 117: -#line 531 "compile.y" +#line 537 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_GET_ELEMENT__WRITE); @@ -1959,7 +1965,7 @@ yyreduce: break; case 120: -#line 540 "compile.y" +#line 546 "compile.y" { yyval=yyvsp[-1]; // stack: class name string if(*LA2S(*yyval) == BASE_NAME) { // pseudo BASE class @@ -1975,7 +1981,7 @@ yyreduce: break; case 121: -#line 552 "compile.y" +#line 558 "compile.y" { yyval=yyvsp[-1]; if(!PC.in_call_value) { @@ -1987,197 +1993,197 @@ yyreduce: break; case 128: -#line 571 "compile.y" +#line 577 "compile.y" { yyval = yyvsp[-1] ;} break; case 129: -#line 572 "compile.y" +#line 578 "compile.y" { yyval = yyvsp[-1] ;} break; case 130: -#line 573 "compile.y" +#line 579 "compile.y" { yyval = yyvsp[-1]; ;} break; case 131: -#line 575 "compile.y" +#line 581 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_NEG) ;} break; case 132: -#line 576 "compile.y" +#line 582 "compile.y" { yyval=yyvsp[0] ;} break; case 133: -#line 577 "compile.y" +#line 583 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_INV) ;} break; case 134: -#line 578 "compile.y" +#line 584 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_NOT) ;} break; case 135: -#line 579 "compile.y" +#line 585 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_DEF) ;} break; case 136: -#line 580 "compile.y" +#line 586 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_IN) ;} break; case 137: -#line 581 "compile.y" +#line 587 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_FEXISTS) ;} break; case 138: -#line 582 "compile.y" +#line 588 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_DEXISTS) ;} break; case 139: -#line 584 "compile.y" +#line 590 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_SUB) ;} break; case 140: -#line 585 "compile.y" +#line 591 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_ADD) ;} break; case 141: -#line 586 "compile.y" +#line 592 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_MUL) ;} break; case 142: -#line 587 "compile.y" +#line 593 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_DIV) ;} break; case 143: -#line 588 "compile.y" +#line 594 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_MOD) ;} break; case 144: -#line 589 "compile.y" +#line 595 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_INTDIV) ;} break; case 145: -#line 590 "compile.y" +#line 596 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_SL) ;} break; case 146: -#line 591 "compile.y" +#line 597 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_SR) ;} break; case 147: -#line 592 "compile.y" +#line 598 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_AND) ;} break; case 148: -#line 593 "compile.y" +#line 599 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_OR) ;} break; case 149: -#line 594 "compile.y" +#line 600 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_XOR) ;} break; case 150: -#line 595 "compile.y" +#line 601 "compile.y" { yyval=yyvsp[-2]; OA(*yyval, OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP_LOG_AND) ;} break; case 151: -#line 596 "compile.y" +#line 602 "compile.y" { yyval=yyvsp[-2]; OA(*yyval, OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP_LOG_OR) ;} break; case 152: -#line 597 "compile.y" +#line 603 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_LOG_XOR) ;} break; case 153: -#line 598 "compile.y" +#line 604 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_LT) ;} break; case 154: -#line 599 "compile.y" +#line 605 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_GT) ;} break; case 155: -#line 600 "compile.y" +#line 606 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_LE) ;} break; case 156: -#line 601 "compile.y" +#line 607 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_GE) ;} break; case 157: -#line 602 "compile.y" +#line 608 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_EQ) ;} break; case 158: -#line 603 "compile.y" +#line 609 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_NE) ;} break; case 159: -#line 604 "compile.y" +#line 610 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_LT) ;} break; case 160: -#line 605 "compile.y" +#line 611 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_GT) ;} break; case 161: -#line 606 "compile.y" +#line 612 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_LE) ;} break; case 162: -#line 607 "compile.y" +#line 613 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_GE) ;} break; case 163: -#line 608 "compile.y" +#line 614 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_EQ) ;} break; case 164: -#line 609 "compile.y" +#line 615 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_NE) ;} break; case 165: -#line 610 "compile.y" +#line 616 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_IS) ;} break; case 166: -#line 613 "compile.y" +#line 619 "compile.y" { // optimized from OP_STRING->OP_VALUE for doubles maybe_change_string_literal_to_double_literal(*(yyval=yyvsp[0])); @@ -2185,7 +2191,7 @@ yyreduce: break; case 167: -#line 618 "compile.y" +#line 624 "compile.y" { yyval=N(); OA(*yyval, OP_STRING_POOL, yyvsp[0]); /* stack: empty write context */ @@ -2195,7 +2201,7 @@ yyreduce: break; case 168: -#line 627 "compile.y" +#line 633 "compile.y" { // optimized from OP_STRING+OP_WRITE_VALUE to OP_STRING__WRITE change_string_literal_to_write_string_literal(*(yyval=yyvsp[0])) @@ -2203,22 +2209,22 @@ yyreduce: break; case 169: -#line 632 "compile.y" +#line 638 "compile.y" { yyval=VL(/*we know that we will not change it*/const_cast(&vvoid), 0, 0, 0) ;} break; case 170: -#line 633 "compile.y" +#line 639 "compile.y" { yyval = VL(/*we know that we will not change it*/const_cast(&vtrue), 0, 0, 0) ;} break; case 171: -#line 634 "compile.y" +#line 640 "compile.y" { yyval = VL(/*we know that we will not change it*/const_cast(&vfalse), 0, 0, 0) ;} break; case 172: -#line 636 "compile.y" +#line 642 "compile.y" { yyval=N() ;} break; @@ -2226,7 +2232,7 @@ yyreduce: } /* Line 1010 of yacc.c. */ -#line 2230 "compile.tab.C" +#line 2236 "compile.tab.C" yyvsp -= yylen; yyssp -= yylen; @@ -2451,7 +2457,7 @@ yyreturn: } -#line 638 "compile.y" +#line 644 "compile.y" #endif @@ -2573,9 +2579,9 @@ default: } // #HH ? if(pc.source[0]=='#' && pc.source[1] && pc.source[2]) { - char c= + char c=(char)( hex_value[(unsigned char)pc.source[1]]*0x10+ - hex_value[(unsigned char)pc.source[2]]; + hex_value[(unsigned char)pc.source[2]]); if(c==0) { result=BAD_HEX_LITERAL; goto break2; // wrong hex value[no ^#00 chars allowed]: bail out @@ -2985,6 +2991,8 @@ default: case '=': case '!': // common delimiters case ',': case '?': case '#': + // mysql column separators + case '`': // before call case '^': pop_LS(pc);