--- parser3/src/main/compile.tab.C 2005/12/21 13:54:43 1.112 +++ parser3/src/main/compile.tab.C 2007/10/25 10:52:48 1.115 @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875b. */ +/* A Bison parser, made by GNU Bison 1.875d. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ #define YYBISON 1 /* Skeleton name. */ -#define YYSKELETON_NAME "/../../../cygdrive/y/parser3project/win32/tools/yacc.c" +#define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 @@ -132,7 +132,7 @@ Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.tab.C,v 1.112 2005/12/21 13:54:43 paf Exp $ + $Id: compile.tab.C,v 1.115 2007/10/25 10:52:48 misha Exp $ */ /** @@ -217,18 +217,25 @@ typedef int YYSTYPE; #if ! defined (yyoverflow) || YYERROR_VERBOSE +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif + /* The parser invokes alloca or malloc; define the necessary symbols. */ -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# endif # else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif @@ -241,20 +248,20 @@ typedef int YYSTYPE; # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ - || (YYSTYPE_IS_TRIVIAL))) + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; + short int yyss; YYSTYPE yyvs; }; @@ -264,13 +271,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if 1 < __GNUC__ +# if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -306,7 +313,7 @@ union yyalloc #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else - typedef short yysigned_char; + typedef short int yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ @@ -367,7 +374,7 @@ static const unsigned char yytranslate[] #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short yyprhs[] = +static const unsigned short int yyprhs[] = { 0, 0, 3, 5, 7, 9, 12, 14, 16, 18, 23, 25, 27, 29, 32, 35, 37, 39, 40, 49, @@ -390,7 +397,7 @@ static const unsigned short yyprhs[] = }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short yyrhs[] = +static const short int yyrhs[] = { 63, 0, -1, 65, -1, 64, -1, 66, -1, 64, 66, -1, 79, -1, 67, -1, 72, -1, 47, 4, @@ -443,26 +450,26 @@ static const short yyrhs[] = }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short yyrline[] = +static const unsigned short int yyrline[] = { 0, 128, 128, 135, 137, 137, 138, 140, 140, 142, - 214, 214, 215, 215, 216, 217, 217, 219, 219, 259, - 259, 260, 261, 261, 262, 262, 264, 264, 268, 268, - 270, 270, 271, 271, 272, 272, 272, 276, 283, 284, - 284, 285, 287, 288, 289, 311, 312, 312, 316, 321, - 322, 323, 324, 341, 346, 349, 350, 351, 353, 356, - 353, 364, 372, 379, 380, 381, 383, 389, 390, 390, - 394, 400, 403, 400, 419, 421, 421, 423, 424, 425, - 427, 430, 427, 433, 434, 436, 437, 440, 441, 444, - 445, 447, 451, 466, 471, 472, 473, 478, 478, 480, - 480, 481, 482, 490, 495, 498, 499, 500, 501, 503, - 507, 516, 519, 516, 527, 532, 532, 533, 539, 540, - 542, 554, 566, 568, 569, 570, 571, 572, 573, 574, - 575, 577, 578, 579, 580, 581, 582, 583, 584, 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, 611, 612, 615, 620, 629, 634, - 635, 636, 638 + 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 @@ -471,40 +478,40 @@ static const unsigned short yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "EON", "STRING", "BOGUS", - "BAD_STRING_COMPARISON_OPERATOR", "BAD_HEX_LITERAL", - "BAD_METHOD_DECL_START", "BAD_METHOD_PARAMETER_NAME_CHARACTER", - "BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE", "\"&&\"", - "\"||\"", "\"!||\"", "\"!|\"", "\"<=\"", "\">=\"", "\"==\"", "\"!=\"", - "\"<<\"", "\">>\"", "\"lt\"", "\"gt\"", "\"le\"", "\"ge\"", "\"eq\"", - "\"ne\"", "\"def\"", "\"in\"", "\"-f\"", "\"-d\"", "\"is\"", "\"true\"", - "\"false\"", "'<'", "'>'", "'|'", "'&'", "'+'", "'-'", "'*'", "'/'", - "'\\\\'", "'%'", "NUNARY", "'~'", "'!'", "'@'", "'\\n'", "'['", "']'", - "';'", "'$'", "'{'", "'}'", "'.'", "'('", "')'", "'^'", "':'", "'\"'", - "'''", "$accept", "all", "methods", "one_big_piece", "method", - "control_method", "maybe_control_strings", "control_strings", - "control_string", "maybe_string", "code_method", "@1", - "maybe_bracketed_strings", "bracketed_maybe_strings", "maybe_strings", - "strings", "maybe_comment", "maybe_codes", "codes", "code", "action", - "get", "get_value", "get_name_value", "name_in_curly_rdive", - "name_without_curly_rdive", "name_without_curly_rdive_read", - "name_without_curly_rdive_class", "name_without_curly_rdive_code", - "put", "name_expr_wdive", "name_expr_wdive_root", - "name_expr_wdive_write", "name_expr_wdive_class", "construct", - "construct_square", "@2", "@3", "construct_round", "construct_curly", - "any_constructor_code_value", "constructor_code_value", - "constructor_code", "codes__excluding_sole_str_literal", "call", - "call_value", "@4", "@5", "call_name", "store_params", "store_param", - "store_square_param", "@6", "@7", "store_round_param", - "store_curly_param", "store_code_param_parts", "store_expr_param_parts", - "store_curly_param_parts", "store_code_param_part", - "store_expr_param_part", "store_curly_param_part", "code_param_value", - "name_expr_dive_code", "name_path", "name_step", "name_advance1", - "name_advance2", "name_expr_value", "name_expr_subvar_value", - "name_expr_with_subvar_value", "name_square_code_value", "@8", "@9", - "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", + "$end", "error", "$undefined", "EON", "STRING", "BOGUS", + "BAD_STRING_COMPARISON_OPERATOR", "BAD_HEX_LITERAL", + "BAD_METHOD_DECL_START", "BAD_METHOD_PARAMETER_NAME_CHARACTER", + "BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE", "\"&&\"", + "\"||\"", "\"!||\"", "\"!|\"", "\"<=\"", "\">=\"", "\"==\"", "\"!=\"", + "\"<<\"", "\">>\"", "\"lt\"", "\"gt\"", "\"le\"", "\"ge\"", "\"eq\"", + "\"ne\"", "\"def\"", "\"in\"", "\"-f\"", "\"-d\"", "\"is\"", "\"true\"", + "\"false\"", "'<'", "'>'", "'|'", "'&'", "'+'", "'-'", "'*'", "'/'", + "'\\\\'", "'%'", "NUNARY", "'~'", "'!'", "'@'", "'\\n'", "'['", "']'", + "';'", "'$'", "'{'", "'}'", "'.'", "'('", "')'", "'^'", "':'", "'\"'", + "'''", "$accept", "all", "methods", "one_big_piece", "method", + "control_method", "maybe_control_strings", "control_strings", + "control_string", "maybe_string", "code_method", "@1", + "maybe_bracketed_strings", "bracketed_maybe_strings", "maybe_strings", + "strings", "maybe_comment", "maybe_codes", "codes", "code", "action", + "get", "get_value", "get_name_value", "name_in_curly_rdive", + "name_without_curly_rdive", "name_without_curly_rdive_read", + "name_without_curly_rdive_class", "name_without_curly_rdive_code", "put", + "name_expr_wdive", "name_expr_wdive_root", "name_expr_wdive_write", + "name_expr_wdive_class", "construct", "construct_square", "@2", "@3", + "construct_round", "construct_curly", "any_constructor_code_value", + "constructor_code_value", "constructor_code", + "codes__excluding_sole_str_literal", "call", "call_value", "@4", "@5", + "call_name", "store_params", "store_param", "store_square_param", "@6", + "@7", "store_round_param", "store_curly_param", "store_code_param_parts", + "store_expr_param_parts", "store_curly_param_parts", + "store_code_param_part", "store_expr_param_part", + "store_curly_param_part", "code_param_value", "name_expr_dive_code", + "name_path", "name_step", "name_advance1", "name_advance2", + "name_expr_value", "name_expr_subvar_value", + "name_expr_with_subvar_value", "name_square_code_value", "@8", "@9", + "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 }; #endif @@ -512,7 +519,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -605,7 +612,7 @@ static const unsigned char yydefact[] = }; /* YYDEFGOTO[NTERM-NUM]. */ -static const short yydefgoto[] = +static const short int yydefgoto[] = { -1, 5, 6, 7, 8, 9, 92, 93, 94, 95, 10, 244, 101, 56, 98, 99, 140, 161, 12, 13, @@ -621,7 +628,7 @@ static const short yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -107 -static const short yypact[] = +static const short int yypact[] = { 14, -107, 13, 45, -107, 28, -15, -107, -107, -107, -107, -107, 21, -107, -107, -107, -107, -107, -107, -107, @@ -653,7 +660,7 @@ static const short yypact[] = }; /* YYPGOTO[NTERM-NUM]. */ -static const short yypgoto[] = +static const short int yypgoto[] = { -107, -107, -107, -107, 206, -107, -107, -107, 124, -107, -107, -107, -107, 170, -107, -107, -107, 1, -58, -7, @@ -671,7 +678,7 @@ static const short yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -173 -static const short yytable[] = +static const short int yytable[] = { 16, 11, 19, 145, 106, 53, 43, 39, -103, 70, 23, 111, 16, 91, 19, 74, 83, 22, 1, 75, @@ -723,7 +730,7 @@ static const short yytable[] = 191 }; -static const short yycheck[] = +static const short int yycheck[] = { 0, 0, 0, 109, 62, 12, 3, 3, 3, 27, 4, 4, 12, 4, 12, 49, 39, 4, 4, 53, @@ -831,7 +838,7 @@ static const unsigned char yystos[] = #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 +#define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily @@ -866,11 +873,11 @@ while (0) are run). */ #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.first_line = Rhs[1].first_line; \ - Current.first_column = Rhs[1].first_column; \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + ((Current).first_line = (Rhs)[1].first_line, \ + (Current).first_column = (Rhs)[1].first_column, \ + (Current).last_line = (Rhs)[N].last_line, \ + (Current).last_column = (Rhs)[N].last_column) #endif /* YYLEX -- calling `yylex' with the right arguments. */ @@ -914,17 +921,17 @@ do { \ /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (cinluded). | +| TOP (included). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) - short *bottom; - short *top; + short int *bottom; + short int *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -993,7 +1000,7 @@ int yydebug; SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if YYMAXDEPTH == 0 +#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif @@ -1191,9 +1198,9 @@ int yynerrs; to reallocate them elsewhere. */ /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + register short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; @@ -1230,6 +1237,7 @@ int yynerrs; yyssp = yyss; yyvsp = yyvs; + goto yysetstate; /*------------------------------------------------------------. @@ -1255,7 +1263,7 @@ int yynerrs; these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + short int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the @@ -1283,7 +1291,7 @@ int yynerrs; yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) @@ -1510,7 +1518,7 @@ yyreduce: #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; @@ -1539,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;] @@ -1549,28 +1557,32 @@ yyreduce: case 18: #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 260 "compile.y" +#line 264 "compile.y" {yyval=yyvsp[-1];} break; case 25: -#line 262 "compile.y" +#line 266 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} break; case 31: -#line 270 "compile.y" +#line 274 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 37: -#line 276 "compile.y" +#line 280 "compile.y" { yyval=yyvsp[0]; /* stack: resulting value */ changetail_or_append(*yyval, @@ -1581,17 +1593,17 @@ yyreduce: break; case 38: -#line 283 "compile.y" +#line 287 "compile.y" { yyval=yyvsp[0] ;} break; case 41: -#line 285 "compile.y" +#line 289 "compile.y" { yyval=yyvsp[-1] ;} break; case 44: -#line 289 "compile.y" +#line 293 "compile.y" { yyval=N(); ArrayOperation* diving_code=yyvsp[0]; @@ -1617,17 +1629,17 @@ yyreduce: break; case 45: -#line 311 "compile.y" +#line 315 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 47: -#line 312 "compile.y" +#line 316 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 48: -#line 316 "compile.y" +#line 320 "compile.y" { yyval=yyvsp[-1]; /* stack: context,name */ P(*yyval, *yyvsp[0]); /* stack: context,name,constructor_value */ @@ -1635,7 +1647,7 @@ yyreduce: break; case 52: -#line 324 "compile.y" +#line 328 "compile.y" { yyval=N(); ArrayOperation* diving_code=yyvsp[0]; @@ -1656,7 +1668,7 @@ yyreduce: break; case 53: -#line 341 "compile.y" +#line 345 "compile.y" { yyval=N(); O(*yyval, OP_WITH_WRITE); /* stack: starting context */ @@ -1665,12 +1677,12 @@ yyreduce: break; case 54: -#line 346 "compile.y" +#line 350 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 58: -#line 353 "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; @@ -1678,14 +1690,14 @@ yyreduce: break; case 59: -#line 356 "compile.y" +#line 360 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 60: -#line 358 "compile.y" +#line 362 "compile.y" { // stack: context, name yyval=yyvsp[-2]; // stack: context, name, value @@ -1694,7 +1706,7 @@ yyreduce: break; case 61: -#line 364 "compile.y" +#line 368 "compile.y" { yyval=N(); O(*yyval, OP_PREPARE_TO_EXPRESSION); @@ -1705,7 +1717,7 @@ yyreduce: break; case 62: -#line 372 "compile.y" +#line 376 "compile.y" { // stack: context, name yyval=N(); @@ -1714,7 +1726,7 @@ yyreduce: break; case 66: -#line 383 "compile.y" +#line 387 "compile.y" { yyval=N(); OA(*yyval, OP_OBJECT_POOL, yyvsp[0]); /* stack: empty write context */ @@ -1724,12 +1736,12 @@ yyreduce: break; case 69: -#line 390 "compile.y" +#line 394 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 70: -#line 394 "compile.y" +#line 398 "compile.y" { yyval=yyvsp[0]; /* stack: value */ changetail_or_append(*yyval, @@ -1739,21 +1751,21 @@ yyreduce: break; case 71: -#line 400 "compile.y" +#line 404 "compile.y" { PC.in_call_value=true; ;} break; case 72: -#line 403 "compile.y" +#line 407 "compile.y" { PC.in_call_value=false; ;} break; case 73: -#line 406 "compile.y" +#line 410 "compile.y" { /* ^field.$method{vasya} */ yyval=yyvsp[-3]; /* with_xxx,diving code; stack: context,method_junction */ @@ -1769,12 +1781,12 @@ yyreduce: break; case 76: -#line 421 "compile.y" +#line 425 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 80: -#line 427 "compile.y" +#line 431 "compile.y" { // allow ^call[ letters here any time ] *reinterpret_cast(&yyval)=PC.explicit_result; PC.explicit_result=false; @@ -1782,44 +1794,44 @@ yyreduce: break; case 81: -#line 430 "compile.y" +#line 434 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 82: -#line 432 "compile.y" +#line 436 "compile.y" {yyval=yyvsp[-2];} break; case 83: -#line 433 "compile.y" +#line 437 "compile.y" {yyval=yyvsp[-1];} break; case 84: -#line 434 "compile.y" +#line 438 "compile.y" {yyval=yyvsp[-1];} break; case 86: -#line 437 "compile.y" +#line 441 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} break; case 88: -#line 441 "compile.y" +#line 445 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} break; case 90: -#line 445 "compile.y" +#line 449 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;} break; case 91: -#line 447 "compile.y" +#line 451 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_STORE_PARAM); @@ -1827,7 +1839,7 @@ yyreduce: break; case 92: -#line 451 "compile.y" +#line 455 "compile.y" { YYSTYPE expr_code=yyvsp[0]; if(expr_code->count()==3 @@ -1846,7 +1858,7 @@ yyreduce: break; case 93: -#line 466 "compile.y" +#line 470 "compile.y" { yyval=N(); OA(*yyval, OP_CURLY_CODE__STORE_PARAM, yyvsp[0]); @@ -1854,17 +1866,17 @@ yyreduce: break; case 98: -#line 478 "compile.y" +#line 482 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 100: -#line 480 "compile.y" +#line 484 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 102: -#line 482 "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 @@ -1876,7 +1888,7 @@ yyreduce: break; case 103: -#line 490 "compile.y" +#line 494 "compile.y" { /* stack: context */ yyval=yyvsp[0]; /* stack: context,name */ @@ -1885,7 +1897,7 @@ yyreduce: break; case 109: -#line 503 "compile.y" +#line 507 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_GET_ELEMENT); @@ -1893,7 +1905,7 @@ yyreduce: break; case 110: -#line 507 "compile.y" +#line 511 "compile.y" { ArrayOperation* code; { @@ -1906,7 +1918,7 @@ yyreduce: break; case 111: -#line 516 "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; @@ -1914,14 +1926,14 @@ yyreduce: break; case 112: -#line 519 "compile.y" +#line 523 "compile.y" { PC.explicit_result=*reinterpret_cast(&yyvsp[-1]); ;} break; case 113: -#line 521 "compile.y" +#line 525 "compile.y" { yyval=N(); OA(*yyval, OP_OBJECT_POOL, yyvsp[-2]); /* stack: empty write context */ @@ -1931,7 +1943,7 @@ yyreduce: break; case 114: -#line 527 "compile.y" +#line 531 "compile.y" { yyval=N(); O(*yyval, OP_WITH_READ); @@ -1940,12 +1952,12 @@ yyreduce: break; case 116: -#line 532 "compile.y" +#line 536 "compile.y" { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;} break; case 117: -#line 533 "compile.y" +#line 537 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_GET_ELEMENT__WRITE); @@ -1953,7 +1965,7 @@ yyreduce: break; case 120: -#line 542 "compile.y" +#line 546 "compile.y" { yyval=yyvsp[-1]; // stack: class name string if(*LA2S(*yyval) == BASE_NAME) { // pseudo BASE class @@ -1969,7 +1981,7 @@ yyreduce: break; case 121: -#line 554 "compile.y" +#line 558 "compile.y" { yyval=yyvsp[-1]; if(!PC.in_call_value) { @@ -1981,197 +1993,197 @@ yyreduce: break; case 128: -#line 573 "compile.y" +#line 577 "compile.y" { yyval = yyvsp[-1] ;} break; case 129: -#line 574 "compile.y" +#line 578 "compile.y" { yyval = yyvsp[-1] ;} break; case 130: -#line 575 "compile.y" +#line 579 "compile.y" { yyval = yyvsp[-1]; ;} break; case 131: -#line 577 "compile.y" +#line 581 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_NEG) ;} break; case 132: -#line 578 "compile.y" +#line 582 "compile.y" { yyval=yyvsp[0] ;} break; case 133: -#line 579 "compile.y" +#line 583 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_INV) ;} break; case 134: -#line 580 "compile.y" +#line 584 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_NOT) ;} break; case 135: -#line 581 "compile.y" +#line 585 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_DEF) ;} break; case 136: -#line 582 "compile.y" +#line 586 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_IN) ;} break; case 137: -#line 583 "compile.y" +#line 587 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_FEXISTS) ;} break; case 138: -#line 584 "compile.y" +#line 588 "compile.y" { yyval=yyvsp[0]; O(*yyval, OP_DEXISTS) ;} break; case 139: -#line 586 "compile.y" +#line 590 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_SUB) ;} break; case 140: -#line 587 "compile.y" +#line 591 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_ADD) ;} break; case 141: -#line 588 "compile.y" +#line 592 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_MUL) ;} break; case 142: -#line 589 "compile.y" +#line 593 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_DIV) ;} break; case 143: -#line 590 "compile.y" +#line 594 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_MOD) ;} break; case 144: -#line 591 "compile.y" +#line 595 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_INTDIV) ;} break; case 145: -#line 592 "compile.y" +#line 596 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_SL) ;} break; case 146: -#line 593 "compile.y" +#line 597 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_SR) ;} break; case 147: -#line 594 "compile.y" +#line 598 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_AND) ;} break; case 148: -#line 595 "compile.y" +#line 599 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_OR) ;} break; case 149: -#line 596 "compile.y" +#line 600 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_XOR) ;} break; case 150: -#line 597 "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 598 "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 599 "compile.y" +#line 603 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_LOG_XOR) ;} break; case 153: -#line 600 "compile.y" +#line 604 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_LT) ;} break; case 154: -#line 601 "compile.y" +#line 605 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_GT) ;} break; case 155: -#line 602 "compile.y" +#line 606 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_LE) ;} break; case 156: -#line 603 "compile.y" +#line 607 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_GE) ;} break; case 157: -#line 604 "compile.y" +#line 608 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_EQ) ;} break; case 158: -#line 605 "compile.y" +#line 609 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_NE) ;} break; case 159: -#line 606 "compile.y" +#line 610 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_LT) ;} break; case 160: -#line 607 "compile.y" +#line 611 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_GT) ;} break; case 161: -#line 608 "compile.y" +#line 612 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_LE) ;} break; case 162: -#line 609 "compile.y" +#line 613 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_GE) ;} break; case 163: -#line 610 "compile.y" +#line 614 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_EQ) ;} break; case 164: -#line 611 "compile.y" +#line 615 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_NE) ;} break; case 165: -#line 612 "compile.y" +#line 616 "compile.y" { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_IS) ;} break; case 166: -#line 615 "compile.y" +#line 619 "compile.y" { // optimized from OP_STRING->OP_VALUE for doubles maybe_change_string_literal_to_double_literal(*(yyval=yyvsp[0])); @@ -2179,7 +2191,7 @@ yyreduce: break; case 167: -#line 620 "compile.y" +#line 624 "compile.y" { yyval=N(); OA(*yyval, OP_STRING_POOL, yyvsp[0]); /* stack: empty write context */ @@ -2189,7 +2201,7 @@ yyreduce: break; case 168: -#line 629 "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])) @@ -2197,30 +2209,30 @@ yyreduce: break; case 169: -#line 634 "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 635 "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 636 "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 638 "compile.y" +#line 642 "compile.y" { yyval=N() ;} break; } -/* Line 999 of yacc.c. */ -#line 2224 "compile.tab.C" +/* Line 1010 of yacc.c. */ +#line 2236 "compile.tab.C" yyvsp -= yylen; yyssp -= yylen; @@ -2323,25 +2335,27 @@ yyerrlab: /* If just tried and failed to reuse lookahead token after an error, discard it. */ - /* Return failure if at end of input. */ - if (yychar == YYEOF) + if (yychar <= YYEOF) { - /* Pop the error token. */ - YYPOPSTACK; - /* Pop the rest of the stack. */ - while (yyss < yyssp) - { - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - YYPOPSTACK; - } - YYABORT; + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + } } + else + { + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); - yychar = YYEMPTY; - + } } /* Else will try to reuse lookahead token after shifting the error @@ -2349,9 +2363,27 @@ yyerrlab: goto yyerrlab1; -/*----------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action. | -`----------------------------------------------------*/ +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; +#endif + + yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ @@ -2375,9 +2407,8 @@ yyerrlab1: YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[yystate], yyvsp); - yyvsp--; - yystate = *--yyssp; - + YYPOPSTACK; + yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } @@ -2426,7 +2457,7 @@ yyreturn: } -#line 640 "compile.y" +#line 644 "compile.y" #endif @@ -2960,6 +2991,8 @@ default: case '=': case '!': // common delimiters case ',': case '?': case '#': + // mysql column separators + case '`': // before call case '^': pop_LS(pc);