Reactos

[JSCRIPT] Sync with Wine Staging 4.18. CORE-16441

+1858 -1409
-2
dll/win32/jscript/activex.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "config.h" 20 - #include "wine/port.h" 21 19 22 20 #include "jscript.h" 23 21 #include "objsafe.h"
+84 -13
dll/win32/jscript/array.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "config.h" 20 - #include "wine/port.h" 19 + #ifdef __REACTOS__ 20 + #include <wine/config.h> 21 + #include <wine/port.h> 22 + #endif 21 23 22 24 #include <math.h> 23 25 #include <assert.h> ··· 49 51 static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0}; 50 52 static const WCHAR unshiftW[] = {'u','n','s','h','i','f','t',0}; 51 53 static const WCHAR indexOfW[] = {'i','n','d','e','x','O','f',0}; 54 + static const WCHAR mapW[] = {'m','a','p',0}; 52 55 53 56 static const WCHAR default_separatorW[] = {',',0}; 54 57 ··· 355 358 356 359 jsstr_release(sep_str); 357 360 }else { 358 - hres = array_join(ctx, jsthis, length, default_separatorW, strlenW(default_separatorW), r); 361 + hres = array_join(ctx, jsthis, length, default_separatorW, lstrlenW(default_separatorW), r); 359 362 } 360 363 361 364 return hres; ··· 941 944 return throw_type_error(ctx, JS_E_ARRAY_EXPECTED, NULL); 942 945 943 946 return array_join(ctx, &array->dispex, array->length, default_separatorW, 944 - strlenW(default_separatorW), r); 947 + lstrlenW(default_separatorW), r); 945 948 } 946 949 947 950 static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, ··· 961 964 962 965 TRACE("\n"); 963 966 964 - /* FIXME: Check IsCallable */ 965 - if(argc != 1 || !is_object_instance(argv[0])) { 966 - FIXME("Unsupported arguments\n"); 967 - return E_NOTIMPL; 968 - } 969 - 970 967 hres = get_length(ctx, vthis, &jsthis, &length); 971 968 if(FAILED(hres)) 972 969 return hres; 970 + 971 + /* Fixme check IsCallable */ 972 + if(!argc || !is_object_instance(argv[0]) || !get_object(argv[0])) { 973 + FIXME("Invalid arg %s\n", debugstr_jsval(argc ? argv[0] : jsval_undefined())); 974 + return E_INVALIDARG; 975 + } 976 + 977 + if(argc > 1 && !is_undefined(argv[1])) { 978 + FIXME("Unsupported context this %s\n", debugstr_jsval(argv[1])); 979 + return E_NOTIMPL; 980 + } 973 981 974 982 for(i = 0; i < length; i++) { 975 983 hres = jsdisp_get_idx(jsthis, i, &value); ··· 1047 1055 return S_OK; 1048 1056 } 1049 1057 1058 + static HRESULT Array_map(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) 1059 + { 1060 + IDispatch *context_this = NULL, *callback; 1061 + jsval_t callback_args[3], mapped_value; 1062 + jsdisp_t *jsthis, *array; 1063 + DWORD length, k; 1064 + HRESULT hres; 1065 + 1066 + TRACE("\n"); 1067 + 1068 + hres = get_length(ctx, vthis, &jsthis, &length); 1069 + if(FAILED(hres)) { 1070 + FIXME("Could not get length\n"); 1071 + return hres; 1072 + } 1073 + 1074 + /* Fixme check IsCallable */ 1075 + if(!argc || !is_object_instance(argv[0]) || !get_object(argv[0])) { 1076 + FIXME("Invalid arg %s\n", debugstr_jsval(argc ? argv[0] : jsval_undefined())); 1077 + return E_INVALIDARG; 1078 + } 1079 + callback = get_object(argv[0]); 1080 + 1081 + if(argc > 1) { 1082 + if(is_object_instance(argv[1]) && get_object(argv[1])) { 1083 + context_this = get_object(argv[1]); 1084 + }else if(!is_undefined(argv[1])) { 1085 + FIXME("Unsupported context this %s\n", debugstr_jsval(argv[1])); 1086 + return E_NOTIMPL; 1087 + } 1088 + } 1089 + 1090 + hres = create_array(ctx, length, &array); 1091 + if(FAILED(hres)) 1092 + return hres; 1093 + 1094 + for(k = 0; k < length; k++) { 1095 + hres = jsdisp_get_idx(jsthis, k, &callback_args[0]); 1096 + if(hres == DISP_E_UNKNOWNNAME) 1097 + continue; 1098 + if(FAILED(hres)) 1099 + break; 1100 + 1101 + callback_args[1] = jsval_number(k); 1102 + callback_args[2] = jsval_obj(jsthis); 1103 + hres = disp_call_value(ctx, callback, context_this, DISPATCH_METHOD, 3, callback_args, &mapped_value); 1104 + jsval_release(callback_args[0]); 1105 + if(FAILED(hres)) 1106 + break; 1107 + 1108 + hres = jsdisp_propput_idx(array, k, mapped_value); 1109 + if(FAILED(hres)) 1110 + break; 1111 + } 1112 + 1113 + if(SUCCEEDED(hres) && r) 1114 + *r = jsval_obj(array); 1115 + else 1116 + jsdisp_release(array); 1117 + return hres; 1118 + } 1119 + 1050 1120 /* ECMA-262 3rd Edition 15.4.4.13 */ 1051 1121 static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, 1052 1122 jsval_t *r) ··· 1114 1184 TRACE("\n"); 1115 1185 1116 1186 return array_join(ctx, &array->dispex, array->length, default_separatorW, 1117 - strlenW(default_separatorW), r); 1187 + lstrlenW(default_separatorW), r); 1118 1188 } 1119 1189 1120 1190 static void Array_destructor(jsdisp_t *dispex) ··· 1128 1198 const WCHAR *ptr = name; 1129 1199 DWORD id = 0; 1130 1200 1131 - if(!isdigitW(*ptr)) 1201 + if(!iswdigit(*ptr)) 1132 1202 return; 1133 1203 1134 - while(*ptr && isdigitW(*ptr)) { 1204 + while(*ptr && iswdigit(*ptr)) { 1135 1205 id = id*10 + (*ptr-'0'); 1136 1206 ptr++; 1137 1207 } ··· 1149 1219 {indexOfW, Array_indexOf, PROPF_METHOD|PROPF_ES5|1}, 1150 1220 {joinW, Array_join, PROPF_METHOD|1}, 1151 1221 {lengthW, NULL,0, Array_get_length, Array_set_length}, 1222 + {mapW, Array_map, PROPF_METHOD|PROPF_ES5|1}, 1152 1223 {popW, Array_pop, PROPF_METHOD}, 1153 1224 {pushW, Array_push, PROPF_METHOD|1}, 1154 1225 {reverseW, Array_reverse, PROPF_METHOD},
+220 -186
dll/win32/jscript/cc_parser.tab.c
··· 1 - /* A Bison parser, made by GNU Bison 3.0. */ 1 + /* A Bison parser, made by GNU Bison 3.4.1. */ 2 2 3 3 /* Bison implementation for Yacc-like parsers in C 4 4 5 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 5 + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, 6 + Inc. 6 7 7 8 This program is free software: you can redistribute it and/or modify 8 9 it under the terms of the GNU General Public License as published by ··· 40 41 define necessary library symbols; they are noted "INFRINGES ON 41 42 USER NAME SPACE" below. */ 42 43 44 + /* Undocumented macros, especially those whose name start with YY_, 45 + are private implementation details. Do not rely on them. */ 46 + 43 47 /* Identify Bison output. */ 44 48 #define YYBISON 1 45 49 46 50 /* Bison version. */ 47 - #define YYBISON_VERSION "3.0" 51 + #define YYBISON_VERSION "3.4.1" 48 52 49 53 /* Skeleton name. */ 50 54 #define YYSKELETON_NAME "yacc.c" ··· 67 71 #define yynerrs cc_parser_nerrs 68 72 69 73 70 - /* Copy the first part of user declarations. */ 71 - #line 19 "cc_parser.y" /* yacc.c:339 */ 74 + /* First part of user prologue. */ 75 + #line 19 "cc_parser.y" 72 76 73 77 74 78 #include "jscript.h" ··· 80 84 WINE_DEFAULT_DEBUG_CHANNEL(jscript); 81 85 82 86 83 - #line 84 "cc_parser.tab.c" /* yacc.c:339 */ 87 + #line 88 "cc_parser.tab.c" 84 88 85 - # ifndef YY_NULL 86 - # if defined __cplusplus && 201103L <= __cplusplus 87 - # define YY_NULL nullptr 89 + # ifndef YY_NULLPTR 90 + # if defined __cplusplus 91 + # if 201103L <= __cplusplus 92 + # define YY_NULLPTR nullptr 93 + # else 94 + # define YY_NULLPTR 0 95 + # endif 88 96 # else 89 - # define YY_NULL 0 97 + # define YY_NULLPTR ((void*)0) 90 98 # endif 91 99 # endif 92 100 ··· 98 106 # define YYERROR_VERBOSE 0 99 107 #endif 100 108 101 - /* In a future release of Bison, this section will be replaced 102 - by #include "cc_parser.tab.h". */ 109 + /* Use api.header.include to #include this header 110 + instead of duplicating it here. */ 103 111 #ifndef YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED 104 112 # define YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED 105 113 /* Debug traces. */ ··· 132 140 133 141 /* Value type. */ 134 142 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 135 - typedef union YYSTYPE YYSTYPE; 136 143 union YYSTYPE 137 144 { 138 - #line 36 "cc_parser.y" /* yacc.c:355 */ 145 + #line 36 "cc_parser.y" 139 146 140 147 ccval_t ccval; 141 148 142 - #line 143 "cc_parser.tab.c" /* yacc.c:355 */ 149 + #line 150 "cc_parser.tab.c" 150 + 143 151 }; 152 + typedef union YYSTYPE YYSTYPE; 144 153 # define YYSTYPE_IS_TRIVIAL 1 145 154 # define YYSTYPE_IS_DECLARED 1 146 155 #endif ··· 151 160 152 161 #endif /* !YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED */ 153 162 154 - /* Copy the second part of user declarations. */ 155 - #line 47 "cc_parser.y" /* yacc.c:358 */ 163 + /* Second part of user prologue. */ 164 + #line 47 "cc_parser.y" 156 165 157 166 158 167 static int cc_parser_error(parser_ctx_t *ctx, const char *str) ··· 246 255 } 247 256 248 257 249 - #line 250 "cc_parser.tab.c" /* yacc.c:358 */ 258 + #line 259 "cc_parser.tab.c" 259 + 250 260 251 261 #ifdef short 252 262 # undef short ··· 267 277 #ifdef YYTYPE_UINT16 268 278 typedef YYTYPE_UINT16 yytype_uint16; 269 279 #else 270 - typedef unsigned short int yytype_uint16; 280 + typedef unsigned short yytype_uint16; 271 281 #endif 272 282 273 283 #ifdef YYTYPE_INT16 274 284 typedef YYTYPE_INT16 yytype_int16; 275 285 #else 276 - typedef short int yytype_int16; 286 + typedef short yytype_int16; 277 287 #endif 278 288 279 289 #ifndef YYSIZE_T ··· 285 295 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 286 296 # define YYSIZE_T size_t 287 297 # else 288 - # define YYSIZE_T unsigned int 298 + # define YYSIZE_T unsigned 289 299 # endif 290 300 #endif 291 301 ··· 303 313 # endif 304 314 #endif 305 315 306 - #ifndef __attribute__ 307 - /* This feature is available in gcc versions 2.5 and later. */ 308 - # if (! defined __GNUC__ || __GNUC__ < 2 \ 309 - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) 310 - # define __attribute__(Spec) /* empty */ 316 + #ifndef YY_ATTRIBUTE 317 + # if (defined __GNUC__ \ 318 + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 319 + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 320 + # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 321 + # else 322 + # define YY_ATTRIBUTE(Spec) /* empty */ 311 323 # endif 312 324 #endif 313 325 326 + #ifndef YY_ATTRIBUTE_PURE 327 + # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 328 + #endif 329 + 330 + #ifndef YY_ATTRIBUTE_UNUSED 331 + # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 332 + #endif 333 + 314 334 /* Suppress unused-variable warnings by "using" E. */ 315 335 #if ! defined lint || defined __GNUC__ 316 336 # define YYUSE(E) ((void) (E)) ··· 318 338 # define YYUSE(E) /* empty */ 319 339 #endif 320 340 321 - #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 341 + #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 322 342 /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 323 343 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 324 344 _Pragma ("GCC diagnostic push") \ ··· 337 357 # define YY_INITIAL_VALUE(Value) /* Nothing. */ 338 358 #endif 339 359 360 + 361 + #define YY_ASSERT(E) ((void) (0 && (E))) 340 362 341 363 #if ! defined yyoverflow || YYERROR_VERBOSE 342 364 ··· 480 502 /* YYNSTATES -- Number of states. */ 481 503 #define YYNSTATES 69 482 504 483 - /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned 484 - by yylex, with out-of-bounds checking. */ 485 505 #define YYUNDEFTOK 2 486 506 #define YYMAXUTOK 269 487 507 508 + /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM 509 + as returned by yylex, with out-of-bounds checking. */ 488 510 #define YYTRANSLATE(YYX) \ 489 - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 511 + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 490 512 491 513 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 492 - as returned by yylex, without out-of-bounds checking. */ 514 + as returned by yylex. */ 493 515 static const yytype_uint8 yytranslate[] = 494 516 { 495 517 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, ··· 545 567 "CCBitwiseORExpression", "CCBitwiseXORExpression", 546 568 "CCBitwiseANDExpression", "CCEqualityExpression", 547 569 "CCRelationalExpression", "CCShiftExpression", "CCAdditiveExpression", 548 - "CCMultiplicativeExpression", YY_NULL 570 + "CCMultiplicativeExpression", YY_NULLPTR 549 571 }; 550 572 #endif 551 573 ··· 678 700 679 701 #define YYRECOVERING() (!!yyerrstatus) 680 702 681 - #define YYBACKUP(Token, Value) \ 682 - do \ 683 - if (yychar == YYEMPTY) \ 684 - { \ 685 - yychar = (Token); \ 686 - yylval = (Value); \ 687 - YYPOPSTACK (yylen); \ 688 - yystate = *yyssp; \ 689 - goto yybackup; \ 690 - } \ 691 - else \ 692 - { \ 693 - yyerror (ctx, YY_("syntax error: cannot back up")); \ 694 - YYERROR; \ 695 - } \ 696 - while (0) 703 + #define YYBACKUP(Token, Value) \ 704 + do \ 705 + if (yychar == YYEMPTY) \ 706 + { \ 707 + yychar = (Token); \ 708 + yylval = (Value); \ 709 + YYPOPSTACK (yylen); \ 710 + yystate = *yyssp; \ 711 + goto yybackup; \ 712 + } \ 713 + else \ 714 + { \ 715 + yyerror (ctx, YY_("syntax error: cannot back up")); \ 716 + YYERROR; \ 717 + } \ 718 + while (0) 697 719 698 720 /* Error token number */ 699 721 #define YYTERROR 1 ··· 733 755 } while (0) 734 756 735 757 736 - /*----------------------------------------. 737 - | Print this symbol's value on YYOUTPUT. | 738 - `----------------------------------------*/ 758 + /*-----------------------------------. 759 + | Print this symbol's value on YYO. | 760 + `-----------------------------------*/ 739 761 740 762 static void 741 - yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) 763 + yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) 742 764 { 743 - FILE *yyo = yyoutput; 744 - YYUSE (yyo); 765 + FILE *yyoutput = yyo; 766 + YYUSE (yyoutput); 745 767 YYUSE (ctx); 746 768 if (!yyvaluep) 747 769 return; 748 770 # ifdef YYPRINT 749 771 if (yytype < YYNTOKENS) 750 - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 772 + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); 751 773 # endif 752 774 YYUSE (yytype); 753 775 } 754 776 755 777 756 - /*--------------------------------. 757 - | Print this symbol on YYOUTPUT. | 758 - `--------------------------------*/ 778 + /*---------------------------. 779 + | Print this symbol on YYO. | 780 + `---------------------------*/ 759 781 760 782 static void 761 - yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) 783 + yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) 762 784 { 763 - YYFPRINTF (yyoutput, "%s %s (", 785 + YYFPRINTF (yyo, "%s %s (", 764 786 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 765 787 766 - yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx); 767 - YYFPRINTF (yyoutput, ")"); 788 + yy_symbol_value_print (yyo, yytype, yyvaluep, ctx); 789 + YYFPRINTF (yyo, ")"); 768 790 } 769 791 770 792 /*------------------------------------------------------------------. ··· 798 820 static void 799 821 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_ctx_t *ctx) 800 822 { 801 - unsigned long int yylno = yyrline[yyrule]; 823 + unsigned long yylno = yyrline[yyrule]; 802 824 int yynrhs = yyr2[yyrule]; 803 825 int yyi; 804 826 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", ··· 809 831 YYFPRINTF (stderr, " $%d = ", yyi + 1); 810 832 yy_symbol_print (stderr, 811 833 yystos[yyssp[yyi + 1 - yynrhs]], 812 - &(yyvsp[(yyi + 1) - (yynrhs)]) 834 + &yyvsp[(yyi + 1) - (yynrhs)] 813 835 , ctx); 814 836 YYFPRINTF (stderr, "\n"); 815 837 } ··· 913 935 case '\\': 914 936 if (*++yyp != '\\') 915 937 goto do_not_strip_quotes; 916 - /* Fall through. */ 938 + else 939 + goto append; 940 + 941 + append: 917 942 default: 918 943 if (yyres) 919 944 yyres[yyn] = *yyp; ··· 931 956 if (! yyres) 932 957 return yystrlen (yystr); 933 958 934 - return yystpcpy (yyres, yystr) - yyres; 959 + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); 935 960 } 936 961 # endif 937 962 ··· 947 972 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 948 973 yytype_int16 *yyssp, int yytoken) 949 974 { 950 - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); 975 + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); 951 976 YYSIZE_T yysize = yysize0; 952 977 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 953 978 /* Internationalized format string. */ 954 - const char *yyformat = YY_NULL; 979 + const char *yyformat = YY_NULLPTR; 955 980 /* Arguments of yyformat. */ 956 981 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 957 982 /* Number of reported tokens (one for the "unexpected", one per ··· 1008 1033 } 1009 1034 yyarg[yycount++] = yytname[yyx]; 1010 1035 { 1011 - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); 1012 - if (! (yysize <= yysize1 1013 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1036 + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); 1037 + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) 1038 + yysize = yysize1; 1039 + else 1014 1040 return 2; 1015 - yysize = yysize1; 1016 1041 } 1017 1042 } 1018 1043 } ··· 1024 1049 case N: \ 1025 1050 yyformat = S; \ 1026 1051 break 1052 + default: /* Avoid compiler warnings. */ 1027 1053 YYCASE_(0, YY_("syntax error")); 1028 1054 YYCASE_(1, YY_("syntax error, unexpected %s")); 1029 1055 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); ··· 1035 1061 1036 1062 { 1037 1063 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1038 - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1064 + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) 1065 + yysize = yysize1; 1066 + else 1039 1067 return 2; 1040 - yysize = yysize1; 1041 1068 } 1042 1069 1043 1070 if (*yymsg_alloc < yysize) ··· 1168 1195 yychar = YYEMPTY; /* Cause a token to be read. */ 1169 1196 goto yysetstate; 1170 1197 1198 + 1171 1199 /*------------------------------------------------------------. 1172 - | yynewstate -- Push a new state, which is found in yystate. | 1200 + | yynewstate -- push a new state, which is found in yystate. | 1173 1201 `------------------------------------------------------------*/ 1174 - yynewstate: 1202 + yynewstate: 1175 1203 /* In all cases, when you get here, the value and location stacks 1176 1204 have just been pushed. So pushing a state here evens the stacks. */ 1177 1205 yyssp++; 1178 1206 1179 - yysetstate: 1180 - *yyssp = yystate; 1207 + 1208 + /*--------------------------------------------------------------------. 1209 + | yynewstate -- set current state (the top of the stack) to yystate. | 1210 + `--------------------------------------------------------------------*/ 1211 + yysetstate: 1212 + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1213 + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); 1214 + *yyssp = (yytype_int16) yystate; 1181 1215 1182 1216 if (yyss + yystacksize - 1 <= yyssp) 1217 + #if !defined yyoverflow && !defined YYSTACK_RELOCATE 1218 + goto yyexhaustedlab; 1219 + #else 1183 1220 { 1184 1221 /* Get the current used size of the three stacks, in elements. */ 1185 - YYSIZE_T yysize = yyssp - yyss + 1; 1222 + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); 1186 1223 1187 - #ifdef yyoverflow 1224 + # if defined yyoverflow 1188 1225 { 1189 1226 /* Give user a chance to reallocate the stack. Use copies of 1190 1227 these so that the &'s don't force the real ones into ··· 1200 1237 &yyss1, yysize * sizeof (*yyssp), 1201 1238 &yyvs1, yysize * sizeof (*yyvsp), 1202 1239 &yystacksize); 1203 - 1204 1240 yyss = yyss1; 1205 1241 yyvs = yyvs1; 1206 1242 } 1207 - #else /* no yyoverflow */ 1208 - # ifndef YYSTACK_RELOCATE 1209 - goto yyexhaustedlab; 1210 - # else 1243 + # else /* defined YYSTACK_RELOCATE */ 1211 1244 /* Extend the stack our own way. */ 1212 1245 if (YYMAXDEPTH <= yystacksize) 1213 1246 goto yyexhaustedlab; ··· 1223 1256 goto yyexhaustedlab; 1224 1257 YYSTACK_RELOCATE (yyss_alloc, yyss); 1225 1258 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1226 - # undef YYSTACK_RELOCATE 1259 + # undef YYSTACK_RELOCATE 1227 1260 if (yyss1 != yyssa) 1228 1261 YYSTACK_FREE (yyss1); 1229 1262 } 1230 1263 # endif 1231 - #endif /* no yyoverflow */ 1232 1264 1233 1265 yyssp = yyss + yysize - 1; 1234 1266 yyvsp = yyvs + yysize - 1; 1235 1267 1236 1268 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1237 - (unsigned long int) yystacksize)); 1269 + (unsigned long) yystacksize)); 1238 1270 1239 1271 if (yyss + yystacksize - 1 <= yyssp) 1240 1272 YYABORT; 1241 1273 } 1242 - 1243 - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1274 + #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ 1244 1275 1245 1276 if (yystate == YYFINAL) 1246 1277 YYACCEPT; 1247 1278 1248 1279 goto yybackup; 1249 1280 1281 + 1250 1282 /*-----------. 1251 1283 | yybackup. | 1252 1284 `-----------*/ 1253 1285 yybackup: 1254 - 1255 1286 /* Do appropriate processing given the current state. Read a 1256 1287 lookahead token if we need one and don't already have one. */ 1257 1288 ··· 1309 1340 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1310 1341 *++yyvsp = yylval; 1311 1342 YY_IGNORE_MAYBE_UNINITIALIZED_END 1312 - 1313 1343 goto yynewstate; 1314 1344 1315 1345 ··· 1324 1354 1325 1355 1326 1356 /*-----------------------------. 1327 - | yyreduce -- Do a reduction. | 1357 + | yyreduce -- do a reduction. | 1328 1358 `-----------------------------*/ 1329 1359 yyreduce: 1330 1360 /* yyn is the number of a rule to reduce with. */ ··· 1344 1374 YY_REDUCE_PRINT (yyn); 1345 1375 switch (yyn) 1346 1376 { 1347 - case 2: 1348 - #line 146 "cc_parser.y" /* yacc.c:1646 */ 1377 + case 2: 1378 + #line 146 "cc_parser.y" 1349 1379 { ctx->ccval = (yyvsp[0].ccval); YYACCEPT; } 1350 - #line 1351 "cc_parser.tab.c" /* yacc.c:1646 */ 1380 + #line 1381 "cc_parser.tab.c" 1351 1381 break; 1352 1382 1353 1383 case 3: 1354 - #line 149 "cc_parser.y" /* yacc.c:1646 */ 1384 + #line 149 "cc_parser.y" 1355 1385 { (yyval.ccval) = (yyvsp[0].ccval); } 1356 - #line 1357 "cc_parser.tab.c" /* yacc.c:1646 */ 1386 + #line 1387 "cc_parser.tab.c" 1357 1387 break; 1358 1388 1359 1389 case 4: 1360 - #line 150 "cc_parser.y" /* yacc.c:1646 */ 1390 + #line 150 "cc_parser.y" 1361 1391 { (yyval.ccval) = (yyvsp[-1].ccval); } 1362 - #line 1363 "cc_parser.tab.c" /* yacc.c:1646 */ 1392 + #line 1393 "cc_parser.tab.c" 1363 1393 break; 1364 1394 1365 1395 case 5: 1366 - #line 151 "cc_parser.y" /* yacc.c:1646 */ 1396 + #line 151 "cc_parser.y" 1367 1397 { (yyval.ccval) = ccval_bool(!get_ccbool((yyvsp[0].ccval))); } 1368 - #line 1369 "cc_parser.tab.c" /* yacc.c:1646 */ 1398 + #line 1399 "cc_parser.tab.c" 1369 1399 break; 1370 1400 1371 1401 case 6: 1372 - #line 152 "cc_parser.y" /* yacc.c:1646 */ 1402 + #line 152 "cc_parser.y" 1373 1403 { FIXME("'~' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1374 - #line 1375 "cc_parser.tab.c" /* yacc.c:1646 */ 1404 + #line 1405 "cc_parser.tab.c" 1375 1405 break; 1376 1406 1377 1407 case 7: 1378 - #line 153 "cc_parser.y" /* yacc.c:1646 */ 1408 + #line 153 "cc_parser.y" 1379 1409 { FIXME("'+' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1380 - #line 1381 "cc_parser.tab.c" /* yacc.c:1646 */ 1410 + #line 1411 "cc_parser.tab.c" 1381 1411 break; 1382 1412 1383 1413 case 8: 1384 - #line 154 "cc_parser.y" /* yacc.c:1646 */ 1414 + #line 154 "cc_parser.y" 1385 1415 { FIXME("'-' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1386 - #line 1387 "cc_parser.tab.c" /* yacc.c:1646 */ 1416 + #line 1417 "cc_parser.tab.c" 1387 1417 break; 1388 1418 1389 1419 case 9: 1390 - #line 157 "cc_parser.y" /* yacc.c:1646 */ 1420 + #line 157 "cc_parser.y" 1391 1421 { (yyval.ccval) = (yyvsp[0].ccval); } 1392 - #line 1393 "cc_parser.tab.c" /* yacc.c:1646 */ 1422 + #line 1423 "cc_parser.tab.c" 1393 1423 break; 1394 1424 1395 1425 case 10: 1396 - #line 159 "cc_parser.y" /* yacc.c:1646 */ 1426 + #line 159 "cc_parser.y" 1397 1427 { FIXME("'||' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1398 - #line 1399 "cc_parser.tab.c" /* yacc.c:1646 */ 1428 + #line 1429 "cc_parser.tab.c" 1399 1429 break; 1400 1430 1401 1431 case 11: 1402 - #line 162 "cc_parser.y" /* yacc.c:1646 */ 1432 + #line 162 "cc_parser.y" 1403 1433 { (yyval.ccval) = (yyvsp[0].ccval); } 1404 - #line 1405 "cc_parser.tab.c" /* yacc.c:1646 */ 1434 + #line 1435 "cc_parser.tab.c" 1405 1435 break; 1406 1436 1407 1437 case 12: 1408 - #line 164 "cc_parser.y" /* yacc.c:1646 */ 1438 + #line 164 "cc_parser.y" 1409 1439 { FIXME("'&&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1410 - #line 1411 "cc_parser.tab.c" /* yacc.c:1646 */ 1440 + #line 1441 "cc_parser.tab.c" 1411 1441 break; 1412 1442 1413 1443 case 13: 1414 - #line 167 "cc_parser.y" /* yacc.c:1646 */ 1444 + #line 167 "cc_parser.y" 1415 1445 { (yyval.ccval) = (yyvsp[0].ccval); } 1416 - #line 1417 "cc_parser.tab.c" /* yacc.c:1646 */ 1446 + #line 1447 "cc_parser.tab.c" 1417 1447 break; 1418 1448 1419 1449 case 14: 1420 - #line 169 "cc_parser.y" /* yacc.c:1646 */ 1450 + #line 169 "cc_parser.y" 1421 1451 { FIXME("'|' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1422 - #line 1423 "cc_parser.tab.c" /* yacc.c:1646 */ 1452 + #line 1453 "cc_parser.tab.c" 1423 1453 break; 1424 1454 1425 1455 case 15: 1426 - #line 172 "cc_parser.y" /* yacc.c:1646 */ 1456 + #line 172 "cc_parser.y" 1427 1457 { (yyval.ccval) = (yyvsp[0].ccval); } 1428 - #line 1429 "cc_parser.tab.c" /* yacc.c:1646 */ 1458 + #line 1459 "cc_parser.tab.c" 1429 1459 break; 1430 1460 1431 1461 case 16: 1432 - #line 174 "cc_parser.y" /* yacc.c:1646 */ 1462 + #line 174 "cc_parser.y" 1433 1463 { FIXME("'^' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1434 - #line 1435 "cc_parser.tab.c" /* yacc.c:1646 */ 1464 + #line 1465 "cc_parser.tab.c" 1435 1465 break; 1436 1466 1437 1467 case 17: 1438 - #line 177 "cc_parser.y" /* yacc.c:1646 */ 1468 + #line 177 "cc_parser.y" 1439 1469 { (yyval.ccval) = (yyvsp[0].ccval); } 1440 - #line 1441 "cc_parser.tab.c" /* yacc.c:1646 */ 1470 + #line 1471 "cc_parser.tab.c" 1441 1471 break; 1442 1472 1443 1473 case 18: 1444 - #line 179 "cc_parser.y" /* yacc.c:1646 */ 1474 + #line 179 "cc_parser.y" 1445 1475 { FIXME("'&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1446 - #line 1447 "cc_parser.tab.c" /* yacc.c:1646 */ 1476 + #line 1477 "cc_parser.tab.c" 1447 1477 break; 1448 1478 1449 1479 case 19: 1450 - #line 182 "cc_parser.y" /* yacc.c:1646 */ 1480 + #line 182 "cc_parser.y" 1451 1481 { (yyval.ccval) = (yyvsp[0].ccval); } 1452 - #line 1453 "cc_parser.tab.c" /* yacc.c:1646 */ 1482 + #line 1483 "cc_parser.tab.c" 1453 1483 break; 1454 1484 1455 1485 case 20: 1456 - #line 184 "cc_parser.y" /* yacc.c:1646 */ 1486 + #line 184 "cc_parser.y" 1457 1487 { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) == get_ccnum((yyvsp[0].ccval))); } 1458 - #line 1459 "cc_parser.tab.c" /* yacc.c:1646 */ 1488 + #line 1489 "cc_parser.tab.c" 1459 1489 break; 1460 1490 1461 1491 case 21: 1462 - #line 186 "cc_parser.y" /* yacc.c:1646 */ 1492 + #line 186 "cc_parser.y" 1463 1493 { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) != get_ccnum((yyvsp[0].ccval))); } 1464 - #line 1465 "cc_parser.tab.c" /* yacc.c:1646 */ 1494 + #line 1495 "cc_parser.tab.c" 1465 1495 break; 1466 1496 1467 1497 case 22: 1468 - #line 188 "cc_parser.y" /* yacc.c:1646 */ 1498 + #line 188 "cc_parser.y" 1469 1499 { FIXME("'===' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1470 - #line 1471 "cc_parser.tab.c" /* yacc.c:1646 */ 1500 + #line 1501 "cc_parser.tab.c" 1471 1501 break; 1472 1502 1473 1503 case 23: 1474 - #line 190 "cc_parser.y" /* yacc.c:1646 */ 1504 + #line 190 "cc_parser.y" 1475 1505 { FIXME("'!==' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1476 - #line 1477 "cc_parser.tab.c" /* yacc.c:1646 */ 1506 + #line 1507 "cc_parser.tab.c" 1477 1507 break; 1478 1508 1479 1509 case 24: 1480 - #line 193 "cc_parser.y" /* yacc.c:1646 */ 1510 + #line 193 "cc_parser.y" 1481 1511 { (yyval.ccval) = (yyvsp[0].ccval); } 1482 - #line 1483 "cc_parser.tab.c" /* yacc.c:1646 */ 1512 + #line 1513 "cc_parser.tab.c" 1483 1513 break; 1484 1514 1485 1515 case 25: 1486 - #line 195 "cc_parser.y" /* yacc.c:1646 */ 1516 + #line 195 "cc_parser.y" 1487 1517 { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) < get_ccnum((yyvsp[0].ccval))); } 1488 - #line 1489 "cc_parser.tab.c" /* yacc.c:1646 */ 1518 + #line 1519 "cc_parser.tab.c" 1489 1519 break; 1490 1520 1491 1521 case 26: 1492 - #line 197 "cc_parser.y" /* yacc.c:1646 */ 1522 + #line 197 "cc_parser.y" 1493 1523 { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) <= get_ccnum((yyvsp[0].ccval))); } 1494 - #line 1495 "cc_parser.tab.c" /* yacc.c:1646 */ 1524 + #line 1525 "cc_parser.tab.c" 1495 1525 break; 1496 1526 1497 1527 case 27: 1498 - #line 199 "cc_parser.y" /* yacc.c:1646 */ 1528 + #line 199 "cc_parser.y" 1499 1529 { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) > get_ccnum((yyvsp[0].ccval))); } 1500 - #line 1501 "cc_parser.tab.c" /* yacc.c:1646 */ 1530 + #line 1531 "cc_parser.tab.c" 1501 1531 break; 1502 1532 1503 1533 case 28: 1504 - #line 201 "cc_parser.y" /* yacc.c:1646 */ 1534 + #line 201 "cc_parser.y" 1505 1535 { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) >= get_ccnum((yyvsp[0].ccval))); } 1506 - #line 1507 "cc_parser.tab.c" /* yacc.c:1646 */ 1536 + #line 1537 "cc_parser.tab.c" 1507 1537 break; 1508 1538 1509 1539 case 29: 1510 - #line 204 "cc_parser.y" /* yacc.c:1646 */ 1540 + #line 204 "cc_parser.y" 1511 1541 { (yyval.ccval) = (yyvsp[0].ccval); } 1512 - #line 1513 "cc_parser.tab.c" /* yacc.c:1646 */ 1542 + #line 1543 "cc_parser.tab.c" 1513 1543 break; 1514 1544 1515 1545 case 30: 1516 - #line 206 "cc_parser.y" /* yacc.c:1646 */ 1546 + #line 206 "cc_parser.y" 1517 1547 { FIXME("'<<' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1518 - #line 1519 "cc_parser.tab.c" /* yacc.c:1646 */ 1548 + #line 1549 "cc_parser.tab.c" 1519 1549 break; 1520 1550 1521 1551 case 31: 1522 - #line 208 "cc_parser.y" /* yacc.c:1646 */ 1552 + #line 208 "cc_parser.y" 1523 1553 { FIXME("'>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1524 - #line 1525 "cc_parser.tab.c" /* yacc.c:1646 */ 1554 + #line 1555 "cc_parser.tab.c" 1525 1555 break; 1526 1556 1527 1557 case 32: 1528 - #line 210 "cc_parser.y" /* yacc.c:1646 */ 1558 + #line 210 "cc_parser.y" 1529 1559 { FIXME("'>>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1530 - #line 1531 "cc_parser.tab.c" /* yacc.c:1646 */ 1560 + #line 1561 "cc_parser.tab.c" 1531 1561 break; 1532 1562 1533 1563 case 33: 1534 - #line 213 "cc_parser.y" /* yacc.c:1646 */ 1564 + #line 213 "cc_parser.y" 1535 1565 { (yyval.ccval) = (yyvsp[0].ccval); } 1536 - #line 1537 "cc_parser.tab.c" /* yacc.c:1646 */ 1566 + #line 1567 "cc_parser.tab.c" 1537 1567 break; 1538 1568 1539 1569 case 34: 1540 - #line 215 "cc_parser.y" /* yacc.c:1646 */ 1570 + #line 215 "cc_parser.y" 1541 1571 { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) + get_ccnum((yyvsp[0].ccval))); } 1542 - #line 1543 "cc_parser.tab.c" /* yacc.c:1646 */ 1572 + #line 1573 "cc_parser.tab.c" 1543 1573 break; 1544 1574 1545 1575 case 35: 1546 - #line 217 "cc_parser.y" /* yacc.c:1646 */ 1576 + #line 217 "cc_parser.y" 1547 1577 { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) - get_ccnum((yyvsp[0].ccval))); } 1548 - #line 1549 "cc_parser.tab.c" /* yacc.c:1646 */ 1578 + #line 1579 "cc_parser.tab.c" 1549 1579 break; 1550 1580 1551 1581 case 36: 1552 - #line 220 "cc_parser.y" /* yacc.c:1646 */ 1582 + #line 220 "cc_parser.y" 1553 1583 { (yyval.ccval) = (yyvsp[0].ccval); } 1554 - #line 1555 "cc_parser.tab.c" /* yacc.c:1646 */ 1584 + #line 1585 "cc_parser.tab.c" 1555 1585 break; 1556 1586 1557 1587 case 37: 1558 - #line 222 "cc_parser.y" /* yacc.c:1646 */ 1588 + #line 222 "cc_parser.y" 1559 1589 { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) * get_ccnum((yyvsp[0].ccval))); } 1560 - #line 1561 "cc_parser.tab.c" /* yacc.c:1646 */ 1590 + #line 1591 "cc_parser.tab.c" 1561 1591 break; 1562 1592 1563 1593 case 38: 1564 - #line 224 "cc_parser.y" /* yacc.c:1646 */ 1594 + #line 224 "cc_parser.y" 1565 1595 { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) / get_ccnum((yyvsp[0].ccval))); } 1566 - #line 1567 "cc_parser.tab.c" /* yacc.c:1646 */ 1596 + #line 1597 "cc_parser.tab.c" 1567 1597 break; 1568 1598 1569 1599 case 39: 1570 - #line 226 "cc_parser.y" /* yacc.c:1646 */ 1600 + #line 226 "cc_parser.y" 1571 1601 { FIXME("'%%' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } 1572 - #line 1573 "cc_parser.tab.c" /* yacc.c:1646 */ 1602 + #line 1603 "cc_parser.tab.c" 1573 1603 break; 1574 1604 1575 1605 1576 - #line 1577 "cc_parser.tab.c" /* yacc.c:1646 */ 1606 + #line 1607 "cc_parser.tab.c" 1607 + 1577 1608 default: break; 1578 1609 } 1579 1610 /* User semantic actions sometimes alter yychar, and that requires ··· 1598 1629 /* Now 'shift' the result of the reduction. Determine what state 1599 1630 that goes to, based on the state we popped back to and the rule 1600 1631 number reduced by. */ 1601 - 1602 - yyn = yyr1[yyn]; 1603 - 1604 - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1605 - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1606 - yystate = yytable[yystate]; 1607 - else 1608 - yystate = yydefgoto[yyn - YYNTOKENS]; 1632 + { 1633 + const int yylhs = yyr1[yyn] - YYNTOKENS; 1634 + const int yyi = yypgoto[yylhs] + *yyssp; 1635 + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp 1636 + ? yytable[yyi] 1637 + : yydefgoto[yylhs]); 1638 + } 1609 1639 1610 1640 goto yynewstate; 1611 1641 ··· 1688 1718 | yyerrorlab -- error raised explicitly by YYERROR. | 1689 1719 `---------------------------------------------------*/ 1690 1720 yyerrorlab: 1691 - 1692 - /* Pacify compilers like GCC when the user code never invokes 1693 - YYERROR and the label yyerrorlab therefore never appears in user 1694 - code. */ 1695 - if (/*CONSTCOND*/ 0) 1696 - goto yyerrorlab; 1721 + /* Pacify compilers when the user code never invokes YYERROR and the 1722 + label yyerrorlab therefore never appears in user code. */ 1723 + if (0) 1724 + YYERROR; 1697 1725 1698 1726 /* Do not reclaim the symbols of the rule whose action triggered 1699 1727 this YYERROR. */ ··· 1755 1783 yyresult = 0; 1756 1784 goto yyreturn; 1757 1785 1786 + 1758 1787 /*-----------------------------------. 1759 1788 | yyabortlab -- YYABORT comes here. | 1760 1789 `-----------------------------------*/ 1761 1790 yyabortlab: 1762 1791 yyresult = 1; 1763 1792 goto yyreturn; 1793 + 1764 1794 1765 1795 #if !defined yyoverflow || YYERROR_VERBOSE 1766 1796 /*-------------------------------------------------. ··· 1772 1802 /* Fall through. */ 1773 1803 #endif 1774 1804 1805 + 1806 + /*-----------------------------------------------------. 1807 + | yyreturn -- parsing is finished, return the result. | 1808 + `-----------------------------------------------------*/ 1775 1809 yyreturn: 1776 1810 if (yychar != YYEMPTY) 1777 1811 { ··· 1801 1835 #endif 1802 1836 return yyresult; 1803 1837 } 1804 - #line 228 "cc_parser.y" /* yacc.c:1906 */ 1838 + #line 228 "cc_parser.y" 1805 1839 1806 1840 1807 1841 BOOL parse_cc_expr(parser_ctx_t *ctx)
+10 -5
dll/win32/jscript/cc_parser.tab.h
··· 1 - /* A Bison parser, made by GNU Bison 3.0. */ 1 + /* A Bison parser, made by GNU Bison 3.4.1. */ 2 2 3 3 /* Bison interface for Yacc-like parsers in C 4 4 5 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 5 + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, 6 + Inc. 6 7 7 8 This program is free software: you can redistribute it and/or modify 8 9 it under the terms of the GNU General Public License as published by ··· 29 30 30 31 This special exception was added by the Free Software Foundation in 31 32 version 2.2 of Bison. */ 33 + 34 + /* Undocumented macros, especially those whose name start with YY_, 35 + are private implementation details. Do not rely on them. */ 32 36 33 37 #ifndef YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED 34 38 # define YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED ··· 62 66 63 67 /* Value type. */ 64 68 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 65 - typedef union YYSTYPE YYSTYPE; 66 69 union YYSTYPE 67 70 { 68 - #line 36 "cc_parser.y" /* yacc.c:1909 */ 71 + #line 36 "cc_parser.y" 69 72 70 73 ccval_t ccval; 71 74 72 - #line 73 "cc_parser.tab.h" /* yacc.c:1909 */ 75 + #line 76 "cc_parser.tab.h" 76 + 73 77 }; 78 + typedef union YYSTYPE YYSTYPE; 74 79 # define YYSTYPE_IS_TRIVIAL 1 75 80 # define YYSTYPE_IS_DECLARED 1 76 81 #endif
+1 -1
dll/win32/jscript/cc_parser.y
··· 30 30 31 31 %lex-param { parser_ctx_t *ctx } 32 32 %parse-param { parser_ctx_t *ctx } 33 - %pure-parser 33 + %define api.pure 34 34 %start CCExpr 35 35 36 36 %union {
+68 -65
dll/win32/jscript/compile.c
··· 48 48 int ref; 49 49 } function_local_t; 50 50 51 - typedef struct { 51 + typedef struct _compiler_ctx_t { 52 52 parser_ctx_t *parser; 53 53 bytecode_t *code; 54 54 ··· 130 130 return heap_pool_alloc(&code->heap, size); 131 131 } 132 132 133 - static jsstr_t *compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsigned len) 133 + jsstr_t *compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsigned len) 134 134 { 135 135 jsstr_t *new_str; 136 136 ··· 160 160 161 161 static jsstr_t *compiler_alloc_string(compiler_ctx_t *ctx, const WCHAR *str) 162 162 { 163 - return compiler_alloc_string_len(ctx, str, strlenW(str)); 163 + return compiler_alloc_string_len(ctx, str, lstrlenW(str)); 164 164 } 165 165 166 166 static BOOL ensure_bstr_slot(compiler_ctx_t *ctx) ··· 245 245 return S_OK; 246 246 } 247 247 248 - static HRESULT push_instr_str(compiler_ctx_t *ctx, jsop_t op, const WCHAR *arg) 248 + static HRESULT push_instr_str(compiler_ctx_t *ctx, jsop_t op, jsstr_t *str) 249 249 { 250 250 unsigned instr; 251 - jsstr_t *str; 252 251 253 - str = compiler_alloc_string(ctx, arg); 254 - if(!str) 252 + instr = push_instr(ctx, op); 253 + if(!instr) 255 254 return E_OUTOFMEMORY; 256 255 256 + instr_ptr(ctx, instr)->u.arg->str = str; 257 + return S_OK; 258 + } 259 + 260 + static HRESULT push_instr_str_uint(compiler_ctx_t *ctx, jsop_t op, jsstr_t *str, unsigned arg2) 261 + { 262 + unsigned instr; 263 + 257 264 instr = push_instr(ctx, op); 258 265 if(!instr) 259 266 return E_OUTOFMEMORY; 260 267 261 - instr_ptr(ctx, instr)->u.arg->str = str; 268 + instr_ptr(ctx, instr)->u.arg[0].str = str; 269 + instr_ptr(ctx, instr)->u.arg[1].uint = arg2; 262 270 return S_OK; 263 271 } 264 272 ··· 477 485 } 478 486 case EXPR_MEMBER: { 479 487 member_expression_t *member_expr = (member_expression_t*)expr; 488 + jsstr_t *jsstr; 480 489 481 490 hres = compile_expression(ctx, member_expr->expression, TRUE); 482 491 if(FAILED(hres)) 483 492 return hres; 484 493 485 494 /* FIXME: Potential optimization */ 486 - hres = push_instr_str(ctx, OP_str, member_expr->identifier); 495 + jsstr = compiler_alloc_string(ctx, member_expr->identifier); 496 + if(!jsstr) 497 + return E_OUTOFMEMORY; 498 + 499 + hres = push_instr_str(ctx, OP_str, jsstr); 487 500 if(FAILED(hres)) 488 501 return hres; 489 502 ··· 676 689 } 677 690 case EXPR_MEMBER: { 678 691 member_expression_t *member_expr = (member_expression_t*)expr->expression; 692 + jsstr_t *jsstr; 679 693 680 694 hres = compile_expression(ctx, member_expr->expression, TRUE); 681 695 if(FAILED(hres)) 682 696 return hres; 683 697 684 698 /* FIXME: Potential optimization */ 685 - hres = push_instr_str(ctx, OP_str, member_expr->identifier); 699 + jsstr = compiler_alloc_string(ctx, member_expr->identifier); 700 + if(!jsstr) 701 + return E_OUTOFMEMORY; 702 + 703 + hres = push_instr_str(ctx, OP_str, jsstr); 686 704 if(FAILED(hres)) 687 705 return hres; 688 706 ··· 718 736 call_expression_t *call_expr = (call_expression_t*)expr->expression1; 719 737 argument_t *arg; 720 738 721 - if(op != OP_LAST) { 722 - FIXME("op %d not supported on parametrized assign expressions\n", op); 723 - return E_NOTIMPL; 724 - } 725 - 726 739 if(is_memberid_expr(call_expr->expression->type) && call_expr->argument_list) { 727 740 hres = compile_memberid_expression(ctx, call_expr->expression, fdexNameEnsure); 728 741 if(FAILED(hres)) ··· 734 747 return hres; 735 748 arg_cnt++; 736 749 } 750 + 751 + if(op != OP_LAST) { 752 + unsigned instr; 753 + 754 + /* We need to call the functions twice: to get the value and to set it. 755 + * JavaScript interpreted functions may to modify value on the stack, 756 + * but assignment calls are allowed only on external functions, so we 757 + * may reuse the stack here. */ 758 + instr = push_instr(ctx, OP_call_member); 759 + if(!instr) 760 + return E_OUTOFMEMORY; 761 + instr_ptr(ctx, instr)->u.arg[0].uint = arg_cnt; 762 + instr_ptr(ctx, instr)->u.arg[1].lng = 1; 763 + 764 + if(!push_instr(ctx, OP_push_acc)) 765 + return E_OUTOFMEMORY; 766 + } 737 767 }else { 738 768 use_throw_path = TRUE; 739 769 } ··· 741 771 hres = compile_memberid_expression(ctx, expr->expression1, fdexNameEnsure); 742 772 if(FAILED(hres)) 743 773 return hres; 774 + if(op != OP_LAST && !push_instr(ctx, OP_refval)) 775 + return E_OUTOFMEMORY; 744 776 }else { 745 777 use_throw_path = TRUE; 746 778 } ··· 760 792 761 793 return push_instr_uint(ctx, OP_throw_ref, JS_E_ILLEGAL_ASSIGN); 762 794 } 763 - 764 - if(op != OP_LAST && !push_instr(ctx, OP_refval)) 765 - return E_OUTOFMEMORY; 766 795 767 796 hres = compile_expression(ctx, expr->expression2, TRUE); 768 797 if(FAILED(hres)) ··· 811 840 case LT_NULL: 812 841 return push_instr(ctx, OP_null) ? S_OK : E_OUTOFMEMORY; 813 842 case LT_STRING: 814 - return push_instr_str(ctx, OP_str, literal->u.wstr); 815 - case LT_REGEXP: { 816 - unsigned instr; 817 - jsstr_t *str; 818 - 819 - str = compiler_alloc_string_len(ctx, literal->u.regexp.str, literal->u.regexp.str_len); 820 - if(!str) 821 - return E_OUTOFMEMORY; 822 - 823 - instr = push_instr(ctx, OP_regexp); 824 - if(!instr) 825 - return E_OUTOFMEMORY; 826 - 827 - instr_ptr(ctx, instr)->u.arg[0].str = str; 828 - instr_ptr(ctx, instr)->u.arg[1].uint = literal->u.regexp.flags; 829 - return S_OK; 830 - } 843 + return push_instr_str(ctx, OP_str, literal->u.str); 844 + case LT_REGEXP: 845 + return push_instr_str_uint(ctx, OP_regexp, literal->u.regexp.str, literal->u.regexp.flags); 831 846 DEFAULT_UNREACHABLE; 832 847 } 833 848 return E_FAIL; 834 849 } 835 850 836 - static HRESULT literal_as_bstr(compiler_ctx_t *ctx, literal_t *literal, BSTR *str) 851 + static HRESULT literal_as_string(compiler_ctx_t *ctx, literal_t *literal, jsstr_t **str) 837 852 { 838 853 switch(literal->type) { 839 854 case LT_STRING: 840 - *str = compiler_alloc_bstr(ctx, literal->u.wstr); 841 - break; 842 - case LT_DOUBLE: { 843 - jsstr_t *jsstr; 844 - HRESULT hres; 845 - 846 - hres = double_to_string(literal->u.dval, &jsstr); 847 - if(FAILED(hres)) 848 - return hres; 849 - 850 - *str = compiler_alloc_bstr_len(ctx, NULL, jsstr_length(jsstr)); 851 - if(*str) 852 - jsstr_flush(jsstr, *str); 853 - jsstr_release(jsstr); 855 + *str = literal->u.str; 854 856 break; 855 - } 857 + case LT_DOUBLE: 858 + return double_to_string(literal->u.dval, str); 856 859 DEFAULT_UNREACHABLE; 857 860 } 858 861 ··· 889 892 static HRESULT compile_object_literal(compiler_ctx_t *ctx, property_value_expression_t *expr) 890 893 { 891 894 property_definition_t *iter; 892 - BSTR name; 895 + jsstr_t *name; 893 896 HRESULT hres; 894 897 895 898 if(!push_instr(ctx, OP_new_obj)) 896 899 return E_OUTOFMEMORY; 897 900 898 901 for(iter = expr->property_list; iter; iter = iter->next) { 899 - hres = literal_as_bstr(ctx, iter->name, &name); 902 + hres = literal_as_string(ctx, iter->name, &name); 900 903 if(FAILED(hres)) 901 904 return hres; 902 905 ··· 904 907 if(FAILED(hres)) 905 908 return hres; 906 909 907 - hres = push_instr_bstr_uint(ctx, OP_obj_prop, name, iter->type); 910 + hres = push_instr_str_uint(ctx, OP_obj_prop, name, iter->type); 908 911 if(FAILED(hres)) 909 912 return hres; 910 913 } ··· 1427 1430 for(iter = ctx->stat_ctx; iter; iter = iter->next) { 1428 1431 if(iter->continue_label) 1429 1432 pop_ctx = iter; 1430 - if(iter->labelled_stat && !strcmpW(iter->labelled_stat->identifier, stat->identifier)) 1433 + if(iter->labelled_stat && !wcscmp(iter->labelled_stat->identifier, stat->identifier)) 1431 1434 break; 1432 1435 } 1433 1436 ··· 1473 1476 1474 1477 if(stat->identifier) { 1475 1478 for(pop_ctx = ctx->stat_ctx; pop_ctx; pop_ctx = pop_ctx->next) { 1476 - if(pop_ctx->labelled_stat && !strcmpW(pop_ctx->labelled_stat->identifier, stat->identifier)) { 1479 + if(pop_ctx->labelled_stat && !wcscmp(pop_ctx->labelled_stat->identifier, stat->identifier)) { 1477 1480 assert(pop_ctx->break_label); 1478 1481 break; 1479 1482 } ··· 1557 1560 HRESULT hres; 1558 1561 1559 1562 for(iter = ctx->stat_ctx; iter; iter = iter->next) { 1560 - if(iter->labelled_stat && !strcmpW(iter->labelled_stat->identifier, stat->identifier)) { 1563 + if(iter->labelled_stat && !wcscmp(iter->labelled_stat->identifier, stat->identifier)) { 1561 1564 WARN("Label %s redefined\n", debugstr_w(stat->identifier)); 1562 1565 return JS_E_LABEL_REDEFINED; 1563 1566 } ··· 1833 1836 static int function_local_cmp(const void *key, const struct wine_rb_entry *entry) 1834 1837 { 1835 1838 function_local_t *local = WINE_RB_ENTRY_VALUE(entry, function_local_t, entry); 1836 - return strcmpW(key, local->name); 1839 + return wcscmp(key, local->name); 1837 1840 } 1838 1841 1839 1842 static inline function_local_t *find_local(compiler_ctx_t *ctx, const WCHAR *name) ··· 2390 2393 const WCHAR *ptr = args, *ptr2; 2391 2394 unsigned arg_cnt = 0; 2392 2395 2393 - while(isspaceW(*ptr)) 2396 + while(iswspace(*ptr)) 2394 2397 ptr++; 2395 2398 if(!*ptr) { 2396 2399 if(args_size) ··· 2399 2402 } 2400 2403 2401 2404 while(1) { 2402 - if(!isalphaW(*ptr) && *ptr != '_') { 2405 + if(!iswalpha(*ptr) && *ptr != '_') { 2403 2406 FIXME("expected alpha or '_': %s\n", debugstr_w(ptr)); 2404 2407 return E_FAIL; 2405 2408 } 2406 2409 2407 2410 ptr2 = ptr; 2408 - while(isalnumW(*ptr) || *ptr == '_') 2411 + while(iswalnum(*ptr) || *ptr == '_') 2409 2412 ptr++; 2410 2413 2411 - if(*ptr && *ptr != ',' && !isspaceW(*ptr)) { 2414 + if(*ptr && *ptr != ',' && !iswspace(*ptr)) { 2412 2415 FIXME("unexpected har %s\n", debugstr_w(ptr)); 2413 2416 return E_FAIL; 2414 2417 } ··· 2420 2423 } 2421 2424 arg_cnt++; 2422 2425 2423 - while(isspaceW(*ptr)) 2426 + while(iswspace(*ptr)) 2424 2427 ptr++; 2425 2428 if(!*ptr) 2426 2429 break; ··· 2430 2433 } 2431 2434 2432 2435 ptr++; 2433 - while(isspaceW(*ptr)) 2436 + while(iswspace(*ptr)) 2434 2437 ptr++; 2435 2438 } 2436 2439 ··· 2479 2482 } 2480 2483 } 2481 2484 2482 - hres = script_parse(ctx, compiler.code->source, delimiter, from_eval, &compiler.parser); 2485 + hres = script_parse(ctx, &compiler, compiler.code->source, delimiter, from_eval, &compiler.parser); 2483 2486 if(FAILED(hres)) { 2484 2487 release_bytecode(compiler.code); 2485 2488 return hres;
+33 -30
dll/win32/jscript/date.c
··· 17 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 18 */ 19 19 20 - #include "config.h" 21 - #include "wine/port.h" 20 + #ifdef __REACTOS__ 21 + #include <wine/config.h> 22 + #include <wine/port.h> 23 + #endif 22 24 23 25 #include <limits.h> 24 26 #include <math.h> ··· 542 544 } 543 545 544 546 if(!show_offset) 545 - sprintfW(buf, formatNoOffsetW, week, month, day, 547 + swprintf(buf, formatNoOffsetW, week, month, day, 546 548 (int)hour_from_time(time), (int)min_from_time(time), 547 549 (int)sec_from_time(time), year, formatAD?ADW:BCW); 548 550 else if(offset) 549 - sprintfW(buf, formatW, week, month, day, 551 + swprintf(buf, formatW, week, month, day, 550 552 (int)hour_from_time(time), (int)min_from_time(time), 551 553 (int)sec_from_time(time), sign, offset/60, offset%60, 552 554 year, formatAD?ADW:BCW); 553 555 else 554 - sprintfW(buf, formatUTCW, week, month, day, 556 + swprintf(buf, formatUTCW, week, month, day, 555 557 (int)hour_from_time(time), (int)min_from_time(time), 556 558 (int)sec_from_time(time), year, formatAD?ADW:BCW); 557 559 ··· 658 660 659 661 if(year < 0) { 660 662 *p++ = '-'; 661 - p += sprintfW(p, long_year_formatW, -(int)year); 663 + p += swprintf(p, long_year_formatW, -(int)year); 662 664 }else if(year > 9999) { 663 665 *p++ = '+'; 664 - p += sprintfW(p, long_year_formatW, (int)year); 666 + p += swprintf(p, long_year_formatW, (int)year); 665 667 }else { 666 - p += sprintfW(p, short_year_formatW, (int)year); 668 + p += swprintf(p, short_year_formatW, (int)year); 667 669 } 668 670 669 - sprintfW(p, formatW, (int)month_from_time(date->time) + 1, (int)date_from_time(date->time), 671 + swprintf(p, formatW, 672 + (int)month_from_time(date->time) + 1, (int)date_from_time(date->time), 670 673 (int)hour_from_time(date->time), (int)min_from_time(date->time), 671 674 (int)sec_from_time(date->time), (int)ms_from_time(date->time)); 672 675 ··· 745 748 746 749 day = date_from_time(date->time); 747 750 748 - sprintfW(buf, formatAD ? formatADW : formatBCW, week, day, month, year, 751 + swprintf(buf, formatAD ? formatADW : formatBCW, week, day, month, year, 749 752 (int)hour_from_time(date->time), (int)min_from_time(date->time), 750 753 (int)sec_from_time(date->time)); 751 754 ··· 822 825 823 826 day = date_from_time(time); 824 827 825 - sprintfW(buf, formatAD ? formatADW : formatBCW, week, month, day, year); 828 + swprintf(buf, formatAD ? formatADW : formatBCW, week, month, day, year); 826 829 827 830 date_str = jsstr_alloc(buf); 828 831 if(!date_str) ··· 883 886 else sign = '-'; 884 887 885 888 if(offset) 886 - sprintfW(buf, formatW, (int)hour_from_time(time), 889 + swprintf(buf, formatW, (int)hour_from_time(time), 887 890 (int)min_from_time(time), (int)sec_from_time(time), 888 891 sign, offset/60, offset%60); 889 892 else 890 - sprintfW(buf, formatUTCW, (int)hour_from_time(time), 893 + swprintf(buf, formatUTCW, (int)hour_from_time(time), 891 894 (int)min_from_time(time), (int)sec_from_time(time)); 892 895 893 896 date_str = jsstr_alloc(buf); ··· 2075 2078 for(i=0; i<input_len; i++) { 2076 2079 if(input[i] == '(') nest_level++; 2077 2080 else if(input[i] == ')') nest_level--; 2078 - else if(!nest_level) parse[parse_len++] = toupperW(input[i]); 2081 + else if(!nest_level) parse[parse_len++] = towupper(input[i]); 2079 2082 } 2080 2083 parse[parse_len] = 0; 2081 2084 ··· 2102 2105 } 2103 2106 2104 2107 for(i=0; i<parse_len;) { 2105 - while(isspaceW(parse[i])) i++; 2108 + while(iswspace(parse[i])) i++; 2106 2109 if(parse[i] == ',') { 2107 2110 while(parse[i] == ',') i++; 2108 2111 continue; 2109 2112 } 2110 2113 2111 2114 if(parse[i]>='0' && parse[i]<='9') { 2112 - int tmp = atoiW(&parse[i]); 2115 + int tmp = wcstol(&parse[i], NULL, 10); 2113 2116 while(parse[i]>='0' && parse[i]<='9') i++; 2114 - while(isspaceW(parse[i])) i++; 2117 + while(iswspace(parse[i])) i++; 2115 2118 2116 2119 if(parse[i] == ':') { 2117 2120 /* Time */ ··· 2121 2124 hour = tmp; 2122 2125 2123 2126 while(parse[i] == ':') i++; 2124 - while(isspaceW(parse[i])) i++; 2127 + while(iswspace(parse[i])) i++; 2125 2128 if(parse[i]>='0' && parse[i]<='9') { 2126 - min = atoiW(&parse[i]); 2129 + min = wcstol(&parse[i], NULL, 10); 2127 2130 while(parse[i]>='0' && parse[i]<='9') i++; 2128 2131 } 2129 2132 2130 - while(isspaceW(parse[i])) i++; 2133 + while(iswspace(parse[i])) i++; 2131 2134 while(parse[i] == ':') i++; 2132 - while(isspaceW(parse[i])) i++; 2135 + while(iswspace(parse[i])) i++; 2133 2136 if(parse[i]>='0' && parse[i]<='9') { 2134 - sec = atoiW(&parse[i]); 2137 + sec = wcstol(&parse[i], NULL, 10); 2135 2138 while(parse[i]>='0' && parse[i]<='9') i++; 2136 2139 } 2137 2140 } ··· 2144 2147 2145 2148 month = tmp-1; 2146 2149 2147 - while(isspaceW(parse[i])) i++; 2150 + while(iswspace(parse[i])) i++; 2148 2151 while(parse[i]=='-' || parse[i]=='/') i++; 2149 - while(isspaceW(parse[i])) i++; 2152 + while(iswspace(parse[i])) i++; 2150 2153 if(parse[i]<'0' || parse[i]>'9') break; 2151 - day = atoiW(&parse[i]); 2154 + day = wcstol(&parse[i], NULL, 10); 2152 2155 while(parse[i]>='0' && parse[i]<='9') i++; 2153 2156 2154 2157 while(parse[i]=='-' || parse[i]=='/') i++; 2155 - while(isspaceW(parse[i])) i++; 2158 + while(iswspace(parse[i])) i++; 2156 2159 if(parse[i]<'0' || parse[i]>'9') break; 2157 - year = atoiW(&parse[i]); 2160 + year = wcstol(&parse[i], NULL, 10); 2158 2161 while(parse[i]>='0' && parse[i]<='9') i++; 2159 2162 2160 2163 if(tmp >= 70){ ··· 2189 2192 if(parse[i] == '-') positive = FALSE; 2190 2193 2191 2194 i++; 2192 - while(isspaceW(parse[i])) i++; 2195 + while(iswspace(parse[i])) i++; 2193 2196 if(parse[i]<'0' || parse[i]>'9') break; 2194 - offset = atoiW(&parse[i]); 2197 + offset = wcstol(&parse[i], NULL, 10); 2195 2198 while(parse[i]>='0' && parse[i]<='9') i++; 2196 2199 2197 2200 if(offset<24) offset *= 60; ··· 2270 2273 size -= i; 2271 2274 2272 2275 for(j=0; j<ARRAY_SIZE(string_ids); j++) 2273 - if(!strncmpiW(&parse[i], strings[j], size)) break; 2276 + if(!_wcsnicmp(&parse[i], strings[j], size)) break; 2274 2277 2275 2278 if(j < 12) { 2276 2279 if(set_month) break;
+2 -2
dll/win32/jscript/decode.c
··· 117 117 static const WCHAR decode_endW[] = {'^','#','~','@'}; 118 118 119 119 while(*src) { 120 - if(!strncmpW(src, decode_beginW, ARRAY_SIZE(decode_beginW))) { 120 + if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) { 121 121 DWORD len, i, j=0, csum, s=0; 122 122 123 123 src += ARRAY_SIZE(decode_beginW); ··· 165 165 return JS_E_INVALID_CHAR; 166 166 src += 8; 167 167 168 - if(strncmpW(src, decode_endW, ARRAY_SIZE(decode_endW))) 168 + if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW))) 169 169 return JS_E_INVALID_CHAR; 170 170 src += ARRAY_SIZE(decode_endW); 171 171 }else {
+38 -31
dll/win32/jscript/dispex.c
··· 20 20 21 21 #include "jscript.h" 22 22 23 - #include "wine/unicode.h" 24 23 #include "wine/debug.h" 25 24 26 25 WINE_DEFAULT_DEBUG_CHANNEL(jscript); ··· 94 93 while(min <= max) { 95 94 i = (min+max)/2; 96 95 97 - r = strcmpW(name, This->builtin_info->props[i].name); 96 + r = wcscmp(name, This->builtin_info->props[i].name); 98 97 if(!r) { 99 98 /* Skip prop if it's available only in higher compatibility mode. */ 100 99 unsigned version = (This->builtin_info->props[i].flags & PROPF_VERSION_MASK) ··· 122 121 { 123 122 unsigned h = 0; 124 123 for(; *name; name++) 125 - h = (h>>(sizeof(unsigned)*8-4)) ^ (h<<4) ^ tolowerW(*name); 124 + h = (h>>(sizeof(unsigned)*8-4)) ^ (h<<4) ^ towlower(*name); 126 125 return h; 127 126 } 128 127 ··· 204 203 bucket = get_props_idx(This, hash); 205 204 pos = This->props[bucket].bucket_head; 206 205 while(pos != 0) { 207 - if(!strcmpW(name, This->props[pos].name)) { 206 + if(!wcscmp(name, This->props[pos].name)) { 208 207 if(prev != 0) { 209 208 This->props[prev].bucket_next = This->props[pos].bucket_next; 210 209 This->props[pos].bucket_next = This->props[bucket].bucket_head; ··· 240 239 const WCHAR *ptr; 241 240 unsigned idx = 0; 242 241 243 - for(ptr = name; isdigitW(*ptr) && idx < 0x10000; ptr++) 242 + for(ptr = name; iswdigit(*ptr) && idx < 0x10000; ptr++) 244 243 idx = idx*10 + (*ptr-'0'); 245 244 if(!*ptr && idx < This->builtin_info->idx_length(This)) { 246 245 prop = alloc_prop(This, name, PROP_IDX, This->builtin_info->idx_put ? PROPF_WRITABLE : 0); ··· 871 870 static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) 872 871 { 873 872 jsdisp_t *This = impl_from_IDispatchEx(iface); 874 - dispex_prop_t *iter; 875 873 HRESULT hres; 876 874 877 875 TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid); 878 876 879 - if(id == DISPID_STARTENUM) { 880 - hres = fill_protrefs(This); 881 - if(FAILED(hres)) 882 - return hres; 883 - } 884 - 885 - if(id+1>=0 && id+1<This->prop_cnt) { 886 - iter = &This->props[id+1]; 887 - }else { 877 + hres = jsdisp_next_prop(This, id, FALSE, pid); 878 + if(hres == S_FALSE) 888 879 *pid = DISPID_STARTENUM; 889 - return S_FALSE; 890 - } 891 - 892 - while(iter < This->props + This->prop_cnt) { 893 - if(iter->name && (get_flags(This, iter) & PROPF_ENUMERABLE) && iter->type!=PROP_DELETED) { 894 - *pid = prop_to_id(This, iter); 895 - return S_OK; 896 - } 897 - iter++; 898 - } 899 - 900 - *pid = DISPID_STARTENUM; 901 - return S_FALSE; 880 + return hres; 902 881 } 903 882 904 883 static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) ··· 1373 1352 1374 1353 static const WCHAR formatW[] = {'%','d',0}; 1375 1354 1376 - sprintfW(buf, formatW, idx); 1355 + swprintf(buf, formatW, idx); 1377 1356 return jsdisp_propput_name(obj, buf, val); 1378 1357 } 1379 1358 ··· 1451 1430 1452 1431 static const WCHAR formatW[] = {'%','d',0}; 1453 1432 1454 - sprintfW(name, formatW, idx); 1433 + swprintf(name, formatW, idx); 1455 1434 1456 1435 hres = find_prop_name_prot(obj, string_hash(name), name, &prop); 1457 1436 if(FAILED(hres)) ··· 1520 1499 BOOL b; 1521 1500 HRESULT hres; 1522 1501 1523 - sprintfW(buf, formatW, idx); 1502 + swprintf(buf, formatW, idx); 1524 1503 1525 1504 hres = find_prop_name(obj, string_hash(buf), buf, &prop); 1526 1505 if(FAILED(hres) || !prop) ··· 1562 1541 1563 1542 *ret = hres == S_OK; 1564 1543 return S_OK; 1544 + } 1545 + 1546 + HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, BOOL own_only, DISPID *ret) 1547 + { 1548 + dispex_prop_t *iter; 1549 + HRESULT hres; 1550 + 1551 + if(id == DISPID_STARTENUM && !own_only) { 1552 + hres = fill_protrefs(obj); 1553 + if(FAILED(hres)) 1554 + return hres; 1555 + } 1556 + 1557 + if(id + 1 < 0 || id+1 >= obj->prop_cnt) 1558 + return S_FALSE; 1559 + 1560 + for(iter = &obj->props[id + 1]; iter < obj->props + obj->prop_cnt; iter++) { 1561 + if(!iter->name || iter->type == PROP_DELETED) 1562 + continue; 1563 + if(own_only && iter->type == PROP_PROTREF) 1564 + continue; 1565 + if(!(get_flags(obj, iter) & PROPF_ENUMERABLE)) 1566 + continue; 1567 + *ret = prop_to_id(obj, iter); 1568 + return S_OK; 1569 + } 1570 + 1571 + return S_FALSE; 1565 1572 } 1566 1573 1567 1574 HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL *ret)
+14 -8
dll/win32/jscript/engine.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "config.h" 20 - #include "wine/port.h" 19 + #ifdef __REACTOS__ 20 + #include <wine/config.h> 21 + #include <wine/port.h> 22 + #endif 21 23 22 24 #include <math.h> 23 25 #include <assert.h> ··· 619 621 return FALSE; 620 622 } 621 623 622 - static int local_ref_cmp(const void *key, const void *ref) 624 + static int __cdecl local_ref_cmp(const void *key, const void *ref) 623 625 { 624 - return strcmpW((const WCHAR*)key, ((const local_ref_t*)ref)->name); 626 + return wcscmp((const WCHAR*)key, ((const local_ref_t*)ref)->name); 625 627 } 626 628 627 629 local_ref_t *lookup_local(const function_code_t *function, const WCHAR *identifier) ··· 653 655 return S_OK; 654 656 } 655 657 656 - if(!strcmpW(identifier, argumentsW)) { 658 + if(!wcscmp(identifier, argumentsW)) { 657 659 hres = detach_variable_object(ctx, scope->frame, FALSE); 658 660 if(FAILED(hres)) 659 661 return hres; ··· 677 679 } 678 680 679 681 for(item = ctx->named_items; item; item = item->next) { 680 - if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpW(item->name, identifier)) { 682 + if((item->flags & SCRIPTITEM_ISVISIBLE) && !wcscmp(item->name, identifier)) { 681 683 if(!item->disp) { 682 684 IUnknown *unk; 683 685 ··· 1449 1451 /* ECMA-262 3rd Edition 11.1.5 */ 1450 1452 static HRESULT interp_obj_prop(script_ctx_t *ctx) 1451 1453 { 1452 - const BSTR name = get_op_bstr(ctx, 0); 1454 + jsstr_t *name_arg = get_op_str(ctx, 0); 1453 1455 unsigned type = get_op_uint(ctx, 1); 1456 + const WCHAR *name; 1454 1457 jsdisp_t *obj; 1455 1458 jsval_t val; 1456 1459 HRESULT hres; 1457 1460 1458 - TRACE("%s\n", debugstr_w(name)); 1461 + TRACE("%s\n", debugstr_jsstr(name_arg)); 1459 1462 1460 1463 val = stack_pop(ctx); 1464 + 1465 + /* FIXME: we should pass it as jsstr_t */ 1466 + name = jsstr_flatten(name_arg); 1461 1467 1462 1468 assert(is_object_instance(stack_top(ctx))); 1463 1469 obj = as_jsdisp(get_object(stack_top(ctx)));
+1 -1
dll/win32/jscript/engine.h
··· 68 68 X(new, 1, ARG_UINT, 0) \ 69 69 X(new_obj, 1, 0,0) \ 70 70 X(null, 1, 0,0) \ 71 - X(obj_prop, 1, ARG_BSTR, ARG_UINT) \ 71 + X(obj_prop, 1, ARG_STR, ARG_UINT) \ 72 72 X(or, 1, 0,0) \ 73 73 X(pop, 1, ARG_UINT, 0) \ 74 74 X(pop_except, 0, ARG_ADDR, 0) \
+2 -2
dll/win32/jscript/enumerator.c
··· 61 61 if (This->atend) 62 62 return S_OK; 63 63 64 - /* dont leak pervious value */ 64 + /* don't leak previous value */ 65 65 jsval_release(This->item); 66 66 67 67 /* not at end ... get next item */ ··· 73 73 VariantClear(&nextitem); 74 74 if (FAILED(hres)) 75 75 { 76 - WARN("failed to convert jsval to variant!"); 76 + WARN("failed to convert jsval to variant!\n"); 77 77 This->item = jsval_undefined(); 78 78 return hres; 79 79 }
+7 -5
dll/win32/jscript/error.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "config.h" 20 - #include "wine/port.h" 19 + #ifdef __REACTOS__ 20 + #include <wine/config.h> 21 + #include <wine/port.h> 22 + #endif 21 23 22 24 #include <math.h> 23 25 ··· 387 389 buf[0] = '\0'; 388 390 LoadStringW(jscript_hinstance, HRESULT_CODE(error), buf, ARRAY_SIZE(buf)); 389 391 390 - if(str) pos = strchrW(buf, '|'); 392 + if(str) pos = wcschr(buf, '|'); 391 393 if(pos) { 392 - int len = strlenW(str); 393 - memmove(pos+len, pos+1, (strlenW(pos+1)+1)*sizeof(WCHAR)); 394 + int len = lstrlenW(str); 395 + memmove(pos+len, pos+1, (lstrlenW(pos+1)+1)*sizeof(WCHAR)); 394 396 memcpy(pos, str, len*sizeof(WCHAR)); 395 397 } 396 398
+321 -162
dll/win32/jscript/function.c
··· 25 25 26 26 WINE_DEFAULT_DEBUG_CHANNEL(jscript); 27 27 28 + typedef struct _function_vtbl_t function_vtbl_t; 29 + 28 30 typedef struct { 29 31 jsdisp_t dispex; 30 - builtin_invoke_t value_proc; 31 - const WCHAR *name; 32 + const function_vtbl_t *vtbl; 32 33 DWORD flags; 34 + DWORD length; 35 + } FunctionInstance; 36 + 37 + struct _function_vtbl_t { 38 + HRESULT (*call)(script_ctx_t*,FunctionInstance*,IDispatch*,unsigned,unsigned,jsval_t*,jsval_t*); 39 + HRESULT (*toString)(FunctionInstance*,jsstr_t**); 40 + void (*destructor)(FunctionInstance*); 41 + }; 42 + 43 + typedef struct { 44 + FunctionInstance function; 33 45 scope_chain_t *scope_chain; 34 46 bytecode_t *code; 35 47 function_code_t *func_code; 36 - DWORD length; 37 - } FunctionInstance; 48 + } InterpretedFunction; 49 + 50 + typedef struct { 51 + FunctionInstance function; 52 + builtin_invoke_t proc; 53 + const WCHAR *name; 54 + } NativeFunction; 55 + 56 + typedef struct { 57 + FunctionInstance function; 58 + FunctionInstance *target; 59 + IDispatch *this; 60 + unsigned argc; 61 + jsval_t args[1]; 62 + } BindFunction; 38 63 39 64 typedef struct { 40 65 jsdisp_t jsdisp; 41 - FunctionInstance *function; 66 + InterpretedFunction *function; 42 67 jsval_t *buf; 43 68 call_frame_t *frame; 44 69 unsigned argc; 45 70 } ArgumentsInstance; 46 71 72 + static HRESULT create_bind_function(script_ctx_t*,FunctionInstance*,IDispatch*,unsigned,jsval_t*,jsdisp_t**r); 73 + 47 74 static inline FunctionInstance *function_from_jsdisp(jsdisp_t *jsdisp) 48 75 { 49 76 return CONTAINING_RECORD(jsdisp, FunctionInstance, dispex); ··· 69 96 static const WCHAR lengthW[] = {'l','e','n','g','t','h',0}; 70 97 static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}; 71 98 static const WCHAR applyW[] = {'a','p','p','l','y',0}; 99 + static const WCHAR bindW[] = {'b','i','n','d',0}; 72 100 static const WCHAR callW[] = {'c','a','l','l',0}; 73 101 static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; 74 102 ··· 92 120 heap_free(arguments->buf); 93 121 } 94 122 95 - jsdisp_release(&arguments->function->dispex); 123 + jsdisp_release(&arguments->function->function.dispex); 96 124 heap_free(arguments); 97 125 } 98 126 ··· 122 150 return jsval_copy(*ref, r); 123 151 124 152 /* FIXME: Accessing by name won't work for duplicated argument names */ 125 - return jsdisp_propget_name(arguments->frame->base_scope->jsobj, arguments->function->func_code->params[idx], r); 153 + return jsdisp_propget_name(arguments->frame->base_scope->jsobj, 154 + arguments->function->func_code->params[idx], r); 126 155 } 127 156 128 157 static HRESULT Arguments_idx_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val) ··· 145 174 } 146 175 147 176 /* FIXME: Accessing by name won't work for duplicated argument names */ 148 - return jsdisp_propput_name(arguments->frame->base_scope->jsobj, arguments->function->func_code->params[idx], val); 177 + return jsdisp_propput_name(arguments->frame->base_scope->jsobj, 178 + arguments->function->func_code->params[idx], val); 149 179 } 150 180 151 181 static const builtin_info_t Arguments_info = { ··· 176 206 return hres; 177 207 } 178 208 179 - args->function = function_from_jsdisp(jsdisp_addref(frame->function_instance)); 209 + args->function = (InterpretedFunction*)function_from_jsdisp(jsdisp_addref(frame->function_instance)); 180 210 args->argc = frame->argc; 181 211 args->frame = frame; 182 212 ··· 184 214 jsval_number(args->argc)); 185 215 if(SUCCEEDED(hres)) 186 216 hres = jsdisp_define_data_property(&args->jsdisp, caleeW, PROPF_WRITABLE | PROPF_CONFIGURABLE, 187 - jsval_obj(&args->function->dispex)); 217 + jsval_obj(&args->function->function.dispex)); 188 218 if(SUCCEEDED(hres)) 189 219 hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_WRITABLE, jsval_obj(&args->jsdisp)); 190 220 if(FAILED(hres)) { ··· 231 261 jsdisp_release(frame->arguments_obj); 232 262 } 233 263 234 - static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, unsigned argc, jsval_t *argv, 235 - BOOL is_constructor, BOOL caller_execs_source, jsval_t *r) 236 - { 237 - jsdisp_t *var_disp; 238 - DWORD exec_flags = 0; 239 - HRESULT hres; 240 - 241 - if(ctx->state == SCRIPTSTATE_UNINITIALIZED || ctx->state == SCRIPTSTATE_CLOSED) { 242 - WARN("Script engine state does not allow running code.\n"); 243 - return E_UNEXPECTED; 244 - } 245 - 246 - if(!function->func_code) { 247 - FIXME("no source\n"); 248 - return E_FAIL; 249 - } 250 - 251 - hres = create_dispex(ctx, NULL, NULL, &var_disp); 252 - if(FAILED(hres)) 253 - return hres; 254 - 255 - if(caller_execs_source) 256 - exec_flags |= EXEC_RETURN_TO_INTERP; 257 - if(is_constructor) 258 - exec_flags |= EXEC_CONSTRUCTOR; 259 - hres = exec_source(ctx, exec_flags, function->code, function->func_code, function->scope_chain, this_obj, 260 - &function->dispex, var_disp, argc, argv, r); 261 - 262 - jsdisp_release(var_disp); 263 - return hres; 264 - } 265 - 266 - static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, 267 - unsigned argc, jsval_t *argv, jsval_t *r) 268 - { 269 - vdisp_t vthis; 270 - HRESULT hres; 271 - 272 - if(this_disp) 273 - set_disp(&vthis, this_disp); 274 - else if(ctx->host_global) 275 - set_disp(&vthis, ctx->host_global); 276 - else 277 - set_jsdisp(&vthis, ctx->global); 278 - 279 - hres = function->value_proc(ctx, &vthis, flags, argc, argv, r); 280 - 281 - vdisp_release(&vthis); 282 - return hres; 283 - } 284 - 285 - static HRESULT call_function(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, 286 - unsigned argc, jsval_t *argv, BOOL caller_execs_source, jsval_t *r) 287 - { 288 - if(function->value_proc) 289 - return invoke_value_proc(ctx, function, this_obj, DISPATCH_METHOD, argc, argv, r); 290 - 291 - return invoke_source(ctx, function, this_obj, argc, argv, FALSE, caller_execs_source, r); 292 - } 293 - 294 - static HRESULT function_to_string(FunctionInstance *function, jsstr_t **ret) 295 - { 296 - jsstr_t *str; 297 - 298 - static const WCHAR native_prefixW[] = {'\n','f','u','n','c','t','i','o','n',' '}; 299 - static const WCHAR native_suffixW[] = 300 - {'(',')',' ','{','\n',' ',' ',' ',' ','[','n','a','t','i','v','e',' ','c','o','d','e',']','\n','}','\n'}; 301 - 302 - if(function->value_proc) { 303 - DWORD name_len; 304 - WCHAR *ptr; 305 - 306 - name_len = strlenW(function->name); 307 - str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len, &ptr); 308 - if(!str) 309 - return E_OUTOFMEMORY; 310 - 311 - memcpy(ptr, native_prefixW, sizeof(native_prefixW)); 312 - memcpy(ptr += ARRAY_SIZE(native_prefixW), function->name, name_len*sizeof(WCHAR)); 313 - memcpy(ptr + name_len, native_suffixW, sizeof(native_suffixW)); 314 - }else { 315 - str = jsstr_alloc_len(function->func_code->source, function->func_code->source_len); 316 - if(!str) 317 - return E_OUTOFMEMORY; 318 - } 319 - 320 - *ret = str; 321 - return S_OK; 322 - } 323 - 324 264 HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) 325 265 { 326 - const BOOL caller_execs_source = (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0; 327 266 FunctionInstance *function; 328 267 329 268 TRACE("func %p this %p\n", func_this, jsthis); ··· 331 270 assert(is_class(func_this, JSCLASS_FUNCTION)); 332 271 function = function_from_jsdisp(func_this); 333 272 334 - flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; 335 - if(function->value_proc) 336 - return invoke_value_proc(function->dispex.ctx, function, jsthis, flags, argc, argv, r); 337 - 338 - if(flags == DISPATCH_CONSTRUCT) { 339 - jsdisp_t *this_obj; 340 - HRESULT hres; 341 - 342 - hres = create_object(function->dispex.ctx, &function->dispex, &this_obj); 343 - if(FAILED(hres)) 344 - return hres; 345 - 346 - hres = invoke_source(function->dispex.ctx, function, to_disp(this_obj), argc, argv, TRUE, caller_execs_source, r); 347 - jsdisp_release(this_obj); 348 - return hres; 349 - } 350 - 351 - assert(flags == DISPATCH_METHOD); 352 - return invoke_source(function->dispex.ctx, function, jsthis, argc, argv, FALSE, caller_execs_source, r); 273 + return function->vtbl->call(function->dispex.ctx, function, jsthis, flags, argc, argv, r); 353 274 } 354 275 355 276 static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) ··· 372 293 if(!(function = function_this(jsthis))) 373 294 return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL); 374 295 375 - hres = function_to_string(function, &str); 296 + hres = function->vtbl->toString(function, &str); 376 297 if(FAILED(hres)) 377 298 return hres; 378 299 ··· 463 384 464 385 if(SUCCEEDED(hres)) { 465 386 if(function) { 466 - hres = call_function(ctx, function, this_obj, cnt, args, (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0, r); 387 + hres = function->vtbl->call(ctx, function, this_obj, flags, cnt, args, r); 467 388 }else { 468 389 jsval_t res; 469 390 hres = disp_call_value(ctx, jsthis->u.disp, this_obj, DISPATCH_METHOD, cnt, args, &res); ··· 507 428 cnt = argc-1; 508 429 } 509 430 510 - hres = call_function(ctx, function, this_obj, cnt, argv+1, (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0, r); 431 + hres = function->vtbl->call(ctx, function, this_obj, flags, cnt, argv + 1, r); 511 432 512 433 if(this_obj) 513 434 IDispatch_Release(this_obj); 514 435 return hres; 515 436 } 516 437 438 + static HRESULT Function_bind(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, 439 + jsval_t *r) 440 + { 441 + FunctionInstance *function; 442 + jsdisp_t *new_function; 443 + HRESULT hres; 444 + 445 + TRACE("\n"); 446 + 447 + if(!(function = function_this(jsthis))) 448 + return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL); 449 + 450 + if(argc < 1) { 451 + FIXME("no this argument\n"); 452 + return E_NOTIMPL; 453 + } 454 + 455 + if(!is_object_instance(argv[0]) || !get_object(argv[0])) { 456 + FIXME("%s is not an object instance\n", debugstr_jsval(argv[0])); 457 + return E_NOTIMPL; 458 + } 459 + 460 + hres = create_bind_function(ctx, function, get_object(argv[0]), argc - 1, argv + 1, &new_function); 461 + if(FAILED(hres)) 462 + return hres; 463 + 464 + if(r) 465 + *r = jsval_obj(new_function); 466 + else 467 + jsdisp_release(new_function); 468 + return S_OK; 469 + } 470 + 517 471 HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, 518 472 jsval_t *r) 519 473 { ··· 527 481 } 528 482 529 483 function = function_from_jsdisp(jsthis->u.jsdisp); 530 - 531 - assert(function->value_proc != NULL); 532 - return invoke_value_proc(ctx, function, NULL, flags, argc, argv, r); 484 + return function->vtbl->call(ctx, function, NULL, flags, argc, argv, r); 533 485 } 534 486 535 487 HRESULT Function_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) 536 488 { 489 + FunctionInstance *function = function_from_jsdisp(jsthis); 537 490 jsstr_t *str; 538 491 HRESULT hres; 539 492 540 493 TRACE("\n"); 541 494 542 - hres = function_to_string(function_from_jsdisp(jsthis), &str); 495 + hres = function->vtbl->toString(function, &str); 543 496 if(FAILED(hres)) 544 497 return hres; 545 498 ··· 573 526 574 527 static void Function_destructor(jsdisp_t *dispex) 575 528 { 576 - FunctionInstance *This = function_from_jsdisp(dispex); 577 - 578 - if(This->code) 579 - release_bytecode(This->code); 580 - if(This->scope_chain) 581 - scope_release(This->scope_chain); 582 - heap_free(This); 529 + FunctionInstance *function = function_from_jsdisp(dispex); 530 + function->vtbl->destructor(function); 531 + heap_free(function); 583 532 } 584 533 585 534 static const builtin_prop_t Function_props[] = { 586 535 {applyW, Function_apply, PROPF_METHOD|2}, 587 536 {argumentsW, NULL, 0, Function_get_arguments}, 537 + {bindW, Function_bind, PROPF_METHOD|PROPF_ES5|1}, 588 538 {callW, Function_call, PROPF_METHOD|1}, 589 539 {lengthW, NULL, 0, Function_get_length}, 590 540 {toStringW, Function_toString, PROPF_METHOD} ··· 613 563 NULL 614 564 }; 615 565 616 - static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_info, DWORD flags, 617 - BOOL funcprot, jsdisp_t *prototype, FunctionInstance **ret) 566 + static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_info, const function_vtbl_t *vtbl, size_t size, 567 + DWORD flags, BOOL funcprot, jsdisp_t *prototype, void **ret) 618 568 { 619 569 FunctionInstance *function; 620 570 HRESULT hres; 621 571 622 - function = heap_alloc_zero(sizeof(FunctionInstance)); 572 + function = heap_alloc_zero(size); 623 573 if(!function) 624 574 return E_OUTOFMEMORY; 625 575 ··· 634 584 return hres; 635 585 } 636 586 587 + function->vtbl = vtbl; 637 588 function->flags = flags; 638 589 function->length = flags & PROPF_ARGMASK; 639 590 ··· 641 592 return S_OK; 642 593 } 643 594 595 + static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_disp, unsigned flags, 596 + unsigned argc, jsval_t *argv, jsval_t *r) 597 + { 598 + NativeFunction *function = (NativeFunction*)func; 599 + vdisp_t vthis; 600 + HRESULT hres; 601 + 602 + if(this_disp) 603 + set_disp(&vthis, this_disp); 604 + else if(ctx->host_global) 605 + set_disp(&vthis, ctx->host_global); 606 + else 607 + set_jsdisp(&vthis, ctx->global); 608 + 609 + hres = function->proc(ctx, &vthis, flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, argc, argv, r); 610 + 611 + vdisp_release(&vthis); 612 + return hres; 613 + } 614 + 615 + static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret) 616 + { 617 + NativeFunction *function = (NativeFunction*)func; 618 + DWORD name_len; 619 + jsstr_t *str; 620 + WCHAR *ptr; 621 + 622 + static const WCHAR native_prefixW[] = {'\n','f','u','n','c','t','i','o','n',' '}; 623 + static const WCHAR native_suffixW[] = 624 + {'(',')',' ','{','\n',' ',' ',' ',' ','[','n','a','t','i','v','e',' ','c','o','d','e',']','\n','}','\n'}; 625 + 626 + name_len = function->name ? lstrlenW(function->name) : 0; 627 + str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len, &ptr); 628 + if(!str) 629 + return E_OUTOFMEMORY; 630 + 631 + memcpy(ptr, native_prefixW, sizeof(native_prefixW)); 632 + ptr += ARRAY_SIZE(native_prefixW); 633 + memcpy(ptr, function->name, name_len*sizeof(WCHAR)); 634 + ptr += name_len; 635 + memcpy(ptr, native_suffixW, sizeof(native_suffixW)); 636 + 637 + *ret = str; 638 + return S_OK; 639 + } 640 + 641 + static void NativeFunction_destructor(FunctionInstance *function) 642 + { 643 + } 644 + 645 + static const function_vtbl_t NativeFunctionVtbl = { 646 + NativeFunction_call, 647 + NativeFunction_toString, 648 + NativeFunction_destructor 649 + }; 650 + 644 651 HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, 645 652 const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret) 646 653 { 647 - FunctionInstance *function; 654 + NativeFunction *function; 648 655 HRESULT hres; 649 656 650 - hres = create_function(ctx, builtin_info, flags, FALSE, NULL, &function); 657 + hres = create_function(ctx, builtin_info, &NativeFunctionVtbl, sizeof(NativeFunction), flags, FALSE, NULL, (void**)&function); 651 658 if(FAILED(hres)) 652 659 return hres; 653 660 654 661 if(builtin_info) 655 - hres = jsdisp_define_data_property(&function->dispex, lengthW, 0, 656 - jsval_number(function->length)); 662 + hres = jsdisp_define_data_property(&function->function.dispex, lengthW, 0, 663 + jsval_number(function->function.length)); 657 664 if(SUCCEEDED(hres)) 658 - hres = jsdisp_define_data_property(&function->dispex, prototypeW, 0, jsval_obj(prototype)); 665 + hres = jsdisp_define_data_property(&function->function.dispex, prototypeW, 0, jsval_obj(prototype)); 659 666 if(FAILED(hres)) { 660 - jsdisp_release(&function->dispex); 667 + jsdisp_release(&function->function.dispex); 661 668 return hres; 662 669 } 663 670 664 - function->value_proc = value_proc; 671 + function->proc = value_proc; 665 672 function->name = name; 666 673 667 - *ret = &function->dispex; 674 + *ret = &function->function.dispex; 668 675 return S_OK; 669 676 } 670 677 ··· 696 703 return S_OK; 697 704 } 698 705 706 + static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_obj, unsigned flags, 707 + unsigned argc, jsval_t *argv, jsval_t *r) 708 + { 709 + InterpretedFunction *function = (InterpretedFunction*)func; 710 + jsdisp_t *var_disp, *new_obj = NULL; 711 + DWORD exec_flags = 0; 712 + HRESULT hres; 713 + 714 + TRACE("%p\n", function); 715 + 716 + if(ctx->state == SCRIPTSTATE_UNINITIALIZED || ctx->state == SCRIPTSTATE_CLOSED) { 717 + WARN("Script engine state does not allow running code.\n"); 718 + return E_UNEXPECTED; 719 + } 720 + 721 + if(flags & DISPATCH_CONSTRUCT) { 722 + hres = create_object(ctx, &function->function.dispex, &new_obj); 723 + if(FAILED(hres)) 724 + return hres; 725 + this_obj = to_disp(new_obj); 726 + } 727 + 728 + if(flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) 729 + exec_flags |= EXEC_RETURN_TO_INTERP; 730 + if(flags & DISPATCH_CONSTRUCT) 731 + exec_flags |= EXEC_CONSTRUCTOR; 732 + 733 + hres = create_dispex(ctx, NULL, NULL, &var_disp); 734 + if(SUCCEEDED(hres)) 735 + hres = exec_source(ctx, exec_flags, function->code, function->func_code, function->scope_chain, this_obj, 736 + &function->function.dispex, var_disp, argc, argv, r); 737 + if(new_obj) 738 + jsdisp_release(new_obj); 739 + 740 + jsdisp_release(var_disp); 741 + return hres; 742 + } 743 + 744 + static HRESULT InterpretedFunction_toString(FunctionInstance *func, jsstr_t **ret) 745 + { 746 + InterpretedFunction *function = (InterpretedFunction*)func; 747 + 748 + *ret = jsstr_alloc_len(function->func_code->source, function->func_code->source_len); 749 + return *ret ? S_OK : E_OUTOFMEMORY; 750 + } 751 + 752 + static void InterpretedFunction_destructor(FunctionInstance *func) 753 + { 754 + InterpretedFunction *function = (InterpretedFunction*)func; 755 + 756 + release_bytecode(function->code); 757 + if(function->scope_chain) 758 + scope_release(function->scope_chain); 759 + } 760 + 761 + static const function_vtbl_t InterpretedFunctionVtbl = { 762 + InterpretedFunction_call, 763 + InterpretedFunction_toString, 764 + InterpretedFunction_destructor 765 + }; 766 + 699 767 HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_code_t *func_code, 700 768 scope_chain_t *scope_chain, jsdisp_t **ret) 701 769 { 702 - FunctionInstance *function; 770 + InterpretedFunction *function; 703 771 jsdisp_t *prototype; 704 772 HRESULT hres; 705 773 ··· 707 775 if(FAILED(hres)) 708 776 return hres; 709 777 710 - hres = create_function(ctx, NULL, PROPF_CONSTR, FALSE, NULL, &function); 778 + hres = create_function(ctx, NULL, &InterpretedFunctionVtbl, sizeof(InterpretedFunction), PROPF_CONSTR, 779 + FALSE, NULL, (void**)&function); 711 780 if(SUCCEEDED(hres)) { 712 - hres = jsdisp_define_data_property(&function->dispex, prototypeW, PROPF_WRITABLE, 781 + hres = jsdisp_define_data_property(&function->function.dispex, prototypeW, PROPF_WRITABLE, 713 782 jsval_obj(prototype)); 714 783 if(SUCCEEDED(hres)) 715 - hres = set_constructor_prop(ctx, &function->dispex, prototype); 784 + hres = set_constructor_prop(ctx, &function->function.dispex, prototype); 716 785 if(FAILED(hres)) 717 - jsdisp_release(&function->dispex); 786 + jsdisp_release(&function->function.dispex); 718 787 } 719 788 jsdisp_release(prototype); 720 789 if(FAILED(hres)) ··· 728 797 bytecode_addref(code); 729 798 function->code = code; 730 799 function->func_code = func_code; 731 - function->length = function->func_code->param_cnt; 800 + function->function.length = function->func_code->param_cnt; 732 801 733 - *ret = &function->dispex; 802 + *ret = &function->function.dispex; 803 + return S_OK; 804 + } 805 + 806 + static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_obj, unsigned flags, 807 + unsigned argc, jsval_t *argv, jsval_t *r) 808 + { 809 + BindFunction *function = (BindFunction*)func; 810 + jsval_t *call_args = NULL; 811 + unsigned call_argc; 812 + HRESULT hres; 813 + 814 + TRACE("%p\n", function); 815 + 816 + call_argc = function->argc + argc; 817 + if(call_argc) { 818 + call_args = heap_alloc(function->argc * sizeof(*function->args)); 819 + if(!call_args) 820 + return E_OUTOFMEMORY; 821 + 822 + if(function->argc) 823 + memcpy(call_args, function->args, function->argc * sizeof(*call_args)); 824 + if(argc) 825 + memcpy(call_args + function->argc, argv, argc * sizeof(*call_args)); 826 + } 827 + 828 + hres = function->target->vtbl->call(ctx, function->target, function->this, flags, call_argc, call_args, r); 829 + 830 + heap_free(call_args); 831 + return hres; 832 + } 833 + 834 + static HRESULT BindFunction_toString(FunctionInstance *function, jsstr_t **ret) 835 + { 836 + static const WCHAR native_functionW[] = 837 + {'\n','f','u','n','c','t','i','o','n','(',')',' ','{','\n', 838 + ' ',' ',' ',' ','[','n','a','t','i','v','e',' ','c','o','d','e',']','\n', 839 + '}','\n',0}; 840 + 841 + *ret = jsstr_alloc(native_functionW); 842 + return *ret ? S_OK : E_OUTOFMEMORY; 843 + } 844 + 845 + static void BindFunction_destructor(FunctionInstance *func) 846 + { 847 + BindFunction *function = (BindFunction*)func; 848 + unsigned i; 849 + 850 + TRACE("%p\n", function); 851 + 852 + for(i = 0; i < function->argc; i++) 853 + jsval_release(function->args[i]); 854 + jsdisp_release(&function->target->dispex); 855 + IDispatch_Release(function->this); 856 + } 857 + 858 + static const function_vtbl_t BindFunctionVtbl = { 859 + BindFunction_call, 860 + BindFunction_toString, 861 + BindFunction_destructor 862 + }; 863 + 864 + static HRESULT create_bind_function(script_ctx_t *ctx, FunctionInstance *target, IDispatch *bound_this, unsigned argc, 865 + jsval_t *argv, jsdisp_t **ret) 866 + { 867 + BindFunction *function; 868 + HRESULT hres; 869 + 870 + hres = create_function(ctx, NULL, &BindFunctionVtbl, FIELD_OFFSET(BindFunction, args[argc]), PROPF_METHOD, 871 + FALSE, NULL, (void**)&function); 872 + if(FAILED(hres)) 873 + return hres; 874 + 875 + jsdisp_addref(&target->dispex); 876 + function->target = target; 877 + 878 + IDispatch_AddRef(function->this = bound_this); 879 + 880 + for(function->argc = 0; function->argc < argc; function->argc++) { 881 + hres = jsval_copy(argv[function->argc], function->args + function->argc); 882 + if(FAILED(hres)) { 883 + jsdisp_release(&function->function.dispex); 884 + return hres; 885 + } 886 + } 887 + 888 + function->function.length = target->length > argc ? target->length - argc : 0; 889 + 890 + *ret = &function->function.dispex; 734 891 return S_OK; 735 892 } 736 893 ··· 852 1009 853 1010 HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype) 854 1011 { 855 - FunctionInstance *prot, *constr; 1012 + NativeFunction *prot, *constr; 856 1013 HRESULT hres; 857 1014 858 1015 static const WCHAR FunctionW[] = {'F','u','n','c','t','i','o','n',0}; 859 1016 860 - hres = create_function(ctx, &Function_info, PROPF_CONSTR, TRUE, object_prototype, &prot); 1017 + hres = create_function(ctx, &Function_info, &NativeFunctionVtbl, sizeof(NativeFunction), PROPF_CONSTR, 1018 + TRUE, object_prototype, (void**)&prot); 861 1019 if(FAILED(hres)) 862 1020 return hres; 863 1021 864 - prot->value_proc = FunctionProt_value; 1022 + prot->proc = FunctionProt_value; 865 1023 prot->name = prototypeW; 866 1024 867 - hres = create_function(ctx, &FunctionInst_info, PROPF_CONSTR|1, TRUE, &prot->dispex, &constr); 1025 + hres = create_function(ctx, &FunctionInst_info, &NativeFunctionVtbl, sizeof(NativeFunction), PROPF_CONSTR|1, 1026 + TRUE, &prot->function.dispex, (void**)&constr); 868 1027 if(SUCCEEDED(hres)) { 869 - constr->value_proc = FunctionConstr_value; 1028 + constr->proc = FunctionConstr_value; 870 1029 constr->name = FunctionW; 871 - hres = jsdisp_define_data_property(&constr->dispex, prototypeW, 0, jsval_obj(&prot->dispex)); 1030 + hres = jsdisp_define_data_property(&constr->function.dispex, prototypeW, 0, jsval_obj(&prot->function.dispex)); 872 1031 if(SUCCEEDED(hres)) 873 - hres = set_constructor_prop(ctx, &constr->dispex, &prot->dispex); 1032 + hres = set_constructor_prop(ctx, &constr->function.dispex, &prot->function.dispex); 874 1033 if(FAILED(hres)) 875 - jsdisp_release(&constr->dispex); 1034 + jsdisp_release(&constr->function.dispex); 876 1035 } 877 - jsdisp_release(&prot->dispex); 1036 + jsdisp_release(&prot->function.dispex); 878 1037 if(FAILED(hres)) 879 1038 return hres; 880 1039 881 - ctx->function_constr = &constr->dispex; 1040 + ctx->function_constr = &constr->function.dispex; 882 1041 return S_OK; 883 1042 }
+21 -22
dll/win32/jscript/global.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "config.h" 20 - #include "wine/port.h" 19 + #ifdef __REACTOS__ 20 + #include <wine/config.h> 21 + #include <wine/port.h> 22 + #endif 21 23 22 24 #include <math.h> 23 25 #include <limits.h> ··· 181 183 HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, 182 184 jsval_t *r) 183 185 { 184 - call_frame_t *frame; 186 + call_frame_t *frame = ctx->call_ctx; 185 187 DWORD exec_flags = EXEC_EVAL; 186 188 bytecode_t *code; 187 189 const WCHAR *src; ··· 201 203 return S_OK; 202 204 } 203 205 204 - if(!(frame = ctx->call_ctx)) { 205 - FIXME("No active exec_ctx\n"); 206 - return E_UNEXPECTED; 207 - } 208 - 209 206 src = jsstr_flatten(get_string(argv[0])); 210 207 if(!src) 211 208 return E_OUTOFMEMORY; ··· 217 214 return throw_syntax_error(ctx, hres, NULL); 218 215 } 219 216 220 - if(frame->flags & EXEC_GLOBAL) 217 + if(!frame || (frame->flags & EXEC_GLOBAL)) 221 218 exec_flags |= EXEC_GLOBAL; 222 219 if(flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) 223 220 exec_flags |= EXEC_RETURN_TO_INTERP; 224 - hres = exec_source(ctx, exec_flags, code, &code->global_code, frame->scope, 225 - frame->this_obj, NULL, frame->variable_obj, 0, NULL, r); 221 + hres = exec_source(ctx, exec_flags, code, &code->global_code, frame ? frame->scope : NULL, 222 + frame ? frame->this_obj : NULL, NULL, frame ? frame->variable_obj : ctx->global, 0, NULL, r); 226 223 release_bytecode(code); 227 224 return hres; 228 225 } ··· 317 314 if(FAILED(hres)) 318 315 return hres; 319 316 320 - while(isspaceW(*ptr)) 317 + while(iswspace(*ptr)) 321 318 ptr++; 322 319 323 320 switch(*ptr) { ··· 343 340 }else { 344 341 radix = 10; 345 342 } 343 + }else if(radix == 16 && *ptr == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) { 344 + ptr += 2; 346 345 } 347 346 348 347 i = char_to_int(*ptr++); ··· 385 384 if(FAILED(hres)) 386 385 return hres; 387 386 388 - while(isspaceW(*str)) str++; 387 + while(iswspace(*str)) str++; 389 388 390 389 if(*str == '+') 391 390 str++; ··· 394 393 str++; 395 394 } 396 395 397 - if(isdigitW(*str)) 396 + if(iswdigit(*str)) 398 397 ret_nan = FALSE; 399 398 400 - while(isdigitW(*str)) { 399 + while(iswdigit(*str)) { 401 400 hlp = d*10 + *(str++) - '0'; 402 401 if(d>MAXLONGLONG/10 || hlp<0) { 403 402 exp++; ··· 406 405 else 407 406 d = hlp; 408 407 } 409 - while(isdigitW(*str)) { 408 + while(iswdigit(*str)) { 410 409 exp++; 411 410 str++; 412 411 } 413 412 414 413 if(*str == '.') str++; 415 414 416 - if(isdigitW(*str)) 415 + if(iswdigit(*str)) 417 416 ret_nan = FALSE; 418 417 419 - while(isdigitW(*str)) { 418 + while(iswdigit(*str)) { 420 419 hlp = d*10 + *(str++) - '0'; 421 420 if(d>MAXLONGLONG/10 || hlp<0) 422 421 break; ··· 424 423 d = hlp; 425 424 exp--; 426 425 } 427 - while(isdigitW(*str)) 426 + while(iswdigit(*str)) 428 427 str++; 429 428 430 429 if(*str && !ret_nan && (*str=='e' || *str=='E')) { ··· 438 437 str++; 439 438 } 440 439 441 - while(isdigitW(*str)) { 440 + while(iswdigit(*str)) { 442 441 if(e>INT_MAX/10 || (e = e*10 + *str++ - '0')<0) 443 442 e = INT_MAX; 444 443 } ··· 465 464 } 466 465 467 466 static inline int hex_to_int(const WCHAR wch) { 468 - if(toupperW(wch)>='A' && toupperW(wch)<='F') return toupperW(wch)-'A'+10; 469 - if(isdigitW(wch)) return wch-'0'; 467 + if(towupper(wch)>='A' && towupper(wch)<='F') return towupper(wch)-'A'+10; 468 + if(iswdigit(wch)) return wch-'0'; 470 469 return -1; 471 470 } 472 471
+6 -10
dll/win32/jscript/jscript.h
··· 20 20 21 21 #include <stdarg.h> 22 22 #include <stdio.h> 23 + #include <stdint.h> 23 24 24 25 #define COBJMACROS 25 26 26 27 #include "windef.h" 27 28 #include "winbase.h" 28 29 #include "winuser.h" 30 + #ifdef __REACTOS__ 31 + #include "winnls.h" 32 + #endif 29 33 #include "ole2.h" 30 34 #include "dispex.h" 31 35 #include "activscp.h" 32 36 33 37 #include "resource.h" 34 38 35 - #include "wine/unicode.h" 36 39 #include "wine/heap.h" 37 40 #include "wine/list.h" 38 41 ··· 77 80 if(str) { 78 81 DWORD size; 79 82 80 - size = (strlenW(str)+1)*sizeof(WCHAR); 83 + size = (lstrlenW(str)+1)*sizeof(WCHAR); 81 84 ret = heap_alloc(size); 82 85 if(ret) 83 86 memcpy(ret, str, size); ··· 299 302 HRESULT jsdisp_get_own_property(jsdisp_t*,const WCHAR*,BOOL,property_desc_t*) DECLSPEC_HIDDEN; 300 303 HRESULT jsdisp_define_property(jsdisp_t*,const WCHAR*,property_desc_t*) DECLSPEC_HIDDEN; 301 304 HRESULT jsdisp_define_data_property(jsdisp_t*,const WCHAR*,unsigned,jsval_t) DECLSPEC_HIDDEN; 305 + HRESULT jsdisp_next_prop(jsdisp_t*,DISPID,BOOL,DISPID*) DECLSPEC_HIDDEN; 302 306 303 307 HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD, 304 308 jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN; ··· 506 510 { 507 511 return is_jsdisp(vdisp) && is_class(vdisp->u.jsdisp, class); 508 512 } 509 - 510 - #ifndef INT32_MIN 511 - #define INT32_MIN (-2147483647-1) 512 - #endif 513 - 514 - #ifndef INT32_MAX 515 - #define INT32_MAX (2147483647) 516 - #endif 517 513 518 514 static inline BOOL is_int32(double d) 519 515 {
+8 -16
dll/win32/jscript/json.c
··· 23 23 #include "parser.h" 24 24 25 25 #include "wine/debug.h" 26 - #include "wine/unicode.h" 27 26 28 27 WINE_DEFAULT_DEBUG_CHANNEL(jscript); 29 28 ··· 89 88 return E_OUTOFMEMORY; 90 89 if(len) 91 90 memcpy(buf, ptr, len*sizeof(WCHAR)); 92 - buf[len] = 0; 93 91 94 - if(!unescape(buf)) { 92 + if(!unescape(buf, &len)) { 95 93 FIXME("unescape failed\n"); 96 94 heap_free(buf); 97 95 return E_FAIL; 98 96 } 99 97 98 + buf[len] = 0; 100 99 ctx->ptr++; 101 100 *r = buf; 102 101 return S_OK; ··· 261 260 skip_spaces(ctx); 262 261 } 263 262 264 - if(!isdigitW(*ctx->ptr)) 263 + if(*ctx->ptr == '0' && ctx->ptr + 1 < ctx->end && iswdigit(ctx->ptr[1])) 265 264 break; 266 265 267 - if(*ctx->ptr == '0') { 268 - ctx->ptr++; 269 - n = 0; 270 - if(is_identifier_char(*ctx->ptr)) 271 - break; 272 - }else { 273 - hres = parse_decimal(&ctx->ptr, ctx->end, &n); 274 - if(FAILED(hres)) 275 - return hres; 276 - } 266 + hres = parse_decimal(&ctx->ptr, ctx->end, &n); 267 + if(FAILED(hres)) 268 + break; 277 269 278 270 *r = jsval_number(sign*n); 279 271 return S_OK; ··· 402 394 403 395 static inline BOOL append_string(stringify_ctx_t *ctx, const WCHAR *str) 404 396 { 405 - return append_string_len(ctx, str, strlenW(str)); 397 + return append_string_len(ctx, str, lstrlenW(str)); 406 398 } 407 399 408 400 static inline BOOL append_char(stringify_ctx_t *ctx, WCHAR c) ··· 489 481 if(*ptr < ' ') { 490 482 static const WCHAR formatW[] = {'\\','u','%','0','4','x',0}; 491 483 WCHAR buf[7]; 492 - sprintfW(buf, formatW, *ptr); 484 + swprintf(buf, formatW, *ptr); 493 485 if(!append_string(ctx, buf)) 494 486 return E_OUTOFMEMORY; 495 487 }else {
+2 -2
dll/win32/jscript/jsregexp.c
··· 647 647 const WCHAR *str; 648 648 HRESULT hres; 649 649 650 - TRACE("%s %x\n", debugstr_jsstr(src), flags); 651 - 652 650 str = jsstr_flatten(src); 653 651 if(!str) 654 652 return E_OUTOFMEMORY; 653 + 654 + TRACE("%s %x\n", debugstr_wn(str, jsstr_length(src)), flags); 655 655 656 656 hres = alloc_regexp(ctx, NULL, &regexp); 657 657 if(FAILED(hres))
+1 -1
dll/win32/jscript/jsstr.h
··· 102 102 103 103 static inline jsstr_t *jsstr_alloc(const WCHAR *str) 104 104 { 105 - return jsstr_alloc_len(str, strlenW(str)); 105 + return jsstr_alloc_len(str, lstrlenW(str)); 106 106 } 107 107 108 108 void jsstr_free(jsstr_t*) DECLSPEC_HIDDEN;
+25 -9
dll/win32/jscript/jsutils.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "config.h" 20 - #include "wine/port.h" 19 + #ifdef __REACTOS__ 20 + #include <wine/config.h> 21 + #include <wine/port.h> 22 + #endif 21 23 22 24 #include <math.h> 23 25 #include <assert.h> ··· 294 296 *r = jsval_disp(V_DISPATCH(var)); 295 297 return S_OK; 296 298 } 299 + case VT_I1: 300 + *r = jsval_number(V_I1(var)); 301 + return S_OK; 302 + case VT_UI1: 303 + *r = jsval_number(V_UI1(var)); 304 + return S_OK; 297 305 case VT_I2: 298 306 *r = jsval_number(V_I2(var)); 299 307 return S_OK; ··· 516 524 if(!ptr) 517 525 return E_OUTOFMEMORY; 518 526 519 - while(isspaceW(*ptr)) 527 + while(iswspace(*ptr)) 520 528 ptr++; 521 529 522 530 if(*ptr == '-') { ··· 526 534 ptr++; 527 535 } 528 536 529 - if(!strncmpW(ptr, infinityW, ARRAY_SIZE(infinityW))) { 537 + if(!wcsncmp(ptr, infinityW, ARRAY_SIZE(infinityW))) { 530 538 ptr += ARRAY_SIZE(infinityW); 531 - while(*ptr && isspaceW(*ptr)) 539 + while(*ptr && iswspace(*ptr)) 532 540 ptr++; 533 541 534 542 if(*ptr) ··· 551 559 return S_OK; 552 560 } 553 561 554 - while(isdigitW(*ptr)) 562 + while(iswdigit(*ptr)) 555 563 d = d*10 + (*ptr++ - '0'); 556 564 557 565 if(*ptr == 'e' || *ptr == 'E') { ··· 566 574 ptr++; 567 575 } 568 576 569 - while(isdigitW(*ptr)) 577 + while(iswdigit(*ptr)) 570 578 l = l*10 + (*ptr++ - '0'); 571 579 if(eneg) 572 580 l = -l; ··· 576 584 DOUBLE dec = 0.1; 577 585 578 586 ptr++; 579 - while(isdigitW(*ptr)) { 587 + while(iswdigit(*ptr)) { 580 588 d += dec * (*ptr++ - '0'); 581 589 dec *= 0.1; 582 590 } 583 591 } 584 592 585 - while(isspaceW(*ptr)) 593 + while(iswspace(*ptr)) 586 594 ptr++; 587 595 588 596 if(*ptr) { ··· 892 900 else 893 901 V_I2(dst) = i; 894 902 } 903 + break; 904 + } 905 + case VT_UI2: { 906 + UINT32 i; 907 + 908 + hres = to_uint32(ctx, val, &i); 909 + if(SUCCEEDED(hres)) 910 + V_UI2(dst) = i; 895 911 break; 896 912 } 897 913 case VT_R8: {
+103 -144
dll/win32/jscript/lex.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "config.h" 20 - #include "wine/port.h" 21 19 22 20 #include <limits.h> 21 + #include <math.h> 23 22 24 23 #include "jscript.h" 25 24 #include "activscp.h" ··· 30 29 #include "parser.tab.h" 31 30 32 31 #include "wine/debug.h" 33 - #include "wine/unicode.h" 34 - 35 - #ifdef __REACTOS__ 36 - /* FIXME: Inspect - For some reason these exist in the generated header but are not picked up */ 37 - #define kGET (270) 38 - #define kSET (272) 39 - #endif 40 32 41 33 WINE_DEFAULT_DEBUG_CHANNEL(jscript); 42 34 43 - static const WCHAR breakW[] = {'b','r','e','a','k',0}; 44 - static const WCHAR caseW[] = {'c','a','s','e',0}; 45 - static const WCHAR catchW[] = {'c','a','t','c','h',0}; 46 - static const WCHAR continueW[] = {'c','o','n','t','i','n','u','e',0}; 47 - static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0}; 48 - static const WCHAR deleteW[] = {'d','e','l','e','t','e',0}; 49 - static const WCHAR doW[] = {'d','o',0}; 50 - static const WCHAR elseW[] = {'e','l','s','e',0}; 51 - static const WCHAR falseW[] = {'f','a','l','s','e',0}; 52 - static const WCHAR finallyW[] = {'f','i','n','a','l','l','y',0}; 53 - static const WCHAR forW[] = {'f','o','r',0}; 54 - static const WCHAR functionW[] = {'f','u','n','c','t','i','o','n',0}; 55 - static const WCHAR getW[] = {'g','e','t',0}; 56 - static const WCHAR ifW[] = {'i','f',0}; 57 - static const WCHAR inW[] = {'i','n',0}; 58 - static const WCHAR instanceofW[] = {'i','n','s','t','a','n','c','e','o','f',0}; 59 - static const WCHAR newW[] = {'n','e','w',0}; 60 - static const WCHAR nullW[] = {'n','u','l','l',0}; 61 - static const WCHAR returnW[] = {'r','e','t','u','r','n',0}; 62 - static const WCHAR setW[] = {'s','e','t',0}; 63 - static const WCHAR switchW[] = {'s','w','i','t','c','h',0}; 64 - static const WCHAR thisW[] = {'t','h','i','s',0}; 65 - static const WCHAR throwW[] = {'t','h','r','o','w',0}; 66 - static const WCHAR trueW[] = {'t','r','u','e',0}; 67 - static const WCHAR tryW[] = {'t','r','y',0}; 68 - static const WCHAR typeofW[] = {'t','y','p','e','o','f',0}; 69 - static const WCHAR varW[] = {'v','a','r',0}; 70 - static const WCHAR voidW[] = {'v','o','i','d',0}; 71 - static const WCHAR whileW[] = {'w','h','i','l','e',0}; 72 - static const WCHAR withW[] = {'w','i','t','h',0}; 73 - 74 - static const WCHAR elifW[] = {'e','l','i','f',0}; 75 - static const WCHAR endW[] = {'e','n','d',0}; 76 - 77 35 static const struct { 78 36 const WCHAR *word; 79 37 int token; 80 38 BOOL no_nl; 81 39 unsigned min_version; 82 40 } keywords[] = { 83 - {breakW, kBREAK, TRUE}, 84 - {caseW, kCASE}, 85 - {catchW, kCATCH}, 86 - {continueW, kCONTINUE, TRUE}, 87 - {defaultW, kDEFAULT}, 88 - {deleteW, kDELETE}, 89 - {doW, kDO}, 90 - {elseW, kELSE}, 91 - {falseW, kFALSE}, 92 - {finallyW, kFINALLY}, 93 - {forW, kFOR}, 94 - {functionW, kFUNCTION}, 95 - {getW, kGET, FALSE, SCRIPTLANGUAGEVERSION_ES5}, 96 - {ifW, kIF}, 97 - {inW, kIN}, 98 - {instanceofW, kINSTANCEOF}, 99 - {newW, kNEW}, 100 - {nullW, kNULL}, 101 - {returnW, kRETURN, TRUE}, 102 - {setW, kSET, FALSE, SCRIPTLANGUAGEVERSION_ES5}, 103 - {switchW, kSWITCH}, 104 - {thisW, kTHIS}, 105 - {throwW, kTHROW}, 106 - {trueW, kTRUE}, 107 - {tryW, kTRY}, 108 - {typeofW, kTYPEOF}, 109 - {varW, kVAR}, 110 - {voidW, kVOID}, 111 - {whileW, kWHILE}, 112 - {withW, kWITH} 41 + {L"break", kBREAK, TRUE}, 42 + {L"case", kCASE}, 43 + {L"catch", kCATCH}, 44 + {L"continue", kCONTINUE, TRUE}, 45 + {L"default", kDEFAULT}, 46 + {L"delete", kDELETE}, 47 + {L"do", kDO}, 48 + {L"else", kELSE}, 49 + {L"false", kFALSE}, 50 + {L"finally", kFINALLY}, 51 + {L"for", kFOR}, 52 + {L"function", kFUNCTION}, 53 + {L"get", kGET, FALSE, SCRIPTLANGUAGEVERSION_ES5}, 54 + {L"if", kIF}, 55 + {L"in", kIN}, 56 + {L"instanceof", kINSTANCEOF}, 57 + {L"new", kNEW}, 58 + {L"null", kNULL}, 59 + {L"return", kRETURN, TRUE}, 60 + {L"set", kSET, FALSE, SCRIPTLANGUAGEVERSION_ES5}, 61 + {L"switch", kSWITCH}, 62 + {L"this", kTHIS}, 63 + {L"throw", kTHROW}, 64 + {L"true", kTRUE}, 65 + {L"try", kTRY}, 66 + {L"typeof", kTYPEOF}, 67 + {L"var", kVAR}, 68 + {L"void", kVOID}, 69 + {L"while", kWHILE}, 70 + {L"with", kWITH} 113 71 }; 114 72 115 73 static int lex_error(parser_ctx_t *ctx, HRESULT hres) ··· 122 80 /* ECMA-262 3rd Edition 7.6 */ 123 81 BOOL is_identifier_char(WCHAR c) 124 82 { 125 - return isalnumW(c) || c == '$' || c == '_' || c == '\\'; 83 + return iswalnum(c) || c == '$' || c == '_' || c == '\\'; 126 84 } 127 85 128 86 static BOOL is_identifier_first_char(WCHAR c) 129 87 { 130 - return isalphaW(c) || c == '$' || c == '_' || c == '\\'; 88 + return iswalpha(c) || c == '$' || c == '_' || c == '\\'; 131 89 } 132 90 133 91 static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval) ··· 183 141 if(ctx->script->version < keywords[i].min_version) { 184 142 TRACE("ignoring keyword %s in incompatible mode\n", 185 143 debugstr_w(keywords[i].word)); 186 - ctx->ptr -= strlenW(keywords[i].word); 144 + ctx->ptr -= lstrlenW(keywords[i].word); 187 145 return 0; 188 146 } 189 147 ctx->implicit_nl_semicolon = keywords[i].no_nl; ··· 258 216 259 217 static BOOL skip_spaces(parser_ctx_t *ctx) 260 218 { 261 - while(ctx->ptr < ctx->end && (isspaceW(*ctx->ptr) || *ctx->ptr == 0xFEFF /* UTF16 BOM */)) { 219 + while(ctx->ptr < ctx->end && (iswspace(*ctx->ptr) || *ctx->ptr == 0xFEFF /* UTF16 BOM */)) { 262 220 if(is_endline(*ctx->ptr++)) 263 221 ctx->nl = TRUE; 264 222 } ··· 266 224 return ctx->ptr != ctx->end; 267 225 } 268 226 269 - BOOL unescape(WCHAR *str) 227 + BOOL unescape(WCHAR *str, size_t *len) 270 228 { 271 - WCHAR *pd, *p, c; 229 + WCHAR *pd, *p, c, *end = str + *len; 272 230 int i; 273 231 274 232 pd = p = str; 275 - while(*p) { 233 + while(p < end) { 276 234 if(*p != '\\') { 277 235 *pd++ = *p++; 278 236 continue; 279 237 } 280 238 281 - p++; 239 + if(++p == end) 240 + return FALSE; 282 241 283 242 switch(*p) { 284 243 case '\'': ··· 302 261 c = '\r'; 303 262 break; 304 263 case 'x': 264 + if(p + 2 >= end) 265 + return FALSE; 305 266 i = hex_to_int(*++p); 306 267 if(i == -1) 307 268 return FALSE; ··· 313 274 c += i; 314 275 break; 315 276 case 'u': 277 + if(p + 4 >= end) 278 + return FALSE; 316 279 i = hex_to_int(*++p); 317 280 if(i == -1) 318 281 return FALSE; ··· 334 297 c += i; 335 298 break; 336 299 default: 337 - if(isdigitW(*p)) { 300 + if(iswdigit(*p)) { 338 301 c = *p++ - '0'; 339 - if(isdigitW(*p)) { 302 + if(p < end && iswdigit(*p)) { 340 303 c = c*8 + (*p++ - '0'); 341 - if(isdigitW(*p)) 304 + if(p < end && iswdigit(*p)) 342 305 c = c*8 + (*p++ - '0'); 343 306 } 344 307 p--; ··· 351 314 p++; 352 315 } 353 316 354 - *pd = 0; 317 + *len = pd - str; 355 318 return TRUE; 356 319 } 357 320 ··· 374 337 return tIdentifier; 375 338 } 376 339 377 - static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret, WCHAR endch) 340 + static int parse_string_literal(parser_ctx_t *ctx, jsstr_t **ret, WCHAR endch) 378 341 { 379 - const WCHAR *ptr = ++ctx->ptr; 380 - WCHAR *wstr; 381 - int len; 342 + const WCHAR *ptr = ++ctx->ptr, *ret_str = ptr; 343 + BOOL needs_unescape = FALSE; 344 + WCHAR *unescape_str; 345 + size_t len; 382 346 383 347 while(ctx->ptr < ctx->end && *ctx->ptr != endch) { 384 - if(*ctx->ptr++ == '\\') 348 + if(*ctx->ptr++ == '\\') { 385 349 ctx->ptr++; 350 + needs_unescape = TRUE; 351 + } 386 352 } 387 353 388 354 if(ctx->ptr == ctx->end) 389 355 return lex_error(ctx, JS_E_UNTERMINATED_STRING); 390 356 391 - len = ctx->ptr-ptr; 392 - 393 - *ret = wstr = parser_alloc(ctx, (len+1)*sizeof(WCHAR)); 394 - memcpy(wstr, ptr, len*sizeof(WCHAR)); 395 - wstr[len] = 0; 396 - 357 + len = ctx->ptr - ptr; 397 358 ctx->ptr++; 398 359 399 - if(!unescape(wstr)) { 400 - WARN("unescape failed\n"); 401 - return lex_error(ctx, E_FAIL); 360 + if(needs_unescape) { 361 + ret_str = unescape_str = parser_alloc(ctx, len * sizeof(WCHAR)); 362 + if(!unescape_str) 363 + return lex_error(ctx, E_OUTOFMEMORY); 364 + memcpy(unescape_str, ptr, len * sizeof(WCHAR)); 365 + if(!unescape(unescape_str, &len)) { 366 + WARN("unescape failed\n"); 367 + return lex_error(ctx, E_FAIL); 368 + } 402 369 } 403 370 371 + if(!(*ret = compiler_alloc_string_len(ctx->compiler, ret_str, len))) 372 + return lex_error(ctx, E_OUTOFMEMORY); 373 + 374 + /* FIXME: leaking string */ 404 375 return tStringLiteral; 405 376 } 406 377 ··· 429 400 LONGLONG d = 0, hlp; 430 401 int exp = 0; 431 402 432 - while(ptr < end && isdigitW(*ptr)) { 403 + while(ptr < end && iswdigit(*ptr)) { 433 404 hlp = d*10 + *(ptr++) - '0'; 434 405 if(d>MAXLONGLONG/10 || hlp<0) { 435 406 exp++; ··· 438 409 else 439 410 d = hlp; 440 411 } 441 - while(ptr < end && isdigitW(*ptr)) { 412 + while(ptr < end && iswdigit(*ptr)) { 442 413 exp++; 443 414 ptr++; 444 415 } ··· 446 417 if(*ptr == '.') { 447 418 ptr++; 448 419 449 - while(ptr < end && isdigitW(*ptr)) { 420 + while(ptr < end && iswdigit(*ptr)) { 450 421 hlp = d*10 + *(ptr++) - '0'; 451 422 if(d>MAXLONGLONG/10 || hlp<0) 452 423 break; ··· 454 425 d = hlp; 455 426 exp--; 456 427 } 457 - while(ptr < end && isdigitW(*ptr)) 428 + while(ptr < end && iswdigit(*ptr)) 458 429 ptr++; 459 430 } 460 431 ··· 467 438 }else if(*ptr == '-') { 468 439 sign = -1; 469 440 ptr++; 470 - }else if(!isdigitW(*ptr)) { 441 + }else if(!iswdigit(*ptr)) { 471 442 WARN("Expected exponent part\n"); 472 443 return E_FAIL; 473 444 } ··· 478 449 return E_FAIL; 479 450 } 480 451 481 - while(ptr < end && isdigitW(*ptr)) { 452 + while(ptr < end && iswdigit(*ptr)) { 482 453 if(e > INT_MAX/10 || (e = e*10 + *ptr++ - '0')<0) 483 454 e = INT_MAX; 484 455 } ··· 529 500 return TRUE; 530 501 } 531 502 532 - if(isdigitW(*ctx->ptr)) { 503 + if(iswdigit(*ctx->ptr)) { 533 504 unsigned base = 8; 534 505 const WCHAR *ptr; 535 506 double val = 0; 536 507 537 - for(ptr = ctx->ptr; ptr < ctx->end && isdigitW(*ptr); ptr++) { 508 + for(ptr = ctx->ptr; ptr < ctx->end && iswdigit(*ptr); ptr++) { 538 509 if(*ptr > '7') { 539 510 base = 10; 540 511 break; ··· 543 514 544 515 do { 545 516 val = val*base + *ctx->ptr-'0'; 546 - }while(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr)); 517 + }while(++ctx->ptr < ctx->end && iswdigit(*ctx->ptr)); 547 518 548 519 /* FIXME: Do we need it here? */ 549 520 if(ctx->ptr < ctx->end && (is_identifier_char(*ctx->ptr) || *ctx->ptr == '.')) { ··· 585 556 ctx->implicit_nl_semicolon = FALSE; 586 557 } 587 558 588 - if(isalphaW(*ctx->ptr)) { 559 + if(iswalpha(*ctx->ptr)) { 589 560 int ret = check_keywords(ctx, lval); 590 561 if(ret) 591 562 return ret; ··· 593 564 return parse_identifier(ctx, lval); 594 565 } 595 566 596 - if(isdigitW(*ctx->ptr)) { 567 + if(iswdigit(*ctx->ptr)) { 597 568 double n; 598 569 599 570 if(!parse_numeric_literal(ctx, &n)) ··· 620 591 return '}'; 621 592 622 593 case '.': 623 - if(ctx->ptr+1 < ctx->end && isdigitW(ctx->ptr[1])) { 594 + if(ctx->ptr+1 < ctx->end && iswdigit(ctx->ptr[1])) { 624 595 double n; 625 596 HRESULT hres; 626 597 hres = parse_decimal(&ctx->ptr, ctx->end, &n); ··· 860 831 cc_var_t *new_v; 861 832 862 833 if(len == -1) 863 - len = strlenW(name); 834 + len = lstrlenW(name); 864 835 865 836 new_v = heap_alloc(sizeof(cc_var_t) + (len+1)*sizeof(WCHAR)); 866 837 if(!new_v) ··· 890 861 { 891 862 cc_ctx_t *cc; 892 863 893 - static const WCHAR _win32W[] = {'_','w','i','n','3','2',0}; 894 - static const WCHAR _win64W[] = {'_','w','i','n','6','4',0}; 895 - static const WCHAR _x86W[] = {'_','x','8','6',0}; 896 - static const WCHAR _amd64W[] = {'_','a','m','d','6','4',0}; 897 - static const WCHAR _jscriptW[] = {'_','j','s','c','r','i','p','t',0}; 898 - static const WCHAR _jscript_buildW[] = {'_','j','s','c','r','i','p','t','_','b','u','i','l','d',0}; 899 - static const WCHAR _jscript_versionW[] = {'_','j','s','c','r','i','p','t','_','v','e','r','s','i','o','n',0}; 900 - 901 864 if(ctx->script->cc) 902 865 return TRUE; 903 866 ··· 909 872 910 873 cc->vars = NULL; 911 874 912 - if(!new_cc_var(cc, _jscriptW, -1, ccval_bool(TRUE)) 913 - || !new_cc_var(cc, sizeof(void*) == 8 ? _win64W : _win32W, -1, ccval_bool(TRUE)) 914 - || !new_cc_var(cc, sizeof(void*) == 8 ? _amd64W : _x86W, -1, ccval_bool(TRUE)) 915 - || !new_cc_var(cc, _jscript_versionW, -1, ccval_num(JSCRIPT_MAJOR_VERSION + (DOUBLE)JSCRIPT_MINOR_VERSION/10.0)) 916 - || !new_cc_var(cc, _jscript_buildW, -1, ccval_num(JSCRIPT_BUILD_VERSION))) { 875 + if(!new_cc_var(cc, L"_jscript", -1, ccval_bool(TRUE)) 876 + || !new_cc_var(cc, sizeof(void*) == 8 ? L"_win64" : L"_win32", -1, ccval_bool(TRUE)) 877 + || !new_cc_var(cc, sizeof(void*) == 8 ? L"_amd64" : L"_x86", -1, ccval_bool(TRUE)) 878 + || !new_cc_var(cc, L"_jscript_version", -1, ccval_num(JSCRIPT_MAJOR_VERSION + (DOUBLE)JSCRIPT_MINOR_VERSION/10.0)) 879 + || !new_cc_var(cc, L"_jscript_build", -1, ccval_num(JSCRIPT_BUILD_VERSION))) { 917 880 release_cc(cc); 918 881 lex_error(ctx, E_OUTOFMEMORY); 919 882 return FALSE; ··· 946 909 if(!skip_spaces(ctx)) 947 910 return -1; 948 911 949 - if(isdigitW(*ctx->ptr)) { 912 + if(iswdigit(*ctx->ptr)) { 950 913 double n; 951 914 952 915 if(!parse_numeric_literal(ctx, &n)) ··· 969 932 return 1; 970 933 } 971 934 972 - if(!check_keyword(ctx, trueW, NULL)) { 935 + if(!check_keyword(ctx, L"true", NULL)) { 973 936 *r = ccval_bool(TRUE); 974 937 return 1; 975 938 } 976 939 977 - if(!check_keyword(ctx, falseW, NULL)) { 940 + if(!check_keyword(ctx, L"false", NULL)) { 978 941 *r = ccval_bool(FALSE); 979 942 return 1; 980 943 } ··· 988 951 const WCHAR *ptr; 989 952 990 953 while(1) { 991 - ptr = strchrW(ctx->ptr, '@'); 954 + ptr = wcschr(ctx->ptr, '@'); 992 955 if(!ptr) { 993 956 WARN("No @end\n"); 994 957 return lex_error(ctx, JS_E_EXPECTED_CCEND); 995 958 } 996 959 ctx->ptr = ptr+1; 997 960 998 - if(!check_keyword(ctx, endW, NULL)) { 961 + if(!check_keyword(ctx, L"end", NULL)) { 999 962 if(--if_depth) 1000 963 continue; 1001 964 return 0; 1002 965 } 1003 966 1004 - if(exec_else && !check_keyword(ctx, elifW, NULL)) { 967 + if(exec_else && !check_keyword(ctx, L"elif", NULL)) { 1005 968 if(if_depth > 1) 1006 969 continue; 1007 970 ··· 1019 982 return 0; 1020 983 } 1021 984 1022 - if(exec_else && !check_keyword(ctx, elseW, NULL)) { 985 + if(exec_else && !check_keyword(ctx, L"else", NULL)) { 1023 986 if(if_depth > 1) 1024 987 continue; 1025 988 ··· 1028 991 return 0; 1029 992 } 1030 993 1031 - if(!check_keyword(ctx, ifW, NULL)) { 994 + if(!check_keyword(ctx, L"if", NULL)) { 1032 995 if_depth++; 1033 996 continue; 1034 997 } ··· 1041 1004 { 1042 1005 unsigned id_len = 0; 1043 1006 cc_var_t *var; 1044 - 1045 - static const WCHAR cc_onW[] = {'c','c','_','o','n',0}; 1046 - static const WCHAR setW[] = {'s','e','t',0}; 1047 1007 1048 1008 ctx->ptr++; 1049 1009 1050 - if(!check_keyword(ctx, cc_onW, NULL)) 1010 + if(!check_keyword(ctx, L"cc_on", NULL)) 1051 1011 return init_cc(ctx) ? 0 : -1; 1052 1012 1053 - if(!check_keyword(ctx, setW, NULL)) { 1013 + if(!check_keyword(ctx, L"set", NULL)) { 1054 1014 const WCHAR *ident; 1055 1015 unsigned ident_len; 1056 1016 cc_var_t *var; ··· 1084 1044 return 0; 1085 1045 } 1086 1046 1087 - if(!check_keyword(ctx, ifW, NULL)) { 1047 + if(!check_keyword(ctx, L"if", NULL)) { 1088 1048 if(!init_cc(ctx)) 1089 1049 return -1; 1090 1050 ··· 1103 1063 return skip_code(ctx, TRUE); 1104 1064 } 1105 1065 1106 - if(!check_keyword(ctx, elifW, NULL) || !check_keyword(ctx, elseW, NULL)) { 1066 + if(!check_keyword(ctx, L"elif", NULL) || !check_keyword(ctx, L"else", NULL)) { 1107 1067 if(!ctx->cc_if_depth) 1108 1068 return lex_error(ctx, JS_E_SYNTAX); 1109 1069 1110 1070 return skip_code(ctx, FALSE); 1111 1071 } 1112 1072 1113 - if(!check_keyword(ctx, endW, NULL)) { 1073 + if(!check_keyword(ctx, L"end", NULL)) { 1114 1074 if(!ctx->cc_if_depth) 1115 1075 return lex_error(ctx, JS_E_SYNTAX); 1116 1076 ··· 1193 1153 re_len = ctx->ptr-re; 1194 1154 1195 1155 flags_ptr = ++ctx->ptr; 1196 - while(ctx->ptr < ctx->end && isalnumW(*ctx->ptr)) 1156 + while(ctx->ptr < ctx->end && iswalnum(*ctx->ptr)) 1197 1157 ctx->ptr++; 1198 1158 1199 1159 hres = parse_regexp_flags(flags_ptr, ctx->ptr-flags_ptr, &flags); ··· 1202 1162 1203 1163 ret = parser_alloc(ctx, sizeof(literal_t)); 1204 1164 ret->type = LT_REGEXP; 1205 - ret->u.regexp.str = re; 1206 - ret->u.regexp.str_len = re_len; 1165 + ret->u.regexp.str = compiler_alloc_string_len(ctx->compiler, re, re_len); 1207 1166 ret->u.regexp.flags = flags; 1208 1167 return ret; 1209 1168 }
+4 -2
dll/win32/jscript/math.c
··· 17 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 18 */ 19 19 20 - #include "config.h" 21 - #include "wine/port.h" 20 + #ifdef __REACTOS__ 21 + #include <wine/config.h> 22 + #include <wine/port.h> 23 + #endif 22 24 23 25 #include <math.h> 24 26 #include <limits.h>
+1 -1
dll/win32/jscript/number.c
··· 332 332 ch = '-'; 333 333 } 334 334 else ch = '+'; 335 - sprintfW(&buf[idx], formatW, ch, (int)log_radix); 335 + swprintf(&buf[idx], formatW, ch, (int)log_radix); 336 336 } 337 337 } 338 338 else buf[idx] = '\0';
+139 -5
dll/win32/jscript/object.c
··· 32 32 {'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0}; 33 33 static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0}; 34 34 35 + static const WCHAR createW[] = {'c','r','e','a','t','e',0}; 35 36 static const WCHAR getOwnPropertyDescriptorW[] = 36 37 {'g','e','t','O','w','n','P','r','o','p','e','r','t','y','D','e','s','c','r','i','p','t','o','r',0}; 38 + static const WCHAR getPrototypeOfW[] = 39 + {'g','e','t','P','r','o','t','o','t','y','p','e','O','f',0}; 37 40 static const WCHAR definePropertyW[] = {'d','e','f','i','n','e','P','r','o','p','e','r','t','y',0}; 38 41 39 42 static const WCHAR definePropertiesW[] = {'d','e','f','i','n','e','P','r','o','p','e','r','t','i','e','s',0}; ··· 86 89 jsstr_t *ret; 87 90 WCHAR *ptr; 88 91 89 - ret = jsstr_alloc_buf(9+strlenW(str), &ptr); 92 + ret = jsstr_alloc_buf(9+lstrlenW(str), &ptr); 90 93 if(!ret) 91 94 return E_OUTOFMEMORY; 92 95 93 - sprintfW(ptr, formatW, str); 96 + swprintf(ptr, formatW, str); 94 97 *r = jsval_string(ret); 95 98 } 96 99 ··· 406 409 return hres; 407 410 } 408 411 412 + static HRESULT jsdisp_define_properties(script_ctx_t *ctx, jsdisp_t *obj, jsval_t list_val) 413 + { 414 + DISPID id = DISPID_STARTENUM; 415 + property_desc_t prop_desc; 416 + IDispatch *list_disp; 417 + jsdisp_t *list_obj, *desc_obj; 418 + jsval_t desc_val; 419 + BSTR name; 420 + HRESULT hres; 421 + 422 + hres = to_object(ctx, list_val, &list_disp); 423 + if(FAILED(hres)) 424 + return hres; 425 + 426 + if(!(list_obj = to_jsdisp(list_disp))) { 427 + FIXME("non-JS list obj\n"); 428 + IDispatch_Release(list_disp); 429 + return E_NOTIMPL; 430 + } 431 + 432 + while(1) { 433 + hres = jsdisp_next_prop(list_obj, id, TRUE, &id); 434 + if(hres != S_OK) 435 + break; 436 + 437 + hres = jsdisp_propget(list_obj, id, &desc_val); 438 + if(FAILED(hres)) 439 + break; 440 + 441 + if(!is_object_instance(desc_val) || !get_object(desc_val) || !(desc_obj = to_jsdisp(get_object(desc_val)))) { 442 + jsval_release(desc_val); 443 + break; 444 + } 445 + 446 + hres = to_property_descriptor(ctx, desc_obj, &prop_desc); 447 + jsdisp_release(desc_obj); 448 + if(FAILED(hres)) 449 + break; 450 + 451 + hres = IDispatchEx_GetMemberName(&list_obj->IDispatchEx_iface, id, &name); 452 + if(SUCCEEDED(hres)) 453 + hres = jsdisp_define_property(obj, name, &prop_desc); 454 + release_property_descriptor(&prop_desc); 455 + if(FAILED(hres)) 456 + break; 457 + } 458 + 459 + jsdisp_release(list_obj); 460 + return FAILED(hres) ? hres : S_OK; 461 + } 462 + 409 463 static HRESULT Object_defineProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, 410 464 unsigned argc, jsval_t *argv, jsval_t *r) 411 465 { ··· 446 500 447 501 hres = jsdisp_define_property(obj, name, &prop_desc); 448 502 release_property_descriptor(&prop_desc); 503 + if(SUCCEEDED(hres) && r) 504 + *r = jsval_obj(jsdisp_addref(obj)); 449 505 return hres; 450 506 } 451 507 452 508 static HRESULT Object_defineProperties(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, 453 509 unsigned argc, jsval_t *argv, jsval_t *r) 454 510 { 455 - FIXME("\n"); 456 - return E_NOTIMPL; 511 + jsdisp_t *obj; 512 + HRESULT hres; 513 + 514 + if(argc < 1 || !is_object_instance(argv[0]) || !get_object(argv[0]) || !(obj = to_jsdisp(get_object(argv[0])))) { 515 + FIXME("not an object\n"); 516 + return E_NOTIMPL; 517 + } 518 + 519 + TRACE("%p\n", obj); 520 + 521 + hres = jsdisp_define_properties(ctx, obj, argc >= 2 ? argv[1] : jsval_undefined()); 522 + if(SUCCEEDED(hres) && r) 523 + *r = jsval_obj(jsdisp_addref(obj)); 524 + return hres; 457 525 } 458 526 459 527 static HRESULT Object_getOwnPropertyDescriptor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ··· 519 587 return hres; 520 588 } 521 589 590 + static HRESULT Object_create(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, 591 + unsigned argc, jsval_t *argv, jsval_t *r) 592 + { 593 + jsdisp_t *proto = NULL, *obj; 594 + HRESULT hres; 595 + 596 + if(!argc || (!is_object_instance(argv[0]) && !is_null(argv[0]))) { 597 + FIXME("Invalid arg\n"); 598 + return E_INVALIDARG; 599 + } 600 + 601 + TRACE("(%s)\n", debugstr_jsval(argv[0])); 602 + 603 + if(argc && is_object_instance(argv[0])) { 604 + if(get_object(argv[0])) 605 + proto = to_jsdisp(get_object(argv[0])); 606 + if(!proto) { 607 + FIXME("Non-JS prototype\n"); 608 + return E_NOTIMPL; 609 + } 610 + }else if(!is_null(argv[0])) { 611 + FIXME("Invalid arg %s\n", debugstr_jsval(argc ? argv[0] : jsval_undefined())); 612 + return E_INVALIDARG; 613 + } 614 + 615 + hres = create_dispex(ctx, NULL, proto, &obj); 616 + if(FAILED(hres)) 617 + return hres; 618 + 619 + if(argc >= 2 && !is_undefined(argv[1])) 620 + hres = jsdisp_define_properties(ctx, obj, argv[1]); 621 + 622 + if(SUCCEEDED(hres) && r) 623 + *r = jsval_obj(obj); 624 + else 625 + jsdisp_release(obj); 626 + return hres; 627 + } 628 + 629 + static HRESULT Object_getPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, 630 + unsigned argc, jsval_t *argv, jsval_t *r) 631 + { 632 + jsdisp_t *obj; 633 + 634 + if(!argc || !is_object_instance(argv[0])) { 635 + FIXME("invalid arguments\n"); 636 + return E_NOTIMPL; 637 + } 638 + 639 + TRACE("(%s)\n", debugstr_jsval(argv[1])); 640 + 641 + obj = to_jsdisp(get_object(argv[0])); 642 + if(!obj) { 643 + FIXME("Non-JS object\n"); 644 + return E_NOTIMPL; 645 + } 646 + 647 + if(r) 648 + *r = obj->prototype 649 + ? jsval_obj(jsdisp_addref(obj->prototype)) 650 + : jsval_null(); 651 + return S_OK; 652 + } 653 + 522 654 static const builtin_prop_t ObjectConstr_props[] = { 655 + {createW, Object_create, PROPF_ES5|PROPF_METHOD|2}, 523 656 {definePropertiesW, Object_defineProperties, PROPF_ES5|PROPF_METHOD|2}, 524 657 {definePropertyW, Object_defineProperty, PROPF_ES5|PROPF_METHOD|2}, 525 - {getOwnPropertyDescriptorW, Object_getOwnPropertyDescriptor, PROPF_ES5|PROPF_METHOD|2} 658 + {getOwnPropertyDescriptorW, Object_getOwnPropertyDescriptor, PROPF_ES5|PROPF_METHOD|2}, 659 + {getPrototypeOfW, Object_getPrototypeOf, PROPF_ES5|PROPF_METHOD|1} 526 660 }; 527 661 528 662 static const builtin_info_t ObjectConstr_info = {
+7 -5
dll/win32/jscript/parser.h
··· 36 36 const WCHAR *ptr; 37 37 38 38 script_ctx_t *script; 39 + struct _compiler_ctx_t *compiler; 39 40 source_elements_t *source; 40 41 BOOL nl; 41 42 BOOL implicit_nl_semicolon; ··· 49 50 heap_pool_t heap; 50 51 } parser_ctx_t; 51 52 52 - HRESULT script_parse(script_ctx_t*,const WCHAR*,const WCHAR*,BOOL,parser_ctx_t**) DECLSPEC_HIDDEN; 53 + HRESULT script_parse(script_ctx_t*,struct _compiler_ctx_t*,const WCHAR*,const WCHAR*,BOOL,parser_ctx_t**) DECLSPEC_HIDDEN; 53 54 void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN; 54 55 55 56 int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN; ··· 65 66 } 66 67 67 68 BOOL is_identifier_char(WCHAR) DECLSPEC_HIDDEN; 68 - BOOL unescape(WCHAR*) DECLSPEC_HIDDEN; 69 + BOOL unescape(WCHAR*,size_t*) DECLSPEC_HIDDEN; 69 70 HRESULT parse_decimal(const WCHAR**,const WCHAR*,double*) DECLSPEC_HIDDEN; 70 71 71 72 typedef enum { ··· 80 81 literal_type_t type; 81 82 union { 82 83 double dval; 83 - const WCHAR *wstr; 84 + jsstr_t *str; 84 85 BOOL bval; 85 86 struct { 86 - const WCHAR *str; 87 - DWORD str_len; 87 + jsstr_t *str; 88 88 DWORD flags; 89 89 } regexp; 90 90 } u; ··· 401 401 { 402 402 return v.is_num ? v.u.n : v.u.b; 403 403 } 404 + 405 + jsstr_t *compiler_alloc_string_len(struct _compiler_ctx_t*,const WCHAR *,unsigned) DECLSPEC_HIDDEN;
+653 -619
dll/win32/jscript/parser.tab.c
··· 1 - /* A Bison parser, made by GNU Bison 3.0. */ 1 + /* A Bison parser, made by GNU Bison 3.4.1. */ 2 2 3 3 /* Bison implementation for Yacc-like parsers in C 4 4 5 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 5 + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, 6 + Inc. 6 7 7 8 This program is free software: you can redistribute it and/or modify 8 9 it under the terms of the GNU General Public License as published by ··· 39 40 There are some unavoidable exceptions within include files to 40 41 define necessary library symbols; they are noted "INFRINGES ON 41 42 USER NAME SPACE" below. */ 43 + 44 + /* Undocumented macros, especially those whose name start with YY_, 45 + are private implementation details. Do not rely on them. */ 42 46 43 47 /* Identify Bison output. */ 44 48 #define YYBISON 1 45 49 46 50 /* Bison version. */ 47 - #define YYBISON_VERSION "3.0" 51 + #define YYBISON_VERSION "3.4.1" 48 52 49 53 /* Skeleton name. */ 50 54 #define YYSKELETON_NAME "yacc.c" ··· 67 71 #define yynerrs parser_nerrs 68 72 69 73 70 - /* Copy the first part of user declarations. */ 71 - #line 19 "parser.y" /* yacc.c:339 */ 74 + /* First part of user prologue. */ 75 + #line 19 "parser.y" 72 76 73 77 74 78 #include "jscript.h" ··· 90 94 statement_t *tail; 91 95 } statement_list_t; 92 96 93 - static literal_t *new_string_literal(parser_ctx_t*,const WCHAR*); 97 + static literal_t *new_string_literal(parser_ctx_t*,jsstr_t*); 94 98 static literal_t *new_null_literal(parser_ctx_t*); 95 99 96 100 typedef struct _property_list_t { ··· 191 195 static source_elements_t *source_elements_add_statement(source_elements_t*,statement_t*); 192 196 193 197 194 - #line 195 "parser.tab.c" /* yacc.c:339 */ 198 + #line 199 "parser.tab.c" 195 199 196 - # ifndef YY_NULL 197 - # if defined __cplusplus && 201103L <= __cplusplus 198 - # define YY_NULL nullptr 200 + # ifndef YY_NULLPTR 201 + # if defined __cplusplus 202 + # if 201103L <= __cplusplus 203 + # define YY_NULLPTR nullptr 204 + # else 205 + # define YY_NULLPTR 0 206 + # endif 199 207 # else 200 - # define YY_NULL 0 208 + # define YY_NULLPTR ((void*)0) 201 209 # endif 202 210 # endif 203 211 ··· 209 217 # define YYERROR_VERBOSE 0 210 218 #endif 211 219 212 - /* In a future release of Bison, this section will be replaced 213 - by #include "parser.tab.h". */ 220 + /* Use api.header.include to #include this header 221 + instead of duplicating it here. */ 214 222 #ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED 215 223 # define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED 216 224 /* Debug traces. */ ··· 278 286 279 287 /* Value type. */ 280 288 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 281 - typedef union YYSTYPE YYSTYPE; 282 289 union YYSTYPE 283 290 { 284 - #line 147 "parser.y" /* yacc.c:355 */ 291 + #line 147 "parser.y" 285 292 286 293 int ival; 287 294 const WCHAR *srcptr; 288 - LPCWSTR wstr; 295 + jsstr_t *str; 289 296 literal_t *literal; 290 297 struct _argument_list_t *argument_list; 291 298 case_clausule_t *case_clausule; ··· 303 310 struct _variable_list_t *variable_list; 304 311 variable_declaration_t *variable_declaration; 305 312 306 - #line 307 "parser.tab.c" /* yacc.c:355 */ 313 + #line 314 "parser.tab.c" 314 + 307 315 }; 316 + typedef union YYSTYPE YYSTYPE; 308 317 # define YYSTYPE_IS_TRIVIAL 1 309 318 # define YYSTYPE_IS_DECLARED 1 310 319 #endif ··· 315 324 316 325 #endif /* !YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED */ 317 326 318 - /* Copy the second part of user declarations. */ 319 327 320 - #line 321 "parser.tab.c" /* yacc.c:358 */ 321 328 322 329 #ifdef short 323 330 # undef short ··· 338 345 #ifdef YYTYPE_UINT16 339 346 typedef YYTYPE_UINT16 yytype_uint16; 340 347 #else 341 - typedef unsigned short int yytype_uint16; 348 + typedef unsigned short yytype_uint16; 342 349 #endif 343 350 344 351 #ifdef YYTYPE_INT16 345 352 typedef YYTYPE_INT16 yytype_int16; 346 353 #else 347 - typedef short int yytype_int16; 354 + typedef short yytype_int16; 348 355 #endif 349 356 350 357 #ifndef YYSIZE_T ··· 356 363 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 357 364 # define YYSIZE_T size_t 358 365 # else 359 - # define YYSIZE_T unsigned int 366 + # define YYSIZE_T unsigned 360 367 # endif 361 368 #endif 362 369 ··· 374 381 # endif 375 382 #endif 376 383 377 - #ifndef __attribute__ 378 - /* This feature is available in gcc versions 2.5 and later. */ 379 - # if (! defined __GNUC__ || __GNUC__ < 2 \ 380 - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) 381 - # define __attribute__(Spec) /* empty */ 384 + #ifndef YY_ATTRIBUTE 385 + # if (defined __GNUC__ \ 386 + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 387 + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 388 + # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 389 + # else 390 + # define YY_ATTRIBUTE(Spec) /* empty */ 382 391 # endif 383 392 #endif 384 393 394 + #ifndef YY_ATTRIBUTE_PURE 395 + # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 396 + #endif 397 + 398 + #ifndef YY_ATTRIBUTE_UNUSED 399 + # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 400 + #endif 401 + 385 402 /* Suppress unused-variable warnings by "using" E. */ 386 403 #if ! defined lint || defined __GNUC__ 387 404 # define YYUSE(E) ((void) (E)) ··· 389 406 # define YYUSE(E) /* empty */ 390 407 #endif 391 408 392 - #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 409 + #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 393 410 /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 394 411 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 395 412 _Pragma ("GCC diagnostic push") \ ··· 408 425 # define YY_INITIAL_VALUE(Value) /* Nothing. */ 409 426 #endif 410 427 428 + 429 + #define YY_ASSERT(E) ((void) (0 && (E))) 411 430 412 431 #if ! defined yyoverflow || YYERROR_VERBOSE 413 432 ··· 551 570 /* YYNSTATES -- Number of states. */ 552 571 #define YYNSTATES 454 553 572 554 - /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned 555 - by yylex, with out-of-bounds checking. */ 556 573 #define YYUNDEFTOK 2 557 574 #define YYMAXUTOK 304 558 575 576 + /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM 577 + as returned by yylex, with out-of-bounds checking. */ 559 578 #define YYTRANSLATE(YYX) \ 560 - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 579 + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 561 580 562 581 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 563 - as returned by yylex, without out-of-bounds checking. */ 582 + as returned by yylex. */ 564 583 static const yytype_uint8 yytranslate[] = 565 584 { 566 585 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, ··· 674 693 "PropertyNameAndValueList", "PropertyDefinition", "GetterSetterMethod", 675 694 "PropertyName", "Identifier_opt", "IdentifierName", 676 695 "ReservedAsIdentifier", "Literal", "BooleanLiteral", "semicolon_opt", 677 - "left_bracket", "right_bracket", "semicolon", YY_NULL 696 + "left_bracket", "right_bracket", "semicolon", YY_NULLPTR 678 697 }; 679 698 #endif 680 699 ··· 1257 1276 1258 1277 #define YYRECOVERING() (!!yyerrstatus) 1259 1278 1260 - #define YYBACKUP(Token, Value) \ 1261 - do \ 1262 - if (yychar == YYEMPTY) \ 1263 - { \ 1264 - yychar = (Token); \ 1265 - yylval = (Value); \ 1266 - YYPOPSTACK (yylen); \ 1267 - yystate = *yyssp; \ 1268 - goto yybackup; \ 1269 - } \ 1270 - else \ 1271 - { \ 1272 - yyerror (ctx, YY_("syntax error: cannot back up")); \ 1273 - YYERROR; \ 1274 - } \ 1275 - while (0) 1279 + #define YYBACKUP(Token, Value) \ 1280 + do \ 1281 + if (yychar == YYEMPTY) \ 1282 + { \ 1283 + yychar = (Token); \ 1284 + yylval = (Value); \ 1285 + YYPOPSTACK (yylen); \ 1286 + yystate = *yyssp; \ 1287 + goto yybackup; \ 1288 + } \ 1289 + else \ 1290 + { \ 1291 + yyerror (ctx, YY_("syntax error: cannot back up")); \ 1292 + YYERROR; \ 1293 + } \ 1294 + while (0) 1276 1295 1277 1296 /* Error token number */ 1278 1297 #define YYTERROR 1 ··· 1312 1331 } while (0) 1313 1332 1314 1333 1315 - /*----------------------------------------. 1316 - | Print this symbol's value on YYOUTPUT. | 1317 - `----------------------------------------*/ 1334 + /*-----------------------------------. 1335 + | Print this symbol's value on YYO. | 1336 + `-----------------------------------*/ 1318 1337 1319 1338 static void 1320 - yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) 1339 + yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) 1321 1340 { 1322 - FILE *yyo = yyoutput; 1323 - YYUSE (yyo); 1341 + FILE *yyoutput = yyo; 1342 + YYUSE (yyoutput); 1324 1343 YYUSE (ctx); 1325 1344 if (!yyvaluep) 1326 1345 return; 1327 1346 # ifdef YYPRINT 1328 1347 if (yytype < YYNTOKENS) 1329 - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 1348 + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); 1330 1349 # endif 1331 1350 YYUSE (yytype); 1332 1351 } 1333 1352 1334 1353 1335 - /*--------------------------------. 1336 - | Print this symbol on YYOUTPUT. | 1337 - `--------------------------------*/ 1354 + /*---------------------------. 1355 + | Print this symbol on YYO. | 1356 + `---------------------------*/ 1338 1357 1339 1358 static void 1340 - yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) 1359 + yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_ctx_t *ctx) 1341 1360 { 1342 - YYFPRINTF (yyoutput, "%s %s (", 1361 + YYFPRINTF (yyo, "%s %s (", 1343 1362 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 1344 1363 1345 - yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx); 1346 - YYFPRINTF (yyoutput, ")"); 1364 + yy_symbol_value_print (yyo, yytype, yyvaluep, ctx); 1365 + YYFPRINTF (yyo, ")"); 1347 1366 } 1348 1367 1349 1368 /*------------------------------------------------------------------. ··· 1377 1396 static void 1378 1397 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_ctx_t *ctx) 1379 1398 { 1380 - unsigned long int yylno = yyrline[yyrule]; 1399 + unsigned long yylno = yyrline[yyrule]; 1381 1400 int yynrhs = yyr2[yyrule]; 1382 1401 int yyi; 1383 1402 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", ··· 1388 1407 YYFPRINTF (stderr, " $%d = ", yyi + 1); 1389 1408 yy_symbol_print (stderr, 1390 1409 yystos[yyssp[yyi + 1 - yynrhs]], 1391 - &(yyvsp[(yyi + 1) - (yynrhs)]) 1410 + &yyvsp[(yyi + 1) - (yynrhs)] 1392 1411 , ctx); 1393 1412 YYFPRINTF (stderr, "\n"); 1394 1413 } ··· 1492 1511 case '\\': 1493 1512 if (*++yyp != '\\') 1494 1513 goto do_not_strip_quotes; 1495 - /* Fall through. */ 1514 + else 1515 + goto append; 1516 + 1517 + append: 1496 1518 default: 1497 1519 if (yyres) 1498 1520 yyres[yyn] = *yyp; ··· 1510 1532 if (! yyres) 1511 1533 return yystrlen (yystr); 1512 1534 1513 - return yystpcpy (yyres, yystr) - yyres; 1535 + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); 1514 1536 } 1515 1537 # endif 1516 1538 ··· 1526 1548 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 1527 1549 yytype_int16 *yyssp, int yytoken) 1528 1550 { 1529 - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); 1551 + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); 1530 1552 YYSIZE_T yysize = yysize0; 1531 1553 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1532 1554 /* Internationalized format string. */ 1533 - const char *yyformat = YY_NULL; 1555 + const char *yyformat = YY_NULLPTR; 1534 1556 /* Arguments of yyformat. */ 1535 1557 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1536 1558 /* Number of reported tokens (one for the "unexpected", one per ··· 1587 1609 } 1588 1610 yyarg[yycount++] = yytname[yyx]; 1589 1611 { 1590 - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); 1591 - if (! (yysize <= yysize1 1592 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1612 + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); 1613 + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) 1614 + yysize = yysize1; 1615 + else 1593 1616 return 2; 1594 - yysize = yysize1; 1595 1617 } 1596 1618 } 1597 1619 } ··· 1603 1625 case N: \ 1604 1626 yyformat = S; \ 1605 1627 break 1628 + default: /* Avoid compiler warnings. */ 1606 1629 YYCASE_(0, YY_("syntax error")); 1607 1630 YYCASE_(1, YY_("syntax error, unexpected %s")); 1608 1631 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); ··· 1614 1637 1615 1638 { 1616 1639 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1617 - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1640 + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) 1641 + yysize = yysize1; 1642 + else 1618 1643 return 2; 1619 - yysize = yysize1; 1620 1644 } 1621 1645 1622 1646 if (*yymsg_alloc < yysize) ··· 1747 1771 yychar = YYEMPTY; /* Cause a token to be read. */ 1748 1772 goto yysetstate; 1749 1773 1774 + 1750 1775 /*------------------------------------------------------------. 1751 - | yynewstate -- Push a new state, which is found in yystate. | 1776 + | yynewstate -- push a new state, which is found in yystate. | 1752 1777 `------------------------------------------------------------*/ 1753 - yynewstate: 1778 + yynewstate: 1754 1779 /* In all cases, when you get here, the value and location stacks 1755 1780 have just been pushed. So pushing a state here evens the stacks. */ 1756 1781 yyssp++; 1757 1782 1758 - yysetstate: 1759 - *yyssp = yystate; 1783 + 1784 + /*--------------------------------------------------------------------. 1785 + | yynewstate -- set current state (the top of the stack) to yystate. | 1786 + `--------------------------------------------------------------------*/ 1787 + yysetstate: 1788 + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1789 + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); 1790 + *yyssp = (yytype_int16) yystate; 1760 1791 1761 1792 if (yyss + yystacksize - 1 <= yyssp) 1793 + #if !defined yyoverflow && !defined YYSTACK_RELOCATE 1794 + goto yyexhaustedlab; 1795 + #else 1762 1796 { 1763 1797 /* Get the current used size of the three stacks, in elements. */ 1764 - YYSIZE_T yysize = yyssp - yyss + 1; 1798 + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); 1765 1799 1766 - #ifdef yyoverflow 1800 + # if defined yyoverflow 1767 1801 { 1768 1802 /* Give user a chance to reallocate the stack. Use copies of 1769 1803 these so that the &'s don't force the real ones into ··· 1779 1813 &yyss1, yysize * sizeof (*yyssp), 1780 1814 &yyvs1, yysize * sizeof (*yyvsp), 1781 1815 &yystacksize); 1782 - 1783 1816 yyss = yyss1; 1784 1817 yyvs = yyvs1; 1785 1818 } 1786 - #else /* no yyoverflow */ 1787 - # ifndef YYSTACK_RELOCATE 1788 - goto yyexhaustedlab; 1789 - # else 1819 + # else /* defined YYSTACK_RELOCATE */ 1790 1820 /* Extend the stack our own way. */ 1791 1821 if (YYMAXDEPTH <= yystacksize) 1792 1822 goto yyexhaustedlab; ··· 1802 1832 goto yyexhaustedlab; 1803 1833 YYSTACK_RELOCATE (yyss_alloc, yyss); 1804 1834 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1805 - # undef YYSTACK_RELOCATE 1835 + # undef YYSTACK_RELOCATE 1806 1836 if (yyss1 != yyssa) 1807 1837 YYSTACK_FREE (yyss1); 1808 1838 } 1809 1839 # endif 1810 - #endif /* no yyoverflow */ 1811 1840 1812 1841 yyssp = yyss + yysize - 1; 1813 1842 yyvsp = yyvs + yysize - 1; 1814 1843 1815 1844 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1816 - (unsigned long int) yystacksize)); 1845 + (unsigned long) yystacksize)); 1817 1846 1818 1847 if (yyss + yystacksize - 1 <= yyssp) 1819 1848 YYABORT; 1820 1849 } 1821 - 1822 - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1850 + #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ 1823 1851 1824 1852 if (yystate == YYFINAL) 1825 1853 YYACCEPT; 1826 1854 1827 1855 goto yybackup; 1828 1856 1857 + 1829 1858 /*-----------. 1830 1859 | yybackup. | 1831 1860 `-----------*/ 1832 1861 yybackup: 1833 - 1834 1862 /* Do appropriate processing given the current state. Read a 1835 1863 lookahead token if we need one and don't already have one. */ 1836 1864 ··· 1888 1916 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1889 1917 *++yyvsp = yylval; 1890 1918 YY_IGNORE_MAYBE_UNINITIALIZED_END 1891 - 1892 1919 goto yynewstate; 1893 1920 1894 1921 ··· 1903 1930 1904 1931 1905 1932 /*-----------------------------. 1906 - | yyreduce -- Do a reduction. | 1933 + | yyreduce -- do a reduction. | 1907 1934 `-----------------------------*/ 1908 1935 yyreduce: 1909 1936 /* yyn is the number of a rule to reduce with. */ ··· 1923 1950 YY_REDUCE_PRINT (yyn); 1924 1951 switch (yyn) 1925 1952 { 1926 - case 2: 1927 - #line 259 "parser.y" /* yacc.c:1646 */ 1953 + case 2: 1954 + #line 259 "parser.y" 1928 1955 { program_parsed(ctx, (yyvsp[-2].source_elements)); } 1929 - #line 1930 "parser.tab.c" /* yacc.c:1646 */ 1956 + #line 1957 "parser.tab.c" 1930 1957 break; 1931 1958 1932 1959 case 3: 1933 - #line 262 "parser.y" /* yacc.c:1646 */ 1960 + #line 262 "parser.y" 1934 1961 {} 1935 - #line 1936 "parser.tab.c" /* yacc.c:1646 */ 1962 + #line 1963 "parser.tab.c" 1936 1963 break; 1937 1964 1938 1965 case 4: 1939 - #line 263 "parser.y" /* yacc.c:1646 */ 1966 + #line 263 "parser.y" 1940 1967 {} 1941 - #line 1942 "parser.tab.c" /* yacc.c:1646 */ 1968 + #line 1969 "parser.tab.c" 1942 1969 break; 1943 1970 1944 1971 case 5: 1945 - #line 267 "parser.y" /* yacc.c:1646 */ 1972 + #line 267 "parser.y" 1946 1973 { (yyval.source_elements) = new_source_elements(ctx); } 1947 - #line 1948 "parser.tab.c" /* yacc.c:1646 */ 1974 + #line 1975 "parser.tab.c" 1948 1975 break; 1949 1976 1950 1977 case 6: 1951 - #line 269 "parser.y" /* yacc.c:1646 */ 1978 + #line 269 "parser.y" 1952 1979 { (yyval.source_elements) = source_elements_add_statement((yyvsp[-1].source_elements), (yyvsp[0].statement)); } 1953 - #line 1954 "parser.tab.c" /* yacc.c:1646 */ 1980 + #line 1981 "parser.tab.c" 1954 1981 break; 1955 1982 1956 1983 case 7: 1957 - #line 274 "parser.y" /* yacc.c:1646 */ 1984 + #line 274 "parser.y" 1958 1985 { (yyval.expr) = new_function_expression(ctx, NULL, (yyvsp[-4].parameter_list), (yyvsp[-1].source_elements), NULL, (yyvsp[-6].srcptr), (yyvsp[0].srcptr)-(yyvsp[-6].srcptr)+1); } 1959 - #line 1960 "parser.tab.c" /* yacc.c:1646 */ 1986 + #line 1987 "parser.tab.c" 1960 1987 break; 1961 1988 1962 1989 case 8: 1963 - #line 276 "parser.y" /* yacc.c:1646 */ 1990 + #line 276 "parser.y" 1964 1991 { (yyval.expr) = new_function_expression(ctx, (yyvsp[-6].identifier), (yyvsp[-4].parameter_list), (yyvsp[-1].source_elements), NULL, (yyvsp[-7].srcptr), (yyvsp[0].srcptr)-(yyvsp[-7].srcptr)+1); } 1965 - #line 1966 "parser.tab.c" /* yacc.c:1646 */ 1992 + #line 1993 "parser.tab.c" 1966 1993 break; 1967 1994 1968 1995 case 9: 1969 - #line 278 "parser.y" /* yacc.c:1646 */ 1996 + #line 278 "parser.y" 1970 1997 { (yyval.expr) = new_function_expression(ctx, (yyvsp[-6].identifier), (yyvsp[-4].parameter_list), (yyvsp[-1].source_elements), (yyvsp[-8].identifier), (yyvsp[-9].srcptr), (yyvsp[0].srcptr)-(yyvsp[-9].srcptr)+1); } 1971 - #line 1972 "parser.tab.c" /* yacc.c:1646 */ 1998 + #line 1999 "parser.tab.c" 1972 1999 break; 1973 2000 1974 2001 case 10: 1975 - #line 281 "parser.y" /* yacc.c:1646 */ 2002 + #line 281 "parser.y" 1976 2003 { (yyval.srcptr) = ctx->ptr - 8; } 1977 - #line 1978 "parser.tab.c" /* yacc.c:1646 */ 2004 + #line 2005 "parser.tab.c" 1978 2005 break; 1979 2006 1980 2007 case 11: 1981 - #line 285 "parser.y" /* yacc.c:1646 */ 2008 + #line 285 "parser.y" 1982 2009 { (yyval.source_elements) = (yyvsp[0].source_elements); } 1983 - #line 1984 "parser.tab.c" /* yacc.c:1646 */ 2010 + #line 2011 "parser.tab.c" 1984 2011 break; 1985 2012 1986 2013 case 12: 1987 - #line 289 "parser.y" /* yacc.c:1646 */ 2014 + #line 289 "parser.y" 1988 2015 { (yyval.parameter_list) = new_parameter_list(ctx, (yyvsp[0].identifier)); } 1989 - #line 1990 "parser.tab.c" /* yacc.c:1646 */ 2016 + #line 2017 "parser.tab.c" 1990 2017 break; 1991 2018 1992 2019 case 13: 1993 - #line 291 "parser.y" /* yacc.c:1646 */ 2020 + #line 291 "parser.y" 1994 2021 { (yyval.parameter_list) = parameter_list_add(ctx, (yyvsp[-2].parameter_list), (yyvsp[0].identifier)); } 1995 - #line 1996 "parser.tab.c" /* yacc.c:1646 */ 2022 + #line 2023 "parser.tab.c" 1996 2023 break; 1997 2024 1998 2025 case 14: 1999 - #line 295 "parser.y" /* yacc.c:1646 */ 2026 + #line 295 "parser.y" 2000 2027 { (yyval.parameter_list) = NULL; } 2001 - #line 2002 "parser.tab.c" /* yacc.c:1646 */ 2028 + #line 2029 "parser.tab.c" 2002 2029 break; 2003 2030 2004 2031 case 15: 2005 - #line 296 "parser.y" /* yacc.c:1646 */ 2032 + #line 296 "parser.y" 2006 2033 { (yyval.parameter_list) = (yyvsp[0].parameter_list); } 2007 - #line 2008 "parser.tab.c" /* yacc.c:1646 */ 2034 + #line 2035 "parser.tab.c" 2008 2035 break; 2009 2036 2010 2037 case 16: 2011 - #line 300 "parser.y" /* yacc.c:1646 */ 2038 + #line 300 "parser.y" 2012 2039 { (yyval.statement) = (yyvsp[0].statement); } 2013 - #line 2014 "parser.tab.c" /* yacc.c:1646 */ 2040 + #line 2041 "parser.tab.c" 2014 2041 break; 2015 2042 2016 2043 case 17: 2017 - #line 301 "parser.y" /* yacc.c:1646 */ 2044 + #line 301 "parser.y" 2018 2045 { (yyval.statement) = (yyvsp[0].statement); } 2019 - #line 2020 "parser.tab.c" /* yacc.c:1646 */ 2046 + #line 2047 "parser.tab.c" 2020 2047 break; 2021 2048 2022 2049 case 18: 2023 - #line 302 "parser.y" /* yacc.c:1646 */ 2050 + #line 302 "parser.y" 2024 2051 { (yyval.statement) = (yyvsp[0].statement); } 2025 - #line 2026 "parser.tab.c" /* yacc.c:1646 */ 2052 + #line 2053 "parser.tab.c" 2026 2053 break; 2027 2054 2028 2055 case 19: 2029 - #line 303 "parser.y" /* yacc.c:1646 */ 2056 + #line 303 "parser.y" 2030 2057 { (yyval.statement) = new_expression_statement(ctx, (yyvsp[0].expr)); } 2031 - #line 2032 "parser.tab.c" /* yacc.c:1646 */ 2058 + #line 2059 "parser.tab.c" 2032 2059 break; 2033 2060 2034 2061 case 20: 2035 - #line 304 "parser.y" /* yacc.c:1646 */ 2062 + #line 304 "parser.y" 2036 2063 { (yyval.statement) = (yyvsp[0].statement); } 2037 - #line 2038 "parser.tab.c" /* yacc.c:1646 */ 2064 + #line 2065 "parser.tab.c" 2038 2065 break; 2039 2066 2040 2067 case 21: 2041 - #line 305 "parser.y" /* yacc.c:1646 */ 2068 + #line 305 "parser.y" 2042 2069 { (yyval.statement) = (yyvsp[0].statement); } 2043 - #line 2044 "parser.tab.c" /* yacc.c:1646 */ 2070 + #line 2071 "parser.tab.c" 2044 2071 break; 2045 2072 2046 2073 case 22: 2047 - #line 306 "parser.y" /* yacc.c:1646 */ 2074 + #line 306 "parser.y" 2048 2075 { (yyval.statement) = (yyvsp[0].statement); } 2049 - #line 2050 "parser.tab.c" /* yacc.c:1646 */ 2076 + #line 2077 "parser.tab.c" 2050 2077 break; 2051 2078 2052 2079 case 23: 2053 - #line 307 "parser.y" /* yacc.c:1646 */ 2080 + #line 307 "parser.y" 2054 2081 { (yyval.statement) = (yyvsp[0].statement); } 2055 - #line 2056 "parser.tab.c" /* yacc.c:1646 */ 2082 + #line 2083 "parser.tab.c" 2056 2083 break; 2057 2084 2058 2085 case 24: 2059 - #line 308 "parser.y" /* yacc.c:1646 */ 2086 + #line 308 "parser.y" 2060 2087 { (yyval.statement) = (yyvsp[0].statement); } 2061 - #line 2062 "parser.tab.c" /* yacc.c:1646 */ 2088 + #line 2089 "parser.tab.c" 2062 2089 break; 2063 2090 2064 2091 case 25: 2065 - #line 309 "parser.y" /* yacc.c:1646 */ 2092 + #line 309 "parser.y" 2066 2093 { (yyval.statement) = (yyvsp[0].statement); } 2067 - #line 2068 "parser.tab.c" /* yacc.c:1646 */ 2094 + #line 2095 "parser.tab.c" 2068 2095 break; 2069 2096 2070 2097 case 26: 2071 - #line 310 "parser.y" /* yacc.c:1646 */ 2098 + #line 310 "parser.y" 2072 2099 { (yyval.statement) = (yyvsp[0].statement); } 2073 - #line 2074 "parser.tab.c" /* yacc.c:1646 */ 2100 + #line 2101 "parser.tab.c" 2074 2101 break; 2075 2102 2076 2103 case 27: 2077 - #line 311 "parser.y" /* yacc.c:1646 */ 2104 + #line 311 "parser.y" 2078 2105 { (yyval.statement) = (yyvsp[0].statement); } 2079 - #line 2080 "parser.tab.c" /* yacc.c:1646 */ 2106 + #line 2107 "parser.tab.c" 2080 2107 break; 2081 2108 2082 2109 case 28: 2083 - #line 312 "parser.y" /* yacc.c:1646 */ 2110 + #line 312 "parser.y" 2084 2111 { (yyval.statement) = (yyvsp[0].statement); } 2085 - #line 2086 "parser.tab.c" /* yacc.c:1646 */ 2112 + #line 2113 "parser.tab.c" 2086 2113 break; 2087 2114 2088 2115 case 29: 2089 - #line 313 "parser.y" /* yacc.c:1646 */ 2116 + #line 313 "parser.y" 2090 2117 { (yyval.statement) = (yyvsp[0].statement); } 2091 - #line 2092 "parser.tab.c" /* yacc.c:1646 */ 2118 + #line 2119 "parser.tab.c" 2092 2119 break; 2093 2120 2094 2121 case 30: 2095 - #line 314 "parser.y" /* yacc.c:1646 */ 2122 + #line 314 "parser.y" 2096 2123 { (yyval.statement) = (yyvsp[0].statement); } 2097 - #line 2098 "parser.tab.c" /* yacc.c:1646 */ 2124 + #line 2125 "parser.tab.c" 2098 2125 break; 2099 2126 2100 2127 case 31: 2101 - #line 318 "parser.y" /* yacc.c:1646 */ 2128 + #line 318 "parser.y" 2102 2129 { (yyval.statement_list) = new_statement_list(ctx, (yyvsp[0].statement)); } 2103 - #line 2104 "parser.tab.c" /* yacc.c:1646 */ 2130 + #line 2131 "parser.tab.c" 2104 2131 break; 2105 2132 2106 2133 case 32: 2107 - #line 320 "parser.y" /* yacc.c:1646 */ 2134 + #line 320 "parser.y" 2108 2135 { (yyval.statement_list) = statement_list_add((yyvsp[-1].statement_list), (yyvsp[0].statement)); } 2109 - #line 2110 "parser.tab.c" /* yacc.c:1646 */ 2136 + #line 2137 "parser.tab.c" 2110 2137 break; 2111 2138 2112 2139 case 33: 2113 - #line 324 "parser.y" /* yacc.c:1646 */ 2140 + #line 324 "parser.y" 2114 2141 { (yyval.statement_list) = NULL; } 2115 - #line 2116 "parser.tab.c" /* yacc.c:1646 */ 2142 + #line 2143 "parser.tab.c" 2116 2143 break; 2117 2144 2118 2145 case 34: 2119 - #line 325 "parser.y" /* yacc.c:1646 */ 2146 + #line 325 "parser.y" 2120 2147 { (yyval.statement_list) = (yyvsp[0].statement_list); } 2121 - #line 2122 "parser.tab.c" /* yacc.c:1646 */ 2148 + #line 2149 "parser.tab.c" 2122 2149 break; 2123 2150 2124 2151 case 35: 2125 - #line 329 "parser.y" /* yacc.c:1646 */ 2152 + #line 329 "parser.y" 2126 2153 { (yyval.statement) = new_block_statement(ctx, (yyvsp[-1].statement_list)); } 2127 - #line 2128 "parser.tab.c" /* yacc.c:1646 */ 2154 + #line 2155 "parser.tab.c" 2128 2155 break; 2129 2156 2130 2157 case 36: 2131 - #line 330 "parser.y" /* yacc.c:1646 */ 2158 + #line 330 "parser.y" 2132 2159 { (yyval.statement) = new_block_statement(ctx, NULL); } 2133 - #line 2134 "parser.tab.c" /* yacc.c:1646 */ 2160 + #line 2161 "parser.tab.c" 2134 2161 break; 2135 2162 2136 2163 case 37: 2137 - #line 335 "parser.y" /* yacc.c:1646 */ 2164 + #line 335 "parser.y" 2138 2165 { (yyval.statement) = new_var_statement(ctx, (yyvsp[-1].variable_list)); } 2139 - #line 2140 "parser.tab.c" /* yacc.c:1646 */ 2166 + #line 2167 "parser.tab.c" 2140 2167 break; 2141 2168 2142 2169 case 38: 2143 - #line 339 "parser.y" /* yacc.c:1646 */ 2170 + #line 339 "parser.y" 2144 2171 { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[0].variable_declaration)); } 2145 - #line 2146 "parser.tab.c" /* yacc.c:1646 */ 2172 + #line 2173 "parser.tab.c" 2146 2173 break; 2147 2174 2148 2175 case 39: 2149 - #line 341 "parser.y" /* yacc.c:1646 */ 2176 + #line 341 "parser.y" 2150 2177 { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[-2].variable_list), (yyvsp[0].variable_declaration)); } 2151 - #line 2152 "parser.tab.c" /* yacc.c:1646 */ 2178 + #line 2179 "parser.tab.c" 2152 2179 break; 2153 2180 2154 2181 case 40: 2155 - #line 346 "parser.y" /* yacc.c:1646 */ 2182 + #line 346 "parser.y" 2156 2183 { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[0].variable_declaration)); } 2157 - #line 2158 "parser.tab.c" /* yacc.c:1646 */ 2184 + #line 2185 "parser.tab.c" 2158 2185 break; 2159 2186 2160 2187 case 41: 2161 - #line 348 "parser.y" /* yacc.c:1646 */ 2188 + #line 348 "parser.y" 2162 2189 { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[-2].variable_list), (yyvsp[0].variable_declaration)); } 2163 - #line 2164 "parser.tab.c" /* yacc.c:1646 */ 2190 + #line 2191 "parser.tab.c" 2164 2191 break; 2165 2192 2166 2193 case 42: 2167 - #line 353 "parser.y" /* yacc.c:1646 */ 2194 + #line 353 "parser.y" 2168 2195 { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[-1].identifier), (yyvsp[0].expr)); } 2169 - #line 2170 "parser.tab.c" /* yacc.c:1646 */ 2196 + #line 2197 "parser.tab.c" 2170 2197 break; 2171 2198 2172 2199 case 43: 2173 - #line 358 "parser.y" /* yacc.c:1646 */ 2200 + #line 358 "parser.y" 2174 2201 { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[-1].identifier), (yyvsp[0].expr)); } 2175 - #line 2176 "parser.tab.c" /* yacc.c:1646 */ 2202 + #line 2203 "parser.tab.c" 2176 2203 break; 2177 2204 2178 2205 case 44: 2179 - #line 362 "parser.y" /* yacc.c:1646 */ 2206 + #line 362 "parser.y" 2180 2207 { (yyval.expr) = NULL; } 2181 - #line 2182 "parser.tab.c" /* yacc.c:1646 */ 2208 + #line 2209 "parser.tab.c" 2182 2209 break; 2183 2210 2184 2211 case 45: 2185 - #line 363 "parser.y" /* yacc.c:1646 */ 2212 + #line 363 "parser.y" 2186 2213 { (yyval.expr) = (yyvsp[0].expr); } 2187 - #line 2188 "parser.tab.c" /* yacc.c:1646 */ 2214 + #line 2215 "parser.tab.c" 2188 2215 break; 2189 2216 2190 2217 case 46: 2191 - #line 368 "parser.y" /* yacc.c:1646 */ 2218 + #line 368 "parser.y" 2192 2219 { (yyval.expr) = (yyvsp[0].expr); } 2193 - #line 2194 "parser.tab.c" /* yacc.c:1646 */ 2220 + #line 2221 "parser.tab.c" 2194 2221 break; 2195 2222 2196 2223 case 47: 2197 - #line 372 "parser.y" /* yacc.c:1646 */ 2224 + #line 372 "parser.y" 2198 2225 { (yyval.expr) = NULL; } 2199 - #line 2200 "parser.tab.c" /* yacc.c:1646 */ 2226 + #line 2227 "parser.tab.c" 2200 2227 break; 2201 2228 2202 2229 case 48: 2203 - #line 373 "parser.y" /* yacc.c:1646 */ 2230 + #line 373 "parser.y" 2204 2231 { (yyval.expr) = (yyvsp[0].expr); } 2205 - #line 2206 "parser.tab.c" /* yacc.c:1646 */ 2232 + #line 2233 "parser.tab.c" 2206 2233 break; 2207 2234 2208 2235 case 49: 2209 - #line 378 "parser.y" /* yacc.c:1646 */ 2236 + #line 378 "parser.y" 2210 2237 { (yyval.expr) = (yyvsp[0].expr); } 2211 - #line 2212 "parser.tab.c" /* yacc.c:1646 */ 2238 + #line 2239 "parser.tab.c" 2212 2239 break; 2213 2240 2214 2241 case 50: 2215 - #line 382 "parser.y" /* yacc.c:1646 */ 2242 + #line 382 "parser.y" 2216 2243 { (yyval.statement) = new_statement(ctx, STAT_EMPTY, 0); } 2217 - #line 2218 "parser.tab.c" /* yacc.c:1646 */ 2244 + #line 2245 "parser.tab.c" 2218 2245 break; 2219 2246 2220 2247 case 51: 2221 - #line 387 "parser.y" /* yacc.c:1646 */ 2248 + #line 387 "parser.y" 2222 2249 { (yyval.statement) = new_expression_statement(ctx, (yyvsp[-1].expr)); } 2223 - #line 2224 "parser.tab.c" /* yacc.c:1646 */ 2250 + #line 2251 "parser.tab.c" 2224 2251 break; 2225 2252 2226 2253 case 52: 2227 - #line 392 "parser.y" /* yacc.c:1646 */ 2254 + #line 392 "parser.y" 2228 2255 { (yyval.statement) = new_if_statement(ctx, (yyvsp[-4].expr), (yyvsp[-2].statement), (yyvsp[0].statement)); } 2229 - #line 2230 "parser.tab.c" /* yacc.c:1646 */ 2256 + #line 2257 "parser.tab.c" 2230 2257 break; 2231 2258 2232 2259 case 53: 2233 - #line 394 "parser.y" /* yacc.c:1646 */ 2260 + #line 394 "parser.y" 2234 2261 { (yyval.statement) = new_if_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].statement), NULL); } 2235 - #line 2236 "parser.tab.c" /* yacc.c:1646 */ 2262 + #line 2263 "parser.tab.c" 2236 2263 break; 2237 2264 2238 2265 case 54: 2239 - #line 399 "parser.y" /* yacc.c:1646 */ 2266 + #line 399 "parser.y" 2240 2267 { (yyval.statement) = new_while_statement(ctx, TRUE, (yyvsp[-2].expr), (yyvsp[-5].statement)); } 2241 - #line 2242 "parser.tab.c" /* yacc.c:1646 */ 2268 + #line 2269 "parser.tab.c" 2242 2269 break; 2243 2270 2244 2271 case 55: 2245 - #line 401 "parser.y" /* yacc.c:1646 */ 2272 + #line 401 "parser.y" 2246 2273 { (yyval.statement) = new_while_statement(ctx, FALSE, (yyvsp[-2].expr), (yyvsp[0].statement)); } 2247 - #line 2248 "parser.tab.c" /* yacc.c:1646 */ 2274 + #line 2275 "parser.tab.c" 2248 2275 break; 2249 2276 2250 2277 case 56: 2251 - #line 403 "parser.y" /* yacc.c:1646 */ 2278 + #line 403 "parser.y" 2252 2279 { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; } 2253 - #line 2254 "parser.tab.c" /* yacc.c:1646 */ 2280 + #line 2281 "parser.tab.c" 2254 2281 break; 2255 2282 2256 2283 case 57: 2257 - #line 405 "parser.y" /* yacc.c:1646 */ 2284 + #line 405 "parser.y" 2258 2285 { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; } 2259 - #line 2260 "parser.tab.c" /* yacc.c:1646 */ 2286 + #line 2287 "parser.tab.c" 2260 2287 break; 2261 2288 2262 2289 case 58: 2263 - #line 407 "parser.y" /* yacc.c:1646 */ 2290 + #line 407 "parser.y" 2264 2291 { (yyval.statement) = new_for_statement(ctx, NULL, (yyvsp[-8].expr), (yyvsp[-5].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); } 2265 - #line 2266 "parser.tab.c" /* yacc.c:1646 */ 2292 + #line 2293 "parser.tab.c" 2266 2293 break; 2267 2294 2268 2295 case 59: 2269 - #line 409 "parser.y" /* yacc.c:1646 */ 2296 + #line 409 "parser.y" 2270 2297 { if(!explicit_error(ctx, (yyvsp[0].variable_list), ';')) YYABORT; } 2271 - #line 2272 "parser.tab.c" /* yacc.c:1646 */ 2298 + #line 2299 "parser.tab.c" 2272 2299 break; 2273 2300 2274 2301 case 60: 2275 - #line 411 "parser.y" /* yacc.c:1646 */ 2302 + #line 411 "parser.y" 2276 2303 { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; } 2277 - #line 2278 "parser.tab.c" /* yacc.c:1646 */ 2304 + #line 2305 "parser.tab.c" 2278 2305 break; 2279 2306 2280 2307 case 61: 2281 - #line 413 "parser.y" /* yacc.c:1646 */ 2308 + #line 413 "parser.y" 2282 2309 { (yyval.statement) = new_for_statement(ctx, (yyvsp[-8].variable_list), NULL, (yyvsp[-5].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); } 2283 - #line 2284 "parser.tab.c" /* yacc.c:1646 */ 2310 + #line 2311 "parser.tab.c" 2284 2311 break; 2285 2312 2286 2313 case 62: 2287 - #line 415 "parser.y" /* yacc.c:1646 */ 2314 + #line 415 "parser.y" 2288 2315 { (yyval.statement) = new_forin_statement(ctx, NULL, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); } 2289 - #line 2290 "parser.tab.c" /* yacc.c:1646 */ 2316 + #line 2317 "parser.tab.c" 2290 2317 break; 2291 2318 2292 2319 case 63: 2293 - #line 417 "parser.y" /* yacc.c:1646 */ 2320 + #line 417 "parser.y" 2294 2321 { (yyval.statement) = new_forin_statement(ctx, (yyvsp[-4].variable_declaration), NULL, (yyvsp[-2].expr), (yyvsp[0].statement)); } 2295 - #line 2296 "parser.tab.c" /* yacc.c:1646 */ 2322 + #line 2323 "parser.tab.c" 2296 2323 break; 2297 2324 2298 2325 case 64: 2299 - #line 422 "parser.y" /* yacc.c:1646 */ 2326 + #line 422 "parser.y" 2300 2327 { (yyval.statement) = new_continue_statement(ctx, (yyvsp[-1].identifier)); } 2301 - #line 2302 "parser.tab.c" /* yacc.c:1646 */ 2328 + #line 2329 "parser.tab.c" 2302 2329 break; 2303 2330 2304 2331 case 65: 2305 - #line 427 "parser.y" /* yacc.c:1646 */ 2332 + #line 427 "parser.y" 2306 2333 { (yyval.statement) = new_break_statement(ctx, (yyvsp[-1].identifier)); } 2307 - #line 2308 "parser.tab.c" /* yacc.c:1646 */ 2334 + #line 2335 "parser.tab.c" 2308 2335 break; 2309 2336 2310 2337 case 66: 2311 - #line 432 "parser.y" /* yacc.c:1646 */ 2338 + #line 432 "parser.y" 2312 2339 { (yyval.statement) = new_return_statement(ctx, (yyvsp[-1].expr)); } 2313 - #line 2314 "parser.tab.c" /* yacc.c:1646 */ 2340 + #line 2341 "parser.tab.c" 2314 2341 break; 2315 2342 2316 2343 case 67: 2317 - #line 437 "parser.y" /* yacc.c:1646 */ 2344 + #line 437 "parser.y" 2318 2345 { (yyval.statement) = new_with_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].statement)); } 2319 - #line 2320 "parser.tab.c" /* yacc.c:1646 */ 2346 + #line 2347 "parser.tab.c" 2320 2347 break; 2321 2348 2322 2349 case 68: 2323 - #line 442 "parser.y" /* yacc.c:1646 */ 2350 + #line 442 "parser.y" 2324 2351 { (yyval.statement) = new_labelled_statement(ctx, (yyvsp[-2].identifier), (yyvsp[0].statement)); } 2325 - #line 2326 "parser.tab.c" /* yacc.c:1646 */ 2352 + #line 2353 "parser.tab.c" 2326 2353 break; 2327 2354 2328 2355 case 69: 2329 - #line 447 "parser.y" /* yacc.c:1646 */ 2356 + #line 447 "parser.y" 2330 2357 { (yyval.statement) = new_switch_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].case_clausule)); } 2331 - #line 2332 "parser.tab.c" /* yacc.c:1646 */ 2358 + #line 2359 "parser.tab.c" 2332 2359 break; 2333 2360 2334 2361 case 70: 2335 - #line 452 "parser.y" /* yacc.c:1646 */ 2362 + #line 452 "parser.y" 2336 2363 { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[-1].case_list), NULL, NULL); } 2337 - #line 2338 "parser.tab.c" /* yacc.c:1646 */ 2364 + #line 2365 "parser.tab.c" 2338 2365 break; 2339 2366 2340 2367 case 71: 2341 - #line 454 "parser.y" /* yacc.c:1646 */ 2368 + #line 454 "parser.y" 2342 2369 { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[-3].case_list), (yyvsp[-2].case_clausule), (yyvsp[-1].case_list)); } 2343 - #line 2344 "parser.tab.c" /* yacc.c:1646 */ 2370 + #line 2371 "parser.tab.c" 2344 2371 break; 2345 2372 2346 2373 case 72: 2347 - #line 458 "parser.y" /* yacc.c:1646 */ 2374 + #line 458 "parser.y" 2348 2375 { (yyval.case_list) = NULL; } 2349 - #line 2350 "parser.tab.c" /* yacc.c:1646 */ 2376 + #line 2377 "parser.tab.c" 2350 2377 break; 2351 2378 2352 2379 case 73: 2353 - #line 459 "parser.y" /* yacc.c:1646 */ 2380 + #line 459 "parser.y" 2354 2381 { (yyval.case_list) = (yyvsp[0].case_list); } 2355 - #line 2356 "parser.tab.c" /* yacc.c:1646 */ 2382 + #line 2383 "parser.tab.c" 2356 2383 break; 2357 2384 2358 2385 case 74: 2359 - #line 463 "parser.y" /* yacc.c:1646 */ 2386 + #line 463 "parser.y" 2360 2387 { (yyval.case_list) = new_case_list(ctx, (yyvsp[0].case_clausule)); } 2361 - #line 2362 "parser.tab.c" /* yacc.c:1646 */ 2388 + #line 2389 "parser.tab.c" 2362 2389 break; 2363 2390 2364 2391 case 75: 2365 - #line 465 "parser.y" /* yacc.c:1646 */ 2392 + #line 465 "parser.y" 2366 2393 { (yyval.case_list) = case_list_add(ctx, (yyvsp[-1].case_list), (yyvsp[0].case_clausule)); } 2367 - #line 2368 "parser.tab.c" /* yacc.c:1646 */ 2394 + #line 2395 "parser.tab.c" 2368 2395 break; 2369 2396 2370 2397 case 76: 2371 - #line 470 "parser.y" /* yacc.c:1646 */ 2398 + #line 470 "parser.y" 2372 2399 { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[-2].expr), (yyvsp[0].statement_list)); } 2373 - #line 2374 "parser.tab.c" /* yacc.c:1646 */ 2400 + #line 2401 "parser.tab.c" 2374 2401 break; 2375 2402 2376 2403 case 77: 2377 - #line 475 "parser.y" /* yacc.c:1646 */ 2404 + #line 475 "parser.y" 2378 2405 { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[0].statement_list)); } 2379 - #line 2380 "parser.tab.c" /* yacc.c:1646 */ 2406 + #line 2407 "parser.tab.c" 2380 2407 break; 2381 2408 2382 2409 case 78: 2383 - #line 480 "parser.y" /* yacc.c:1646 */ 2410 + #line 480 "parser.y" 2384 2411 { (yyval.statement) = new_throw_statement(ctx, (yyvsp[-1].expr)); } 2385 - #line 2386 "parser.tab.c" /* yacc.c:1646 */ 2412 + #line 2413 "parser.tab.c" 2386 2413 break; 2387 2414 2388 2415 case 79: 2389 - #line 484 "parser.y" /* yacc.c:1646 */ 2416 + #line 484 "parser.y" 2390 2417 { (yyval.statement) = new_try_statement(ctx, (yyvsp[-1].statement), (yyvsp[0].catch_block), NULL); } 2391 - #line 2392 "parser.tab.c" /* yacc.c:1646 */ 2418 + #line 2419 "parser.tab.c" 2392 2419 break; 2393 2420 2394 2421 case 80: 2395 - #line 485 "parser.y" /* yacc.c:1646 */ 2422 + #line 485 "parser.y" 2396 2423 { (yyval.statement) = new_try_statement(ctx, (yyvsp[-1].statement), NULL, (yyvsp[0].statement)); } 2397 - #line 2398 "parser.tab.c" /* yacc.c:1646 */ 2424 + #line 2425 "parser.tab.c" 2398 2425 break; 2399 2426 2400 2427 case 81: 2401 - #line 487 "parser.y" /* yacc.c:1646 */ 2428 + #line 487 "parser.y" 2402 2429 { (yyval.statement) = new_try_statement(ctx, (yyvsp[-2].statement), (yyvsp[-1].catch_block), (yyvsp[0].statement)); } 2403 - #line 2404 "parser.tab.c" /* yacc.c:1646 */ 2430 + #line 2431 "parser.tab.c" 2404 2431 break; 2405 2432 2406 2433 case 82: 2407 - #line 492 "parser.y" /* yacc.c:1646 */ 2434 + #line 492 "parser.y" 2408 2435 { (yyval.catch_block) = new_catch_block(ctx, (yyvsp[-2].identifier), (yyvsp[0].statement)); } 2409 - #line 2410 "parser.tab.c" /* yacc.c:1646 */ 2436 + #line 2437 "parser.tab.c" 2410 2437 break; 2411 2438 2412 2439 case 83: 2413 - #line 496 "parser.y" /* yacc.c:1646 */ 2440 + #line 496 "parser.y" 2414 2441 { (yyval.statement) = (yyvsp[0].statement); } 2415 - #line 2416 "parser.tab.c" /* yacc.c:1646 */ 2442 + #line 2443 "parser.tab.c" 2416 2443 break; 2417 2444 2418 2445 case 84: 2419 - #line 500 "parser.y" /* yacc.c:1646 */ 2446 + #line 500 "parser.y" 2420 2447 { (yyval.expr) = NULL; } 2421 - #line 2422 "parser.tab.c" /* yacc.c:1646 */ 2448 + #line 2449 "parser.tab.c" 2422 2449 break; 2423 2450 2424 2451 case 85: 2425 - #line 501 "parser.y" /* yacc.c:1646 */ 2452 + #line 501 "parser.y" 2426 2453 { (yyval.expr) = (yyvsp[0].expr); } 2427 - #line 2428 "parser.tab.c" /* yacc.c:1646 */ 2454 + #line 2455 "parser.tab.c" 2428 2455 break; 2429 2456 2430 2457 case 86: 2431 - #line 504 "parser.y" /* yacc.c:1646 */ 2458 + #line 504 "parser.y" 2432 2459 { (yyval.expr) = (yyvsp[0].expr); } 2433 - #line 2434 "parser.tab.c" /* yacc.c:1646 */ 2460 + #line 2461 "parser.tab.c" 2434 2461 break; 2435 2462 2436 2463 case 87: 2437 - #line 505 "parser.y" /* yacc.c:1646 */ 2464 + #line 505 "parser.y" 2438 2465 { set_error(ctx, JS_E_SYNTAX); YYABORT; } 2439 - #line 2440 "parser.tab.c" /* yacc.c:1646 */ 2466 + #line 2467 "parser.tab.c" 2440 2467 break; 2441 2468 2442 2469 case 88: 2443 - #line 509 "parser.y" /* yacc.c:1646 */ 2470 + #line 509 "parser.y" 2444 2471 { (yyval.expr) = (yyvsp[0].expr); } 2445 - #line 2446 "parser.tab.c" /* yacc.c:1646 */ 2472 + #line 2473 "parser.tab.c" 2446 2473 break; 2447 2474 2448 2475 case 89: 2449 - #line 511 "parser.y" /* yacc.c:1646 */ 2476 + #line 511 "parser.y" 2450 2477 { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2451 - #line 2452 "parser.tab.c" /* yacc.c:1646 */ 2478 + #line 2479 "parser.tab.c" 2452 2479 break; 2453 2480 2454 2481 case 90: 2455 - #line 515 "parser.y" /* yacc.c:1646 */ 2482 + #line 515 "parser.y" 2456 2483 { (yyval.expr) = NULL; } 2457 - #line 2458 "parser.tab.c" /* yacc.c:1646 */ 2484 + #line 2485 "parser.tab.c" 2458 2485 break; 2459 2486 2460 2487 case 91: 2461 - #line 516 "parser.y" /* yacc.c:1646 */ 2488 + #line 516 "parser.y" 2462 2489 { (yyval.expr) = (yyvsp[0].expr); } 2463 - #line 2464 "parser.tab.c" /* yacc.c:1646 */ 2490 + #line 2491 "parser.tab.c" 2464 2491 break; 2465 2492 2466 2493 case 92: 2467 - #line 521 "parser.y" /* yacc.c:1646 */ 2494 + #line 521 "parser.y" 2468 2495 { (yyval.expr) = (yyvsp[0].expr); } 2469 - #line 2470 "parser.tab.c" /* yacc.c:1646 */ 2496 + #line 2497 "parser.tab.c" 2470 2497 break; 2471 2498 2472 2499 case 93: 2473 - #line 523 "parser.y" /* yacc.c:1646 */ 2500 + #line 523 "parser.y" 2474 2501 { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2475 - #line 2476 "parser.tab.c" /* yacc.c:1646 */ 2502 + #line 2503 "parser.tab.c" 2476 2503 break; 2477 2504 2478 2505 case 94: 2479 - #line 526 "parser.y" /* yacc.c:1646 */ 2506 + #line 526 "parser.y" 2480 2507 { (yyval.ival) = (yyvsp[0].ival); } 2481 - #line 2482 "parser.tab.c" /* yacc.c:1646 */ 2508 + #line 2509 "parser.tab.c" 2482 2509 break; 2483 2510 2484 2511 case 95: 2485 - #line 527 "parser.y" /* yacc.c:1646 */ 2512 + #line 527 "parser.y" 2486 2513 { (yyval.ival) = EXPR_ASSIGNDIV; } 2487 - #line 2488 "parser.tab.c" /* yacc.c:1646 */ 2514 + #line 2515 "parser.tab.c" 2488 2515 break; 2489 2516 2490 2517 case 96: 2491 - #line 531 "parser.y" /* yacc.c:1646 */ 2518 + #line 531 "parser.y" 2492 2519 { (yyval.expr) = (yyvsp[0].expr); } 2493 - #line 2494 "parser.tab.c" /* yacc.c:1646 */ 2520 + #line 2521 "parser.tab.c" 2494 2521 break; 2495 2522 2496 2523 case 97: 2497 - #line 533 "parser.y" /* yacc.c:1646 */ 2524 + #line 533 "parser.y" 2498 2525 { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2499 - #line 2500 "parser.tab.c" /* yacc.c:1646 */ 2526 + #line 2527 "parser.tab.c" 2500 2527 break; 2501 2528 2502 2529 case 98: 2503 - #line 535 "parser.y" /* yacc.c:1646 */ 2530 + #line 535 "parser.y" 2504 2531 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2505 - #line 2506 "parser.tab.c" /* yacc.c:1646 */ 2532 + #line 2533 "parser.tab.c" 2506 2533 break; 2507 2534 2508 2535 case 99: 2509 - #line 540 "parser.y" /* yacc.c:1646 */ 2536 + #line 540 "parser.y" 2510 2537 { (yyval.expr) = (yyvsp[0].expr); } 2511 - #line 2512 "parser.tab.c" /* yacc.c:1646 */ 2538 + #line 2539 "parser.tab.c" 2512 2539 break; 2513 2540 2514 2541 case 100: 2515 - #line 542 "parser.y" /* yacc.c:1646 */ 2542 + #line 542 "parser.y" 2516 2543 { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2517 - #line 2518 "parser.tab.c" /* yacc.c:1646 */ 2544 + #line 2545 "parser.tab.c" 2518 2545 break; 2519 2546 2520 2547 case 101: 2521 - #line 544 "parser.y" /* yacc.c:1646 */ 2548 + #line 544 "parser.y" 2522 2549 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2523 - #line 2524 "parser.tab.c" /* yacc.c:1646 */ 2550 + #line 2551 "parser.tab.c" 2524 2551 break; 2525 2552 2526 2553 case 102: 2527 - #line 548 "parser.y" /* yacc.c:1646 */ 2554 + #line 548 "parser.y" 2528 2555 { (yyval.expr) = (yyvsp[0].expr); } 2529 - #line 2530 "parser.tab.c" /* yacc.c:1646 */ 2556 + #line 2557 "parser.tab.c" 2530 2557 break; 2531 2558 2532 2559 case 103: 2533 - #line 550 "parser.y" /* yacc.c:1646 */ 2560 + #line 550 "parser.y" 2534 2561 { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2535 - #line 2536 "parser.tab.c" /* yacc.c:1646 */ 2562 + #line 2563 "parser.tab.c" 2536 2563 break; 2537 2564 2538 2565 case 104: 2539 - #line 555 "parser.y" /* yacc.c:1646 */ 2566 + #line 555 "parser.y" 2540 2567 { (yyval.expr) = (yyvsp[0].expr); } 2541 - #line 2542 "parser.tab.c" /* yacc.c:1646 */ 2568 + #line 2569 "parser.tab.c" 2542 2569 break; 2543 2570 2544 2571 case 105: 2545 - #line 557 "parser.y" /* yacc.c:1646 */ 2572 + #line 557 "parser.y" 2546 2573 { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2547 - #line 2548 "parser.tab.c" /* yacc.c:1646 */ 2574 + #line 2575 "parser.tab.c" 2548 2575 break; 2549 2576 2550 2577 case 106: 2551 - #line 561 "parser.y" /* yacc.c:1646 */ 2578 + #line 561 "parser.y" 2552 2579 { (yyval.expr) = (yyvsp[0].expr); } 2553 - #line 2554 "parser.tab.c" /* yacc.c:1646 */ 2580 + #line 2581 "parser.tab.c" 2554 2581 break; 2555 2582 2556 2583 case 107: 2557 - #line 563 "parser.y" /* yacc.c:1646 */ 2584 + #line 563 "parser.y" 2558 2585 { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2559 - #line 2560 "parser.tab.c" /* yacc.c:1646 */ 2586 + #line 2587 "parser.tab.c" 2560 2587 break; 2561 2588 2562 2589 case 108: 2563 - #line 568 "parser.y" /* yacc.c:1646 */ 2590 + #line 568 "parser.y" 2564 2591 { (yyval.expr) = (yyvsp[0].expr); } 2565 - #line 2566 "parser.tab.c" /* yacc.c:1646 */ 2592 + #line 2593 "parser.tab.c" 2566 2593 break; 2567 2594 2568 2595 case 109: 2569 - #line 570 "parser.y" /* yacc.c:1646 */ 2596 + #line 570 "parser.y" 2570 2597 { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2571 - #line 2572 "parser.tab.c" /* yacc.c:1646 */ 2598 + #line 2599 "parser.tab.c" 2572 2599 break; 2573 2600 2574 2601 case 110: 2575 - #line 574 "parser.y" /* yacc.c:1646 */ 2602 + #line 574 "parser.y" 2576 2603 { (yyval.expr) = (yyvsp[0].expr); } 2577 - #line 2578 "parser.tab.c" /* yacc.c:1646 */ 2604 + #line 2605 "parser.tab.c" 2578 2605 break; 2579 2606 2580 2607 case 111: 2581 - #line 576 "parser.y" /* yacc.c:1646 */ 2608 + #line 576 "parser.y" 2582 2609 { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2583 - #line 2584 "parser.tab.c" /* yacc.c:1646 */ 2610 + #line 2611 "parser.tab.c" 2584 2611 break; 2585 2612 2586 2613 case 112: 2587 - #line 581 "parser.y" /* yacc.c:1646 */ 2614 + #line 581 "parser.y" 2588 2615 { (yyval.expr) = (yyvsp[0].expr); } 2589 - #line 2590 "parser.tab.c" /* yacc.c:1646 */ 2616 + #line 2617 "parser.tab.c" 2590 2617 break; 2591 2618 2592 2619 case 113: 2593 - #line 583 "parser.y" /* yacc.c:1646 */ 2620 + #line 583 "parser.y" 2594 2621 { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2595 - #line 2596 "parser.tab.c" /* yacc.c:1646 */ 2622 + #line 2623 "parser.tab.c" 2596 2623 break; 2597 2624 2598 2625 case 114: 2599 - #line 587 "parser.y" /* yacc.c:1646 */ 2626 + #line 587 "parser.y" 2600 2627 { (yyval.expr) = (yyvsp[0].expr); } 2601 - #line 2602 "parser.tab.c" /* yacc.c:1646 */ 2628 + #line 2629 "parser.tab.c" 2602 2629 break; 2603 2630 2604 2631 case 115: 2605 - #line 589 "parser.y" /* yacc.c:1646 */ 2632 + #line 589 "parser.y" 2606 2633 { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2607 - #line 2608 "parser.tab.c" /* yacc.c:1646 */ 2634 + #line 2635 "parser.tab.c" 2608 2635 break; 2609 2636 2610 2637 case 116: 2611 - #line 594 "parser.y" /* yacc.c:1646 */ 2638 + #line 594 "parser.y" 2612 2639 { (yyval.expr) = (yyvsp[0].expr); } 2613 - #line 2614 "parser.tab.c" /* yacc.c:1646 */ 2640 + #line 2641 "parser.tab.c" 2614 2641 break; 2615 2642 2616 2643 case 117: 2617 - #line 596 "parser.y" /* yacc.c:1646 */ 2644 + #line 596 "parser.y" 2618 2645 { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2619 - #line 2620 "parser.tab.c" /* yacc.c:1646 */ 2646 + #line 2647 "parser.tab.c" 2620 2647 break; 2621 2648 2622 2649 case 118: 2623 - #line 600 "parser.y" /* yacc.c:1646 */ 2650 + #line 600 "parser.y" 2624 2651 { (yyval.expr) = (yyvsp[0].expr); } 2625 - #line 2626 "parser.tab.c" /* yacc.c:1646 */ 2652 + #line 2653 "parser.tab.c" 2626 2653 break; 2627 2654 2628 2655 case 119: 2629 - #line 602 "parser.y" /* yacc.c:1646 */ 2656 + #line 602 "parser.y" 2630 2657 { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2631 - #line 2632 "parser.tab.c" /* yacc.c:1646 */ 2658 + #line 2659 "parser.tab.c" 2632 2659 break; 2633 2660 2634 2661 case 120: 2635 - #line 607 "parser.y" /* yacc.c:1646 */ 2662 + #line 607 "parser.y" 2636 2663 { (yyval.expr) = (yyvsp[0].expr); } 2637 - #line 2638 "parser.tab.c" /* yacc.c:1646 */ 2664 + #line 2665 "parser.tab.c" 2638 2665 break; 2639 2666 2640 2667 case 121: 2641 - #line 609 "parser.y" /* yacc.c:1646 */ 2668 + #line 609 "parser.y" 2642 2669 { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2643 - #line 2644 "parser.tab.c" /* yacc.c:1646 */ 2670 + #line 2671 "parser.tab.c" 2644 2671 break; 2645 2672 2646 2673 case 122: 2647 - #line 613 "parser.y" /* yacc.c:1646 */ 2674 + #line 613 "parser.y" 2648 2675 { (yyval.expr) = (yyvsp[0].expr); } 2649 - #line 2650 "parser.tab.c" /* yacc.c:1646 */ 2676 + #line 2677 "parser.tab.c" 2650 2677 break; 2651 2678 2652 2679 case 123: 2653 - #line 615 "parser.y" /* yacc.c:1646 */ 2680 + #line 615 "parser.y" 2654 2681 { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2655 - #line 2656 "parser.tab.c" /* yacc.c:1646 */ 2682 + #line 2683 "parser.tab.c" 2656 2683 break; 2657 2684 2658 2685 case 124: 2659 - #line 620 "parser.y" /* yacc.c:1646 */ 2686 + #line 620 "parser.y" 2660 2687 { (yyval.expr) = (yyvsp[0].expr); } 2661 - #line 2662 "parser.tab.c" /* yacc.c:1646 */ 2688 + #line 2689 "parser.tab.c" 2662 2689 break; 2663 2690 2664 2691 case 125: 2665 - #line 622 "parser.y" /* yacc.c:1646 */ 2692 + #line 622 "parser.y" 2666 2693 { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2667 - #line 2668 "parser.tab.c" /* yacc.c:1646 */ 2694 + #line 2695 "parser.tab.c" 2668 2695 break; 2669 2696 2670 2697 case 126: 2671 - #line 626 "parser.y" /* yacc.c:1646 */ 2698 + #line 626 "parser.y" 2672 2699 { (yyval.expr) = (yyvsp[0].expr); } 2673 - #line 2674 "parser.tab.c" /* yacc.c:1646 */ 2700 + #line 2701 "parser.tab.c" 2674 2701 break; 2675 2702 2676 2703 case 127: 2677 - #line 628 "parser.y" /* yacc.c:1646 */ 2704 + #line 628 "parser.y" 2678 2705 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2679 - #line 2680 "parser.tab.c" /* yacc.c:1646 */ 2706 + #line 2707 "parser.tab.c" 2680 2707 break; 2681 2708 2682 2709 case 128: 2683 - #line 632 "parser.y" /* yacc.c:1646 */ 2710 + #line 632 "parser.y" 2684 2711 { (yyval.expr) = (yyvsp[0].expr); } 2685 - #line 2686 "parser.tab.c" /* yacc.c:1646 */ 2712 + #line 2713 "parser.tab.c" 2686 2713 break; 2687 2714 2688 2715 case 129: 2689 - #line 634 "parser.y" /* yacc.c:1646 */ 2716 + #line 634 "parser.y" 2690 2717 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2691 - #line 2692 "parser.tab.c" /* yacc.c:1646 */ 2718 + #line 2719 "parser.tab.c" 2692 2719 break; 2693 2720 2694 2721 case 130: 2695 - #line 638 "parser.y" /* yacc.c:1646 */ 2722 + #line 638 "parser.y" 2696 2723 { (yyval.expr) = (yyvsp[0].expr); } 2697 - #line 2698 "parser.tab.c" /* yacc.c:1646 */ 2724 + #line 2725 "parser.tab.c" 2698 2725 break; 2699 2726 2700 2727 case 131: 2701 - #line 640 "parser.y" /* yacc.c:1646 */ 2728 + #line 640 "parser.y" 2702 2729 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2703 - #line 2704 "parser.tab.c" /* yacc.c:1646 */ 2730 + #line 2731 "parser.tab.c" 2704 2731 break; 2705 2732 2706 2733 case 132: 2707 - #line 642 "parser.y" /* yacc.c:1646 */ 2734 + #line 642 "parser.y" 2708 2735 { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2709 - #line 2710 "parser.tab.c" /* yacc.c:1646 */ 2736 + #line 2737 "parser.tab.c" 2710 2737 break; 2711 2738 2712 2739 case 133: 2713 - #line 644 "parser.y" /* yacc.c:1646 */ 2740 + #line 644 "parser.y" 2714 2741 { (yyval.expr) = new_binary_expression(ctx, EXPR_IN, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2715 - #line 2716 "parser.tab.c" /* yacc.c:1646 */ 2742 + #line 2743 "parser.tab.c" 2716 2743 break; 2717 2744 2718 2745 case 134: 2719 - #line 648 "parser.y" /* yacc.c:1646 */ 2746 + #line 648 "parser.y" 2720 2747 { (yyval.expr) = (yyvsp[0].expr); } 2721 - #line 2722 "parser.tab.c" /* yacc.c:1646 */ 2748 + #line 2749 "parser.tab.c" 2722 2749 break; 2723 2750 2724 2751 case 135: 2725 - #line 650 "parser.y" /* yacc.c:1646 */ 2752 + #line 650 "parser.y" 2726 2753 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2727 - #line 2728 "parser.tab.c" /* yacc.c:1646 */ 2754 + #line 2755 "parser.tab.c" 2728 2755 break; 2729 2756 2730 2757 case 136: 2731 - #line 652 "parser.y" /* yacc.c:1646 */ 2758 + #line 652 "parser.y" 2732 2759 { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2733 - #line 2734 "parser.tab.c" /* yacc.c:1646 */ 2760 + #line 2761 "parser.tab.c" 2734 2761 break; 2735 2762 2736 2763 case 137: 2737 - #line 656 "parser.y" /* yacc.c:1646 */ 2764 + #line 656 "parser.y" 2738 2765 { (yyval.expr) = (yyvsp[0].expr); } 2739 - #line 2740 "parser.tab.c" /* yacc.c:1646 */ 2766 + #line 2767 "parser.tab.c" 2740 2767 break; 2741 2768 2742 2769 case 138: 2743 - #line 658 "parser.y" /* yacc.c:1646 */ 2770 + #line 658 "parser.y" 2744 2771 { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } 2745 - #line 2746 "parser.tab.c" /* yacc.c:1646 */ 2772 + #line 2773 "parser.tab.c" 2746 2773 break; 2747 2774 2748 2775 case 139: 2749 - #line 663 "parser.y" /* yacc.c:1646 */ 2776 + #line 663 "parser.y" 2750 2777 { (yyval.expr) = (yyvsp[0].expr); } 2751 - #line 2752 "parser.tab.c" /* yacc.c:1646 */ 2778 + #line 2779 "parser.tab.c" 2752 2779 break; 2753 2780 2754 2781 case 140: 2755 - #line 665 "parser.y" /* yacc.c:1646 */ 2782 + #line 665 "parser.y" 2756 2783 { (yyval.expr) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2757 - #line 2758 "parser.tab.c" /* yacc.c:1646 */ 2784 + #line 2785 "parser.tab.c" 2758 2785 break; 2759 2786 2760 2787 case 141: 2761 - #line 667 "parser.y" /* yacc.c:1646 */ 2788 + #line 667 "parser.y" 2762 2789 { (yyval.expr) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2763 - #line 2764 "parser.tab.c" /* yacc.c:1646 */ 2790 + #line 2791 "parser.tab.c" 2764 2791 break; 2765 2792 2766 2793 case 142: 2767 - #line 671 "parser.y" /* yacc.c:1646 */ 2794 + #line 671 "parser.y" 2768 2795 { (yyval.expr) = (yyvsp[0].expr); } 2769 - #line 2770 "parser.tab.c" /* yacc.c:1646 */ 2796 + #line 2797 "parser.tab.c" 2770 2797 break; 2771 2798 2772 2799 case 143: 2773 - #line 673 "parser.y" /* yacc.c:1646 */ 2800 + #line 673 "parser.y" 2774 2801 { (yyval.expr) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2775 - #line 2776 "parser.tab.c" /* yacc.c:1646 */ 2802 + #line 2803 "parser.tab.c" 2776 2803 break; 2777 2804 2778 2805 case 144: 2779 - #line 675 "parser.y" /* yacc.c:1646 */ 2806 + #line 675 "parser.y" 2780 2807 { (yyval.expr) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2781 - #line 2782 "parser.tab.c" /* yacc.c:1646 */ 2808 + #line 2809 "parser.tab.c" 2782 2809 break; 2783 2810 2784 2811 case 145: 2785 - #line 677 "parser.y" /* yacc.c:1646 */ 2812 + #line 677 "parser.y" 2786 2813 { (yyval.expr) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[-2].expr), (yyvsp[0].expr)); } 2787 - #line 2788 "parser.tab.c" /* yacc.c:1646 */ 2814 + #line 2815 "parser.tab.c" 2788 2815 break; 2789 2816 2790 2817 case 146: 2791 - #line 681 "parser.y" /* yacc.c:1646 */ 2818 + #line 681 "parser.y" 2792 2819 { (yyval.expr) = (yyvsp[0].expr); } 2793 - #line 2794 "parser.tab.c" /* yacc.c:1646 */ 2820 + #line 2821 "parser.tab.c" 2794 2821 break; 2795 2822 2796 2823 case 147: 2797 - #line 683 "parser.y" /* yacc.c:1646 */ 2824 + #line 683 "parser.y" 2798 2825 { (yyval.expr) = new_unary_expression(ctx, EXPR_DELETE, (yyvsp[0].expr)); } 2799 - #line 2800 "parser.tab.c" /* yacc.c:1646 */ 2826 + #line 2827 "parser.tab.c" 2800 2827 break; 2801 2828 2802 2829 case 148: 2803 - #line 684 "parser.y" /* yacc.c:1646 */ 2830 + #line 684 "parser.y" 2804 2831 { (yyval.expr) = new_unary_expression(ctx, EXPR_VOID, (yyvsp[0].expr)); } 2805 - #line 2806 "parser.tab.c" /* yacc.c:1646 */ 2832 + #line 2833 "parser.tab.c" 2806 2833 break; 2807 2834 2808 2835 case 149: 2809 - #line 686 "parser.y" /* yacc.c:1646 */ 2836 + #line 686 "parser.y" 2810 2837 { (yyval.expr) = new_unary_expression(ctx, EXPR_TYPEOF, (yyvsp[0].expr)); } 2811 - #line 2812 "parser.tab.c" /* yacc.c:1646 */ 2838 + #line 2839 "parser.tab.c" 2812 2839 break; 2813 2840 2814 2841 case 150: 2815 - #line 687 "parser.y" /* yacc.c:1646 */ 2842 + #line 687 "parser.y" 2816 2843 { (yyval.expr) = new_unary_expression(ctx, EXPR_PREINC, (yyvsp[0].expr)); } 2817 - #line 2818 "parser.tab.c" /* yacc.c:1646 */ 2844 + #line 2845 "parser.tab.c" 2818 2845 break; 2819 2846 2820 2847 case 151: 2821 - #line 688 "parser.y" /* yacc.c:1646 */ 2848 + #line 688 "parser.y" 2822 2849 { (yyval.expr) = new_unary_expression(ctx, EXPR_PREDEC, (yyvsp[0].expr)); } 2823 - #line 2824 "parser.tab.c" /* yacc.c:1646 */ 2850 + #line 2851 "parser.tab.c" 2824 2851 break; 2825 2852 2826 2853 case 152: 2827 - #line 689 "parser.y" /* yacc.c:1646 */ 2854 + #line 689 "parser.y" 2828 2855 { (yyval.expr) = new_unary_expression(ctx, EXPR_PLUS, (yyvsp[0].expr)); } 2829 - #line 2830 "parser.tab.c" /* yacc.c:1646 */ 2856 + #line 2857 "parser.tab.c" 2830 2857 break; 2831 2858 2832 2859 case 153: 2833 - #line 690 "parser.y" /* yacc.c:1646 */ 2860 + #line 690 "parser.y" 2834 2861 { (yyval.expr) = new_unary_expression(ctx, EXPR_MINUS, (yyvsp[0].expr)); } 2835 - #line 2836 "parser.tab.c" /* yacc.c:1646 */ 2862 + #line 2863 "parser.tab.c" 2836 2863 break; 2837 2864 2838 2865 case 154: 2839 - #line 691 "parser.y" /* yacc.c:1646 */ 2866 + #line 691 "parser.y" 2840 2867 { (yyval.expr) = new_unary_expression(ctx, EXPR_BITNEG, (yyvsp[0].expr)); } 2841 - #line 2842 "parser.tab.c" /* yacc.c:1646 */ 2868 + #line 2869 "parser.tab.c" 2842 2869 break; 2843 2870 2844 2871 case 155: 2845 - #line 692 "parser.y" /* yacc.c:1646 */ 2872 + #line 692 "parser.y" 2846 2873 { (yyval.expr) = new_unary_expression(ctx, EXPR_LOGNEG, (yyvsp[0].expr)); } 2847 - #line 2848 "parser.tab.c" /* yacc.c:1646 */ 2874 + #line 2875 "parser.tab.c" 2848 2875 break; 2849 2876 2850 2877 case 156: 2851 - #line 697 "parser.y" /* yacc.c:1646 */ 2878 + #line 697 "parser.y" 2852 2879 { (yyval.expr) = (yyvsp[0].expr); } 2853 - #line 2854 "parser.tab.c" /* yacc.c:1646 */ 2880 + #line 2881 "parser.tab.c" 2854 2881 break; 2855 2882 2856 2883 case 157: 2857 - #line 699 "parser.y" /* yacc.c:1646 */ 2884 + #line 699 "parser.y" 2858 2885 { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTINC, (yyvsp[-1].expr)); } 2859 - #line 2860 "parser.tab.c" /* yacc.c:1646 */ 2886 + #line 2887 "parser.tab.c" 2860 2887 break; 2861 2888 2862 2889 case 158: 2863 - #line 701 "parser.y" /* yacc.c:1646 */ 2890 + #line 701 "parser.y" 2864 2891 { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTDEC, (yyvsp[-1].expr)); } 2865 - #line 2866 "parser.tab.c" /* yacc.c:1646 */ 2892 + #line 2893 "parser.tab.c" 2866 2893 break; 2867 2894 2868 2895 case 159: 2869 - #line 706 "parser.y" /* yacc.c:1646 */ 2896 + #line 706 "parser.y" 2870 2897 { (yyval.expr) = (yyvsp[0].expr); } 2871 - #line 2872 "parser.tab.c" /* yacc.c:1646 */ 2898 + #line 2899 "parser.tab.c" 2872 2899 break; 2873 2900 2874 2901 case 160: 2875 - #line 707 "parser.y" /* yacc.c:1646 */ 2902 + #line 707 "parser.y" 2876 2903 { (yyval.expr) = (yyvsp[0].expr); } 2877 - #line 2878 "parser.tab.c" /* yacc.c:1646 */ 2904 + #line 2905 "parser.tab.c" 2878 2905 break; 2879 2906 2880 2907 case 161: 2881 - #line 711 "parser.y" /* yacc.c:1646 */ 2908 + #line 711 "parser.y" 2882 2909 { (yyval.expr) = (yyvsp[0].expr); } 2883 - #line 2884 "parser.tab.c" /* yacc.c:1646 */ 2910 + #line 2911 "parser.tab.c" 2884 2911 break; 2885 2912 2886 2913 case 162: 2887 - #line 712 "parser.y" /* yacc.c:1646 */ 2914 + #line 712 "parser.y" 2888 2915 { (yyval.expr) = new_new_expression(ctx, (yyvsp[0].expr), NULL); } 2889 - #line 2890 "parser.tab.c" /* yacc.c:1646 */ 2916 + #line 2917 "parser.tab.c" 2890 2917 break; 2891 2918 2892 2919 case 163: 2893 - #line 716 "parser.y" /* yacc.c:1646 */ 2920 + #line 716 "parser.y" 2894 2921 { (yyval.expr) = (yyvsp[0].expr); } 2895 - #line 2896 "parser.tab.c" /* yacc.c:1646 */ 2922 + #line 2923 "parser.tab.c" 2896 2923 break; 2897 2924 2898 2925 case 164: 2899 - #line 717 "parser.y" /* yacc.c:1646 */ 2926 + #line 717 "parser.y" 2900 2927 { (yyval.expr) = (yyvsp[0].expr); } 2901 - #line 2902 "parser.tab.c" /* yacc.c:1646 */ 2928 + #line 2929 "parser.tab.c" 2902 2929 break; 2903 2930 2904 2931 case 165: 2905 - #line 719 "parser.y" /* yacc.c:1646 */ 2932 + #line 719 "parser.y" 2906 2933 { (yyval.expr) = new_binary_expression(ctx, EXPR_ARRAY, (yyvsp[-3].expr), (yyvsp[-1].expr)); } 2907 - #line 2908 "parser.tab.c" /* yacc.c:1646 */ 2934 + #line 2935 "parser.tab.c" 2908 2935 break; 2909 2936 2910 2937 case 166: 2911 - #line 721 "parser.y" /* yacc.c:1646 */ 2938 + #line 721 "parser.y" 2912 2939 { (yyval.expr) = new_member_expression(ctx, (yyvsp[-2].expr), (yyvsp[0].identifier)); } 2913 - #line 2914 "parser.tab.c" /* yacc.c:1646 */ 2940 + #line 2941 "parser.tab.c" 2914 2941 break; 2915 2942 2916 2943 case 167: 2917 - #line 723 "parser.y" /* yacc.c:1646 */ 2944 + #line 723 "parser.y" 2918 2945 { (yyval.expr) = new_new_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); } 2919 - #line 2920 "parser.tab.c" /* yacc.c:1646 */ 2946 + #line 2947 "parser.tab.c" 2920 2947 break; 2921 2948 2922 2949 case 168: 2923 - #line 728 "parser.y" /* yacc.c:1646 */ 2950 + #line 728 "parser.y" 2924 2951 { (yyval.expr) = new_call_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); } 2925 - #line 2926 "parser.tab.c" /* yacc.c:1646 */ 2952 + #line 2953 "parser.tab.c" 2926 2953 break; 2927 2954 2928 2955 case 169: 2929 - #line 730 "parser.y" /* yacc.c:1646 */ 2956 + #line 730 "parser.y" 2930 2957 { (yyval.expr) = new_call_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); } 2931 - #line 2932 "parser.tab.c" /* yacc.c:1646 */ 2958 + #line 2959 "parser.tab.c" 2932 2959 break; 2933 2960 2934 2961 case 170: 2935 - #line 732 "parser.y" /* yacc.c:1646 */ 2962 + #line 732 "parser.y" 2936 2963 { (yyval.expr) = new_binary_expression(ctx, EXPR_ARRAY, (yyvsp[-3].expr), (yyvsp[-1].expr)); } 2937 - #line 2938 "parser.tab.c" /* yacc.c:1646 */ 2964 + #line 2965 "parser.tab.c" 2938 2965 break; 2939 2966 2940 2967 case 171: 2941 - #line 734 "parser.y" /* yacc.c:1646 */ 2968 + #line 734 "parser.y" 2942 2969 { (yyval.expr) = new_member_expression(ctx, (yyvsp[-2].expr), (yyvsp[0].identifier)); } 2943 - #line 2944 "parser.tab.c" /* yacc.c:1646 */ 2970 + #line 2971 "parser.tab.c" 2944 2971 break; 2945 2972 2946 2973 case 172: 2947 - #line 738 "parser.y" /* yacc.c:1646 */ 2974 + #line 738 "parser.y" 2948 2975 { (yyval.argument_list) = NULL; } 2949 - #line 2950 "parser.tab.c" /* yacc.c:1646 */ 2976 + #line 2977 "parser.tab.c" 2950 2977 break; 2951 2978 2952 2979 case 173: 2953 - #line 739 "parser.y" /* yacc.c:1646 */ 2980 + #line 739 "parser.y" 2954 2981 { (yyval.argument_list) = (yyvsp[-1].argument_list); } 2955 - #line 2956 "parser.tab.c" /* yacc.c:1646 */ 2982 + #line 2983 "parser.tab.c" 2956 2983 break; 2957 2984 2958 2985 case 174: 2959 - #line 743 "parser.y" /* yacc.c:1646 */ 2986 + #line 743 "parser.y" 2960 2987 { (yyval.argument_list) = new_argument_list(ctx, (yyvsp[0].expr)); } 2961 - #line 2962 "parser.tab.c" /* yacc.c:1646 */ 2988 + #line 2989 "parser.tab.c" 2962 2989 break; 2963 2990 2964 2991 case 175: 2965 - #line 745 "parser.y" /* yacc.c:1646 */ 2992 + #line 745 "parser.y" 2966 2993 { (yyval.argument_list) = argument_list_add(ctx, (yyvsp[-2].argument_list), (yyvsp[0].expr)); } 2967 - #line 2968 "parser.tab.c" /* yacc.c:1646 */ 2994 + #line 2995 "parser.tab.c" 2968 2995 break; 2969 2996 2970 2997 case 176: 2971 - #line 749 "parser.y" /* yacc.c:1646 */ 2998 + #line 749 "parser.y" 2972 2999 { (yyval.expr) = new_expression(ctx, EXPR_THIS, 0); } 2973 - #line 2974 "parser.tab.c" /* yacc.c:1646 */ 3000 + #line 3001 "parser.tab.c" 2974 3001 break; 2975 3002 2976 3003 case 177: 2977 - #line 750 "parser.y" /* yacc.c:1646 */ 3004 + #line 750 "parser.y" 2978 3005 { (yyval.expr) = new_identifier_expression(ctx, (yyvsp[0].identifier)); } 2979 - #line 2980 "parser.tab.c" /* yacc.c:1646 */ 3006 + #line 3007 "parser.tab.c" 2980 3007 break; 2981 3008 2982 3009 case 178: 2983 - #line 751 "parser.y" /* yacc.c:1646 */ 3010 + #line 751 "parser.y" 2984 3011 { (yyval.expr) = new_literal_expression(ctx, (yyvsp[0].literal)); } 2985 - #line 2986 "parser.tab.c" /* yacc.c:1646 */ 3012 + #line 3013 "parser.tab.c" 2986 3013 break; 2987 3014 2988 3015 case 179: 2989 - #line 752 "parser.y" /* yacc.c:1646 */ 3016 + #line 752 "parser.y" 2990 3017 { (yyval.expr) = (yyvsp[0].expr); } 2991 - #line 2992 "parser.tab.c" /* yacc.c:1646 */ 3018 + #line 3019 "parser.tab.c" 2992 3019 break; 2993 3020 2994 3021 case 180: 2995 - #line 753 "parser.y" /* yacc.c:1646 */ 3022 + #line 753 "parser.y" 2996 3023 { (yyval.expr) = (yyvsp[0].expr); } 2997 - #line 2998 "parser.tab.c" /* yacc.c:1646 */ 3024 + #line 3025 "parser.tab.c" 2998 3025 break; 2999 3026 3000 3027 case 181: 3001 - #line 754 "parser.y" /* yacc.c:1646 */ 3028 + #line 754 "parser.y" 3002 3029 { (yyval.expr) = (yyvsp[-1].expr); } 3003 - #line 3004 "parser.tab.c" /* yacc.c:1646 */ 3030 + #line 3031 "parser.tab.c" 3004 3031 break; 3005 3032 3006 3033 case 182: 3007 - #line 758 "parser.y" /* yacc.c:1646 */ 3034 + #line 758 "parser.y" 3008 3035 { (yyval.expr) = new_array_literal_expression(ctx, NULL, 0); } 3009 - #line 3010 "parser.tab.c" /* yacc.c:1646 */ 3036 + #line 3037 "parser.tab.c" 3010 3037 break; 3011 3038 3012 3039 case 183: 3013 - #line 759 "parser.y" /* yacc.c:1646 */ 3040 + #line 759 "parser.y" 3014 3041 { (yyval.expr) = new_array_literal_expression(ctx, NULL, (yyvsp[-1].ival)+1); } 3015 - #line 3016 "parser.tab.c" /* yacc.c:1646 */ 3042 + #line 3043 "parser.tab.c" 3016 3043 break; 3017 3044 3018 3045 case 184: 3019 - #line 760 "parser.y" /* yacc.c:1646 */ 3046 + #line 760 "parser.y" 3020 3047 { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[-1].element_list), 0); } 3021 - #line 3022 "parser.tab.c" /* yacc.c:1646 */ 3048 + #line 3049 "parser.tab.c" 3022 3049 break; 3023 3050 3024 3051 case 185: 3025 - #line 762 "parser.y" /* yacc.c:1646 */ 3052 + #line 762 "parser.y" 3026 3053 { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[-3].element_list), (yyvsp[-1].ival)+1); } 3027 - #line 3028 "parser.tab.c" /* yacc.c:1646 */ 3054 + #line 3055 "parser.tab.c" 3028 3055 break; 3029 3056 3030 3057 case 186: 3031 - #line 767 "parser.y" /* yacc.c:1646 */ 3058 + #line 767 "parser.y" 3032 3059 { (yyval.element_list) = new_element_list(ctx, (yyvsp[-1].ival), (yyvsp[0].expr)); } 3033 - #line 3034 "parser.tab.c" /* yacc.c:1646 */ 3060 + #line 3061 "parser.tab.c" 3034 3061 break; 3035 3062 3036 3063 case 187: 3037 - #line 769 "parser.y" /* yacc.c:1646 */ 3064 + #line 769 "parser.y" 3038 3065 { (yyval.element_list) = element_list_add(ctx, (yyvsp[-3].element_list), (yyvsp[-1].ival), (yyvsp[0].expr)); } 3039 - #line 3040 "parser.tab.c" /* yacc.c:1646 */ 3066 + #line 3067 "parser.tab.c" 3040 3067 break; 3041 3068 3042 3069 case 188: 3043 - #line 773 "parser.y" /* yacc.c:1646 */ 3070 + #line 773 "parser.y" 3044 3071 { (yyval.ival) = 1; } 3045 - #line 3046 "parser.tab.c" /* yacc.c:1646 */ 3072 + #line 3073 "parser.tab.c" 3046 3073 break; 3047 3074 3048 3075 case 189: 3049 - #line 774 "parser.y" /* yacc.c:1646 */ 3076 + #line 774 "parser.y" 3050 3077 { (yyval.ival) = (yyvsp[-1].ival) + 1; } 3051 - #line 3052 "parser.tab.c" /* yacc.c:1646 */ 3078 + #line 3079 "parser.tab.c" 3052 3079 break; 3053 3080 3054 3081 case 190: 3055 - #line 778 "parser.y" /* yacc.c:1646 */ 3082 + #line 778 "parser.y" 3056 3083 { (yyval.ival) = 0; } 3057 - #line 3058 "parser.tab.c" /* yacc.c:1646 */ 3084 + #line 3085 "parser.tab.c" 3058 3085 break; 3059 3086 3060 3087 case 191: 3061 - #line 779 "parser.y" /* yacc.c:1646 */ 3088 + #line 779 "parser.y" 3062 3089 { (yyval.ival) = (yyvsp[0].ival); } 3063 - #line 3064 "parser.tab.c" /* yacc.c:1646 */ 3090 + #line 3091 "parser.tab.c" 3064 3091 break; 3065 3092 3066 3093 case 192: 3067 - #line 783 "parser.y" /* yacc.c:1646 */ 3094 + #line 783 "parser.y" 3068 3095 { (yyval.expr) = new_prop_and_value_expression(ctx, NULL); } 3069 - #line 3070 "parser.tab.c" /* yacc.c:1646 */ 3096 + #line 3097 "parser.tab.c" 3070 3097 break; 3071 3098 3072 3099 case 193: 3073 - #line 785 "parser.y" /* yacc.c:1646 */ 3100 + #line 785 "parser.y" 3074 3101 { (yyval.expr) = new_prop_and_value_expression(ctx, (yyvsp[-1].property_list)); } 3075 - #line 3076 "parser.tab.c" /* yacc.c:1646 */ 3102 + #line 3103 "parser.tab.c" 3076 3103 break; 3077 3104 3078 3105 case 194: 3079 - #line 787 "parser.y" /* yacc.c:1646 */ 3106 + #line 787 "parser.y" 3080 3107 { 3081 3108 if(ctx->script->version < 2) { 3082 3109 WARN("Trailing comma in object literal is illegal in legacy mode.\n"); ··· 3084 3111 } 3085 3112 (yyval.expr) = new_prop_and_value_expression(ctx, (yyvsp[-2].property_list)); 3086 3113 } 3087 - #line 3088 "parser.tab.c" /* yacc.c:1646 */ 3114 + #line 3115 "parser.tab.c" 3088 3115 break; 3089 3116 3090 3117 case 195: 3091 - #line 797 "parser.y" /* yacc.c:1646 */ 3118 + #line 797 "parser.y" 3092 3119 { (yyval.property_list) = new_property_list(ctx, (yyvsp[0].property_definition)); } 3093 - #line 3094 "parser.tab.c" /* yacc.c:1646 */ 3120 + #line 3121 "parser.tab.c" 3094 3121 break; 3095 3122 3096 3123 case 196: 3097 - #line 799 "parser.y" /* yacc.c:1646 */ 3124 + #line 799 "parser.y" 3098 3125 { (yyval.property_list) = property_list_add(ctx, (yyvsp[-2].property_list), (yyvsp[0].property_definition)); } 3099 - #line 3100 "parser.tab.c" /* yacc.c:1646 */ 3126 + #line 3127 "parser.tab.c" 3100 3127 break; 3101 3128 3102 3129 case 197: 3103 - #line 804 "parser.y" /* yacc.c:1646 */ 3130 + #line 804 "parser.y" 3104 3131 { (yyval.property_definition) = new_property_definition(ctx, PROPERTY_DEFINITION_VALUE, (yyvsp[-2].literal), (yyvsp[0].expr)); } 3105 - #line 3106 "parser.tab.c" /* yacc.c:1646 */ 3132 + #line 3133 "parser.tab.c" 3106 3133 break; 3107 3134 3108 3135 case 198: 3109 - #line 806 "parser.y" /* yacc.c:1646 */ 3136 + #line 806 "parser.y" 3110 3137 { (yyval.property_definition) = new_property_definition(ctx, PROPERTY_DEFINITION_GETTER, (yyvsp[-1].literal), (yyvsp[0].expr)); } 3111 - #line 3112 "parser.tab.c" /* yacc.c:1646 */ 3138 + #line 3139 "parser.tab.c" 3112 3139 break; 3113 3140 3114 3141 case 199: 3115 - #line 808 "parser.y" /* yacc.c:1646 */ 3142 + #line 808 "parser.y" 3116 3143 { (yyval.property_definition) = new_property_definition(ctx, PROPERTY_DEFINITION_SETTER, (yyvsp[-1].literal), (yyvsp[0].expr)); } 3117 - #line 3118 "parser.tab.c" /* yacc.c:1646 */ 3144 + #line 3145 "parser.tab.c" 3118 3145 break; 3119 3146 3120 3147 case 200: 3121 - #line 812 "parser.y" /* yacc.c:1646 */ 3148 + #line 812 "parser.y" 3122 3149 { (yyval.expr) = new_function_expression(ctx, NULL, (yyvsp[-4].parameter_list), (yyvsp[-1].source_elements), NULL, (yyvsp[-5].srcptr), (yyvsp[0].srcptr)-(yyvsp[-5].srcptr)); } 3123 - #line 3124 "parser.tab.c" /* yacc.c:1646 */ 3150 + #line 3151 "parser.tab.c" 3124 3151 break; 3125 3152 3126 3153 case 201: 3127 - #line 816 "parser.y" /* yacc.c:1646 */ 3128 - { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].identifier)); } 3129 - #line 3130 "parser.tab.c" /* yacc.c:1646 */ 3154 + #line 816 "parser.y" 3155 + { (yyval.literal) = new_string_literal(ctx, compiler_alloc_string_len(ctx->compiler, (yyvsp[0].identifier), lstrlenW((yyvsp[0].identifier)))); } 3156 + #line 3157 "parser.tab.c" 3130 3157 break; 3131 3158 3132 3159 case 202: 3133 - #line 817 "parser.y" /* yacc.c:1646 */ 3134 - { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].wstr)); } 3135 - #line 3136 "parser.tab.c" /* yacc.c:1646 */ 3160 + #line 817 "parser.y" 3161 + { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].str)); } 3162 + #line 3163 "parser.tab.c" 3136 3163 break; 3137 3164 3138 3165 case 203: 3139 - #line 818 "parser.y" /* yacc.c:1646 */ 3166 + #line 818 "parser.y" 3140 3167 { (yyval.literal) = (yyvsp[0].literal); } 3141 - #line 3142 "parser.tab.c" /* yacc.c:1646 */ 3168 + #line 3169 "parser.tab.c" 3142 3169 break; 3143 3170 3144 3171 case 204: 3145 - #line 822 "parser.y" /* yacc.c:1646 */ 3172 + #line 822 "parser.y" 3146 3173 { (yyval.identifier) = NULL; } 3147 - #line 3148 "parser.tab.c" /* yacc.c:1646 */ 3174 + #line 3175 "parser.tab.c" 3148 3175 break; 3149 3176 3150 3177 case 205: 3151 - #line 823 "parser.y" /* yacc.c:1646 */ 3178 + #line 823 "parser.y" 3152 3179 { (yyval.identifier) = (yyvsp[0].identifier); } 3153 - #line 3154 "parser.tab.c" /* yacc.c:1646 */ 3180 + #line 3181 "parser.tab.c" 3154 3181 break; 3155 3182 3156 3183 case 206: 3157 - #line 827 "parser.y" /* yacc.c:1646 */ 3184 + #line 827 "parser.y" 3158 3185 { (yyval.identifier) = (yyvsp[0].identifier); } 3159 - #line 3160 "parser.tab.c" /* yacc.c:1646 */ 3186 + #line 3187 "parser.tab.c" 3160 3187 break; 3161 3188 3162 3189 case 207: 3163 - #line 829 "parser.y" /* yacc.c:1646 */ 3190 + #line 829 "parser.y" 3164 3191 { 3165 3192 if(ctx->script->version < SCRIPTLANGUAGEVERSION_ES5) { 3166 3193 WARN("%s keyword used as an identifier in legacy mode.\n", ··· 3169 3196 } 3170 3197 (yyval.identifier) = (yyvsp[0].identifier); 3171 3198 } 3172 - #line 3173 "parser.tab.c" /* yacc.c:1646 */ 3199 + #line 3200 "parser.tab.c" 3173 3200 break; 3174 3201 3175 3202 case 208: 3176 - #line 839 "parser.y" /* yacc.c:1646 */ 3203 + #line 839 "parser.y" 3177 3204 { (yyval.identifier) = (yyvsp[0].identifier); } 3178 - #line 3179 "parser.tab.c" /* yacc.c:1646 */ 3205 + #line 3206 "parser.tab.c" 3179 3206 break; 3180 3207 3181 3208 case 209: 3182 - #line 840 "parser.y" /* yacc.c:1646 */ 3209 + #line 840 "parser.y" 3183 3210 { (yyval.identifier) = (yyvsp[0].identifier); } 3184 - #line 3185 "parser.tab.c" /* yacc.c:1646 */ 3211 + #line 3212 "parser.tab.c" 3185 3212 break; 3186 3213 3187 3214 case 210: 3188 - #line 841 "parser.y" /* yacc.c:1646 */ 3215 + #line 841 "parser.y" 3189 3216 { (yyval.identifier) = (yyvsp[0].identifier); } 3190 - #line 3191 "parser.tab.c" /* yacc.c:1646 */ 3217 + #line 3218 "parser.tab.c" 3191 3218 break; 3192 3219 3193 3220 case 211: 3194 - #line 842 "parser.y" /* yacc.c:1646 */ 3221 + #line 842 "parser.y" 3195 3222 { (yyval.identifier) = (yyvsp[0].identifier); } 3196 - #line 3197 "parser.tab.c" /* yacc.c:1646 */ 3223 + #line 3224 "parser.tab.c" 3197 3224 break; 3198 3225 3199 3226 case 212: 3200 - #line 843 "parser.y" /* yacc.c:1646 */ 3227 + #line 843 "parser.y" 3201 3228 { (yyval.identifier) = (yyvsp[0].identifier); } 3202 - #line 3203 "parser.tab.c" /* yacc.c:1646 */ 3229 + #line 3230 "parser.tab.c" 3203 3230 break; 3204 3231 3205 3232 case 213: 3206 - #line 844 "parser.y" /* yacc.c:1646 */ 3233 + #line 844 "parser.y" 3207 3234 { (yyval.identifier) = (yyvsp[0].identifier); } 3208 - #line 3209 "parser.tab.c" /* yacc.c:1646 */ 3235 + #line 3236 "parser.tab.c" 3209 3236 break; 3210 3237 3211 3238 case 214: 3212 - #line 845 "parser.y" /* yacc.c:1646 */ 3239 + #line 845 "parser.y" 3213 3240 { (yyval.identifier) = (yyvsp[0].identifier); } 3214 - #line 3215 "parser.tab.c" /* yacc.c:1646 */ 3241 + #line 3242 "parser.tab.c" 3215 3242 break; 3216 3243 3217 3244 case 215: 3218 - #line 846 "parser.y" /* yacc.c:1646 */ 3245 + #line 846 "parser.y" 3219 3246 { (yyval.identifier) = (yyvsp[0].identifier); } 3220 - #line 3221 "parser.tab.c" /* yacc.c:1646 */ 3247 + #line 3248 "parser.tab.c" 3221 3248 break; 3222 3249 3223 3250 case 216: 3224 - #line 847 "parser.y" /* yacc.c:1646 */ 3251 + #line 847 "parser.y" 3225 3252 { (yyval.identifier) = (yyvsp[0].identifier); } 3226 - #line 3227 "parser.tab.c" /* yacc.c:1646 */ 3253 + #line 3254 "parser.tab.c" 3227 3254 break; 3228 3255 3229 3256 case 217: 3230 - #line 848 "parser.y" /* yacc.c:1646 */ 3257 + #line 848 "parser.y" 3231 3258 { (yyval.identifier) = (yyvsp[0].identifier); } 3232 - #line 3233 "parser.tab.c" /* yacc.c:1646 */ 3259 + #line 3260 "parser.tab.c" 3233 3260 break; 3234 3261 3235 3262 case 218: 3236 - #line 849 "parser.y" /* yacc.c:1646 */ 3263 + #line 849 "parser.y" 3237 3264 { (yyval.identifier) = (yyvsp[0].identifier); } 3238 - #line 3239 "parser.tab.c" /* yacc.c:1646 */ 3265 + #line 3266 "parser.tab.c" 3239 3266 break; 3240 3267 3241 3268 case 219: 3242 - #line 850 "parser.y" /* yacc.c:1646 */ 3269 + #line 850 "parser.y" 3243 3270 { (yyval.identifier) = (yyvsp[0].identifier); } 3244 - #line 3245 "parser.tab.c" /* yacc.c:1646 */ 3271 + #line 3272 "parser.tab.c" 3245 3272 break; 3246 3273 3247 3274 case 220: 3248 - #line 851 "parser.y" /* yacc.c:1646 */ 3275 + #line 851 "parser.y" 3249 3276 { (yyval.identifier) = (yyvsp[0].identifier); } 3250 - #line 3251 "parser.tab.c" /* yacc.c:1646 */ 3277 + #line 3278 "parser.tab.c" 3251 3278 break; 3252 3279 3253 3280 case 221: 3254 - #line 852 "parser.y" /* yacc.c:1646 */ 3281 + #line 852 "parser.y" 3255 3282 { (yyval.identifier) = (yyvsp[0].identifier); } 3256 - #line 3257 "parser.tab.c" /* yacc.c:1646 */ 3283 + #line 3284 "parser.tab.c" 3257 3284 break; 3258 3285 3259 3286 case 222: 3260 - #line 853 "parser.y" /* yacc.c:1646 */ 3287 + #line 853 "parser.y" 3261 3288 { (yyval.identifier) = (yyvsp[0].identifier); } 3262 - #line 3263 "parser.tab.c" /* yacc.c:1646 */ 3289 + #line 3290 "parser.tab.c" 3263 3290 break; 3264 3291 3265 3292 case 223: 3266 - #line 854 "parser.y" /* yacc.c:1646 */ 3293 + #line 854 "parser.y" 3267 3294 { (yyval.identifier) = (yyvsp[0].identifier); } 3268 - #line 3269 "parser.tab.c" /* yacc.c:1646 */ 3295 + #line 3296 "parser.tab.c" 3269 3296 break; 3270 3297 3271 3298 case 224: 3272 - #line 855 "parser.y" /* yacc.c:1646 */ 3299 + #line 855 "parser.y" 3273 3300 { (yyval.identifier) = (yyvsp[0].identifier); } 3274 - #line 3275 "parser.tab.c" /* yacc.c:1646 */ 3301 + #line 3302 "parser.tab.c" 3275 3302 break; 3276 3303 3277 3304 case 225: 3278 - #line 856 "parser.y" /* yacc.c:1646 */ 3305 + #line 856 "parser.y" 3279 3306 { (yyval.identifier) = (yyvsp[0].identifier); } 3280 - #line 3281 "parser.tab.c" /* yacc.c:1646 */ 3307 + #line 3308 "parser.tab.c" 3281 3308 break; 3282 3309 3283 3310 case 226: 3284 - #line 857 "parser.y" /* yacc.c:1646 */ 3311 + #line 857 "parser.y" 3285 3312 { (yyval.identifier) = (yyvsp[0].identifier); } 3286 - #line 3287 "parser.tab.c" /* yacc.c:1646 */ 3313 + #line 3314 "parser.tab.c" 3287 3314 break; 3288 3315 3289 3316 case 227: 3290 - #line 858 "parser.y" /* yacc.c:1646 */ 3317 + #line 858 "parser.y" 3291 3318 { (yyval.identifier) = (yyvsp[0].identifier); } 3292 - #line 3293 "parser.tab.c" /* yacc.c:1646 */ 3319 + #line 3320 "parser.tab.c" 3293 3320 break; 3294 3321 3295 3322 case 228: 3296 - #line 859 "parser.y" /* yacc.c:1646 */ 3323 + #line 859 "parser.y" 3297 3324 { (yyval.identifier) = (yyvsp[0].identifier); } 3298 - #line 3299 "parser.tab.c" /* yacc.c:1646 */ 3325 + #line 3326 "parser.tab.c" 3299 3326 break; 3300 3327 3301 3328 case 229: 3302 - #line 860 "parser.y" /* yacc.c:1646 */ 3329 + #line 860 "parser.y" 3303 3330 { (yyval.identifier) = (yyvsp[0].identifier); } 3304 - #line 3305 "parser.tab.c" /* yacc.c:1646 */ 3331 + #line 3332 "parser.tab.c" 3305 3332 break; 3306 3333 3307 3334 case 230: 3308 - #line 861 "parser.y" /* yacc.c:1646 */ 3335 + #line 861 "parser.y" 3309 3336 { (yyval.identifier) = (yyvsp[0].identifier); } 3310 - #line 3311 "parser.tab.c" /* yacc.c:1646 */ 3337 + #line 3338 "parser.tab.c" 3311 3338 break; 3312 3339 3313 3340 case 231: 3314 - #line 862 "parser.y" /* yacc.c:1646 */ 3341 + #line 862 "parser.y" 3315 3342 { (yyval.identifier) = (yyvsp[0].identifier); } 3316 - #line 3317 "parser.tab.c" /* yacc.c:1646 */ 3343 + #line 3344 "parser.tab.c" 3317 3344 break; 3318 3345 3319 3346 case 232: 3320 - #line 863 "parser.y" /* yacc.c:1646 */ 3347 + #line 863 "parser.y" 3321 3348 { (yyval.identifier) = (yyvsp[0].identifier); } 3322 - #line 3323 "parser.tab.c" /* yacc.c:1646 */ 3349 + #line 3350 "parser.tab.c" 3323 3350 break; 3324 3351 3325 3352 case 233: 3326 - #line 864 "parser.y" /* yacc.c:1646 */ 3353 + #line 864 "parser.y" 3327 3354 { (yyval.identifier) = (yyvsp[0].identifier); } 3328 - #line 3329 "parser.tab.c" /* yacc.c:1646 */ 3355 + #line 3356 "parser.tab.c" 3329 3356 break; 3330 3357 3331 3358 case 234: 3332 - #line 865 "parser.y" /* yacc.c:1646 */ 3359 + #line 865 "parser.y" 3333 3360 { (yyval.identifier) = (yyvsp[0].identifier); } 3334 - #line 3335 "parser.tab.c" /* yacc.c:1646 */ 3361 + #line 3362 "parser.tab.c" 3335 3362 break; 3336 3363 3337 3364 case 235: 3338 - #line 866 "parser.y" /* yacc.c:1646 */ 3365 + #line 866 "parser.y" 3339 3366 { (yyval.identifier) = (yyvsp[0].identifier); } 3340 - #line 3341 "parser.tab.c" /* yacc.c:1646 */ 3367 + #line 3368 "parser.tab.c" 3341 3368 break; 3342 3369 3343 3370 case 236: 3344 - #line 867 "parser.y" /* yacc.c:1646 */ 3371 + #line 867 "parser.y" 3345 3372 { (yyval.identifier) = (yyvsp[0].identifier); } 3346 - #line 3347 "parser.tab.c" /* yacc.c:1646 */ 3373 + #line 3374 "parser.tab.c" 3347 3374 break; 3348 3375 3349 3376 case 237: 3350 - #line 868 "parser.y" /* yacc.c:1646 */ 3377 + #line 868 "parser.y" 3351 3378 { (yyval.identifier) = (yyvsp[0].identifier); } 3352 - #line 3353 "parser.tab.c" /* yacc.c:1646 */ 3379 + #line 3380 "parser.tab.c" 3353 3380 break; 3354 3381 3355 3382 case 238: 3356 - #line 872 "parser.y" /* yacc.c:1646 */ 3383 + #line 872 "parser.y" 3357 3384 { (yyval.literal) = new_null_literal(ctx); } 3358 - #line 3359 "parser.tab.c" /* yacc.c:1646 */ 3385 + #line 3386 "parser.tab.c" 3359 3386 break; 3360 3387 3361 3388 case 239: 3362 - #line 873 "parser.y" /* yacc.c:1646 */ 3389 + #line 873 "parser.y" 3363 3390 { (yyval.literal) = (yyvsp[0].literal); } 3364 - #line 3365 "parser.tab.c" /* yacc.c:1646 */ 3391 + #line 3392 "parser.tab.c" 3365 3392 break; 3366 3393 3367 3394 case 240: 3368 - #line 874 "parser.y" /* yacc.c:1646 */ 3395 + #line 874 "parser.y" 3369 3396 { (yyval.literal) = (yyvsp[0].literal); } 3370 - #line 3371 "parser.tab.c" /* yacc.c:1646 */ 3397 + #line 3398 "parser.tab.c" 3371 3398 break; 3372 3399 3373 3400 case 241: 3374 - #line 875 "parser.y" /* yacc.c:1646 */ 3375 - { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].wstr)); } 3376 - #line 3377 "parser.tab.c" /* yacc.c:1646 */ 3401 + #line 875 "parser.y" 3402 + { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].str)); } 3403 + #line 3404 "parser.tab.c" 3377 3404 break; 3378 3405 3379 3406 case 242: 3380 - #line 876 "parser.y" /* yacc.c:1646 */ 3407 + #line 876 "parser.y" 3381 3408 { (yyval.literal) = parse_regexp(ctx); 3382 3409 if(!(yyval.literal)) YYABORT; } 3383 - #line 3384 "parser.tab.c" /* yacc.c:1646 */ 3410 + #line 3411 "parser.tab.c" 3384 3411 break; 3385 3412 3386 3413 case 243: 3387 - #line 878 "parser.y" /* yacc.c:1646 */ 3414 + #line 878 "parser.y" 3388 3415 { (yyval.literal) = parse_regexp(ctx); 3389 3416 if(!(yyval.literal)) YYABORT; } 3390 - #line 3391 "parser.tab.c" /* yacc.c:1646 */ 3417 + #line 3418 "parser.tab.c" 3391 3418 break; 3392 3419 3393 3420 case 244: 3394 - #line 883 "parser.y" /* yacc.c:1646 */ 3421 + #line 883 "parser.y" 3395 3422 { (yyval.literal) = new_boolean_literal(ctx, VARIANT_TRUE); } 3396 - #line 3397 "parser.tab.c" /* yacc.c:1646 */ 3423 + #line 3424 "parser.tab.c" 3397 3424 break; 3398 3425 3399 3426 case 245: 3400 - #line 884 "parser.y" /* yacc.c:1646 */ 3427 + #line 884 "parser.y" 3401 3428 { (yyval.literal) = new_boolean_literal(ctx, VARIANT_FALSE); } 3402 - #line 3403 "parser.tab.c" /* yacc.c:1646 */ 3429 + #line 3430 "parser.tab.c" 3403 3430 break; 3404 3431 3405 3432 case 246: 3406 - #line 885 "parser.y" /* yacc.c:1646 */ 3433 + #line 885 "parser.y" 3407 3434 { (yyval.literal) = (yyvsp[0].literal); } 3408 - #line 3409 "parser.tab.c" /* yacc.c:1646 */ 3435 + #line 3436 "parser.tab.c" 3409 3436 break; 3410 3437 3411 3438 case 248: 3412 - #line 889 "parser.y" /* yacc.c:1646 */ 3439 + #line 889 "parser.y" 3413 3440 { if(!allow_auto_semicolon(ctx)) {YYABORT;} } 3414 - #line 3415 "parser.tab.c" /* yacc.c:1646 */ 3441 + #line 3442 "parser.tab.c" 3415 3442 break; 3416 3443 3417 3444 case 249: 3418 - #line 892 "parser.y" /* yacc.c:1646 */ 3445 + #line 892 "parser.y" 3419 3446 { (yyval.srcptr) = ctx->ptr; } 3420 - #line 3421 "parser.tab.c" /* yacc.c:1646 */ 3447 + #line 3448 "parser.tab.c" 3421 3448 break; 3422 3449 3423 3450 case 250: 3424 - #line 893 "parser.y" /* yacc.c:1646 */ 3451 + #line 893 "parser.y" 3425 3452 { set_error(ctx, JS_E_MISSING_LBRACKET); YYABORT; } 3426 - #line 3427 "parser.tab.c" /* yacc.c:1646 */ 3453 + #line 3454 "parser.tab.c" 3427 3454 break; 3428 3455 3429 3456 case 252: 3430 - #line 897 "parser.y" /* yacc.c:1646 */ 3457 + #line 897 "parser.y" 3431 3458 { set_error(ctx, JS_E_MISSING_RBRACKET); YYABORT; } 3432 - #line 3433 "parser.tab.c" /* yacc.c:1646 */ 3459 + #line 3460 "parser.tab.c" 3433 3460 break; 3434 3461 3435 3462 case 254: 3436 - #line 901 "parser.y" /* yacc.c:1646 */ 3463 + #line 901 "parser.y" 3437 3464 { set_error(ctx, JS_E_MISSING_SEMICOLON); YYABORT; } 3438 - #line 3439 "parser.tab.c" /* yacc.c:1646 */ 3465 + #line 3466 "parser.tab.c" 3439 3466 break; 3440 3467 3441 3468 3442 - #line 3443 "parser.tab.c" /* yacc.c:1646 */ 3469 + #line 3470 "parser.tab.c" 3470 + 3443 3471 default: break; 3444 3472 } 3445 3473 /* User semantic actions sometimes alter yychar, and that requires ··· 3464 3492 /* Now 'shift' the result of the reduction. Determine what state 3465 3493 that goes to, based on the state we popped back to and the rule 3466 3494 number reduced by. */ 3467 - 3468 - yyn = yyr1[yyn]; 3469 - 3470 - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 3471 - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 3472 - yystate = yytable[yystate]; 3473 - else 3474 - yystate = yydefgoto[yyn - YYNTOKENS]; 3495 + { 3496 + const int yylhs = yyr1[yyn] - YYNTOKENS; 3497 + const int yyi = yypgoto[yylhs] + *yyssp; 3498 + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp 3499 + ? yytable[yyi] 3500 + : yydefgoto[yylhs]); 3501 + } 3475 3502 3476 3503 goto yynewstate; 3477 3504 ··· 3554 3581 | yyerrorlab -- error raised explicitly by YYERROR. | 3555 3582 `---------------------------------------------------*/ 3556 3583 yyerrorlab: 3557 - 3558 - /* Pacify compilers like GCC when the user code never invokes 3559 - YYERROR and the label yyerrorlab therefore never appears in user 3560 - code. */ 3561 - if (/*CONSTCOND*/ 0) 3562 - goto yyerrorlab; 3584 + /* Pacify compilers when the user code never invokes YYERROR and the 3585 + label yyerrorlab therefore never appears in user code. */ 3586 + if (0) 3587 + YYERROR; 3563 3588 3564 3589 /* Do not reclaim the symbols of the rule whose action triggered 3565 3590 this YYERROR. */ ··· 3621 3646 yyresult = 0; 3622 3647 goto yyreturn; 3623 3648 3649 + 3624 3650 /*-----------------------------------. 3625 3651 | yyabortlab -- YYABORT comes here. | 3626 3652 `-----------------------------------*/ 3627 3653 yyabortlab: 3628 3654 yyresult = 1; 3629 3655 goto yyreturn; 3656 + 3630 3657 3631 3658 #if !defined yyoverflow || YYERROR_VERBOSE 3632 3659 /*-------------------------------------------------. ··· 3638 3665 /* Fall through. */ 3639 3666 #endif 3640 3667 3668 + 3669 + /*-----------------------------------------------------. 3670 + | yyreturn -- parsing is finished, return the result. | 3671 + `-----------------------------------------------------*/ 3641 3672 yyreturn: 3642 3673 if (yychar != YYEMPTY) 3643 3674 { ··· 3667 3698 #endif 3668 3699 return yyresult; 3669 3700 } 3670 - #line 903 "parser.y" /* yacc.c:1906 */ 3701 + #line 903 "parser.y" 3671 3702 3672 3703 3673 3704 static BOOL allow_auto_semicolon(parser_ctx_t *ctx) ··· 3689 3720 return stat; 3690 3721 } 3691 3722 3692 - static literal_t *new_string_literal(parser_ctx_t *ctx, const WCHAR *str) 3723 + static literal_t *new_string_literal(parser_ctx_t *ctx, jsstr_t *str) 3693 3724 { 3694 3725 literal_t *ret = parser_alloc(ctx, sizeof(literal_t)); 3695 3726 3696 3727 ret->type = LT_STRING; 3697 - ret->u.wstr = str; 3728 + ret->u.str = str; 3698 3729 3699 3730 return ret; 3700 3731 } ··· 4334 4365 heap_free(ctx); 4335 4366 } 4336 4367 4337 - HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter, BOOL from_eval, 4368 + HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, const WCHAR *code, const WCHAR *delimiter, BOOL from_eval, 4338 4369 parser_ctx_t **ret) 4339 4370 { 4340 4371 parser_ctx_t *parser_ctx; ··· 4348 4379 return E_OUTOFMEMORY; 4349 4380 4350 4381 parser_ctx->hres = JS_E_SYNTAX; 4351 - parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW); 4382 + parser_ctx->is_html = delimiter && !wcsicmp(delimiter, html_tagW); 4352 4383 4353 4384 parser_ctx->begin = parser_ctx->ptr = code; 4354 - parser_ctx->end = parser_ctx->begin + strlenW(parser_ctx->begin); 4385 + parser_ctx->end = parser_ctx->begin + lstrlenW(parser_ctx->begin); 4355 4386 4356 4387 script_addref(ctx); 4357 4388 parser_ctx->script = ctx; ··· 4359 4390 mark = heap_pool_mark(&ctx->tmp_heap); 4360 4391 heap_pool_init(&parser_ctx->heap); 4361 4392 4393 + parser_ctx->compiler = compiler; 4362 4394 parser_parse(parser_ctx); 4395 + parser_ctx->compiler = NULL; 4396 + 4363 4397 heap_pool_clear(mark); 4364 4398 hres = parser_ctx->hres; 4365 4399 if(FAILED(hres)) {
+11 -6
dll/win32/jscript/parser.tab.h
··· 1 - /* A Bison parser, made by GNU Bison 3.0. */ 1 + /* A Bison parser, made by GNU Bison 3.4.1. */ 2 2 3 3 /* Bison interface for Yacc-like parsers in C 4 4 5 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 5 + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, 6 + Inc. 6 7 7 8 This program is free software: you can redistribute it and/or modify 8 9 it under the terms of the GNU General Public License as published by ··· 29 30 30 31 This special exception was added by the Free Software Foundation in 31 32 version 2.2 of Bison. */ 33 + 34 + /* Undocumented macros, especially those whose name start with YY_, 35 + are private implementation details. Do not rely on them. */ 32 36 33 37 #ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED 34 38 # define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED ··· 97 101 98 102 /* Value type. */ 99 103 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 100 - typedef union YYSTYPE YYSTYPE; 101 104 union YYSTYPE 102 105 { 103 - #line 147 "parser.y" /* yacc.c:1909 */ 106 + #line 147 "parser.y" 104 107 105 108 int ival; 106 109 const WCHAR *srcptr; 107 - LPCWSTR wstr; 110 + jsstr_t *str; 108 111 literal_t *literal; 109 112 struct _argument_list_t *argument_list; 110 113 case_clausule_t *case_clausule; ··· 122 125 struct _variable_list_t *variable_list; 123 126 variable_declaration_t *variable_declaration; 124 127 125 - #line 126 "parser.tab.h" /* yacc.c:1909 */ 128 + #line 129 "parser.tab.h" 129 + 126 130 }; 131 + typedef union YYSTYPE YYSTYPE; 127 132 # define YYSTYPE_IS_TRIVIAL 1 128 133 # define YYSTYPE_IS_DECLARED 1 129 134 #endif
+13 -10
dll/win32/jscript/parser.y
··· 37 37 statement_t *tail; 38 38 } statement_list_t; 39 39 40 - static literal_t *new_string_literal(parser_ctx_t*,const WCHAR*); 40 + static literal_t *new_string_literal(parser_ctx_t*,jsstr_t*); 41 41 static literal_t *new_null_literal(parser_ctx_t*); 42 42 43 43 typedef struct _property_list_t { ··· 141 141 142 142 %lex-param { parser_ctx_t *ctx } 143 143 %parse-param { parser_ctx_t *ctx } 144 - %pure-parser 144 + %define api.pure 145 145 %start Program 146 146 147 147 %union { 148 148 int ival; 149 149 const WCHAR *srcptr; 150 - LPCWSTR wstr; 150 + jsstr_t *str; 151 151 literal_t *literal; 152 152 struct _argument_list_t *argument_list; 153 153 case_clausule_t *case_clausule; ··· 177 177 %token <identifier> tIdentifier 178 178 %token <ival> tAssignOper tEqOper tShiftOper tRelOper 179 179 %token <literal> tNumericLiteral tBooleanLiteral 180 - %token <wstr> tStringLiteral 180 + %token <str> tStringLiteral 181 181 %token tEOF 182 182 183 183 %type <source_elements> SourceElements ··· 813 813 814 814 /* Ecma-262 3rd Edition 11.1.5 */ 815 815 PropertyName 816 - : IdentifierName { $$ = new_string_literal(ctx, $1); } 816 + : IdentifierName { $$ = new_string_literal(ctx, compiler_alloc_string_len(ctx->compiler, $1, lstrlenW($1))); } 817 817 | tStringLiteral { $$ = new_string_literal(ctx, $1); } 818 818 | tNumericLiteral { $$ = $1; } 819 819 ··· 921 921 return stat; 922 922 } 923 923 924 - static literal_t *new_string_literal(parser_ctx_t *ctx, const WCHAR *str) 924 + static literal_t *new_string_literal(parser_ctx_t *ctx, jsstr_t *str) 925 925 { 926 926 literal_t *ret = parser_alloc(ctx, sizeof(literal_t)); 927 927 928 928 ret->type = LT_STRING; 929 - ret->u.wstr = str; 929 + ret->u.str = str; 930 930 931 931 return ret; 932 932 } ··· 1566 1566 heap_free(ctx); 1567 1567 } 1568 1568 1569 - HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter, BOOL from_eval, 1569 + HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, const WCHAR *code, const WCHAR *delimiter, BOOL from_eval, 1570 1570 parser_ctx_t **ret) 1571 1571 { 1572 1572 parser_ctx_t *parser_ctx; ··· 1580 1580 return E_OUTOFMEMORY; 1581 1581 1582 1582 parser_ctx->hres = JS_E_SYNTAX; 1583 - parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW); 1583 + parser_ctx->is_html = delimiter && !wcsicmp(delimiter, html_tagW); 1584 1584 1585 1585 parser_ctx->begin = parser_ctx->ptr = code; 1586 - parser_ctx->end = parser_ctx->begin + strlenW(parser_ctx->begin); 1586 + parser_ctx->end = parser_ctx->begin + lstrlenW(parser_ctx->begin); 1587 1587 1588 1588 script_addref(ctx); 1589 1589 parser_ctx->script = ctx; ··· 1591 1591 mark = heap_pool_mark(&ctx->tmp_heap); 1592 1592 heap_pool_init(&parser_ctx->heap); 1593 1593 1594 + parser_ctx->compiler = compiler; 1594 1595 parser_parse(parser_ctx); 1596 + parser_ctx->compiler = NULL; 1597 + 1595 1598 heap_pool_clear(mark); 1596 1599 hres = parser_ctx->hres; 1597 1600 if(FAILED(hres)) {
+14 -14
dll/win32/jscript/regexp.c
··· 1142 1142 for (i = rangeStart; i <= localMax; i++) { 1143 1143 WCHAR uch, dch; 1144 1144 1145 - uch = toupperW(i); 1146 - dch = tolowerW(i); 1145 + uch = towupper(i); 1146 + dch = towlower(i); 1147 1147 if(maxch < uch) 1148 1148 maxch = uch; 1149 1149 if(maxch < dch) ··· 1988 1988 if (length > (size_t)(gData->cpend - x->cp)) 1989 1989 return NULL; 1990 1990 for (i = 0; i != length; i++) { 1991 - if (toupperW(matchChars[i]) != toupperW(x->cp[i])) 1991 + if (towupper(matchChars[i]) != towupper(x->cp[i])) 1992 1992 return NULL; 1993 1993 } 1994 1994 x->cp += length; ··· 2035 2035 parenContent = &gData->cpbegin[cap->index]; 2036 2036 if (gData->regexp->flags & REG_FOLD) { 2037 2037 for (i = 0; i < len; i++) { 2038 - if (toupperW(parenContent[i]) != toupperW(x->cp[i])) 2038 + if (towupper(parenContent[i]) != towupper(x->cp[i])) 2039 2039 return NULL; 2040 2040 } 2041 2041 } else { ··· 2226 2226 continue; 2227 2227 case 's': 2228 2228 for (i = (INT)charSet->length; i >= 0; i--) 2229 - if (isspaceW(i)) 2229 + if (iswspace(i)) 2230 2230 AddCharacterToCharSet(charSet, (WCHAR)i); 2231 2231 continue; 2232 2232 case 'S': 2233 2233 for (i = (INT)charSet->length; i >= 0; i--) 2234 - if (!isspaceW(i)) 2234 + if (!iswspace(i)) 2235 2235 AddCharacterToCharSet(charSet, (WCHAR)i); 2236 2236 continue; 2237 2237 case 'w': ··· 2263 2263 WCHAR uch, dch; 2264 2264 2265 2265 AddCharacterToCharSet(charSet, i); 2266 - uch = toupperW(i); 2267 - dch = tolowerW(i); 2266 + uch = towupper(i); 2267 + dch = towlower(i); 2268 2268 if (i != uch) 2269 2269 AddCharacterToCharSet(charSet, uch); 2270 2270 if (i != dch) ··· 2276 2276 inRange = FALSE; 2277 2277 } else { 2278 2278 if (gData->regexp->flags & REG_FOLD) { 2279 - AddCharacterToCharSet(charSet, toupperW(thisCh)); 2280 - AddCharacterToCharSet(charSet, tolowerW(thisCh)); 2279 + AddCharacterToCharSet(charSet, towupper(thisCh)); 2280 + AddCharacterToCharSet(charSet, towlower(thisCh)); 2281 2281 } else { 2282 2282 AddCharacterToCharSet(charSet, thisCh); 2283 2283 } ··· 2411 2411 } 2412 2412 break; 2413 2413 case REOP_SPACE: 2414 - if (x->cp != gData->cpend && isspaceW(*x->cp)) { 2414 + if (x->cp != gData->cpend && iswspace(*x->cp)) { 2415 2415 result = x; 2416 2416 result->cp++; 2417 2417 } 2418 2418 break; 2419 2419 case REOP_NONSPACE: 2420 - if (x->cp != gData->cpend && !isspaceW(*x->cp)) { 2420 + if (x->cp != gData->cpend && !iswspace(*x->cp)) { 2421 2421 result = x; 2422 2422 result->cp++; 2423 2423 } ··· 2463 2463 break; 2464 2464 case REOP_FLAT1i: 2465 2465 matchCh = *pc++; 2466 - if (x->cp != gData->cpend && toupperW(*x->cp) == toupperW(matchCh)) { 2466 + if (x->cp != gData->cpend && towupper(*x->cp) == towupper(matchCh)) { 2467 2467 result = x; 2468 2468 result->cp++; 2469 2469 } ··· 2480 2480 case REOP_UCFLAT1i: 2481 2481 matchCh = GET_ARG(pc); 2482 2482 pc += ARG_LEN; 2483 - if (x->cp != gData->cpend && toupperW(*x->cp) == toupperW(matchCh)) { 2483 + if (x->cp != gData->cpend && towupper(*x->cp) == towupper(matchCh)) { 2484 2484 result = x; 2485 2485 result->cp++; 2486 2486 }
+48 -29
dll/win32/jscript/string.c
··· 16 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 17 */ 18 18 19 - #include "config.h" 20 - #include "wine/port.h" 19 + 20 + #include <math.h> 21 21 22 22 #include "jscript.h" 23 23 #include "regexp.h" ··· 168 168 return S_OK; 169 169 } 170 170 171 - tagname_len = strlenW(tagname); 171 + tagname_len = lstrlenW(tagname); 172 172 173 173 ret = jsstr_alloc_buf(jsstr_length(str) + 2*tagname_len + 5, &ptr); 174 174 if(!ret) { ··· 215 215 } 216 216 217 217 if(r) { 218 - unsigned attrname_len = strlenW(attrname); 219 - unsigned tagname_len = strlenW(tagname); 218 + unsigned attrname_len = lstrlenW(attrname); 219 + unsigned tagname_len = lstrlenW(tagname); 220 220 jsstr_t *ret; 221 221 WCHAR *ptr; 222 222 ··· 853 853 match->cp = str; 854 854 } 855 855 856 - match->cp = strstrW(match->cp, match_str); 856 + match->cp = wcsstr(match->cp, match_str); 857 857 if(!match->cp) 858 858 break; 859 859 match->match_len = jsstr_length(match_jsstr); ··· 879 879 }else if(rep_str && regexp) { 880 880 const WCHAR *ptr = rep_str, *ptr2; 881 881 882 - while((ptr2 = strchrW(ptr, '$'))) { 882 + while((ptr2 = wcschr(ptr, '$'))) { 883 883 hres = strbuf_append(&ret, ptr, ptr2-ptr); 884 884 if(FAILED(hres)) 885 885 break; ··· 904 904 default: { 905 905 DWORD idx; 906 906 907 - if(!isdigitW(ptr2[1])) { 907 + if(!iswdigit(ptr2[1])) { 908 908 hres = strbuf_append(&ret, ptr2, 1); 909 909 ptr = ptr2+1; 910 910 break; 911 911 } 912 912 913 913 idx = ptr2[1] - '0'; 914 - if(isdigitW(ptr2[2]) && idx*10 + (ptr2[2]-'0') <= match->paren_count) { 914 + if(iswdigit(ptr2[2]) && idx*10 + (ptr2[2]-'0') <= match->paren_count) { 915 915 idx = idx*10 + (ptr[2]-'0'); 916 916 ptr = ptr2+3; 917 917 }else if(idx && idx <= match->paren_count) { ··· 1131 1131 jsval_t *r) 1132 1132 { 1133 1133 match_state_t match_result, *match_ptr = &match_result; 1134 - DWORD length, i, match_len = 0; 1134 + size_t length, i = 0, match_len = 0; 1135 1135 const WCHAR *ptr, *ptr2, *str, *match_str = NULL; 1136 1136 unsigned limit = ~0u; 1137 1137 jsdisp_t *array, *regexp = NULL; 1138 1138 jsstr_t *jsstr, *match_jsstr, *tmp_str; 1139 1139 HRESULT hres; 1140 - 1141 - TRACE("\n"); 1142 1140 1143 1141 hres = get_string_flat_val(ctx, jsthis, &jsstr, &str); 1144 1142 if(FAILED(hres)) 1145 1143 return hres; 1144 + length = jsstr_length(jsstr); 1146 1145 1147 - length = jsstr_length(jsstr); 1146 + TRACE("%s\n", debugstr_wn(str, length)); 1148 1147 1149 1148 if(!argc || (is_undefined(argv[0]) && ctx->version >= SCRIPTLANGUAGEVERSION_ES5)) { 1150 1149 if(!r) ··· 1203 1202 if(SUCCEEDED(hres)) { 1204 1203 ptr = str; 1205 1204 match_result.cp = str; 1206 - for(i=0; i<limit; i++) { 1205 + while(i < limit) { 1207 1206 if(regexp) { 1208 1207 hres = regexp_match_next(ctx, regexp, REM_NO_PARENS, jsstr, &match_ptr); 1209 1208 if(hres != S_OK) 1210 1209 break; 1210 + TRACE("got match %d %d\n", (int)(match_result.cp - match_result.match_len - str), match_result.match_len); 1211 + if(!match_result.match_len) { 1212 + /* If an empty string is matched, prevent including any match in the result */ 1213 + if(!length) { 1214 + limit = 0; 1215 + break; 1216 + } 1217 + if(match_result.cp == ptr) { 1218 + match_result.cp++; 1219 + hres = regexp_match_next(ctx, regexp, REM_NO_PARENS, jsstr, &match_ptr); 1220 + if(hres != S_OK) 1221 + break; 1222 + TRACE("retried, got match %d %d\n", (int)(match_result.cp - match_result.match_len - str), 1223 + match_result.match_len); 1224 + } 1225 + if(!match_result.match_len && match_result.cp == str + length) 1226 + break; 1227 + } 1211 1228 ptr2 = match_result.cp - match_result.match_len; 1212 1229 }else if(match_str) { 1213 - ptr2 = strstrW(ptr, match_str); 1230 + ptr2 = wcsstr(ptr, match_str); 1214 1231 if(!ptr2) 1215 1232 break; 1216 1233 }else { ··· 1219 1236 ptr2 = ptr+1; 1220 1237 } 1221 1238 1222 - tmp_str = jsstr_alloc_len(ptr, ptr2-ptr); 1223 - if(!tmp_str) { 1224 - hres = E_OUTOFMEMORY; 1225 - break; 1226 - } 1239 + if(!regexp || ptr2 > ptr || ctx->version >= SCRIPTLANGUAGEVERSION_ES5) { 1240 + tmp_str = jsstr_alloc_len(ptr, ptr2-ptr); 1241 + if(!tmp_str) { 1242 + hres = E_OUTOFMEMORY; 1243 + break; 1244 + } 1227 1245 1228 - hres = jsdisp_propput_idx(array, i, jsval_string(tmp_str)); 1229 - jsstr_release(tmp_str); 1230 - if(FAILED(hres)) 1231 - break; 1246 + hres = jsdisp_propput_idx(array, i++, jsval_string(tmp_str)); 1247 + jsstr_release(tmp_str); 1248 + if(FAILED(hres)) 1249 + break; 1250 + } 1232 1251 1233 1252 if(regexp) 1234 1253 ptr = match_result.cp; ··· 1242 1261 if(SUCCEEDED(hres) && (match_str || regexp) && i<limit) { 1243 1262 DWORD len = (str+length) - ptr; 1244 1263 1245 - if(len || match_str) { 1264 + if(len || match_str || !length || ctx->version >= SCRIPTLANGUAGEVERSION_ES5) { 1246 1265 tmp_str = jsstr_alloc_len(ptr, len); 1247 1266 1248 1267 if(tmp_str) { ··· 1427 1446 } 1428 1447 1429 1448 jsstr_flush(str, buf); 1430 - for (; len--; buf++) *buf = tolowerW(*buf); 1449 + for (; len--; buf++) *buf = towlower(*buf); 1431 1450 1432 1451 *r = jsval_string(ret); 1433 1452 } ··· 1459 1478 } 1460 1479 1461 1480 jsstr_flush(str, buf); 1462 - for (; len--; buf++) *buf = toupperW(*buf); 1481 + for (; len--; buf++) *buf = towupper(*buf); 1463 1482 1464 1483 *r = jsval_string(ret); 1465 1484 } ··· 1497 1516 len = jsstr_length(jsstr); 1498 1517 TRACE("%s\n", debugstr_wn(str, len)); 1499 1518 1500 - for(begin = str, end = str + len; begin < end && isspaceW(*begin); begin++); 1501 - while(end > begin + 1 && isspaceW(*(end-1))) end--; 1519 + for(begin = str, end = str + len; begin < end && iswspace(*begin); begin++); 1520 + while(end > begin + 1 && iswspace(*(end-1))) end--; 1502 1521 1503 1522 if(r) { 1504 1523 jsstr_t *ret;
+1 -1
media/doc/README.WINE
··· 86 86 dll/win32/iphlpapi # Out of sync 87 87 dll/win32/itircl # Synced to WineStaging-4.18 88 88 dll/win32/itss # Synced to WineStaging-4.18 89 - dll/win32/jscript # Synced to WineStaging-4.0 89 + dll/win32/jscript # Synced to WineStaging-4.18 90 90 dll/win32/jsproxy # Synced to WineStaging-4.0 91 91 dll/win32/loadperf # Synced to WineStaging-3.3 92 92 dll/win32/lz32 # Synced to WineStaging-3.3