--- parser3/src/main/compile.tab.C 2012/03/16 09:24:12 1.154 +++ parser3/src/main/compile.tab.C 2014/11/13 04:59:03 1.158 @@ -1,10 +1,8 @@ +/* A Bison parser, made by GNU Bison 2.5. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 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 @@ -46,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -67,7 +65,7 @@ /* Copy the first part of user declarations. */ -/* Line 189 of yacc.c */ +/* Line 268 of yacc.c */ #line 1 "compile.y" /** @file @@ -79,7 +77,7 @@ */ -volatile const char * IDENT_COMPILE_Y = "$Id: compile.tab.C,v 1.154 2012/03/16 09:24:12 moko Exp $"; +volatile const char * IDENT_COMPILE_Y = "$Id: compile.tab.C,v 1.158 2014/11/13 04:59:03 misha Exp $"; /** @todo parser4: @@ -120,7 +118,7 @@ volatile const char * IDENT_COMPILE_Y = // forwards -static int real_yyerror(Parse_control* pc, char* s); +static int real_yyerror(Parse_control* pc, const char* s); static void yyprint(FILE* file, int type, YYSTYPE value); static int yylex(YYSTYPE* lvalp, void* pc); @@ -135,9 +133,16 @@ static const VString vempty; #define POOL (*PC.pool) #ifndef DOXYGEN +#define CLASS_ADD if(PC.class_add()){ \ + strncpy(PC.error, PC.cclass->name().cstr(), MAX_STRING/2); \ + strcat(PC.error, " - class is already defined"); \ + YYERROR; \ +} + -/* Line 189 of yacc.c */ -#line 141 "compile.tab.C" + +/* Line 268 of yacc.c */ +#line 146 "compile.tab.C" /* Enabling traces. */ #ifndef YYDEBUG @@ -212,8 +217,8 @@ typedef int YYSTYPE; /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 217 "compile.tab.C" +/* Line 343 of yacc.c */ +#line 222 "compile.tab.C" #ifdef short # undef short @@ -263,7 +268,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -316,11 +321,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -343,24 +348,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -389,23 +394,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -425,6 +414,26 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 51 /* YYLAST -- Last index in YYTABLE. */ @@ -561,24 +570,24 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 133, 133, 140, 142, 142, 143, 145, 145, 147, - 254, 254, 255, 255, 256, 257, 257, 259, 259, 307, - 307, 308, 309, 309, 310, 310, 312, 312, 316, 316, - 318, 318, 319, 319, 320, 320, 320, 324, 365, 366, - 366, 367, 369, 370, 371, 424, 425, 425, 429, 442, - 443, 444, 445, 471, 476, 479, 480, 481, 483, 486, - 483, 494, 502, 509, 510, 511, 513, 519, 520, 520, - 524, 536, 539, 536, 584, 586, 586, 588, 589, 590, - 592, 595, 592, 598, 599, 601, 602, 605, 606, 609, - 610, 612, 615, 629, 634, 635, 636, 641, 641, 643, - 643, 644, 645, 653, 658, 661, 662, 663, 664, 666, - 670, 679, 682, 679, 690, 695, 695, 696, 702, 703, - 705, 718, 730, 732, 733, 734, 735, 736, 737, 738, - 739, 741, 742, 743, 744, 745, 746, 747, 748, 750, - 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, + 0, 140, 140, 147, 149, 149, 150, 152, 152, 154, + 264, 264, 265, 265, 266, 267, 267, 269, 269, 317, + 317, 318, 319, 319, 320, 320, 322, 322, 326, 326, + 328, 328, 329, 329, 330, 330, 330, 334, 375, 376, + 376, 377, 379, 380, 381, 434, 435, 435, 439, 452, + 453, 454, 455, 481, 486, 489, 490, 491, 493, 496, + 493, 504, 512, 519, 520, 521, 523, 529, 530, 530, + 534, 546, 549, 546, 594, 596, 596, 598, 599, 600, + 602, 605, 602, 608, 609, 611, 612, 615, 616, 619, + 620, 622, 625, 639, 644, 645, 646, 651, 651, 653, + 653, 654, 655, 663, 668, 671, 672, 673, 674, 676, + 680, 689, 692, 689, 700, 705, 705, 706, 712, 713, + 715, 728, 740, 742, 743, 744, 745, 746, 747, 748, + 749, 751, 752, 753, 754, 755, 756, 757, 758, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, - 771, 772, 773, 774, 775, 776, 779, 784, 805, 810, - 811, 812, 814 + 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, + 781, 782, 783, 784, 785, 786, 789, 794, 815, 820, + 821, 822, 824 }; #endif @@ -686,8 +695,8 @@ static const yytype_uint8 yyr2[] = 1, 1, 0 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -784,8 +793,7 @@ static const yytype_int16 yypgoto[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -173 static const yytype_int16 yytable[] = { @@ -839,6 +847,12 @@ static const yytype_int16 yytable[] = 191 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-107)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_int16 yycheck[] = { 0, 0, 0, 109, 62, 12, 3, 3, 3, 27, @@ -936,9 +950,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -948,7 +971,6 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -990,19 +1012,10 @@ while (YYID (0)) #endif -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ +/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif @@ -1194,7 +1207,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1297,115 +1309,142 @@ yytnamerr (char *yyres, const char *yyst } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { - int yyn = yypact[yystate]; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + switch (yycount) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1438,6 +1477,7 @@ yydestruct (yymsg, yytype, yyvaluep) } } + /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus @@ -1454,12 +1494,9 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ - - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1646,7 +1683,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1677,8 +1714,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1733,21 +1770,21 @@ yyreduce: { case 2: -/* Line 1455 of yacc.c */ -#line 133 "compile.y" +/* Line 1806 of yacc.c */ +#line 140 "compile.y" { Method* method=new Method(Method::CT_ANY, 0, 0, /*min, max numbered_params_count*/ 0/*param_names*/, 0/*local_names*/, (yyvsp[(1) - (1)])/*parser_code*/, 0/*native_code*/); PC.cclass->set_method(PC.alias_method(main_method_name), method); -;} +} break; case 9: -/* Line 1455 of yacc.c */ -#line 148 "compile.y" +/* Line 1806 of yacc.c */ +#line 155 "compile.y" { const String& command=LA2S(*(yyvsp[(2) - (4)]))->trim(String::TRIM_END); YYSTYPE strings_code=(yyvsp[(4) - (4)]); @@ -1759,17 +1796,20 @@ yyreduce: } if(command==CLASS_NAME) { if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) { + CLASS_ADD; // new class' name const String& name=LA2S(*strings_code)->trim(String::TRIM_END); // creating the class VStateless_class* cclass=new VClass; PC.cclass_new=cclass; PC.cclass_new->set_name(name); + PC.append=false; } else { strcpy(PC.error, "@"CLASS_NAME" must contain only one line with class name (contains more then one)"); YYERROR; } } else if(command==USE_CONTROL_METHOD_NAME) { + CLASS_ADD; for(size_t i=0; icount(); i+=OPERATIONS_PER_OPVALUE) 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) { @@ -1779,7 +1819,7 @@ yyreduce: strcat(PC.error, "'"); YYERROR; } - PC.class_add(); + CLASS_ADD; if(PC.cclass->base_class()) { // already changed from default? strcpy(PC.error, "class already have a base '"); strncat(PC.error, PC.cclass->base_class()->name().cstr(), MAX_STRING/2); @@ -1853,22 +1893,22 @@ yyreduce: "'"CLASS_NAME"', '"USE_CONTROL_METHOD_NAME"', '"BASE_NAME"' and '"OPTIONS_CONTROL_METHOD_NAME"'."); YYERROR; } -;} +} break; case 13: -/* Line 1455 of yacc.c */ -#line 255 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 265 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 17: -/* Line 1455 of yacc.c */ -#line 259 "compile.y" +/* Line 1806 of yacc.c */ +#line 269 "compile.y" { - PC.class_add(); + CLASS_ADD; PC.explicit_result=false; YYSTYPE params_names_code=(yyvsp[(3) - (6)]); @@ -1905,13 +1945,13 @@ yyreduce: 0/*to be filled later in next {} */, 0, all_vars_local); *reinterpret_cast(&(yyval))=method; -;} +} break; case 18: -/* Line 1455 of yacc.c */ -#line 297 "compile.y" +/* Line 1806 of yacc.c */ +#line 307 "compile.y" { Method* method=reinterpret_cast((yyvsp[(7) - (8)])); // fill in the code @@ -1920,34 +1960,34 @@ yyreduce: // register in class const String& name=*LA2S(*(yyvsp[(2) - (8)])); PC.cclass->set_method(PC.alias_method(name), method); -;} +} break; case 21: -/* Line 1455 of yacc.c */ -#line 308 "compile.y" - {(yyval)=(yyvsp[(2) - (3)]);;} +/* Line 1806 of yacc.c */ +#line 318 "compile.y" + {(yyval)=(yyvsp[(2) - (3)]);} break; case 25: -/* Line 1455 of yacc.c */ -#line 310 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); ;} +/* Line 1806 of yacc.c */ +#line 320 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); } break; case 31: -/* Line 1455 of yacc.c */ -#line 318 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 328 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 37: -/* Line 1455 of yacc.c */ -#line 324 "compile.y" +/* Line 1806 of yacc.c */ +#line 334 "compile.y" { (yyval)=N(); YYSTYPE code=(yyvsp[(1) - (1)]); @@ -1988,27 +2028,27 @@ yyreduce: } P(*(yyval), *code); -;} +} break; case 38: -/* Line 1455 of yacc.c */ -#line 365 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); ;} +/* Line 1806 of yacc.c */ +#line 375 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); } break; case 41: -/* Line 1455 of yacc.c */ -#line 367 "compile.y" - { (yyval)=(yyvsp[(2) - (3)]); ;} +/* Line 1806 of yacc.c */ +#line 377 "compile.y" + { (yyval)=(yyvsp[(2) - (3)]); } break; case 44: -/* Line 1455 of yacc.c */ -#line 371 "compile.y" +/* Line 1806 of yacc.c */ +#line 381 "compile.y" { (yyval)=N(); YYSTYPE diving_code=(yyvsp[(1) - (1)]); @@ -2061,27 +2101,27 @@ yyreduce: } #endif /* diving code; stack: current context */ -;} +} break; case 45: -/* Line 1455 of yacc.c */ -#line 424 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 434 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 47: -/* Line 1455 of yacc.c */ -#line 425 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 435 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 48: -/* Line 1455 of yacc.c */ -#line 429 "compile.y" +/* Line 1806 of yacc.c */ +#line 439 "compile.y" { (yyval)=N(); #ifdef OPTIMIZE_BYTECODE_CONSTRUCT @@ -2093,13 +2133,13 @@ yyreduce: P(*(yyval), *(yyvsp[(2) - (3)])); /* stack: context,name */ P(*(yyval), *(yyvsp[(3) - (3)])); /* stack: context,name,constructor_value */ } -;} +} break; case 52: -/* Line 1455 of yacc.c */ -#line 445 "compile.y" +/* Line 1806 of yacc.c */ +#line 455 "compile.y" { (yyval)=N(); YYSTYPE diving_code=(yyvsp[(1) - (1)]); @@ -2125,104 +2165,104 @@ yyreduce: P(*(yyval), *diving_code); } /* diving code; stack: current context */ -;} +} break; case 53: -/* Line 1455 of yacc.c */ -#line 471 "compile.y" +/* Line 1806 of yacc.c */ +#line 481 "compile.y" { (yyval)=N(); O(*(yyval), OP::OP_WITH_WRITE); /* stack: starting context */ P(*(yyval), *(yyvsp[(2) - (2)])); /* diving code; stack: context,name */ -;} +} break; case 54: -/* Line 1455 of yacc.c */ -#line 476 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 486 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 58: -/* Line 1455 of yacc.c */ -#line 483 "compile.y" +/* Line 1806 of yacc.c */ +#line 493 "compile.y" { // allow $result_or_other_variable[ letters here any time ] *reinterpret_cast(&(yyval))=PC.explicit_result; PC.explicit_result=false; -;} +} break; case 59: -/* Line 1455 of yacc.c */ -#line 486 "compile.y" +/* Line 1806 of yacc.c */ +#line 496 "compile.y" { PC.explicit_result=*reinterpret_cast(&(yyvsp[(2) - (3)])); -;} +} break; case 60: -/* Line 1455 of yacc.c */ -#line 488 "compile.y" +/* Line 1806 of yacc.c */ +#line 498 "compile.y" { // stack: context, name (yyval)=(yyvsp[(3) - (5)]); // stack: context, name, value O(*(yyval), OP::OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */ -;} +} break; case 61: -/* Line 1455 of yacc.c */ -#line 494 "compile.y" +/* Line 1806 of yacc.c */ +#line 504 "compile.y" { (yyval)=N(); O(*(yyval), OP::OP_PREPARE_TO_EXPRESSION); // stack: context, name P(*(yyval), *(yyvsp[(2) - (3)])); // stack: context, name, value O(*(yyval), OP::OP_CONSTRUCT_EXPR); /* value=pop->as_expr_result; name=pop; context=pop; construct(context,name,value) */ -;} +} break; case 62: -/* Line 1455 of yacc.c */ -#line 502 "compile.y" +/* Line 1806 of yacc.c */ +#line 512 "compile.y" { // stack: context, name (yyval)=N(); OA(*(yyval), OP::OP_CURLY_CODE__CONSTRUCT, (yyvsp[(2) - (3)])); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */ -;} +} break; case 66: -/* Line 1455 of yacc.c */ -#line 513 "compile.y" +/* Line 1806 of yacc.c */ +#line 523 "compile.y" { (yyval)=N(); OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[(1) - (1)])); /* stack: empty write context */ /* some code that writes to that context */ /* context=pop; stack: context.value() */ -;} +} break; case 69: -/* Line 1455 of yacc.c */ -#line 520 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 530 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 70: -/* Line 1455 of yacc.c */ -#line 524 "compile.y" +/* Line 1806 of yacc.c */ +#line 534 "compile.y" { #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR if((*(yyvsp[(1) - (1)])).count()) @@ -2234,31 +2274,31 @@ yyreduce: OP::OP_CALL, true, /*=>*/ OP::OP_CALL__WRITE, /*or */OP::OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */ } -;} +} break; case 71: -/* Line 1455 of yacc.c */ -#line 536 "compile.y" +/* Line 1806 of yacc.c */ +#line 546 "compile.y" { PC.in_call_value=true; - ;} + } break; case 72: -/* Line 1455 of yacc.c */ -#line 539 "compile.y" +/* Line 1806 of yacc.c */ +#line 549 "compile.y" { PC.in_call_value=false; - ;} + } break; case 73: -/* Line 1455 of yacc.c */ -#line 542 "compile.y" +/* Line 1806 of yacc.c */ +#line 552 "compile.y" { /* ^field.$method{vasya} */ #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT @@ -2299,90 +2339,90 @@ yyreduce: OA(*(yyval), OP::OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value } } -;} +} break; case 76: -/* Line 1455 of yacc.c */ -#line 586 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 596 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 80: -/* Line 1455 of yacc.c */ -#line 592 "compile.y" +/* Line 1806 of yacc.c */ +#line 602 "compile.y" { // allow ^call[ letters here any time ] *reinterpret_cast(&(yyval))=PC.explicit_result; PC.explicit_result=false; -;} +} break; case 81: -/* Line 1455 of yacc.c */ -#line 595 "compile.y" +/* Line 1806 of yacc.c */ +#line 605 "compile.y" { PC.explicit_result=*reinterpret_cast(&(yyvsp[(2) - (3)])); -;} +} break; case 82: -/* Line 1455 of yacc.c */ -#line 597 "compile.y" - {(yyval)=(yyvsp[(3) - (5)]);;} +/* Line 1806 of yacc.c */ +#line 607 "compile.y" + {(yyval)=(yyvsp[(3) - (5)]);} break; case 83: -/* Line 1455 of yacc.c */ -#line 598 "compile.y" - {(yyval)=(yyvsp[(2) - (3)]);;} +/* Line 1806 of yacc.c */ +#line 608 "compile.y" + {(yyval)=(yyvsp[(2) - (3)]);} break; case 84: -/* Line 1455 of yacc.c */ -#line 599 "compile.y" - {(yyval)=(yyvsp[(2) - (3)]);;} +/* Line 1806 of yacc.c */ +#line 609 "compile.y" + {(yyval)=(yyvsp[(2) - (3)]);} break; case 86: -/* Line 1455 of yacc.c */ -#line 602 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); ;} +/* Line 1806 of yacc.c */ +#line 612 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); } break; case 88: -/* Line 1455 of yacc.c */ -#line 606 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); ;} +/* Line 1806 of yacc.c */ +#line 616 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); } break; case 90: -/* Line 1455 of yacc.c */ -#line 610 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); ;} +/* Line 1806 of yacc.c */ +#line 620 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); } break; case 91: -/* Line 1455 of yacc.c */ -#line 612 "compile.y" +/* Line 1806 of yacc.c */ +#line 622 "compile.y" { (yyval)=(yyvsp[(1) - (1)]); -;} +} break; case 92: -/* Line 1455 of yacc.c */ -#line 615 "compile.y" +/* Line 1806 of yacc.c */ +#line 625 "compile.y" { YYSTYPE expr_code=(yyvsp[(1) - (1)]); if(expr_code->count()==3 @@ -2396,37 +2436,37 @@ yyreduce: (yyval)=N(); OA(*(yyval), OP::OP_EXPR_CODE__STORE_PARAM, code); } -;} +} break; case 93: -/* Line 1455 of yacc.c */ -#line 629 "compile.y" +/* Line 1806 of yacc.c */ +#line 639 "compile.y" { (yyval)=N(); OA(*(yyval), OP::OP_CURLY_CODE__STORE_PARAM, (yyvsp[(1) - (1)])); -;} +} break; case 98: -/* Line 1455 of yacc.c */ -#line 641 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 651 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 100: -/* Line 1455 of yacc.c */ -#line 643 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 653 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 102: -/* Line 1455 of yacc.c */ -#line 645 "compile.y" +/* Line 1806 of yacc.c */ +#line 655 "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 @@ -2434,34 +2474,34 @@ yyreduce: /* stack: context */ (yyval)=(yyvsp[(1) - (1)]); /* stack: context,name */ O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */ -;} +} break; case 103: -/* Line 1455 of yacc.c */ -#line 653 "compile.y" +/* Line 1806 of yacc.c */ +#line 663 "compile.y" { /* stack: context */ (yyval)=(yyvsp[(1) - (1)]); /* stack: context,name */ O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */ -;} +} break; case 109: -/* Line 1455 of yacc.c */ -#line 666 "compile.y" +/* Line 1806 of yacc.c */ +#line 676 "compile.y" { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_GET_ELEMENT); -;} +} break; case 110: -/* Line 1455 of yacc.c */ -#line 670 "compile.y" +/* Line 1806 of yacc.c */ +#line 680 "compile.y" { YYSTYPE code; { @@ -2470,72 +2510,72 @@ yyreduce: } (yyval)=N(); OA(*(yyval), OP::OP_STRING_POOL, code); -;} +} break; case 111: -/* Line 1455 of yacc.c */ -#line 679 "compile.y" +/* Line 1806 of yacc.c */ +#line 689 "compile.y" { // allow $result_or_other_variable[ letters here any time ] *reinterpret_cast(&(yyval))=PC.explicit_result; PC.explicit_result=false; -;} +} break; case 112: -/* Line 1455 of yacc.c */ -#line 682 "compile.y" +/* Line 1806 of yacc.c */ +#line 692 "compile.y" { PC.explicit_result=*reinterpret_cast(&(yyvsp[(2) - (3)])); -;} +} break; case 113: -/* Line 1455 of yacc.c */ -#line 684 "compile.y" +/* Line 1806 of yacc.c */ +#line 694 "compile.y" { (yyval)=N(); OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[(3) - (5)])); /* stack: empty write context */ /* some code that writes to that context */ /* context=pop; stack: context.value() */ -;} +} break; case 114: -/* Line 1455 of yacc.c */ -#line 690 "compile.y" +/* Line 1806 of yacc.c */ +#line 700 "compile.y" { (yyval)=N(); O(*(yyval), OP::OP_WITH_READ); P(*(yyval), *(yyvsp[(1) - (1)])); -;} +} break; case 116: -/* Line 1455 of yacc.c */ -#line 695 "compile.y" - { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;} +/* Line 1806 of yacc.c */ +#line 705 "compile.y" + { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); } break; case 117: -/* Line 1455 of yacc.c */ -#line 696 "compile.y" +/* Line 1806 of yacc.c */ +#line 706 "compile.y" { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_GET_ELEMENT__WRITE); -;} +} break; case 120: -/* Line 1455 of yacc.c */ -#line 705 "compile.y" +/* Line 1806 of yacc.c */ +#line 715 "compile.y" { (yyval)=(yyvsp[(1) - (2)]); // stack: class name string if(*LA2S(*(yyval)) == BASE_NAME) { // pseudo BASE class @@ -2548,13 +2588,13 @@ 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); -;} +} break; case 121: -/* Line 1455 of yacc.c */ -#line 718 "compile.y" +/* Line 1806 of yacc.c */ +#line 728 "compile.y" { (yyval)=(yyvsp[(1) - (2)]); if(!PC.in_call_value) { @@ -2562,289 +2602,289 @@ yyreduce: YYERROR; } O(*(yyval), OP::OP_PREPARE_TO_CONSTRUCT_OBJECT); -;} +} break; case 128: -/* Line 1455 of yacc.c */ -#line 737 "compile.y" - { (yyval) = (yyvsp[(2) - (3)]); ;} +/* Line 1806 of yacc.c */ +#line 747 "compile.y" + { (yyval) = (yyvsp[(2) - (3)]); } break; case 129: -/* Line 1455 of yacc.c */ -#line 738 "compile.y" - { (yyval) = (yyvsp[(2) - (3)]); ;} +/* Line 1806 of yacc.c */ +#line 748 "compile.y" + { (yyval) = (yyvsp[(2) - (3)]); } break; case 130: -/* Line 1455 of yacc.c */ -#line 739 "compile.y" - { (yyval) = (yyvsp[(2) - (3)]); ;} +/* Line 1806 of yacc.c */ +#line 749 "compile.y" + { (yyval) = (yyvsp[(2) - (3)]); } break; case 131: -/* Line 1455 of yacc.c */ -#line 741 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_NEG); ;} +/* Line 1806 of yacc.c */ +#line 751 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_NEG); } break; case 132: -/* Line 1455 of yacc.c */ -#line 742 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); ;} +/* Line 1806 of yacc.c */ +#line 752 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); } break; case 133: -/* Line 1455 of yacc.c */ -#line 743 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_INV); ;} +/* Line 1806 of yacc.c */ +#line 753 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_INV); } break; case 134: -/* Line 1455 of yacc.c */ -#line 744 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_NOT); ;} +/* Line 1806 of yacc.c */ +#line 754 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_NOT); } break; case 135: -/* Line 1455 of yacc.c */ -#line 745 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_DEF); ;} +/* Line 1806 of yacc.c */ +#line 755 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_DEF); } break; case 136: -/* Line 1455 of yacc.c */ -#line 746 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_IN); ;} +/* Line 1806 of yacc.c */ +#line 756 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_IN); } break; case 137: -/* Line 1455 of yacc.c */ -#line 747 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_FEXISTS); ;} +/* Line 1806 of yacc.c */ +#line 757 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_FEXISTS); } break; case 138: -/* Line 1455 of yacc.c */ -#line 748 "compile.y" - { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_DEXISTS); ;} +/* Line 1806 of yacc.c */ +#line 758 "compile.y" + { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_DEXISTS); } break; case 139: -/* Line 1455 of yacc.c */ -#line 750 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_SUB); ;} +/* Line 1806 of yacc.c */ +#line 760 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_SUB); } break; case 140: -/* Line 1455 of yacc.c */ -#line 751 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_ADD); ;} +/* Line 1806 of yacc.c */ +#line 761 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_ADD); } break; case 141: -/* Line 1455 of yacc.c */ -#line 752 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_MUL); ;} +/* Line 1806 of yacc.c */ +#line 762 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_MUL); } break; case 142: -/* Line 1455 of yacc.c */ -#line 753 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_DIV); ;} +/* Line 1806 of yacc.c */ +#line 763 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_DIV); } break; case 143: -/* Line 1455 of yacc.c */ -#line 754 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_MOD); ;} +/* Line 1806 of yacc.c */ +#line 764 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_MOD); } break; case 144: -/* Line 1455 of yacc.c */ -#line 755 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_INTDIV); ;} +/* Line 1806 of yacc.c */ +#line 765 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_INTDIV); } break; case 145: -/* Line 1455 of yacc.c */ -#line 756 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_SL); ;} +/* Line 1806 of yacc.c */ +#line 766 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_SL); } break; case 146: -/* Line 1455 of yacc.c */ -#line 757 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_SR); ;} +/* Line 1806 of yacc.c */ +#line 767 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_SR); } break; case 147: -/* Line 1455 of yacc.c */ -#line 758 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_AND); ;} +/* Line 1806 of yacc.c */ +#line 768 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_AND); } break; case 148: -/* Line 1455 of yacc.c */ -#line 759 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_OR); ;} +/* Line 1806 of yacc.c */ +#line 769 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_OR); } break; case 149: -/* Line 1455 of yacc.c */ -#line 760 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_XOR); ;} +/* Line 1806 of yacc.c */ +#line 770 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_XOR); } break; case 150: -/* Line 1455 of yacc.c */ -#line 761 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_AND); ;} +/* Line 1806 of yacc.c */ +#line 771 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_AND); } break; case 151: -/* Line 1455 of yacc.c */ -#line 762 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_OR); ;} +/* Line 1806 of yacc.c */ +#line 772 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_OR); } break; case 152: -/* Line 1455 of yacc.c */ -#line 763 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_XOR); ;} +/* Line 1806 of yacc.c */ +#line 773 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_XOR); } break; case 153: -/* Line 1455 of yacc.c */ -#line 764 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_LT); ;} +/* Line 1806 of yacc.c */ +#line 774 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_LT); } break; case 154: -/* Line 1455 of yacc.c */ -#line 765 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_GT); ;} +/* Line 1806 of yacc.c */ +#line 775 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_GT); } break; case 155: -/* Line 1455 of yacc.c */ -#line 766 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_LE); ;} +/* Line 1806 of yacc.c */ +#line 776 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_LE); } break; case 156: -/* Line 1455 of yacc.c */ -#line 767 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_GE); ;} +/* Line 1806 of yacc.c */ +#line 777 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_GE); } break; case 157: -/* Line 1455 of yacc.c */ -#line 768 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_EQ); ;} +/* Line 1806 of yacc.c */ +#line 778 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_EQ); } break; case 158: -/* Line 1455 of yacc.c */ -#line 769 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_NE); ;} +/* Line 1806 of yacc.c */ +#line 779 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_NE); } break; case 159: -/* Line 1455 of yacc.c */ -#line 770 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_LT); ;} +/* Line 1806 of yacc.c */ +#line 780 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_LT); } break; case 160: -/* Line 1455 of yacc.c */ -#line 771 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_GT); ;} +/* Line 1806 of yacc.c */ +#line 781 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_GT); } break; case 161: -/* Line 1455 of yacc.c */ -#line 772 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_LE); ;} +/* Line 1806 of yacc.c */ +#line 782 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_LE); } break; case 162: -/* Line 1455 of yacc.c */ -#line 773 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_GE); ;} +/* Line 1806 of yacc.c */ +#line 783 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_GE); } break; case 163: -/* Line 1455 of yacc.c */ -#line 774 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_EQ); ;} +/* Line 1806 of yacc.c */ +#line 784 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_EQ); } break; case 164: -/* Line 1455 of yacc.c */ -#line 775 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_NE); ;} +/* Line 1806 of yacc.c */ +#line 785 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_NE); } break; case 165: -/* Line 1455 of yacc.c */ -#line 776 "compile.y" - { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_IS); ;} +/* Line 1806 of yacc.c */ +#line 786 "compile.y" + { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_IS); } break; case 166: -/* Line 1455 of yacc.c */ -#line 779 "compile.y" +/* Line 1806 of yacc.c */ +#line 789 "compile.y" { // optimized OP_STRING => OP_VALUE for doubles maybe_change_string_literal_to_double_literal(*((yyval)=(yyvsp[(1) - (1)]))); -;} +} break; case 167: -/* Line 1455 of yacc.c */ -#line 784 "compile.y" +/* Line 1806 of yacc.c */ +#line 794 "compile.y" { #ifdef OPTIMIZE_BYTECODE_STRING_POOL // it brakes ^if(" 09 "){...} @@ -2862,53 +2902,64 @@ yyreduce: #endif /* some code that writes to that context */ /* context=pop; stack: context.get_string() */ -;} +} break; case 168: -/* Line 1455 of yacc.c */ -#line 805 "compile.y" +/* Line 1806 of yacc.c */ +#line 815 "compile.y" { // optimized OP_STRING+OP_WRITE_VALUE => OP_STRING__WRITE change_string_literal_to_write_string_literal(*((yyval)=(yyvsp[(1) - (1)]))); -;} +} break; case 169: -/* Line 1455 of yacc.c */ -#line 810 "compile.y" - { (yyval)=VL(/*we know that we will not change it*/const_cast(&vempty), 0, 0, 0); ;} +/* Line 1806 of yacc.c */ +#line 820 "compile.y" + { (yyval)=VL(/*we know that we will not change it*/const_cast(&vempty), 0, 0, 0); } break; case 170: -/* Line 1455 of yacc.c */ -#line 811 "compile.y" - { (yyval) = VL(/*we know that we will not change it*/const_cast(&vtrue), 0, 0, 0); ;} +/* Line 1806 of yacc.c */ +#line 821 "compile.y" + { (yyval) = VL(/*we know that we will not change it*/const_cast(&vtrue), 0, 0, 0); } break; case 171: -/* Line 1455 of yacc.c */ -#line 812 "compile.y" - { (yyval) = VL(/*we know that we will not change it*/const_cast(&vfalse), 0, 0, 0); ;} +/* Line 1806 of yacc.c */ +#line 822 "compile.y" + { (yyval) = VL(/*we know that we will not change it*/const_cast(&vfalse), 0, 0, 0); } break; case 172: -/* Line 1455 of yacc.c */ -#line 814 "compile.y" - { (yyval)=N(); ;} +/* Line 1806 of yacc.c */ +#line 824 "compile.y" + { (yyval)=N(); } break; -/* Line 1455 of yacc.c */ -#line 2910 "compile.tab.C" +/* Line 1806 of yacc.c */ +#line 2950 "compile.tab.C" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -2936,6 +2987,10 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -2943,37 +2998,36 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -3032,7 +3086,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -3091,8 +3145,13 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -3117,8 +3176,8 @@ yyreturn: -/* Line 1675 of yacc.c */ -#line 816 "compile.y" +/* Line 2067 of yacc.c */ +#line 826 "compile.y" #endif @@ -3915,7 +3974,7 @@ break2: return result; } -static int real_yyerror(Parse_control *pc, char *s) { // Called by yyparse on error +static int real_yyerror(Parse_control *pc, const char *s) { // Called by yyparse on error strncpy(PC.error, s, MAX_STRING); return 1; }