[0.4.8][JSCRIPT] Fix regression CORE-13810 "Vypress Chat 2.1.9 MSI setup fatal error"
authorJoachim Henze <Joachim.Henze@reactos.org>
Mon, 30 Nov 2020 05:34:52 +0000 (06:34 +0100)
committerJoachim Henze <Joachim.Henze@reactos.org>
Mon, 30 Nov 2020 05:42:28 +0000 (06:42 +0100)
The regression was unhidden by MSI-winesync 1.5.10 almost 7years ago:
8939969e21ddd1472e64596e11dee2ab58c9025e == SVN r57070

Finally we can fix it by adding MS enumerator extension to Jscript.
Many thanks to the patches author
Andreas Maier <staubim@quantentunnel.de>
JIRA-nick: andy-123

fix picked from commit 0.4.12-RC-18-g 9ebb42a4c01db05bb50be72fcfa49bd7a5a6afe4

It went afterwards into master in slightly modified form as 0.4.13-dev-890-g 83dcae1
But I decided to take the older state from 0.4.12RC, so that I do not have to risk
touching releases/0.4.12 again to sync to "latest&greatest".

Due to the changed PROPF_* defines in jscript.h, I felt most safe by porting back also:
0.4.10-dev-188-g c6f49f5
0.4.10-dev-152-g 3f071cc
0.4.9-dev-248-g 8dba275
0.4.9-dev-120-g 004d830fe974f3ade31bb3fe31d5ec186f7486d9 [INCLUDE/WINE] Import heap.h from Wine Staging 3.3

40 files changed:
dll/win32/jscript/CMakeLists.txt
dll/win32/jscript/activex.c
dll/win32/jscript/array.c
dll/win32/jscript/bool.c
dll/win32/jscript/cc_parser.tab.c
dll/win32/jscript/cc_parser.tab.h [new file with mode: 0644]
dll/win32/jscript/cc_parser.y
dll/win32/jscript/compile.c
dll/win32/jscript/date.c
dll/win32/jscript/decode.c
dll/win32/jscript/dispex.c
dll/win32/jscript/engine.c
dll/win32/jscript/engine.h
dll/win32/jscript/enumerator.c [new file with mode: 0644]
dll/win32/jscript/error.c
dll/win32/jscript/function.c
dll/win32/jscript/global.c
dll/win32/jscript/jscript.c
dll/win32/jscript/jscript.h
dll/win32/jscript/jscript_main.c
dll/win32/jscript/json.c
dll/win32/jscript/jsregexp.c
dll/win32/jscript/jsstr.c
dll/win32/jscript/jsutils.c
dll/win32/jscript/jsval.h
dll/win32/jscript/lex.c
dll/win32/jscript/math.c
dll/win32/jscript/number.c
dll/win32/jscript/object.c
dll/win32/jscript/parser.tab.c
dll/win32/jscript/parser.tab.h
dll/win32/jscript/parser.y
dll/win32/jscript/precomp.h [new file with mode: 0644]
dll/win32/jscript/regexp.c
dll/win32/jscript/resource.h
dll/win32/jscript/rsrc.rc
dll/win32/jscript/string.c
dll/win32/jscript/vbarray.c
media/doc/README.WINE
sdk/include/reactos/wine/heap.h [new file with mode: 0644]

index 01dc2da..0923c56 100644 (file)
@@ -16,6 +16,7 @@ list(APPEND SOURCE
     decode.c
     dispex.c
     engine.c
+    enumerator.c
     error.c
     function.c
     global.c
@@ -33,7 +34,7 @@ list(APPEND SOURCE
     regexp.c
     string.c
     vbarray.c
-    jscript.h)
+    precomp.h)
 
 list(APPEND jscript_rc_deps
     ${CMAKE_CURRENT_SOURCE_DIR}/jscript.rgs
@@ -54,5 +55,5 @@ add_dependencies(jscript jscript_idlheader stdole2)
 set_module_type(jscript win32dll)
 target_link_libraries(jscript uuid wine)
 add_importlibs(jscript user32 ole32 oleaut32 advapi32 msvcrt kernel32 ntdll)
-add_pch(jscript jscript.h SOURCE)
+add_pch(jscript precomp.h SOURCE)
 add_cd_file(TARGET jscript DESTINATION reactos/system32 FOR all)
index 0bdf80e..c7d9a66 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "jscript.h"
+#include "objsafe.h"
+#include "mshtmhst.h"
+
+#include "wine/debug.h"
 
-#include <mshtmhst.h>
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 /* Defined as extern in urlmon.idl, but not exported by uuid.lib */
 const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =
index 4fb70a3..fcccdd6 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <math.h>
+#include <assert.h>
+
 #include "jscript.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 typedef struct {
     jsdisp_t dispex;
 
@@ -37,6 +47,7 @@ static const WCHAR spliceW[] = {'s','p','l','i','c','e',0};
 static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
 static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0};
 static const WCHAR unshiftW[] = {'u','n','s','h','i','f','t',0};
+static const WCHAR indexOfW[] = {'i','n','d','e','x','O','f',0};
 
 static const WCHAR default_separatorW[] = {',',0};
 
@@ -377,9 +388,10 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
     hres = jsdisp_get_idx(jsthis, length, &val);
     if(SUCCEEDED(hres))
         hres = jsdisp_delete_idx(jsthis, length);
-    else if(hres == DISP_E_UNKNOWNNAME)
+    else if(hres == DISP_E_UNKNOWNNAME) {
         val = jsval_undefined();
-    else
+        hres = S_OK;
+    }else
         return hres;
 
     if(SUCCEEDED(hres))
@@ -938,6 +950,61 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flag
     return E_NOTIMPL;
 }
 
+static HRESULT Array_indexOf(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
+        jsval_t *r)
+{
+    jsdisp_t *jsthis;
+    unsigned length, i, from = 0;
+    jsval_t search, value;
+    BOOL eq;
+    HRESULT hres;
+
+    TRACE("\n");
+
+    hres = get_length(ctx, vthis, &jsthis, &length);
+    if(FAILED(hres))
+        return hres;
+    if(!length) {
+        if(r) *r = jsval_number(-1);
+        return S_OK;
+    }
+
+    search = argc ? argv[0] : jsval_undefined();
+
+    if(argc > 1) {
+        double from_arg;
+
+        hres = to_integer(ctx, argv[1], &from_arg);
+        if(FAILED(hres))
+            return hres;
+
+        if(from_arg >= 0)
+            from = min(from_arg, length);
+        else
+            from = max(from_arg + length, 0);
+    }
+
+    for(i = from; i < length; i++) {
+        hres = jsdisp_get_idx(jsthis, i, &value);
+        if(hres == DISP_E_UNKNOWNNAME)
+            continue;
+        if(FAILED(hres))
+            return hres;
+
+        hres = jsval_strict_equal(value, search, &eq);
+        jsval_release(value);
+        if(FAILED(hres))
+            return hres;
+        if(eq) {
+            if(r) *r = jsval_number(i);
+            return S_OK;
+        }
+    }
+
+    if(r) *r = jsval_number(-1);
+    return S_OK;
+}
+
 /* ECMA-262 3rd Edition    15.4.4.13 */
 static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
@@ -1036,6 +1103,7 @@ static void Array_on_put(jsdisp_t *dispex, const WCHAR *name)
 
 static const builtin_prop_t Array_props[] = {
     {concatW,                Array_concat,               PROPF_METHOD|1},
+    {indexOfW,               Array_indexOf,              PROPF_ES5|PROPF_METHOD|1},
     {joinW,                  Array_join,                 PROPF_METHOD|1},
     {lengthW,                NULL,0,                     Array_get_length, Array_set_length},
     {popW,                   Array_pop,                  PROPF_METHOD},
@@ -1072,6 +1140,24 @@ static const builtin_info_t ArrayInst_info = {
     Array_on_put
 };
 
+/* ECMA-262 5.1 Edition    15.4.3.2 */
+static HRESULT ArrayConstr_isArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
+{
+    jsdisp_t *obj;
+
+    TRACE("\n");
+
+    if(!argc || !is_object_instance(argv[0])) {
+        if(r) *r = jsval_bool(FALSE);
+        return S_OK;
+    }
+
+    obj = iface_to_jsdisp(get_object(argv[0]));
+    if(r) *r = jsval_bool(obj && is_class(obj, JSCLASS_ARRAY));
+    if(obj) jsdisp_release(obj);
+    return S_OK;
+}
+
 static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -1146,6 +1232,21 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
     return S_OK;
 }
 
+static const WCHAR isArrayW[] = {'i','s','A','r','r','a','y',0};
+
+static const builtin_prop_t ArrayConstr_props[] = {
+    {isArrayW,    ArrayConstr_isArray,    PROPF_ES5|PROPF_METHOD|1}
+};
+
+static const builtin_info_t ArrayConstr_info = {
+    JSCLASS_FUNCTION,
+    DEFAULT_FUNCTION_VALUE,
+    sizeof(ArrayConstr_props)/sizeof(*ArrayConstr_props),
+    ArrayConstr_props,
+    NULL,
+    NULL
+};
+
 HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp_t **ret)
 {
     ArrayInstance *array;
@@ -1157,7 +1258,7 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis
     if(FAILED(hres))
         return hres;
 
-    hres = create_builtin_constructor(ctx, ArrayConstr_value, ArrayW, NULL, PROPF_CONSTR|1, &array->dispex, ret);
+    hres = create_builtin_constructor(ctx, ArrayConstr_value, ArrayW, &ArrayConstr_info, PROPF_CONSTR|1, &array->dispex, ret);
 
     jsdisp_release(&array->dispex);
     return hres;
index f7e8df2..75c98c2 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <assert.h>
+
 #include "jscript.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 typedef struct {
     jsdisp_t dispex;
 
index 264d071..2e46c11 100644 (file)
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.0.2.  */
+/* A Bison parser, made by GNU Bison 3.0.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
@@ -44,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.0.2"
+#define YYBISON_VERSION "3.0"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 /* Copy the first part of user declarations.  */
 #line 19 "cc_parser.y" /* yacc.c:339  */
 
+
 #include "jscript.h"
+#include "engine.h"
+#include "parser.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 
 #line 84 "cc_parser.tab.c" /* yacc.c:339  */
 
-# ifndef YY_NULLPTR
+# ifndef YY_NULL
 #  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
+#   define YY_NULL nullptr
 #  else
-#   define YY_NULLPTR 0
+#   define YY_NULL 0
 #  endif
 # endif
 
 # define YYERROR_VERBOSE 0
 #endif
 
-
+/* In a future release of Bison, this section will be replaced
+   by #include "cc_parser.tab.h".  */
+#ifndef YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED
+# define YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED
 /* Debug traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
@@ -128,7 +139,7 @@ union YYSTYPE
 
     ccval_t ccval;
 
-#line 140 "cc_parser.tab.c" /* yacc.c:355  */
+#line 143 "cc_parser.tab.c" /* yacc.c:355  */
 };
 # define YYSTYPE_IS_TRIVIAL 1
 # define YYSTYPE_IS_DECLARED 1
@@ -138,7 +149,7 @@ union YYSTYPE
 
 int cc_parser_parse (parser_ctx_t *ctx);
 
-
+#endif /* !YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED  */
 
 /* Copy the second part of user declarations.  */
 #line 47 "cc_parser.y" /* yacc.c:358  */
@@ -235,7 +246,7 @@ static int cc_parser_lex(void *lval, parser_ctx_t *ctx)
 }
 
 
-#line 247 "cc_parser.tab.c" /* yacc.c:358  */
+#line 250 "cc_parser.tab.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -292,30 +303,11 @@ typedef short int yytype_int16;
 # endif
 #endif
 
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__                                               \
-      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
-     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-#  define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later.  */
+# if (! defined __GNUC__ || __GNUC__ < 2 \
+      || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
+#  define __attribute__(Spec) /* empty */
 # endif
 #endif
 
@@ -553,7 +545,7 @@ static const char *const yytname[] =
   "CCBitwiseORExpression", "CCBitwiseXORExpression",
   "CCBitwiseANDExpression", "CCEqualityExpression",
   "CCRelationalExpression", "CCShiftExpression", "CCAdditiveExpression",
-  "CCMultiplicativeExpression", YY_NULLPTR
+  "CCMultiplicativeExpression", YY_NULL
 };
 #endif
 
@@ -955,11 +947,11 @@ static int
 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yytype_int16 *yyssp, int yytoken)
 {
-  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
   YYSIZE_T yysize = yysize0;
   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   /* Internationalized format string. */
-  const char *yyformat = YY_NULLPTR;
+  const char *yyformat = YY_NULL;
   /* Arguments of yyformat. */
   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   /* Number of reported tokens (one for the "unexpected", one per
@@ -1016,7 +1008,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                   }
                 yyarg[yycount++] = yytname[yyx];
                 {
-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
                   if (! (yysize <= yysize1
                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                     return 2;
@@ -1355,233 +1347,233 @@ yyreduce:
         case 2:
 #line 146 "cc_parser.y" /* yacc.c:1646  */
     { ctx->ccval = (yyvsp[0].ccval); YYACCEPT; }
-#line 1367 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1351 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 3:
 #line 149 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1373 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1357 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 4:
 #line 150 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[-1].ccval); }
-#line 1379 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1363 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 5:
 #line 151 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_bool(!get_ccbool((yyvsp[0].ccval))); }
-#line 1385 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1369 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 6:
 #line 152 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'~' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1391 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1375 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 7:
 #line 153 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'+' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1397 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1381 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 8:
 #line 154 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'-' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1403 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1387 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 9:
 #line 157 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1409 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1393 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 10:
 #line 159 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'||' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1415 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1399 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 11:
 #line 162 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1421 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1405 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 12:
 #line 164 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'&&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1427 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1411 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 13:
 #line 167 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1433 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1417 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 14:
 #line 169 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'|' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1439 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1423 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 15:
 #line 172 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1445 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1429 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 16:
 #line 174 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'^' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1451 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1435 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 17:
 #line 177 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1457 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1441 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 18:
 #line 179 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1463 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1447 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 19:
 #line 182 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1469 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1453 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 20:
 #line 184 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) == get_ccnum((yyvsp[0].ccval))); }
-#line 1475 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1459 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 21:
 #line 186 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) != get_ccnum((yyvsp[0].ccval))); }
-#line 1481 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1465 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 22:
 #line 188 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'===' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1487 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1471 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 23:
 #line 190 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'!==' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1493 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1477 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 24:
 #line 193 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1499 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1483 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 25:
 #line 195 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) < get_ccnum((yyvsp[0].ccval))); }
-#line 1505 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1489 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 26:
 #line 197 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) <= get_ccnum((yyvsp[0].ccval))); }
-#line 1511 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1495 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 27:
 #line 199 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) > get_ccnum((yyvsp[0].ccval))); }
-#line 1517 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1501 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 28:
 #line 201 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) >= get_ccnum((yyvsp[0].ccval))); }
-#line 1523 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1507 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 29:
 #line 204 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1529 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1513 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 30:
 #line 206 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'<<' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1535 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1519 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 31:
 #line 208 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1541 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1525 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 32:
 #line 210 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'>>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1547 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1531 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 33:
 #line 213 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1553 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1537 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 34:
 #line 215 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) + get_ccnum((yyvsp[0].ccval))); }
-#line 1559 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1543 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 35:
 #line 217 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) - get_ccnum((yyvsp[0].ccval))); }
-#line 1565 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1549 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 36:
 #line 220 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = (yyvsp[0].ccval); }
-#line 1571 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1555 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 37:
 #line 222 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) * get_ccnum((yyvsp[0].ccval))); }
-#line 1577 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1561 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 38:
 #line 224 "cc_parser.y" /* yacc.c:1646  */
     { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) / get_ccnum((yyvsp[0].ccval))); }
-#line 1583 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1567 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 39:
 #line 226 "cc_parser.y" /* yacc.c:1646  */
     { FIXME("'%%' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
-#line 1589 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1573 "cc_parser.tab.c" /* yacc.c:1646  */
     break;
 
 
-#line 1593 "cc_parser.tab.c" /* yacc.c:1646  */
+#line 1577 "cc_parser.tab.c" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
diff --git a/dll/win32/jscript/cc_parser.tab.h b/dll/win32/jscript/cc_parser.tab.h
new file mode 100644 (file)
index 0000000..275e13e
--- /dev/null
@@ -0,0 +1,82 @@
+/* A Bison parser, made by GNU Bison 3.0.  */
+
+/* Bison interface for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+#ifndef YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED
+# define YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int cc_parser_debug;
+#endif
+
+/* Token type.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+  enum yytokentype
+  {
+    tEQ = 258,
+    tEQEQ = 259,
+    tNEQ = 260,
+    tNEQEQ = 261,
+    tLSHIFT = 262,
+    tRSHIFT = 263,
+    tRRSHIFT = 264,
+    tOR = 265,
+    tAND = 266,
+    tLEQ = 267,
+    tGEQ = 268,
+    tCCValue = 269
+  };
+#endif
+
+/* Value type.  */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
+{
+#line 36 "cc_parser.y" /* yacc.c:1909  */
+
+    ccval_t ccval;
+
+#line 73 "cc_parser.tab.h" /* yacc.c:1909  */
+};
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+
+int cc_parser_parse (parser_ctx_t *ctx);
+
+#endif /* !YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED  */
index d06ba7c..18c1cb1 100644 (file)
 %{
 
 #include "jscript.h"
+#include "engine.h"
+#include "parser.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 %}
 
index b9dff8f..6e6be91 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <math.h>
+#include <assert.h>
+
 #include "jscript.h"
+#include "engine.h"
+#include "parser.h"
 
-#include <wine/rbtree.h>
+#include "wine/rbtree.h"
+#include "wine/debug.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 WINE_DECLARE_DEBUG_CHANNEL(jscript_disas);
 
 typedef struct _statement_ctx_t {
@@ -854,29 +861,29 @@ static HRESULT literal_as_bstr(compiler_ctx_t *ctx, literal_t *literal, BSTR *st
 
 static HRESULT compile_array_literal(compiler_ctx_t *ctx, array_literal_expression_t *expr)
 {
-    unsigned i, elem_cnt = expr->length;
+    unsigned length = 0;
     array_element_t *iter;
+    unsigned array_instr;
     HRESULT hres;
 
-    for(iter = expr->element_list; iter; iter = iter->next) {
-        elem_cnt += iter->elision+1;
+    array_instr = push_instr(ctx, OP_carray);
 
-        for(i=0; i < iter->elision; i++) {
-            if(!push_instr(ctx, OP_undefined))
-                return E_OUTOFMEMORY;
-        }
+    for(iter = expr->element_list; iter; iter = iter->next) {
+        length += iter->elision;
 
         hres = compile_expression(ctx, iter->expr, TRUE);
         if(FAILED(hres))
             return hres;
-    }
 
-    for(i=0; i < expr->length; i++) {
-        if(!push_instr(ctx, OP_undefined))
-            return E_OUTOFMEMORY;
+        hres = push_instr_uint(ctx, OP_carray_set, length);
+        if(FAILED(hres))
+            return hres;
+
+        length++;
     }
 
-    return push_instr_uint(ctx, OP_carray, elem_cnt);
+    instr_ptr(ctx, array_instr)->u.arg[0].uint = length + expr->length;
+    return S_OK;
 }
 
 static HRESULT compile_object_literal(compiler_ctx_t *ctx, property_value_expression_t *expr)
index fb81dd4..28ad23d 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <limits.h>
+#include <math.h>
+#include <assert.h>
+
 #include "jscript.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 /* 1601 to 1970 is 369 years plus 89 leap days */
 #define TIME_EPOCH  ((ULONGLONG)(369 * 365 + 89) * 86400 * 1000)
 
@@ -38,6 +49,7 @@ typedef struct {
 static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
 static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0};
 static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
+static const WCHAR toISOStringW[] = {'t','o','I','S','O','S','t','r','i','n','g',0};
 static const WCHAR toUTCStringW[] = {'t','o','U','T','C','S','t','r','i','n','g',0};
 static const WCHAR toGMTStringW[] = {'t','o','G','M','T','S','t','r','i','n','g',0};
 static const WCHAR toDateStringW[] = {'t','o','D','a','t','e','S','t','r','i','n','g',0};
@@ -81,6 +93,7 @@ static const WCHAR getYearW[] = {'g','e','t','Y','e','a','r',0};
 static const WCHAR setYearW[] = {'s','e','t','Y','e','a','r',0};
 
 static const WCHAR UTCW[] = {'U','T','C',0};
+static const WCHAR nowW[] = {'n','o','w',0};
 static const WCHAR parseW[] = {'p','a','r','s','e',0};
 
 static inline DateInstance *date_from_jsdisp(jsdisp_t *jsdisp)
@@ -441,6 +454,17 @@ static inline DOUBLE time_clip(DOUBLE time)
     return floor(time);
 }
 
+static double date_now(void)
+{
+    FILETIME ftime;
+    LONGLONG time;
+
+    GetSystemTimeAsFileTime(&ftime);
+    time = ((LONGLONG)ftime.dwHighDateTime << 32) + ftime.dwLowDateTime;
+
+    return time/10000 - TIME_EPOCH;
+}
+
 static SYSTEMTIME create_systemtime(DOUBLE time)
 {
     SYSTEMTIME st;
@@ -609,6 +633,52 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
     return S_OK;
 }
 
+static HRESULT Date_toISOString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
+        jsval_t *r)
+{
+    DateInstance *date;
+    WCHAR buf[64], *p = buf;
+    double year;
+
+    static const WCHAR short_year_formatW[] = {'%','0','4','d',0};
+    static const WCHAR long_year_formatW[] = {'%','0','6','d',0};
+    static const WCHAR formatW[] = {'-','%','0','2','d','-','%','0','2','d',
+        'T','%','0','2','d',':','%','0','2','d',':','%','0','2','d','.','%','0','3','d','Z',0};
+
+    TRACE("\n");
+
+    if(!(date = date_this(jsthis)))
+        return throw_type_error(ctx, JS_E_DATE_EXPECTED, NULL);
+
+    year = year_from_time(date->time);
+    if(isnan(year) || year > 999999 || year < -999999) {
+        FIXME("year %lf should throw an exception\n", year);
+        return E_FAIL;
+    }
+
+    if(year < 0) {
+        *p++ = '-';
+        p += sprintfW(p, long_year_formatW, -(int)year);
+    }else if(year > 9999) {
+        *p++ = '+';
+        p += sprintfW(p, long_year_formatW, (int)year);
+    }else {
+        p += sprintfW(p, short_year_formatW, (int)year);
+    }
+
+    sprintfW(p, formatW, (int)month_from_time(date->time) + 1, (int)date_from_time(date->time),
+             (int)hour_from_time(date->time), (int)min_from_time(date->time),
+             (int)sec_from_time(date->time), (int)ms_from_time(date->time));
+
+    if(r) {
+        jsstr_t *ret;
+        if(!(ret = jsstr_alloc(buf)))
+            return E_OUTOFMEMORY;
+        *r = jsval_string(ret);
+    }
+    return S_OK;
+}
+
 static HRESULT Date_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -1900,6 +1970,7 @@ static const builtin_prop_t Date_props[] = {
     {setYearW,               Date_setYear,               PROPF_METHOD|1},
     {toDateStringW,          Date_toDateString,          PROPF_METHOD},
     {toGMTStringW,           Date_toGMTString,           PROPF_METHOD},
+    {toISOStringW,           Date_toISOString,           PROPF_METHOD|PROPF_ES5},
     {toLocaleDateStringW,    Date_toLocaleDateString,    PROPF_METHOD},
     {toLocaleStringW,        Date_toLocaleString,        PROPF_METHOD},
     {toLocaleTimeStringW,    Date_toLocaleTimeString,    PROPF_METHOD},
@@ -2350,6 +2421,15 @@ static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
     return hres;
 }
 
+/* ECMA-262 5.1 Edition    15.9.4.4 */
+static HRESULT DateConstr_now(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
+{
+    TRACE("\n");
+
+    if(r) *r = jsval_number(date_now());
+    return S_OK;
+}
+
 static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -2362,19 +2442,11 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
     case DISPATCH_CONSTRUCT:
         switch(argc) {
         /* ECMA-262 3rd Edition    15.9.3.3 */
-        case 0: {
-            FILETIME time;
-            LONGLONG lltime;
-
-            GetSystemTimeAsFileTime(&time);
-            lltime = ((LONGLONG)time.dwHighDateTime<<32)
-                + time.dwLowDateTime;
-
-            hres = create_date(ctx, NULL, lltime/10000-TIME_EPOCH, &date);
+        case 0:
+            hres = create_date(ctx, NULL, date_now(), &date);
             if(FAILED(hres))
                 return hres;
             break;
-        }
 
         /* ECMA-262 3rd Edition    15.9.3.2 */
         case 1: {
@@ -2443,6 +2515,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
 
 static const builtin_prop_t DateConstr_props[] = {
     {UTCW,    DateConstr_UTC,    PROPF_METHOD},
+    {nowW,    DateConstr_now,    PROPF_HTML|PROPF_METHOD},
     {parseW,  DateConstr_parse,  PROPF_METHOD}
 };
 
index 1799b91..d402d7c 100644 (file)
 
 #include "jscript.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 /*
  * This file implements algorithm for decoding scripts encoded by
  * screnc.exe. The 'secret' algorithm that's well documented here:
index 8bc03d1..65ca47a 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <assert.h>
+
 #include "jscript.h"
 
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 #define FDEX_VERSION_MASK 0xf0000000
 #define GOLDEN_RATIO 0x9E3779B9U
 
@@ -25,6 +32,7 @@ typedef enum {
     PROP_JSVAL,
     PROP_BUILTIN,
     PROP_PROTREF,
+    PROP_ACCESSOR,
     PROP_DELETED,
     PROP_IDX
 } prop_type_t;
@@ -40,6 +48,10 @@ struct _dispex_prop_t {
         const builtin_prop_t *p;
         DWORD ref;
         unsigned idx;
+        struct {
+            jsdisp_t *getter;
+            jsdisp_t *setter;
+        } accessor;
     } u;
 
     int bucket_head;
@@ -83,8 +95,19 @@ static const builtin_prop_t *find_builtin_prop(jsdisp_t *This, const WCHAR *name
         i = (min+max)/2;
 
         r = strcmpW(name, This->builtin_info->props[i].name);
-        if(!r)
+        if(!r) {
+            /* Skip prop if it's available only in higher compatibility mode. */
+            unsigned version = (This->builtin_info->props[i].flags & PROPF_VERSION_MASK)
+                >> PROPF_VERSION_SHIFT;
+            if(version && version > This->ctx->version)
+                return NULL;
+
+            /* Skip prop if it's available only in HTML mode and we're not running in HTML mode. */
+            if((This->builtin_info->props[i].flags & PROPF_HTML) && !This->ctx->html_mode)
+                return NULL;
+
             return This->builtin_info->props + i;
+        }
 
         if(r < 0)
             max = i-1;
@@ -198,7 +221,13 @@ static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name,
 
     builtin = find_builtin_prop(This, name);
     if(builtin) {
-        prop = alloc_prop(This, name, PROP_BUILTIN, builtin->flags);
+        unsigned flags = builtin->flags;
+        if(flags & PROPF_METHOD)
+            flags |= PROPF_WRITABLE | PROPF_CONFIGURABLE;
+        else if(builtin->setter)
+            flags |= PROPF_WRITABLE;
+        flags &= PROPF_ENUMERABLE | PROPF_WRITABLE | PROPF_CONFIGURABLE;
+        prop = alloc_prop(This, name, PROP_BUILTIN, flags);
         if(!prop)
             return E_OUTOFMEMORY;
 
@@ -214,7 +243,7 @@ static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name,
         for(ptr = name; isdigitW(*ptr) && idx < 0x10000; ptr++)
             idx = idx*10 + (*ptr-'0');
         if(!*ptr && idx < This->builtin_info->idx_length(This)) {
-            prop = alloc_prop(This, name, PROP_IDX, This->builtin_info->idx_put ? 0 : PROPF_CONST);
+            prop = alloc_prop(This, name, PROP_IDX, This->builtin_info->idx_put ? PROPF_WRITABLE : 0);
             if(!prop)
                 return E_OUTOFMEMORY;
 
@@ -250,7 +279,6 @@ static HRESULT find_prop_name_prot(jsdisp_t *This, unsigned hash, const WCHAR *n
         if(prop) {
             if(del) {
                 del->type = PROP_PROTREF;
-                del->flags = 0;
                 del->u.ref = prop - This->prototype->props;
                 prop = del;
             }else {
@@ -268,15 +296,12 @@ static HRESULT find_prop_name_prot(jsdisp_t *This, unsigned hash, const WCHAR *n
     return S_OK;
 }
 
-static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, BOOL search_prot, DWORD create_flags, dispex_prop_t **ret)
+static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, DWORD create_flags, dispex_prop_t **ret)
 {
     dispex_prop_t *prop;
     HRESULT hres;
 
-    if(search_prot)
-        hres = find_prop_name_prot(This, string_hash(name), name, &prop);
-    else
-        hres = find_prop_name(This, string_hash(name), name, &prop);
+    hres = find_prop_name_prot(This, string_hash(name), name, &prop);
     if(SUCCEEDED(hres) && (!prop || prop->type == PROP_DELETED)) {
         TRACE("creating prop %s flags %x\n", debugstr_w(name), create_flags);
 
@@ -390,6 +415,9 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
 
         return disp_call_value(This->ctx, get_object(prop->u.val), jsthis, flags, argc, argv, r);
     }
+    case PROP_ACCESSOR:
+        FIXME("accessor\n");
+        return E_NOTIMPL;
     case PROP_IDX:
         FIXME("Invoking PROP_IDX not yet supported\n");
         return E_NOTIMPL;
@@ -401,11 +429,16 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
     return E_FAIL;
 }
 
-static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
-        jsval_t *r, IServiceProvider *caller)
+static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop,  jsval_t *r)
 {
+    jsdisp_t *prop_obj = This;
     HRESULT hres;
 
+    while(prop->type == PROP_PROTREF) {
+        prop_obj = prop_obj->prototype;
+        prop = prop_obj->props + prop->u.ref;
+    }
+
     switch(prop->type) {
     case PROP_BUILTIN:
         if(prop->u.p->getter) {
@@ -426,14 +459,20 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
             *r = jsval_obj(obj);
         }
         break;
-    case PROP_PROTREF:
-        hres = prop_get(This->prototype, This->prototype->props+prop->u.ref, dp, r, caller);
-        break;
     case PROP_JSVAL:
         hres = jsval_copy(prop->u.val, r);
         break;
+    case PROP_ACCESSOR:
+        if(prop->u.accessor.getter) {
+            hres = jsdisp_call_value(prop->u.accessor.getter, to_disp(This),
+                                     DISPATCH_METHOD, 0, NULL, r);
+        }else {
+            *r = jsval_undefined();
+            hres = S_OK;
+        }
+        break;
     case PROP_IDX:
-        hres = This->builtin_info->idx_get(This, prop->u.idx, r);
+        hres = prop_obj->builtin_info->idx_get(prop_obj, prop->u.idx, r);
         break;
     default:
         ERR("type %d\n", prop->type);
@@ -449,32 +488,53 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
     return hres;
 }
 
-static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServiceProvider *caller)
+static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
 {
     HRESULT hres;
 
-    if(prop->flags & PROPF_CONST)
-        return S_OK;
+    if(prop->type == PROP_PROTREF) {
+        dispex_prop_t *prop_iter = prop;
+        jsdisp_t *prototype_iter = This;
+
+        do {
+            prototype_iter = prototype_iter->prototype;
+            prop_iter = prototype_iter->props + prop_iter->u.ref;
+        } while(prop_iter->type == PROP_PROTREF);
+
+        if(prop_iter->type == PROP_ACCESSOR)
+            prop = prop_iter;
+    }
 
     switch(prop->type) {
     case PROP_BUILTIN:
-        if(prop->u.p->setter)
-            return prop->u.p->setter(This->ctx, This, val);
-
-        if(prop->u.p->setter) {
-            FIXME("getter with no setter\n");
-            return E_FAIL;
+        if(!prop->u.p->setter) {
+            TRACE("getter with no setter\n");
+            return S_OK;
         }
-        /* fall through */
+        return prop->u.p->setter(This->ctx, This, val);
     case PROP_PROTREF:
+    case PROP_DELETED:
         prop->type = PROP_JSVAL;
-        prop->flags = PROPF_ENUM;
+        prop->flags = PROPF_ENUMERABLE | PROPF_CONFIGURABLE | PROPF_WRITABLE;
         prop->u.val = jsval_undefined();
         break;
     case PROP_JSVAL:
+        if(!(prop->flags & PROPF_WRITABLE))
+            return S_OK;
+
         jsval_release(prop->u.val);
         break;
+    case PROP_ACCESSOR:
+        if(!prop->u.accessor.setter) {
+            TRACE("no setter\n");
+            return S_OK;
+        }
+        return jsdisp_call_value(prop->u.accessor.setter, to_disp(This), DISPATCH_METHOD, 1, &val, NULL);
     case PROP_IDX:
+        if(!This->builtin_info->idx_put) {
+            TRACE("no put_idx\n");
+            return S_OK;
+        }
         return This->builtin_info->idx_put(This, prop->u.idx, val);
     default:
         ERR("type %d\n", prop->type);
@@ -686,7 +746,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
     case DISPATCH_PROPERTYGET: {
         jsval_t r;
 
-        hres = prop_get(This, prop, pdp, &r, pspCaller);
+        hres = prop_get(This, prop, &r);
         if(SUCCEEDED(hres)) {
             hres = jsval_to_variant(r, pvarRes);
             jsval_release(r);
@@ -711,7 +771,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
         if(FAILED(hres))
             return hres;
 
-        hres = prop_put(This, prop, val, pspCaller);
+        hres = prop_put(This, prop, val);
         jsval_release(val);
         break;
     }
@@ -727,7 +787,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
 
 static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
 {
-    if(prop->flags & PROPF_DONTDELETE) {
+    if(!(prop->flags & PROPF_CONFIGURABLE)) {
         *ret = FALSE;
         return S_OK;
     }
@@ -738,6 +798,8 @@ static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
         jsval_release(prop->u.val);
         prop->type = PROP_DELETED;
     }
+    if(prop->type == PROP_ACCESSOR)
+        FIXME("not supported on accessor property\n");
     return S_OK;
 }
 
@@ -828,7 +890,7 @@ static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex,
     }
 
     while(iter < This->props + This->prop_cnt) {
-        if(iter->name && (get_flags(This, iter) & PROPF_ENUM) && iter->type!=PROP_DELETED) {
+        if(iter->name && (get_flags(This, iter) & PROPF_ENUMERABLE) && iter->type!=PROP_DELETED) {
             *pid = prop_to_id(This, iter);
             return S_OK;
         }
@@ -939,8 +1001,19 @@ void jsdisp_free(jsdisp_t *obj)
     TRACE("(%p)\n", obj);
 
     for(prop = obj->props; prop < obj->props+obj->prop_cnt; prop++) {
-        if(prop->type == PROP_JSVAL)
+        switch(prop->type) {
+        case PROP_JSVAL:
             jsval_release(prop->u.val);
+            break;
+        case PROP_ACCESSOR:
+            if(prop->u.accessor.getter)
+                jsdisp_release(prop->u.accessor.getter);
+            if(prop->u.accessor.setter)
+                jsdisp_release(prop->u.accessor.setter);
+            break;
+        default:
+            break;
+        };
         heap_free(prop->name);
     }
     heap_free(obj->props);
@@ -987,7 +1060,7 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
     if(SUCCEEDED(hres) && prop && prop->type!=PROP_DELETED) {
         jsval_t val;
 
-        hres = prop_get(constr, prop, NULL, &val, NULL);
+        hres = prop_get(constr, prop, &val);
         if(FAILED(hres)) {
             ERR("Could not get prototype\n");
             return hres;
@@ -1018,7 +1091,8 @@ HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *
     HRESULT hres;
 
     if(flags & fdexNameEnsure)
-        hres = ensure_prop_name(jsdisp, name, TRUE, PROPF_ENUM, &prop);
+        hres = ensure_prop_name(jsdisp, name, PROPF_ENUMERABLE | PROPF_CONFIGURABLE | PROPF_WRITABLE,
+                                &prop);
     else
         hres = find_prop_name_prot(jsdisp, string_hash(name), name, &prop);
     if(FAILED(hres))
@@ -1281,33 +1355,16 @@ HRESULT jsdisp_propput(jsdisp_t *obj, const WCHAR *name, DWORD flags, jsval_t va
     dispex_prop_t *prop;
     HRESULT hres;
 
-    hres = ensure_prop_name(obj, name, FALSE, flags, &prop);
+    hres = ensure_prop_name(obj, name, flags, &prop);
     if(FAILED(hres))
         return hres;
 
-    return prop_put(obj, prop, val, NULL);
+    return prop_put(obj, prop, val);
 }
 
 HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
 {
-    return jsdisp_propput(obj, name, PROPF_ENUM, val);
-}
-
-HRESULT jsdisp_propput_const(jsdisp_t *obj, const WCHAR *name, jsval_t val)
-{
-    dispex_prop_t *prop;
-    HRESULT hres;
-
-    hres = ensure_prop_name(obj, name, FALSE, PROPF_CONST, &prop);
-    if(FAILED(hres))
-        return hres;
-
-    return jsval_copy(val, &prop->u.val);
-}
-
-HRESULT jsdisp_propput_dontenum(jsdisp_t *obj, const WCHAR *name, jsval_t val)
-{
-    return jsdisp_propput(obj, name, 0, val);
+    return jsdisp_propput(obj, name, PROPF_ENUMERABLE | PROPF_CONFIGURABLE | PROPF_WRITABLE, val);
 }
 
 HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
@@ -1331,7 +1388,7 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
 
         prop = get_prop(jsdisp, id);
         if(prop)
-            hres = prop_put(jsdisp, prop, val, NULL);
+            hres = prop_put(jsdisp, prop, val);
         else
             hres = DISP_E_MEMBERNOTFOUND;
 
@@ -1371,7 +1428,6 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
 
 HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val)
 {
-    DISPPARAMS dp = {NULL, NULL, 0, 0};
     dispex_prop_t *prop;
     HRESULT hres;
 
@@ -1384,13 +1440,12 @@ HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val)
         return S_OK;
     }
 
-    return prop_get(obj, prop, &dp, val, NULL);
+    return prop_get(obj, prop, val);
 }
 
 HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r)
 {
     WCHAR name[12];
-    DISPPARAMS dp = {NULL, NULL, 0, 0};
     dispex_prop_t *prop;
     HRESULT hres;
 
@@ -1407,19 +1462,18 @@ HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r)
         return DISP_E_UNKNOWNNAME;
     }
 
-    return prop_get(obj, prop, &dp, r, NULL);
+    return prop_get(obj, prop, r);
 }
 
 HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val)
 {
-    DISPPARAMS dp  = {NULL,NULL,0,0};
     dispex_prop_t *prop;
 
     prop = get_prop(jsdisp, id);
     if(!prop)
         return DISP_E_MEMBERNOTFOUND;
 
-    return prop_get(jsdisp, prop, &dp, val, NULL);
+    return prop_get(jsdisp, prop, val);
 }
 
 HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t *val)
@@ -1569,7 +1623,8 @@ HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL
     return hres;
 }
 
-HRESULT jsdisp_is_own_prop(jsdisp_t *obj, const WCHAR *name, BOOL *ret)
+HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_only,
+                                property_desc_t *desc)
 {
     dispex_prop_t *prop;
     HRESULT hres;
@@ -1578,11 +1633,41 @@ HRESULT jsdisp_is_own_prop(jsdisp_t *obj, const WCHAR *name, BOOL *ret)
     if(FAILED(hres))
         return hres;
 
-    *ret = prop && (prop->type == PROP_JSVAL || prop->type == PROP_BUILTIN);
+    if(!prop)
+        return DISP_E_UNKNOWNNAME;
+
+    memset(desc, 0, sizeof(*desc));
+
+    switch(prop->type) {
+    case PROP_BUILTIN:
+    case PROP_JSVAL:
+        desc->mask |= PROPF_WRITABLE;
+        desc->explicit_value = TRUE;
+        if(!flags_only) {
+            hres = prop_get(obj, prop, &desc->value);
+            if(FAILED(hres))
+                return hres;
+        }
+        break;
+    case PROP_ACCESSOR:
+        desc->explicit_getter = desc->explicit_setter = TRUE;
+        if(!flags_only) {
+            desc->getter = prop->u.accessor.getter
+                ? jsdisp_addref(prop->u.accessor.getter) : NULL;
+            desc->setter = prop->u.accessor.setter
+                ? jsdisp_addref(prop->u.accessor.setter) : NULL;
+        }
+        break;
+    default:
+        return DISP_E_UNKNOWNNAME;
+    }
+
+    desc->flags = prop->flags & (PROPF_ENUMERABLE | PROPF_WRITABLE | PROPF_CONFIGURABLE);
+    desc->mask |= PROPF_ENUMERABLE | PROPF_CONFIGURABLE;
     return S_OK;
 }
 
-HRESULT jsdisp_is_enumerable(jsdisp_t *obj, const WCHAR *name, BOOL *ret)
+HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t *desc)
 {
     dispex_prop_t *prop;
     HRESULT hres;
@@ -1591,6 +1676,124 @@ HRESULT jsdisp_is_enumerable(jsdisp_t *obj, const WCHAR *name, BOOL *ret)
     if(FAILED(hres))
         return hres;
 
-    *ret = prop && (prop->flags & PROPF_ENUM) && prop->type != PROP_PROTREF;
+    if(!prop && !(prop = alloc_prop(obj, name, PROP_DELETED, 0)))
+       return E_OUTOFMEMORY;
+
+    if(prop->type == PROP_DELETED || prop->type == PROP_PROTREF) {
+        prop->flags = desc->flags;
+        if(desc->explicit_getter || desc->explicit_setter) {
+            prop->type = PROP_ACCESSOR;
+            prop->u.accessor.getter = desc->getter ? jsdisp_addref(desc->getter) : NULL;
+            prop->u.accessor.setter = desc->setter ? jsdisp_addref(desc->setter) : NULL;
+            TRACE("%s = accessor { get: %p set: %p }\n", debugstr_w(name),
+                  prop->u.accessor.getter, prop->u.accessor.setter);
+        }else {
+            prop->type = PROP_JSVAL;
+            if(desc->explicit_value) {
+                hres = jsval_copy(desc->value, &prop->u.val);
+                if(FAILED(hres))
+                    return hres;
+            }else {
+                prop->u.val = jsval_undefined();
+            }
+            TRACE("%s = %s\n", debugstr_w(name), debugstr_jsval(prop->u.val));
+        }
+        return S_OK;
+    }
+
+    TRACE("existing prop %s prop flags %x desc flags %x desc mask %x\n", debugstr_w(name),
+          prop->flags, desc->flags, desc->mask);
+
+    if(!(prop->flags & PROPF_CONFIGURABLE)) {
+        if(((desc->mask & PROPF_CONFIGURABLE) && (desc->flags & PROPF_CONFIGURABLE))
+           || ((desc->mask & PROPF_ENUMERABLE)
+               && ((desc->flags & PROPF_ENUMERABLE) != (prop->flags & PROPF_ENUMERABLE))))
+            return throw_type_error(obj->ctx, JS_E_NONCONFIGURABLE_REDEFINED, name);
+    }
+
+    if(desc->explicit_value || (desc->mask & PROPF_WRITABLE)) {
+        if(prop->type == PROP_ACCESSOR) {
+            if(!(prop->flags & PROPF_CONFIGURABLE))
+                return throw_type_error(obj->ctx, JS_E_NONCONFIGURABLE_REDEFINED, name);
+            if(prop->u.accessor.getter)
+                jsdisp_release(prop->u.accessor.getter);
+            if(prop->u.accessor.setter)
+                jsdisp_release(prop->u.accessor.setter);
+
+            prop->type = PROP_JSVAL;
+            hres = jsval_copy(desc->value, &prop->u.val);
+            if(FAILED(hres)) {
+                prop->u.val = jsval_undefined();
+                return hres;
+            }
+        }else {
+            if(!(prop->flags & PROPF_CONFIGURABLE) && !(prop->flags & PROPF_WRITABLE)) {
+                if((desc->mask & PROPF_WRITABLE) && (desc->flags & PROPF_WRITABLE))
+                    return throw_type_error(obj->ctx, JS_E_NONWRITABLE_MODIFIED, name);
+                if(desc->explicit_value) {
+                    if(prop->type == PROP_JSVAL) {
+                        BOOL eq;
+                        hres = jsval_strict_equal(desc->value, prop->u.val, &eq);
+                        if(FAILED(hres))
+                            return hres;
+                        if(!eq)
+                            return throw_type_error(obj->ctx, JS_E_NONWRITABLE_MODIFIED, name);
+                    }else {
+                        FIXME("redefinition of property type %d\n", prop->type);
+                    }
+                }
+            }
+            if(desc->explicit_value) {
+                if(prop->type == PROP_JSVAL)
+                    jsval_release(prop->u.val);
+                else
+                    prop->type = PROP_JSVAL;
+                hres = jsval_copy(desc->value, &prop->u.val);
+                if(FAILED(hres)) {
+                    prop->u.val = jsval_undefined();
+                    return hres;
+                }
+            }
+        }
+    }else if(desc->explicit_getter || desc->explicit_setter) {
+        if(prop->type != PROP_ACCESSOR) {
+            if(!(prop->flags & PROPF_CONFIGURABLE))
+                return throw_type_error(obj->ctx, JS_E_NONCONFIGURABLE_REDEFINED, name);
+            if(prop->type == PROP_JSVAL)
+                jsval_release(prop->u.val);
+            prop->type = PROP_ACCESSOR;
+            prop->u.accessor.getter = prop->u.accessor.setter = NULL;
+        }else if(!(prop->flags & PROPF_CONFIGURABLE)) {
+            if((desc->explicit_getter && desc->getter != prop->u.accessor.getter)
+               || (desc->explicit_setter && desc->setter != prop->u.accessor.setter))
+                return throw_type_error(obj->ctx, JS_E_NONCONFIGURABLE_REDEFINED, name);
+        }
+
+        if(desc->explicit_getter) {
+            if(prop->u.accessor.getter) {
+                jsdisp_release(prop->u.accessor.getter);
+                prop->u.accessor.getter = NULL;
+            }
+            if(desc->getter)
+                prop->u.accessor.getter = jsdisp_addref(desc->getter);
+        }
+        if(desc->explicit_setter) {
+            if(prop->u.accessor.setter) {
+                jsdisp_release(prop->u.accessor.setter);
+                prop->u.accessor.setter = NULL;
+            }
+            if(desc->setter)
+                prop->u.accessor.setter = jsdisp_addref(desc->setter);
+        }
+    }
+
+    prop->flags = (prop->flags & ~desc->mask) | (desc->flags & desc->mask);
     return S_OK;
 }
+
+HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
+{
+    property_desc_t prop_desc = { flags, flags, TRUE };
+    prop_desc.value = value;
+    return jsdisp_define_property(obj, name, &prop_desc);
+}
index 16fe6aa..d41afa5 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <math.h>
+#include <assert.h>
+
 #include "jscript.h"
+#include "engine.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 static const WCHAR booleanW[] = {'b','o','o','l','e','a','n',0};
 static const WCHAR functionW[] = {'f','u','n','c','t','i','o','n',0};
@@ -514,7 +525,7 @@ static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, BOOL *ret)
 }
 
 /* ECMA-262 3rd Edition    11.9.6 */
-static HRESULT equal2_values(jsval_t lval, jsval_t rval, BOOL *ret)
+HRESULT jsval_strict_equal(jsval_t lval, jsval_t rval, BOOL *ret)
 {
     jsval_type_t type = jsval_type(lval);
 
@@ -843,7 +854,7 @@ static HRESULT interp_case(script_ctx_t *ctx)
     TRACE("\n");
 
     v = stack_pop(ctx);
-    hres = equal2_values(stack_top(ctx), v, &b);
+    hres = jsval_strict_equal(stack_top(ctx), v, &b);
     jsval_release(v);
     if(FAILED(hres))
         return hres;
@@ -1290,7 +1301,7 @@ static HRESULT interp_local(script_ctx_t *ctx)
     jsval_t copy;
     HRESULT hres;
 
-    TRACE("%d\n", arg);
+    TRACE("%d: %s\n", arg, debugstr_w(local_name(frame, arg)));
 
     if(!frame->base_scope || !frame->base_scope->frame)
         return identifier_value(ctx, local_name(frame, arg));
@@ -1393,8 +1404,6 @@ static HRESULT interp_carray(script_ctx_t *ctx)
 {
     const unsigned arg = get_op_uint(ctx, 0);
     jsdisp_t *array;
-    jsval_t val;
-    unsigned i;
     HRESULT hres;
 
     TRACE("%u\n", arg);
@@ -1403,20 +1412,27 @@ static HRESULT interp_carray(script_ctx_t *ctx)
     if(FAILED(hres))
         return hres;
 
-    i = arg;
-    while(i--) {
-        val = stack_pop(ctx);
-        hres = jsdisp_propput_idx(array, i, val);
-        jsval_release(val);
-        if(FAILED(hres)) {
-            jsdisp_release(array);
-            return hres;
-        }
-    }
-
     return stack_push(ctx, jsval_obj(array));
 }
 
+static HRESULT interp_carray_set(script_ctx_t *ctx)
+{
+    const unsigned index = get_op_uint(ctx, 0);
+    jsval_t value, array;
+    HRESULT hres;
+
+    value = stack_pop(ctx);
+
+    TRACE("[%u] = %s\n", index, debugstr_jsval(value));
+
+    array = stack_top(ctx);
+    assert(is_object_instance(array));
+
+    hres = jsdisp_propput_idx(iface_to_jsdisp(get_object(array)), index, value);
+    jsval_release(value);
+    return hres;
+}
+
 /* ECMA-262 3rd Edition    11.1.5 */
 static HRESULT interp_new_obj(script_ctx_t *ctx)
 {
@@ -2092,7 +2108,7 @@ static HRESULT interp_preinc(script_ctx_t *ctx)
 static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, BOOL *ret)
 {
     if(jsval_type(lval) == jsval_type(rval) || (is_number(lval) && is_number(rval)))
-       return equal2_values(lval, rval, ret);
+       return jsval_strict_equal(lval, rval, ret);
 
     /* FIXME: NULL disps should be handled in more general way */
     if(is_object_instance(lval) && !get_object(lval))
@@ -2222,7 +2238,7 @@ static HRESULT interp_eq2(script_ctx_t *ctx)
 
     TRACE("%s === %s\n", debugstr_jsval(l), debugstr_jsval(r));
 
-    hres = equal2_values(r, l, &b);
+    hres = jsval_strict_equal(r, l, &b);
     jsval_release(l);
     jsval_release(r);
     if(FAILED(hres))
@@ -2243,7 +2259,7 @@ static HRESULT interp_neq2(script_ctx_t *ctx)
     r = stack_pop(ctx);
     l = stack_pop(ctx);
 
-    hres = equal2_values(r, l, &b);
+    hres = jsval_strict_equal(r, l, &b);
     jsval_release(l);
     jsval_release(r);
     if(FAILED(hres))
index ce4c326..6d40e30 100644 (file)
     X(and,        1, 0,0)                  \
     X(array,      1, 0,0)                  \
     X(assign,     1, 0,0)                  \
-    X(assign_call,1, ARG_UINT,   0)       \
+    X(assign_call,1, ARG_UINT,   0)        \
     X(bool,       1, ARG_INT,    0)        \
     X(bneg,       1, 0,0)                  \
     X(call,       1, ARG_UINT,   ARG_UINT) \
     X(call_member,1, ARG_UINT,   ARG_UINT) \
     X(carray,     1, ARG_UINT,   0)        \
+    X(carray_set, 1, ARG_UINT,   0)        \
     X(case,       0, ARG_ADDR,   0)        \
     X(cnd_nz,     0, ARG_ADDR,   0)        \
     X(cnd_z,      0, ARG_ADDR,   0)        \
diff --git a/dll/win32/jscript/enumerator.c b/dll/win32/jscript/enumerator.c
new file mode 100644 (file)
index 0000000..f5b5ede
--- /dev/null
@@ -0,0 +1,363 @@
+/*
+ * Copyright 2019 Andreas Maier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <assert.h>
+
+#include "jscript.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
+typedef struct {
+    jsdisp_t dispex;
+    /* IEnumVARIANT returned by _NewEnum */
+    IEnumVARIANT *enumvar;
+    /* current item */
+    jsval_t item;
+    BOOL atend;
+} EnumeratorInstance;
+
+static const WCHAR atEndW[] = {'a','t','E','n','d',0};
+static const WCHAR itemW[] = {'i','t','e','m',0};
+static const WCHAR moveFirstW[] = {'m','o','v','e','F','i','r','s','t',0};
+static const WCHAR moveNextW[] = {'m','o','v','e','N','e','x','t',0};
+
+static inline EnumeratorInstance *enumerator_from_jsdisp(jsdisp_t *jsdisp)
+{
+    return CONTAINING_RECORD(jsdisp, EnumeratorInstance, dispex);
+}
+
+static inline EnumeratorInstance *enumerator_from_vdisp(vdisp_t *vdisp)
+{
+    return enumerator_from_jsdisp(vdisp->u.jsdisp);
+}
+
+static inline EnumeratorInstance *enumerator_this(vdisp_t *jsthis)
+{
+    return is_vclass(jsthis, JSCLASS_ENUMERATOR) ? enumerator_from_vdisp(jsthis) : NULL;
+}
+
+static inline HRESULT enumvar_get_next_item(EnumeratorInstance *This)
+{
+    HRESULT hres;
+    VARIANT nextitem;
+
+    if (This->atend)
+        return S_OK;
+
+    /* dont leak pervious value */
+    jsval_release(This->item);
+
+    /* not at end ... get next item */
+    VariantInit(&nextitem);
+    hres = IEnumVARIANT_Next(This->enumvar, 1, &nextitem, NULL);
+    if (hres == S_OK)
+    {
+        hres = variant_to_jsval(&nextitem, &This->item);
+        if (FAILED(hres))
+        {
+            WARN("failed to convert jsval to variant!");
+            This->item = jsval_undefined();
+        }
+    }
+    else
+    {
+        This->item = jsval_undefined();
+        This->atend = TRUE;
+    }
+    VariantClear(&nextitem);
+
+    return S_OK;
+}
+
+static void Enumerator_destructor(jsdisp_t *dispex)
+{
+    EnumeratorInstance *This = enumerator_from_jsdisp(dispex);
+
+    TRACE("\n");
+
+    jsval_release(This->item);
+    heap_free(dispex);
+}
+
+static HRESULT Enumerator_atEnd(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
+        jsval_t *r)
+{
+    EnumeratorInstance *This;
+
+    if (!(This = enumerator_this(jsthis)))
+        return throw_type_error(ctx, JS_E_ENUMERATOR_EXPECTED, NULL);
+
+    if (r)
+        *r = jsval_bool(This->atend);
+
+    TRACE("%d\n", This->atend);
+
+    return S_OK;
+}
+
+static HRESULT Enumerator_item(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
+        jsval_t *r)
+{
+    EnumeratorInstance *This;
+
+    TRACE("\n");
+
+    if (!(This = enumerator_this(jsthis)))
+        return throw_type_error(ctx, JS_E_ENUMERATOR_EXPECTED, NULL);
+
+    return r ? jsval_copy(This->item, r) : S_OK;
+}
+
+static HRESULT Enumerator_moveFirst(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
+        jsval_t *r)
+{
+    EnumeratorInstance *This;
+    HRESULT hres = S_OK;
+
+    TRACE("\n");
+
+    if (!(This = enumerator_this(jsthis)))
+        return throw_type_error(ctx, JS_E_ENUMERATOR_EXPECTED, NULL);
+
+    if (This->enumvar)
+    {
+        This->atend = FALSE;
+        hres = IEnumVARIANT_Reset(This->enumvar);
+        if (!FAILED(hres))
+            hres = enumvar_get_next_item(This);
+    }
+
+    if (r)
+        *r = jsval_undefined();
+
+    return hres;
+}
+
+static HRESULT Enumerator_moveNext(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
+        jsval_t *r)
+{
+    EnumeratorInstance *This;
+    HRESULT hres = S_OK;
+
+    TRACE("\n");
+
+    if (!(This = enumerator_this(jsthis)))
+        return throw_type_error(ctx, JS_E_ENUMERATOR_EXPECTED, NULL);
+
+    if (This->enumvar)
+        hres = enumvar_get_next_item(This);
+
+    if (r)
+        *r = jsval_undefined();
+
+    return hres;
+}
+
+static const builtin_prop_t Enumerator_props[] = {
+    {atEndW,     Enumerator_atEnd,     PROPF_METHOD},
+    {itemW,      Enumerator_item,      PROPF_METHOD},
+    {moveFirstW, Enumerator_moveFirst, PROPF_METHOD},
+    {moveNextW,  Enumerator_moveNext,  PROPF_METHOD},
+};
+
+static const builtin_info_t Enumerator_info = {
+    JSCLASS_ENUMERATOR,
+    {NULL, NULL, 0},
+    (sizeof(Enumerator_props) / sizeof(Enumerator_props[0])),
+    Enumerator_props,
+    NULL,
+    NULL
+};
+
+static const builtin_info_t EnumeratorInst_info = {
+    JSCLASS_ENUMERATOR,
+    {NULL, NULL, 0, NULL},
+    0,
+    NULL,
+    Enumerator_destructor,
+    NULL
+};
+
+static HRESULT EnumeratorConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
+        jsval_t *r)
+{
+    jsdisp_t *obj;
+    jsval_t *arg0;
+    HRESULT hres;
+
+    TRACE("\n");
+
+    switch(flags) {
+    case DISPATCH_CONSTRUCT: {
+        if (argc > 1)
+            return throw_syntax_error(ctx, JS_E_INVALIDARG, NULL);
+
+        arg0 = (argc == 1) ? &argv[0] : 0;
+        hres = create_enumerator(ctx, arg0, &obj);
+        if(FAILED(hres))
+            return hres;
+
+        *r = jsval_obj(obj);
+        break;
+    }
+    default:
+        FIXME("unimplemented flags: %x\n", flags);
+        return E_NOTIMPL;
+    }
+
+    return S_OK;
+}
+
+static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, EnumeratorInstance **ret)
+{
+    EnumeratorInstance *enumerator;
+    HRESULT hres;
+
+    enumerator = heap_alloc_zero(sizeof(EnumeratorInstance));
+    if(!enumerator)
+        return E_OUTOFMEMORY;
+
+    if(object_prototype)
+        hres = init_dispex(&enumerator->dispex, ctx, &Enumerator_info, object_prototype);
+    else
+        hres = init_dispex_from_constr(&enumerator->dispex, ctx, &EnumeratorInst_info,
+                                       ctx->enumerator_constr);
+
+    if(FAILED(hres))
+    {
+        heap_free(enumerator);
+        return hres;
+    }
+
+    *ret = enumerator;
+    return S_OK;
+}
+
+static const builtin_info_t EnumeratorConstr_info = {
+    JSCLASS_FUNCTION,
+    DEFAULT_FUNCTION_VALUE,
+    0,
+    NULL,
+    NULL,
+    NULL
+};
+
+HRESULT create_enumerator_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp_t **ret)
+{
+    EnumeratorInstance *enumerator;
+    HRESULT hres;
+    static const WCHAR EnumeratorW[] = {'E','n','u','m','e','r','a','t','o','r',0};
+
+    hres = alloc_enumerator(ctx, object_prototype, &enumerator);
+    if(FAILED(hres))
+        return hres;
+
+    hres = create_builtin_constructor(ctx, EnumeratorConstr_value,
+                                     EnumeratorW, &EnumeratorConstr_info,
+                                     PROPF_CONSTR|7, &enumerator->dispex, ret);
+    jsdisp_release(&enumerator->dispex);
+
+    return hres;
+}
+
+HRESULT create_enumerator(script_ctx_t *ctx, jsval_t *argv, jsdisp_t **ret)
+{
+    EnumeratorInstance *enumerator;
+    HRESULT hres;
+    IDispatch *obj;
+    DISPPARAMS dispparams = {NULL, NULL, 0, 0};
+    VARIANT varresult;
+    BOOL atend;
+
+    IEnumVARIANT *enumvar;
+
+    memset(&varresult, 0, sizeof(VARIANT));
+    VariantInit(&varresult);
+
+    /* new Enumerator() */
+    if (argv == NULL)
+    {
+        enumvar = NULL;
+        atend = TRUE;
+    }
+    else if (is_object_instance(*argv))
+    {
+        obj = get_object(*argv);
+
+        /* Try to get a IEnumVARIANT by _NewEnum */
+        hres = IDispatch_Invoke(obj,
+            DISPID_NEWENUM, &IID_NULL, LOCALE_NEUTRAL,
+            DISPATCH_METHOD, &dispparams, &varresult,
+            NULL, NULL);
+        if (FAILED(hres))
+        {
+            WARN("Enumerator: no DISPID_NEWENUM.\n");
+            hres = E_INVALIDARG;
+            goto cleanuperr;
+        }
+
+        if ((V_VT(&varresult) == VT_DISPATCH) ||
+            (V_VT(&varresult) == VT_UNKNOWN))
+        {
+            hres = IUnknown_QueryInterface(V_UNKNOWN(&varresult),
+                &IID_IEnumVARIANT, (void**)&enumvar);
+            if (FAILED(hres))
+            {
+                hres = E_INVALIDARG;
+                goto cleanuperr;
+            }
+        }
+        else
+        {
+            FIXME("Enumerator: NewEnum unexpected type of varresult (%d).\n", V_VT(&varresult));
+            hres = E_INVALIDARG;
+            goto cleanuperr;
+        }
+        VariantClear(&varresult);
+
+        atend = FALSE;
+    }
+    else
+    {
+        FIXME("I don't know how to handle this type!\n");
+        hres = E_NOTIMPL;
+        goto cleanuperr;
+    }
+
+    hres = alloc_enumerator(ctx, NULL, &enumerator);
+    if(FAILED(hres))
+        goto cleanuperr;
+
+    enumerator->atend = atend;
+    enumerator->enumvar = enumvar;
+
+    hres = enumvar_get_next_item(enumerator);
+    if (FAILED(hres))
+        goto cleanuperr;
+
+    *ret = &enumerator->dispex;
+
+    return S_OK;
+cleanuperr:
+    VariantClear(&varresult);
+    if (enumerator)
+        heap_free(enumerator);
+    return hres;
+}
index 835f06e..8cf52f0 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <math.h>
+
 #include "jscript.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 static const WCHAR descriptionW[] = {'d','e','s','c','r','i','p','t','i','o','n',0};
 static const WCHAR messageW[] = {'m','e','s','s','a','g','e',0};
 static const WCHAR nameW[] = {'n','a','m','e',0};
@@ -184,15 +193,19 @@ static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr,
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(err, numberW, jsval_number((INT)number));
+    hres = jsdisp_define_data_property(err, numberW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+                                       jsval_number((INT)number));
     if(FAILED(hres)) {
         jsdisp_release(err);
         return hres;
     }
 
-    hres = jsdisp_propput_name(err, messageW, jsval_string(msg));
+    hres = jsdisp_define_data_property(err, messageW,
+                                       PROPF_WRITABLE | PROPF_ENUMERABLE | PROPF_CONFIGURABLE,
+                                       jsval_string(msg));
     if(SUCCEEDED(hres))
-        hres = jsdisp_propput_dontenum(err, descriptionW, jsval_string(msg));
+        hres = jsdisp_define_data_property(err, descriptionW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+                                           jsval_string(msg));
     if(FAILED(hres)) {
         jsdisp_release(err);
         return hres;
@@ -346,7 +359,8 @@ HRESULT init_error_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
             return E_OUTOFMEMORY;
         }
 
-        hres = jsdisp_propput_dontenum(err, nameW, jsval_string(str));
+        hres = jsdisp_define_data_property(err, nameW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+                                           jsval_string(str));
         jsstr_release(str);
         if(SUCCEEDED(hres))
             hres = create_builtin_constructor(ctx, constr_val[i], names[i], NULL,
index c1456c2..0aae300 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <assert.h>
+
 #include "jscript.h"
+#include "engine.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 typedef struct {
     jsdisp_t dispex;
@@ -173,11 +180,13 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame)
     args->argc = frame->argc;
     args->frame = frame;
 
-    hres = jsdisp_propput_dontenum(&args->jsdisp, lengthW, jsval_number(args->argc));
+    hres = jsdisp_define_data_property(&args->jsdisp, lengthW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+                                       jsval_number(args->argc));
     if(SUCCEEDED(hres))
-        hres = jsdisp_propput_dontenum(&args->jsdisp, caleeW, jsval_disp(to_disp(&args->function->dispex)));
+        hres = jsdisp_define_data_property(&args->jsdisp, caleeW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+                                           jsval_obj(&args->function->dispex));
     if(SUCCEEDED(hres))
-        hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_DONTDELETE, jsval_obj(&args->jsdisp));
+        hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_WRITABLE, jsval_obj(&args->jsdisp));
     if(FAILED(hres)) {
         jsdisp_release(&args->jsdisp);
         return hres;
@@ -351,12 +360,6 @@ static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t
     return S_OK;
 }
 
-static HRESULT Function_set_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
-{
-    FIXME("\n");
-    return E_NOTIMPL;
-}
-
 static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -581,9 +584,9 @@ static void Function_destructor(jsdisp_t *dispex)
 
 static const builtin_prop_t Function_props[] = {
     {applyW,                 Function_apply,                 PROPF_METHOD|2},
-    {argumentsW,             NULL, 0,                        Function_get_arguments, builtin_set_const},
+    {argumentsW,             NULL, 0,                        Function_get_arguments},
     {callW,                  Function_call,                  PROPF_METHOD|1},
-    {lengthW,                NULL, 0,                        Function_get_length,    Function_set_length},
+    {lengthW,                NULL, 0,                        Function_get_length},
     {toStringW,              Function_toString,              PROPF_METHOD}
 };
 
@@ -597,8 +600,8 @@ static const builtin_info_t Function_info = {
 };
 
 static const builtin_prop_t FunctionInst_props[] = {
-    {argumentsW,             NULL, 0,                        Function_get_arguments, builtin_set_const},
-    {lengthW,                NULL, 0,                        Function_get_length,    Function_set_length}
+    {argumentsW,             NULL, 0,                        Function_get_arguments},
+    {lengthW,                NULL, 0,                        Function_get_length}
 };
 
 static const builtin_info_t FunctionInst_info = {
@@ -638,11 +641,6 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
     return S_OK;
 }
 
-static inline HRESULT set_prototype(script_ctx_t *ctx, jsdisp_t *dispex, jsdisp_t *prototype)
-{
-    return jsdisp_propput_dontenum(dispex, prototypeW, jsval_obj(prototype));
-}
-
 HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name,
         const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
 {
@@ -654,9 +652,10 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
         return hres;
 
     if(builtin_info)
-        hres = jsdisp_propput_const(&function->dispex, lengthW, jsval_number(function->length));
+        hres = jsdisp_define_data_property(&function->dispex, lengthW, 0,
+                                           jsval_number(function->length));
     if(SUCCEEDED(hres))
-        hres = set_prototype(ctx, &function->dispex, prototype);
+        hres = jsdisp_define_data_property(&function->dispex, prototypeW, 0, jsval_obj(prototype));
     if(FAILED(hres)) {
         jsdisp_release(&function->dispex);
         return hres;
@@ -673,7 +672,8 @@ static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_
 {
     static const WCHAR constructorW[] = {'c','o','n','s','t','r','u','c','t','o','r',0};
 
-    return jsdisp_propput_dontenum(prot, constructorW, jsval_obj(constr));
+    return jsdisp_define_data_property(prot, constructorW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+                                       jsval_obj(constr));
 }
 
 HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name,
@@ -709,7 +709,8 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod
 
     hres = create_function(ctx, NULL, PROPF_CONSTR, FALSE, NULL, &function);
     if(SUCCEEDED(hres)) {
-        hres = set_prototype(ctx, &function->dispex, prototype);
+        hres = jsdisp_define_data_property(&function->dispex, prototypeW, PROPF_WRITABLE,
+                                           jsval_obj(prototype));
         if(SUCCEEDED(hres))
             hres = set_constructor_prop(ctx, &function->dispex, prototype);
         if(FAILED(hres))
@@ -867,7 +868,7 @@ HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(SUCCEEDED(hres)) {
         constr->value_proc = FunctionConstr_value;
         constr->name = FunctionW;
-        hres = set_prototype(ctx, &constr->dispex, &prot->dispex);
+        hres = jsdisp_define_data_property(&constr->dispex, prototypeW, 0, jsval_obj(&prot->dispex));
         if(SUCCEEDED(hres))
             hres = set_constructor_prop(ctx, &constr->dispex, &prot->dispex);
         if(FAILED(hres))
index 4ac33b3..8d9fb71 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <math.h>
+#include <limits.h>
+
 #include "jscript.h"
+#include "engine.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 static const WCHAR NaNW[] = {'N','a','N',0};
 static const WCHAR InfinityW[] = {'I','n','f','i','n','i','t','y',0};
@@ -103,13 +113,6 @@ static WCHAR int_to_char(int i)
     return 'A'+i-10;
 }
 
-static HRESULT JSGlobal_Enumerator(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
-        jsval_t *r)
-{
-    FIXME("\n");
-    return E_NOTIMPL;
-}
-
 static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -932,7 +935,6 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
 
 static const builtin_prop_t JSGlobal_props[] = {
     {CollectGarbageW,            JSGlobal_CollectGarbage,            PROPF_METHOD},
-    {EnumeratorW,                JSGlobal_Enumerator,                PROPF_METHOD|7},
     {_GetObjectW,                JSGlobal_GetObject,                 PROPF_METHOD|2},
     {ScriptEngineW,              JSGlobal_ScriptEngine,              PROPF_METHOD},
     {ScriptEngineBuildVersionW,  JSGlobal_ScriptEngineBuildVersion,  PROPF_METHOD},
@@ -968,7 +970,8 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, FunctionW, jsval_obj(ctx->function_constr));
+    hres = jsdisp_define_data_property(ctx->global, FunctionW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->function_constr));
     if(FAILED(hres))
         return hres;
 
@@ -976,7 +979,8 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, ObjectW, jsval_obj(ctx->object_constr));
+    hres = jsdisp_define_data_property(ctx->global, ObjectW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->object_constr));
     if(FAILED(hres))
         return hres;
 
@@ -984,7 +988,8 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, ArrayW, jsval_obj(ctx->array_constr));
+    hres = jsdisp_define_data_property(ctx->global, ArrayW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->array_constr));
     if(FAILED(hres))
         return hres;
 
@@ -992,7 +997,8 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, BooleanW, jsval_obj(ctx->bool_constr));
+    hres = jsdisp_define_data_property(ctx->global, BooleanW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->bool_constr));
     if(FAILED(hres))
         return hres;
 
@@ -1000,7 +1006,17 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, DateW, jsval_obj(ctx->date_constr));
+    hres = jsdisp_define_data_property(ctx->global, DateW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->date_constr));
+    if(FAILED(hres))
+        return hres;
+
+    hres = create_enumerator_constr(ctx, object_prototype, &ctx->enumerator_constr);
+    if(FAILED(hres))
+        return hres;
+
+    hres = jsdisp_define_data_property(ctx->global, EnumeratorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->enumerator_constr));
     if(FAILED(hres))
         return hres;
 
@@ -1008,35 +1024,43 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, ErrorW, jsval_obj(ctx->error_constr));
+    hres = jsdisp_define_data_property(ctx->global, ErrorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->error_constr));
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, EvalErrorW, jsval_obj(ctx->eval_error_constr));
+    hres = jsdisp_define_data_property(ctx->global, EvalErrorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->eval_error_constr));
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, RangeErrorW, jsval_obj(ctx->range_error_constr));
+    hres = jsdisp_define_data_property(ctx->global, RangeErrorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->range_error_constr));
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, ReferenceErrorW, jsval_obj(ctx->reference_error_constr));
+    hres = jsdisp_define_data_property(ctx->global, ReferenceErrorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->reference_error_constr));
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, RegExpErrorW, jsval_obj(ctx->regexp_error_constr));
+    hres = jsdisp_define_data_property(ctx->global, RegExpErrorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->regexp_error_constr));
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, SyntaxErrorW, jsval_obj(ctx->syntax_error_constr));
+    hres = jsdisp_define_data_property(ctx->global, SyntaxErrorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->syntax_error_constr));
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, TypeErrorW, jsval_obj(ctx->type_error_constr));
+    hres = jsdisp_define_data_property(ctx->global, TypeErrorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->type_error_constr));
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, URIErrorW, jsval_obj(ctx->uri_error_constr));
+    hres = jsdisp_define_data_property(ctx->global, URIErrorW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->uri_error_constr));
     if(FAILED(hres))
         return hres;
 
@@ -1044,7 +1068,8 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, NumberW, jsval_obj(ctx->number_constr));
+    hres = jsdisp_define_data_property(ctx->global, NumberW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->number_constr));
     if(FAILED(hres))
         return hres;
 
@@ -1052,7 +1077,8 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, RegExpW, jsval_obj(ctx->regexp_constr));
+    hres = jsdisp_define_data_property(ctx->global, RegExpW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->regexp_constr));
     if(FAILED(hres))
         return hres;
 
@@ -1060,7 +1086,8 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, StringW, jsval_obj(ctx->string_constr));
+    hres = jsdisp_define_data_property(ctx->global, StringW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->string_constr));
     if(FAILED(hres))
         return hres;
 
@@ -1068,7 +1095,8 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, VBArrayW, jsval_obj(ctx->vbarray_constr));
+    hres = jsdisp_define_data_property(ctx->global, VBArrayW, PROPF_WRITABLE,
+                                       jsval_obj(ctx->vbarray_constr));
     if(FAILED(hres))
         return hres;
 
@@ -1077,6 +1105,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
 
 HRESULT init_global(script_ctx_t *ctx)
 {
+    unsigned const_flags = ctx->version >= SCRIPTLANGUAGEVERSION_ES5 ? 0 : PROPF_WRITABLE;
     jsdisp_t *math, *object_prototype, *constr;
     HRESULT hres;
 
@@ -1100,7 +1129,7 @@ HRESULT init_global(script_ctx_t *ctx)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, MathW, jsval_obj(math));
+    hres = jsdisp_define_data_property(ctx->global, MathW, PROPF_WRITABLE, jsval_obj(math));
     jsdisp_release(math);
     if(FAILED(hres))
         return hres;
@@ -1112,7 +1141,7 @@ HRESULT init_global(script_ctx_t *ctx)
         if(FAILED(hres))
             return hres;
 
-        hres = jsdisp_propput_dontenum(ctx->global, JSONW, jsval_obj(json));
+        hres = jsdisp_define_data_property(ctx->global, JSONW, PROPF_WRITABLE, jsval_obj(json));
         jsdisp_release(json);
         if(FAILED(hres))
             return hres;
@@ -1122,19 +1151,20 @@ HRESULT init_global(script_ctx_t *ctx)
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, ActiveXObjectW, jsval_obj(constr));
+    hres = jsdisp_define_data_property(ctx->global, ActiveXObjectW, PROPF_WRITABLE,
+                                       jsval_obj(constr));
     jsdisp_release(constr);
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, undefinedW, jsval_undefined());
+    hres = jsdisp_define_data_property(ctx->global, undefinedW, const_flags, jsval_undefined());
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, NaNW, jsval_number(NAN));
+    hres = jsdisp_define_data_property(ctx->global, NaNW, const_flags, jsval_number(NAN));
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_propput_dontenum(ctx->global, InfinityW, jsval_number(INFINITY));
+    hres = jsdisp_define_data_property(ctx->global, InfinityW, const_flags, jsval_number(INFINITY));
     return hres;
 }
index 9e8b3cb..15d81d2 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <assert.h>
+
 #include "jscript.h"
+#include "engine.h"
+#include "objsafe.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 #ifdef _WIN64
 
@@ -47,6 +55,7 @@ typedef struct {
     LONG thread_id;
     LCID lcid;
     DWORD version;
+    BOOL html_mode;
     BOOL is_encode;
 
     IActiveScriptSite *site;
@@ -704,6 +713,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
     ctx->active_script = &This->IActiveScript_iface;
     ctx->safeopt = This->safeopt;
     ctx->version = This->version;
+    ctx->html_mode = This->html_mode;
     ctx->ei.val = jsval_undefined();
     heap_pool_init(&ctx->tmp_heap);
 
@@ -912,12 +922,14 @@ static HRESULT WINAPI JScriptProperty_SetProperty(IActiveScriptProperty *iface,
 
     switch(dwProperty) {
     case SCRIPTPROP_INVOKEVERSIONING:
-        if(V_VT(pvarValue) != VT_I4 || V_I4(pvarValue) < 0 || V_I4(pvarValue) > 15) {
+        if(V_VT(pvarValue) != VT_I4 || V_I4(pvarValue) < 0
+           || (V_I4(pvarValue) > 15 && !(V_I4(pvarValue) & SCRIPTLANGUAGEVERSION_HTML))) {
             WARN("invalid value %s\n", debugstr_variant(pvarValue));
             return E_INVALIDARG;
         }
 
-        This->version = V_I4(pvarValue);
+        This->version = V_I4(pvarValue) & 0x1ff;
+        This->html_mode = (V_I4(pvarValue) & SCRIPTLANGUAGEVERSION_HTML) != 0;
         break;
     default:
         FIXME("Unimplemented property %x\n", dwProperty);
index 1a51019..6f823a9 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#ifndef _WINE_JSCRIPT_H
-#define _WINE_JSCRIPT_H
+#pragma once
 
-#include <wine/config.h>
-#include <wine/port.h>
-
-#include <assert.h>
 #include <stdarg.h>
-
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
+#include <stdio.h>
 
 #define COBJMACROS
 
-#include <windef.h>
-#include <winbase.h>
-#include <objbase.h>
-#include <oleauto.h>
-#include <dispex.h>
-#include <activscp.h>
-#include <objsafe.h>
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "dispex.h"
+#include "activscp.h"
 
-#include <wine/debug.h>
-#include <wine/list.h>
-#include <wine/unicode.h>
+#include "resource.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+#include "wine/unicode.h"
+#include "wine/heap.h"
+#include "wine/list.h"
 
-#include "resource.h"
+/*
+ * This is Wine jscript extension for ES5 compatible mode. Native IE9+ implements
+ * a separated JavaScript enging in side MSHTML. We implement its features here
+ * and enable it when HTML flag is specified in SCRIPTPROP_INVOKEVERSIONING property.
+ */
+#define SCRIPTLANGUAGEVERSION_HTML 0x400
+
+/*
+ * This is Wine jscript extension for ES5 compatible mode. Allowed only in HTML mode.
+ */
+#define SCRIPTLANGUAGEVERSION_ES5  0x102
 
 typedef struct _jsval_t jsval_t;
 typedef struct _jsstr_t jsstr_t;
 typedef struct _script_ctx_t script_ctx_t;
 typedef struct _dispex_prop_t dispex_prop_t;
+typedef struct _property_desc_t property_desc_t;
 
 typedef struct {
     void **blocks;
@@ -68,26 +70,6 @@ void heap_pool_clear(heap_pool_t*) DECLSPEC_HIDDEN;
 void heap_pool_free(heap_pool_t*) DECLSPEC_HIDDEN;
 heap_pool_t *heap_pool_mark(heap_pool_t*) DECLSPEC_HIDDEN;
 
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
-{
-    return HeapAlloc(GetProcessHeap(), 0, size);
-}
-
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size)
-{
-    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
-}
-
-static inline void* __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t size)
-{
-    return HeapReAlloc(GetProcessHeap(), 0, mem, size);
-}
-
-static inline BOOL heap_free(void *mem)
-{
-    return HeapFree(GetProcessHeap(), 0, mem);
-}
-
 static inline LPWSTR heap_strdupW(LPCWSTR str)
 {
     LPWSTR ret = NULL;
@@ -108,12 +90,17 @@ typedef struct jsdisp_t jsdisp_t;
 
 extern HINSTANCE jscript_hinstance DECLSPEC_HIDDEN;
 
-#define PROPF_ARGMASK     0x00ff
-#define PROPF_METHOD      0x0100
-#define PROPF_ENUM        0x0200
-#define PROPF_CONSTR      0x0400
-#define PROPF_CONST       0x0800
-#define PROPF_DONTDELETE  0x1000
+#define PROPF_ARGMASK       0x00ff
+#define PROPF_METHOD        0x0100
+#define PROPF_ENUMERABLE    0x0200
+#define PROPF_CONSTR        0x0400
+#define PROPF_WRITABLE      0x0800
+#define PROPF_CONFIGURABLE  0x1000
+
+#define PROPF_VERSION_MASK  0x01ff0000
+#define PROPF_VERSION_SHIFT 16
+#define PROPF_HTML          (SCRIPTLANGUAGEVERSION_HTML << PROPF_VERSION_SHIFT)
+#define PROPF_ES5           ((SCRIPTLANGUAGEVERSION_HTML|SCRIPTLANGUAGEVERSION_ES5) << PROPF_VERSION_SHIFT)
 
 /*
  * This is our internal dispatch flag informing calee that it's called directly from interpreter.
@@ -129,6 +116,7 @@ typedef enum {
     JSCLASS_ARRAY,
     JSCLASS_BOOLEAN,
     JSCLASS_DATE,
+    JSCLASS_ENUMERATOR,
     JSCLASS_ERROR,
     JSCLASS_FUNCTION,
     JSCLASS_GLOBAL,
@@ -299,8 +287,6 @@ HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propget(jsdisp_t*,DISPID,jsval_t*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propput(jsdisp_t*,const WCHAR*,DWORD,jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propput_name(jsdisp_t*,const WCHAR*,jsval_t) DECLSPEC_HIDDEN;
-HRESULT jsdisp_propput_const(jsdisp_t*,const WCHAR*,jsval_t) DECLSPEC_HIDDEN;
-HRESULT jsdisp_propput_dontenum(jsdisp_t*,const WCHAR*,jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propput_idx(jsdisp_t*,DWORD,jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propget_name(jsdisp_t*,LPCWSTR,jsval_t*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_get_idx(jsdisp_t*,DWORD,jsval_t*) DECLSPEC_HIDDEN;
@@ -308,8 +294,9 @@ HRESULT jsdisp_get_id(jsdisp_t*,const WCHAR*,DWORD,DISPID*) DECLSPEC_HIDDEN;
 HRESULT disp_delete(IDispatch*,DISPID,BOOL*) DECLSPEC_HIDDEN;
 HRESULT disp_delete_name(script_ctx_t*,IDispatch*,jsstr_t*,BOOL*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD) DECLSPEC_HIDDEN;
-HRESULT jsdisp_is_own_prop(jsdisp_t*,const WCHAR*,BOOL*) DECLSPEC_HIDDEN;
-HRESULT jsdisp_is_enumerable(jsdisp_t*,const WCHAR*,BOOL*) DECLSPEC_HIDDEN;
+HRESULT jsdisp_get_own_property(jsdisp_t*,const WCHAR*,BOOL,property_desc_t*) DECLSPEC_HIDDEN;
+HRESULT jsdisp_define_property(jsdisp_t*,const WCHAR*,property_desc_t*) DECLSPEC_HIDDEN;
+HRESULT jsdisp_define_data_property(jsdisp_t*,const WCHAR*,unsigned,jsval_t) DECLSPEC_HIDDEN;
 
 HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD,
         jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
@@ -340,6 +327,7 @@ HRESULT create_bool(script_ctx_t*,BOOL,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT create_number(script_ctx_t*,double,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT create_vbarray(script_ctx_t*,SAFEARRAY*,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT create_json(script_ctx_t*,jsdisp_t**) DECLSPEC_HIDDEN;
+HRESULT create_enumerator(script_ctx_t *ctx, jsval_t *argv, jsdisp_t **ret) DECLSPEC_HIDDEN;
 
 typedef enum {
     NO_HINT,
@@ -357,6 +345,8 @@ HRESULT to_string(script_ctx_t*,jsval_t,jsstr_t**) DECLSPEC_HIDDEN;
 HRESULT to_flat_string(script_ctx_t*,jsval_t,jsstr_t**,const WCHAR**) DECLSPEC_HIDDEN;
 HRESULT to_object(script_ctx_t*,jsval_t,IDispatch**) DECLSPEC_HIDDEN;
 
+HRESULT jsval_strict_equal(jsval_t,jsval_t,BOOL*) DECLSPEC_HIDDEN;
+
 HRESULT variant_change_type(script_ctx_t*,VARIANT*,VARIANT*,VARTYPE) DECLSPEC_HIDDEN;
 
 HRESULT decode_source(WCHAR*) DECLSPEC_HIDDEN;
@@ -390,6 +380,17 @@ typedef struct {
 
 #include "jsval.h"
 
+struct _property_desc_t {
+    unsigned flags;
+    unsigned mask;
+    BOOL explicit_value;
+    jsval_t value;
+    BOOL explicit_getter;
+    jsdisp_t *getter;
+    BOOL explicit_setter;
+    jsdisp_t *setter;
+};
+
 typedef struct {
     EXCEPINFO ei;
     jsval_t val;
@@ -412,6 +413,7 @@ struct _script_ctx_t {
     IInternetHostSecurityManager *secmgr;
     DWORD safeopt;
     DWORD version;
+    BOOL html_mode;
     LCID lcid;
     cc_ctx_t *cc;
     JSCaller *jscaller;
@@ -435,6 +437,7 @@ struct _script_ctx_t {
     jsdisp_t *array_constr;
     jsdisp_t *bool_constr;
     jsdisp_t *date_constr;
+    jsdisp_t *enumerator_constr;
     jsdisp_t *error_constr;
     jsdisp_t *eval_error_constr;
     jsdisp_t *range_error_constr;
@@ -467,6 +470,7 @@ HRESULT create_array_constr(script_ctx_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT create_bool_constr(script_ctx_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT create_date_constr(script_ctx_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT init_error_constr(script_ctx_t*,jsdisp_t*) DECLSPEC_HIDDEN;
+HRESULT create_enumerator_constr(script_ctx_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT create_number_constr(script_ctx_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT create_object_constr(script_ctx_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
 HRESULT create_regexp_constr(script_ctx_t*,jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
@@ -516,7 +520,7 @@ static inline BOOL is_int32(double d)
 
 static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
 {
-    return (ctx->version << 28) | flags;
+    return ((ctx->version & 0xff) << 28) | flags;
 }
 
 #define FACILITY_JSCRIPT 10
@@ -557,6 +561,7 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
 #define JS_E_VBARRAY_EXPECTED        MAKE_JSERROR(IDS_NOT_VBARRAY)
 #define JS_E_INVALID_DELETE          MAKE_JSERROR(IDS_INVALID_DELETE)
 #define JS_E_JSCRIPT_EXPECTED        MAKE_JSERROR(IDS_JSCRIPT_EXPECTED)
+#define JS_E_ENUMERATOR_EXPECTED     MAKE_JSERROR(IDS_NOT_ENUMERATOR)
 #define JS_E_REGEXP_SYNTAX           MAKE_JSERROR(IDS_REGEXP_SYNTAX_ERROR)
 #define JS_E_INVALID_URI_CODING      MAKE_JSERROR(IDS_URI_INVALID_CODING)
 #define JS_E_INVALID_URI_CHAR        MAKE_JSERROR(IDS_URI_INVALID_CHAR)
@@ -564,6 +569,10 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
 #define JS_E_PRECISION_OUT_OF_RANGE  MAKE_JSERROR(IDS_PRECISION_OUT_OF_RANGE)
 #define JS_E_INVALID_LENGTH          MAKE_JSERROR(IDS_INVALID_LENGTH)
 #define JS_E_ARRAY_EXPECTED          MAKE_JSERROR(IDS_ARRAY_EXPECTED)
+#define JS_E_NONCONFIGURABLE_REDEFINED MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED)
+#define JS_E_NONWRITABLE_MODIFIED    MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED)
+#define JS_E_PROP_DESC_MISMATCH      MAKE_JSERROR(IDS_PROP_DESC_MISMATCH)
+#define JS_E_INVALID_WRITABLE_PROP_DESC MAKE_JSERROR(IDS_INVALID_WRITABLE_PROP_DESC)
 
 static inline BOOL is_jscript_error(HRESULT hres)
 {
@@ -585,9 +594,3 @@ static inline void unlock_module(void)
 {
     InterlockedDecrement(&module_ref);
 }
-
-#include "engine.h"
-#include "parser.h"
-#include "regexp.h"
-
-#endif /* _WINE_JSCRIPT_H */
index 03f1f56..9f9f412 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "initguid.h"
+
 #include "jscript.h"
 
-#include <rpcproxy.h>
-#include <initguid.h>
-#include <jscript_classes.h>
+#include "winreg.h"
+#include "advpub.h"
+#include "activaut.h"
+#include "objsafe.h"
+#include "mshtmhst.h"
+#include "rpcproxy.h"
+#include "jscript_classes.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 LONG module_ref = 0;
 
+DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
+
 HINSTANCE jscript_hinstance;
 
 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
index fd1e471..0430d41 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <math.h>
+#include <assert.h>
+
 #include "jscript.h"
+#include "parser.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 static const WCHAR parseW[] = {'p','a','r','s','e',0};
 static const WCHAR stringifyW[] = {'s','t','r','i','n','g','i','f','y',0};
@@ -536,15 +545,18 @@ static HRESULT stringify_array(stringify_ctx_t *ctx, jsdisp_t *obj)
         }
 
         hres = jsdisp_get_idx(obj, i, &val);
-        if(FAILED(hres))
-            return hres;
-
-        hres = stringify(ctx, val);
-        if(FAILED(hres))
+        if(SUCCEEDED(hres)) {
+            hres = stringify(ctx, val);
+            if(FAILED(hres))
+                return hres;
+            if(hres == S_FALSE && !append_string(ctx, nullW))
+                return E_OUTOFMEMORY;
+        }else if(hres == DISP_E_UNKNOWNNAME) {
+            if(!append_string(ctx, nullW))
+                return E_OUTOFMEMORY;
+        }else {
             return hres;
-
-        if(hres == S_FALSE && !append_string(ctx, nullW))
-            return E_OUTOFMEMORY;
+        }
     }
 
     if((length && *ctx->gap && !append_char(ctx, '\n')) || !append_char(ctx, ']'))
@@ -756,6 +768,12 @@ static HRESULT JSON_stringify(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
 
     TRACE("\n");
 
+    if(!argc) {
+        if(r)
+            *r = jsval_undefined();
+        return S_OK;
+    }
+
     if(argc >= 2 && is_object_instance(argv[1])) {
         FIXME("Replacer %s not yet supported\n", debugstr_jsval(argv[1]));
         return E_NOTIMPL;
index 6615005..821c016 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <math.h>
+
 #include "jscript.h"
+#include "regexp.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 typedef struct {
     jsdisp_t dispex;
@@ -249,12 +256,6 @@ static HRESULT RegExp_get_source(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r
     return S_OK;
 }
 
-static HRESULT RegExp_set_source(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
-{
-    FIXME("\n");
-    return E_NOTIMPL;
-}
-
 static HRESULT RegExp_get_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 {
     TRACE("\n");
@@ -263,12 +264,6 @@ static HRESULT RegExp_get_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r
     return S_OK;
 }
 
-static HRESULT RegExp_set_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
-{
-    FIXME("\n");
-    return E_NOTIMPL;
-}
-
 static HRESULT RegExp_get_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 {
     TRACE("\n");
@@ -277,12 +272,6 @@ static HRESULT RegExp_get_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_
     return S_OK;
 }
 
-static HRESULT RegExp_set_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
-{
-    FIXME("\n");
-    return E_NOTIMPL;
-}
-
 static HRESULT RegExp_get_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 {
     TRACE("\n");
@@ -291,12 +280,6 @@ static HRESULT RegExp_get_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t
     return S_OK;
 }
 
-static HRESULT RegExp_set_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
-{
-    FIXME("\n");
-    return E_NOTIMPL;
-}
-
 static INT index_from_val(script_ctx_t *ctx, jsval_t v)
 {
     double n;
@@ -600,11 +583,11 @@ static void RegExp_destructor(jsdisp_t *dispex)
 
 static const builtin_prop_t RegExp_props[] = {
     {execW,                  RegExp_exec,                  PROPF_METHOD|1},
-    {globalW,                NULL,0,                       RegExp_get_global,     RegExp_set_global},
-    {ignoreCaseW,            NULL,0,                       RegExp_get_ignoreCase, RegExp_set_ignoreCase},
+    {globalW,                NULL,0,                       RegExp_get_global},
+    {ignoreCaseW,            NULL,0,                       RegExp_get_ignoreCase},
     {lastIndexW,             NULL,0,                       RegExp_get_lastIndex,  RegExp_set_lastIndex},
-    {multilineW,             NULL,0,                       RegExp_get_multiline,  RegExp_set_multiline},
-    {sourceW,                NULL,0,                       RegExp_get_source,     RegExp_set_source},
+    {multilineW,             NULL,0,                       RegExp_get_multiline},
+    {sourceW,                NULL,0,                       RegExp_get_source},
     {testW,                  RegExp_test,                  PROPF_METHOD|1},
     {toStringW,              RegExp_toString,              PROPF_METHOD}
 };
@@ -619,11 +602,11 @@ static const builtin_info_t RegExp_info = {
 };
 
 static const builtin_prop_t RegExpInst_props[] = {
-    {globalW,                NULL,0,                       RegExp_get_global,     RegExp_set_global},
-    {ignoreCaseW,            NULL,0,                       RegExp_get_ignoreCase, RegExp_set_ignoreCase},
+    {globalW,                NULL,0,                       RegExp_get_global},
+    {ignoreCaseW,            NULL,0,                       RegExp_get_ignoreCase},
     {lastIndexW,             NULL,0,                       RegExp_get_lastIndex,  RegExp_set_lastIndex},
-    {multilineW,             NULL,0,                       RegExp_get_multiline,  RegExp_set_multiline},
-    {sourceW,                NULL,0,                       RegExp_get_source,     RegExp_set_source}
+    {multilineW,             NULL,0,                       RegExp_get_multiline},
+    {sourceW,                NULL,0,                       RegExp_get_source}
 };
 
 static const builtin_info_t RegExpInst_info = {
index 6eb7dea..6a39c4c 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <assert.h>
+
 #include "jscript.h"
 
+#include "wine/debug.h"
+
 /*
  * This is the length of a string that is considered to be long enough to be
  * worth the rope to avoid copy.
index fb691af..9020611 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <math.h>
+#include <assert.h>
+
 #include "jscript.h"
+#include "engine.h"
+
+#include "wine/debug.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 WINE_DECLARE_DEBUG_CHANNEL(heap);
 
 const char *debugstr_jsval(const jsval_t v)
@@ -649,11 +659,18 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, INT *ret)
     double n;
     HRESULT hres;
 
+    const double p32 = (double)0xffffffff + 1;
+
     hres = to_number(ctx, v, &n);
     if(FAILED(hres))
         return hres;
 
-    *ret = is_finite(n) ? n : 0;
+    if(is_finite(n))
+        n = n > 0 ? fmod(n, p32) : -fmod(-n, p32);
+    else
+        n = 0;
+
+    *ret = (UINT32)n;
     return S_OK;
 }
 
index 1121425..963f59f 100644 (file)
@@ -246,4 +246,4 @@ HRESULT jsval_to_variant(jsval_t,VARIANT*) DECLSPEC_HIDDEN;
 void jsval_release(jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsval_copy(jsval_t,jsval_t*) DECLSPEC_HIDDEN;
 
-#endif /* JSVAL_H */
+#endif
index 2471aaa..b4cc82a 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <limits.h>
+
 #include "jscript.h"
+#include "activscp.h"
+#include "objsafe.h"
+#include "engine.h"
+#include "parser.h"
 
 #include "parser.tab.h"
 
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 static const WCHAR breakW[] = {'b','r','e','a','k',0};
 static const WCHAR caseW[] = {'c','a','s','e',0};
 static const WCHAR catchW[] = {'c','a','t','c','h',0};
@@ -121,7 +135,7 @@ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lva
         return 1;
 
     if(lval)
-        *lval = ctx->ptr;
+        *lval = word;
     ctx->ptr = p1;
     return 0;
 }
@@ -473,18 +487,18 @@ static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
     HRESULT hres;
 
     if(*ctx->ptr == '0') {
-        LONG d, l = 0;
-
         ctx->ptr++;
 
         if(*ctx->ptr == 'x' || *ctx->ptr == 'X') {
+            double r = 0;
+            int d;
             if(++ctx->ptr == ctx->end) {
                 ERR("unexpected end of file\n");
                 return FALSE;
             }
 
             while(ctx->ptr < ctx->end && (d = hex_to_int(*ctx->ptr)) != -1) {
-                l = l*16 + d;
+                r = r*16 + d;
                 ctx->ptr++;
             }
 
@@ -494,7 +508,7 @@ static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
                 return FALSE;
             }
 
-            *ret = l;
+            *ret = r;
             return TRUE;
         }
 
index 77c2062..109df9d 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <math.h>
+#include <limits.h>
+
 #include "jscript.h"
+#include "ntsecapi.h"
+
+#include "wine/debug.h"
 
-#include <ntsecapi.h>
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 static const WCHAR EW[] = {'E',0};
 static const WCHAR LOG2EW[] = {'L','O','G','2','E',0};
@@ -550,7 +559,8 @@ HRESULT create_math(script_ctx_t *ctx, jsdisp_t **ret)
     }
 
     for(i=0; i < sizeof(constants)/sizeof(*constants); i++) {
-        hres = jsdisp_propput_const(math, constants[i].name, jsval_number(constants[i].val));
+        hres = jsdisp_define_data_property(math, constants[i].name, 0,
+                                           jsval_number(constants[i].val));
         if(FAILED(hres)) {
             jsdisp_release(math);
             return hres;
index 94ec171..94c8cc4 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <math.h>
+#include <assert.h>
+
 #include "jscript.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 typedef struct {
     jsdisp_t dispex;
 
index 9a02618..684d342 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <assert.h>
+
 #include "jscript.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
 static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0};
 static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
@@ -26,8 +32,21 @@ static const WCHAR propertyIsEnumerableW[] =
     {'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0};
 static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0};
 
+static const WCHAR getOwnPropertyDescriptorW[] =
+    {'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};
+static const WCHAR definePropertyW[] = {'d','e','f','i','n','e','P','r','o','p','e','r','t','y',0};
+
+static const WCHAR definePropertiesW[] = {'d','e','f','i','n','e','P','r','o','p','e','r','t','i','e','s',0};
+
 static const WCHAR default_valueW[] = {'[','o','b','j','e','c','t',' ','O','b','j','e','c','t',']',0};
 
+static const WCHAR configurableW[] = {'c','o','n','f','i','g','u','r','a','b','l','e',0};
+static const WCHAR enumerableW[] = {'e','n','u','m','e','r','a','b','l','e',0};
+static const WCHAR valueW[] = {'v','a','l','u','e',0};
+static const WCHAR writableW[] = {'w','r','i','t','a','b','l','e',0};
+static const WCHAR getW[] = {'g','e','t',0};
+static const WCHAR setW[] = {'s','e','t',0};
+
 static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -47,7 +66,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
     static const WCHAR regexpW[] = {'R','e','g','E','x','p',0};
     static const WCHAR stringW[] = {'S','t','r','i','n','g',0};
     /* Keep in sync with jsclass_t enum */
-    static const WCHAR *names[] = {NULL, arrayW, booleanW, dateW, errorW,
+    static const WCHAR *names[] = {NULL, arrayW, booleanW, dateW, objectW, errorW,
         functionW, NULL, mathW, numberW, objectW, regexpW, stringW, objectW, objectW, objectW};
 
     TRACE("\n");
@@ -124,20 +143,21 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
         return hres;
 
     if(is_jsdisp(jsthis)) {
+        property_desc_t prop_desc;
         const WCHAR *name_str;
-        BOOL result;
 
         name_str = jsstr_flatten(name);
-        if(name_str)
-            hres = jsdisp_is_own_prop(jsthis->u.jsdisp, name_str, &result);
-        else
-            hres = E_OUTOFMEMORY;
+        if(!name_str) {
+            jsstr_release(name);
+            return E_OUTOFMEMORY;
+        }
+
+        hres = jsdisp_get_own_property(jsthis->u.jsdisp, name_str, TRUE, &prop_desc);
         jsstr_release(name);
-        if(FAILED(hres))
+        if(FAILED(hres) && hres != DISP_E_UNKNOWNNAME)
             return hres;
 
-        if(r)
-            *r = jsval_bool(result);
+        if(r) *r = jsval_bool(hres == S_OK);
         return S_OK;
     }
 
@@ -163,9 +183,9 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
 static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
+    property_desc_t prop_desc;
     const WCHAR *name;
     jsstr_t *name_str;
-    BOOL ret;
     HRESULT hres;
 
     TRACE("\n");
@@ -184,13 +204,13 @@ static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, W
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_is_enumerable(jsthis->u.jsdisp, name, &ret);
+    hres = jsdisp_get_own_property(jsthis->u.jsdisp, name, TRUE, &prop_desc);
     jsstr_release(name_str);
-    if(FAILED(hres))
+    if(FAILED(hres) && hres != DISP_E_UNKNOWNNAME)
         return hres;
 
     if(r)
-        *r = jsval_bool(ret);
+        *r = jsval_bool(hres == S_OK && (prop_desc.flags & PROPF_ENUMERABLE) != 0);
     return S_OK;
 }
 
@@ -246,6 +266,274 @@ static const builtin_info_t ObjectInst_info = {
     NULL
 };
 
+static void release_property_descriptor(property_desc_t *desc)
+{
+    if(desc->explicit_value)
+        jsval_release(desc->value);
+    if(desc->getter)
+        jsdisp_release(desc->getter);
+    if(desc->setter)
+        jsdisp_release(desc->setter);
+}
+
+static HRESULT to_property_descriptor(script_ctx_t *ctx, jsdisp_t *attr_obj, property_desc_t *desc)
+{
+    DISPID id;
+    jsval_t v;
+    BOOL b;
+    HRESULT hres;
+
+    memset(desc, 0, sizeof(*desc));
+    desc->value = jsval_undefined();
+
+    hres = jsdisp_get_id(attr_obj, enumerableW, 0, &id);
+    if(SUCCEEDED(hres)) {
+        desc->mask |= PROPF_ENUMERABLE;
+        hres = jsdisp_propget(attr_obj, id, &v);
+        if(FAILED(hres))
+            return hres;
+        hres = to_boolean(v, &b);
+        jsval_release(v);
+        if(FAILED(hres))
+            return hres;
+        if(b)
+            desc->flags |= PROPF_ENUMERABLE;
+    }else if(hres != DISP_E_UNKNOWNNAME) {
+        return hres;
+    }
+
+    hres = jsdisp_get_id(attr_obj, configurableW, 0, &id);
+    if(SUCCEEDED(hres)) {
+        desc->mask |= PROPF_CONFIGURABLE;
+        hres = jsdisp_propget(attr_obj, id, &v);
+        if(FAILED(hres))
+            return hres;
+        hres = to_boolean(v, &b);
+        jsval_release(v);
+        if(FAILED(hres))
+            return hres;
+        if(b)
+            desc->flags |= PROPF_CONFIGURABLE;
+    }else if(hres != DISP_E_UNKNOWNNAME) {
+        return hres;
+    }
+
+    hres = jsdisp_get_id(attr_obj, valueW, 0, &id);
+    if(SUCCEEDED(hres)) {
+        hres = jsdisp_propget(attr_obj, id, &desc->value);
+        if(FAILED(hres))
+            return hres;
+        desc->explicit_value = TRUE;
+    }else if(hres != DISP_E_UNKNOWNNAME) {
+        return hres;
+    }
+
+    hres = jsdisp_get_id(attr_obj, writableW, 0, &id);
+    if(SUCCEEDED(hres)) {
+        desc->mask |= PROPF_WRITABLE;
+        hres = jsdisp_propget(attr_obj, id, &v);
+        if(SUCCEEDED(hres)) {
+            hres = to_boolean(v, &b);
+            jsval_release(v);
+            if(SUCCEEDED(hres) && b)
+                desc->flags |= PROPF_WRITABLE;
+        }
+    }else if(hres == DISP_E_UNKNOWNNAME) {
+        hres = S_OK;
+    }
+    if(FAILED(hres)) {
+        release_property_descriptor(desc);
+        return hres;
+    }
+
+    hres = jsdisp_get_id(attr_obj, getW, 0, &id);
+    if(SUCCEEDED(hres)) {
+        desc->explicit_getter = TRUE;
+        hres = jsdisp_propget(attr_obj, id, &v);
+        if(SUCCEEDED(hres) && !is_undefined(v)) {
+            if(!is_object_instance(v)) {
+                FIXME("getter is not an object\n");
+                jsval_release(v);
+                hres = E_FAIL;
+            }else {
+                /* FIXME: Check IsCallable */
+                desc->getter = to_jsdisp(get_object(v));
+                if(!desc->getter)
+                    FIXME("getter is not JS object\n");
+            }
+        }
+    }else if(hres == DISP_E_UNKNOWNNAME) {
+        hres = S_OK;
+    }
+    if(FAILED(hres)) {
+        release_property_descriptor(desc);
+        return hres;
+    }
+
+    hres = jsdisp_get_id(attr_obj, setW, 0, &id);
+    if(SUCCEEDED(hres)) {
+        desc->explicit_setter = TRUE;
+        hres = jsdisp_propget(attr_obj, id, &v);
+        if(SUCCEEDED(hres) && !is_undefined(v)) {
+            if(!is_object_instance(v)) {
+                FIXME("setter is not an object\n");
+                jsval_release(v);
+                hres = E_FAIL;
+            }else {
+                /* FIXME: Check IsCallable */
+                desc->setter = to_jsdisp(get_object(v));
+                if(!desc->setter)
+                    FIXME("setter is not JS object\n");
+            }
+        }
+    }else if(hres == DISP_E_UNKNOWNNAME) {
+        hres = S_OK;
+    }
+    if(FAILED(hres)) {
+        release_property_descriptor(desc);
+        return hres;
+    }
+
+    if(desc->explicit_getter || desc->explicit_setter) {
+        if(desc->explicit_value)
+            hres = throw_type_error(ctx, JS_E_PROP_DESC_MISMATCH, NULL);
+        else if(desc->mask & PROPF_WRITABLE)
+            hres = throw_type_error(ctx, JS_E_INVALID_WRITABLE_PROP_DESC, NULL);
+    }
+
+    if(FAILED(hres))
+        release_property_descriptor(desc);
+    return hres;
+}
+
+static HRESULT Object_defineProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
+                                     unsigned argc, jsval_t *argv, jsval_t *r)
+{
+    property_desc_t prop_desc;
+    jsdisp_t *obj, *attr_obj;
+    const WCHAR *name;
+    jsstr_t *name_str;
+    HRESULT hres;
+
+    TRACE("\n");
+
+    if(argc < 1 || !is_object_instance(argv[0]))
+        return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL);
+    obj = to_jsdisp(get_object(argv[0]));
+    if(!obj) {
+        FIXME("not implemented non-JS object\n");
+        return E_NOTIMPL;
+    }
+
+    hres = to_flat_string(ctx, argc >= 2 ? argv[1] : jsval_undefined(), &name_str, &name);
+    if(FAILED(hres))
+        return hres;
+
+    if(argc >= 3 && is_object_instance(argv[2])) {
+        attr_obj = to_jsdisp(get_object(argv[2]));
+        if(attr_obj) {
+            hres = to_property_descriptor(ctx, attr_obj, &prop_desc);
+        }else {
+            FIXME("not implemented non-JS object\n");
+            hres = E_NOTIMPL;
+        }
+    }else {
+        hres = throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL);
+    }
+    jsstr_release(name_str);
+    if(FAILED(hres))
+        return hres;
+
+    hres = jsdisp_define_property(obj, name, &prop_desc);
+    release_property_descriptor(&prop_desc);
+    return hres;
+}
+
+static HRESULT Object_defineProperties(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
+                                     unsigned argc, jsval_t *argv, jsval_t *r)
+{
+    FIXME("\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT Object_getOwnPropertyDescriptor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
+                                               unsigned argc, jsval_t *argv, jsval_t *r)
+{
+    property_desc_t prop_desc;
+    jsdisp_t *obj, *desc_obj;
+    const WCHAR *name;
+    jsstr_t *name_str;
+    HRESULT hres;
+
+    TRACE("\n");
+
+    if(argc < 1 || !is_object_instance(argv[0]))
+        return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL);
+    obj = to_jsdisp(get_object(argv[0]));
+    if(!obj) {
+        FIXME("not implemented non-JS object\n");
+        return E_NOTIMPL;
+    }
+
+    hres = to_flat_string(ctx, argc >= 2 ? argv[1] : jsval_undefined(), &name_str, &name);
+    if(FAILED(hres))
+        return hres;
+
+    hres = jsdisp_get_own_property(obj, name, FALSE, &prop_desc);
+    jsstr_release(name_str);
+    if(hres == DISP_E_UNKNOWNNAME) {
+        if(r) *r = jsval_undefined();
+        return S_OK;
+    }
+    if(FAILED(hres))
+        return hres;
+
+    hres = create_object(ctx, NULL, &desc_obj);
+    if(FAILED(hres))
+        return hres;
+
+    if(prop_desc.explicit_getter || prop_desc.explicit_setter) {
+        hres = jsdisp_propput_name(desc_obj, getW, prop_desc.getter
+                                   ? jsval_obj(prop_desc.getter) : jsval_undefined());
+        if(SUCCEEDED(hres))
+            hres = jsdisp_propput_name(desc_obj, setW, prop_desc.setter
+                                       ? jsval_obj(prop_desc.setter) : jsval_undefined());
+    }else {
+        hres = jsdisp_propput_name(desc_obj, valueW, prop_desc.value);
+        if(SUCCEEDED(hres))
+            hres = jsdisp_propput_name(desc_obj, writableW,
+                                       jsval_bool(!!(prop_desc.flags & PROPF_WRITABLE)));
+    }
+    if(SUCCEEDED(hres))
+        hres = jsdisp_propput_name(desc_obj, enumerableW,
+                                   jsval_bool(!!(prop_desc.flags & PROPF_ENUMERABLE)));
+    if(SUCCEEDED(hres))
+        hres = jsdisp_propput_name(desc_obj, configurableW,
+                                   jsval_bool(!!(prop_desc.flags & PROPF_CONFIGURABLE)));
+
+    release_property_descriptor(&prop_desc);
+    if(SUCCEEDED(hres) && r)
+        *r = jsval_obj(desc_obj);
+    else
+        jsdisp_release(desc_obj);
+    return hres;
+}
+
+static const builtin_prop_t ObjectConstr_props[] = {
+    {definePropertiesW,         Object_defineProperties,            PROPF_ES5|PROPF_METHOD|2},
+    {definePropertyW,           Object_defineProperty,              PROPF_ES5|PROPF_METHOD|2},
+    {getOwnPropertyDescriptorW, Object_getOwnPropertyDescriptor,    PROPF_ES5|PROPF_METHOD|2}
+};
+
+static const builtin_info_t ObjectConstr_info = {
+    JSCLASS_FUNCTION,
+    DEFAULT_FUNCTION_VALUE,
+    sizeof(ObjectConstr_props)/sizeof(*ObjectConstr_props),
+    ObjectConstr_props,
+    NULL,
+    NULL
+};
+
 static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -297,7 +585,7 @@ HRESULT create_object_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
 {
     static const WCHAR ObjectW[] = {'O','b','j','e','c','t',0};
 
-    return create_builtin_constructor(ctx, ObjectConstr_value, ObjectW, NULL, PROPF_CONSTR,
+    return create_builtin_constructor(ctx, ObjectConstr_value, ObjectW, &ObjectConstr_info, PROPF_CONSTR,
             object_prototype, ret);
 }
 
index 798cd1d..65c26dc 100644 (file)
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.0.2.  */
+/* A Bison parser, made by GNU Bison 3.0.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
@@ -44,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.0.2"
+#define YYBISON_VERSION "3.0"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 
 
 #include "jscript.h"
+#include "engine.h"
+#include "parser.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 static int parser_error(parser_ctx_t*,const char*);
 static void set_error(parser_ctx_t*,UINT);
@@ -185,11 +191,11 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
 
 #line 193 "parser.tab.c" /* yacc.c:339  */
 
-# ifndef YY_NULLPTR
+# ifndef YY_NULL
 #  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
+#   define YY_NULL nullptr
 #  else
-#   define YY_NULLPTR 0
+#   define YY_NULL 0
 #  endif
 # endif
 
@@ -201,7 +207,10 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
 # define YYERROR_VERBOSE 0
 #endif
 
-
+/* In a future release of Bison, this section will be replaced
+   by #include "parser.tab.h".  */
+#ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED
+# define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED
 /* Debug traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
@@ -223,33 +232,33 @@ extern int parser_debug;
     kDELETE = 263,
     kDO = 264,
     kELSE = 265,
-    kIF = 266,
-    kFINALLY = 267,
-    kFOR = 268,
-    kIN = 269,
-    kINSTANCEOF = 270,
-    kNEW = 271,
-    kNULL = 272,
-    kRETURN = 273,
-    kSWITCH = 274,
-    kTHIS = 275,
-    kTHROW = 276,
-    kTRUE = 277,
-    kFALSE = 278,
-    kTRY = 279,
-    kTYPEOF = 280,
-    kVAR = 281,
-    kVOID = 282,
-    kWHILE = 283,
-    kWITH = 284,
-    tANDAND = 285,
-    tOROR = 286,
-    tINC = 287,
-    tDEC = 288,
-    tHTMLCOMMENT = 289,
-    kDIVEQ = 290,
-    kDCOL = 291,
-    kFUNCTION = 292,
+    kFUNCTION = 266,
+    kIF = 267,
+    kFINALLY = 268,
+    kFOR = 269,
+    kIN = 270,
+    kINSTANCEOF = 271,
+    kNEW = 272,
+    kNULL = 273,
+    kRETURN = 274,
+    kSWITCH = 275,
+    kTHIS = 276,
+    kTHROW = 277,
+    kTRUE = 278,
+    kFALSE = 279,
+    kTRY = 280,
+    kTYPEOF = 281,
+    kVAR = 282,
+    kVOID = 283,
+    kWHILE = 284,
+    kWITH = 285,
+    tANDAND = 286,
+    tOROR = 287,
+    tINC = 288,
+    tDEC = 289,
+    tHTMLCOMMENT = 290,
+    kDIVEQ = 291,
+    kDCOL = 292,
     tIdentifier = 293,
     tAssignOper = 294,
     tEqOper = 295,
@@ -289,7 +298,7 @@ union YYSTYPE
     struct _variable_list_t *variable_list;
     variable_declaration_t  *variable_declaration;
 
-#line 299 "parser.tab.c" /* yacc.c:355  */
+#line 302 "parser.tab.c" /* yacc.c:355  */
 };
 # define YYSTYPE_IS_TRIVIAL 1
 # define YYSTYPE_IS_DECLARED 1
@@ -299,11 +308,11 @@ union YYSTYPE
 
 int parser_parse (parser_ctx_t *ctx);
 
-
+#endif /* !YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED  */
 
 /* Copy the second part of user declarations.  */
 
-#line 313 "parser.tab.c" /* yacc.c:358  */
+#line 316 "parser.tab.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -360,30 +369,11 @@ typedef short int yytype_int16;
 # endif
 #endif
 
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__                                               \
-      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
-     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-#  define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later.  */
+# if (! defined __GNUC__ || __GNUC__ < 2 \
+      || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
+#  define __attribute__(Spec) /* empty */
 # endif
 #endif
 
@@ -545,16 +535,16 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   1085
+#define YYLAST   1287
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  70
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  95
+#define YYNNTS  97
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  217
+#define YYNRULES  247
 /* YYNSTATES -- Number of states.  */
-#define YYNSTATES  389
+#define YYNSTATES  440
 
 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
    by yylex, with out-of-bounds checking.  */
@@ -605,28 +595,31 @@ static const yytype_uint8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   252,   252,   256,   257,   261,   262,   267,   269,   271,
-     275,   279,   283,   284,   289,   290,   294,   295,   296,   297,
-     298,   299,   300,   301,   302,   303,   304,   305,   306,   307,
-     308,   312,   313,   318,   319,   323,   324,   328,   333,   334,
-     339,   341,   346,   351,   356,   357,   361,   366,   367,   371,
-     376,   380,   385,   387,   392,   394,   397,   399,   396,   403,
-     405,   402,   408,   410,   415,   420,   425,   430,   435,   440,
-     445,   447,   452,   453,   457,   458,   463,   468,   473,   478,
-     479,   480,   485,   490,   494,   495,   498,   499,   503,   504,
-     509,   510,   514,   516,   520,   521,   525,   526,   528,   533,
-     535,   537,   542,   543,   548,   550,   555,   556,   561,   563,
-     568,   569,   574,   576,   581,   582,   587,   589,   594,   595,
-     600,   602,   607,   608,   613,   615,   620,   621,   626,   627,
-     632,   633,   635,   637,   642,   643,   645,   650,   651,   656,
-     658,   660,   665,   666,   668,   670,   675,   676,   678,   679,
-     681,   682,   683,   684,   685,   686,   690,   692,   694,   700,
-     701,   705,   706,   710,   711,   712,   714,   716,   721,   723,
-     725,   727,   732,   733,   737,   738,   743,   744,   745,   746,
-     747,   748,   752,   753,   754,   755,   760,   762,   767,   768,
-     772,   773,   777,   778,   783,   785,   790,   791,   792,   796,
-     797,   801,   802,   803,   804,   805,   807,   812,   813,   814,
-     817,   818,   821,   822,   825,   826,   829,   830
+       0,   253,   253,   257,   258,   262,   263,   268,   270,   272,
+     276,   280,   284,   285,   290,   291,   295,   296,   297,   298,
+     299,   300,   301,   302,   303,   304,   305,   306,   307,   308,
+     309,   313,   314,   319,   320,   324,   325,   329,   334,   335,
+     340,   342,   347,   352,   357,   358,   362,   367,   368,   372,
+     377,   381,   386,   388,   393,   395,   398,   400,   397,   404,
+     406,   403,   409,   411,   416,   421,   426,   431,   436,   441,
+     446,   448,   453,   454,   458,   459,   464,   469,   474,   479,
+     480,   481,   486,   491,   495,   496,   499,   500,   504,   505,
+     510,   511,   515,   517,   521,   522,   526,   527,   529,   534,
+     536,   538,   543,   544,   549,   551,   556,   557,   562,   564,
+     569,   570,   575,   577,   582,   583,   588,   590,   595,   596,
+     601,   603,   608,   609,   614,   616,   621,   622,   627,   628,
+     633,   634,   636,   638,   643,   644,   646,   651,   652,   657,
+     659,   661,   666,   667,   669,   671,   676,   677,   679,   680,
+     682,   683,   684,   685,   686,   687,   691,   693,   695,   701,
+     702,   706,   707,   711,   712,   713,   715,   717,   722,   724,
+     726,   728,   733,   734,   738,   739,   744,   745,   746,   747,
+     748,   749,   753,   754,   755,   756,   761,   763,   768,   769,
+     773,   774,   778,   779,   784,   786,   791,   792,   793,   797,
+     798,   802,   803,   814,   815,   816,   817,   818,   819,   820,
+     821,   822,   823,   824,   825,   826,   827,   828,   829,   830,
+     831,   832,   833,   834,   835,   836,   837,   838,   839,   840,
+     841,   845,   846,   847,   848,   849,   851,   856,   857,   858,
+     861,   862,   865,   866,   869,   870,   873,   874
 };
 #endif
 
@@ -636,11 +629,11 @@ static const yytype_uint16 yyrline[] =
 static const char *const yytname[] =
 {
   "$end", "error", "$undefined", "kBREAK", "kCASE", "kCATCH", "kCONTINUE",
-  "kDEFAULT", "kDELETE", "kDO", "kELSE", "kIF", "kFINALLY", "kFOR", "kIN",
-  "kINSTANCEOF", "kNEW", "kNULL", "kRETURN", "kSWITCH", "kTHIS", "kTHROW",
-  "kTRUE", "kFALSE", "kTRY", "kTYPEOF", "kVAR", "kVOID", "kWHILE", "kWITH",
-  "tANDAND", "tOROR", "tINC", "tDEC", "tHTMLCOMMENT", "kDIVEQ", "kDCOL",
-  "kFUNCTION", "'}'", "tIdentifier", "tAssignOper", "tEqOper",
+  "kDEFAULT", "kDELETE", "kDO", "kELSE", "kFUNCTION", "kIF", "kFINALLY",
+  "kFOR", "kIN", "kINSTANCEOF", "kNEW", "kNULL", "kRETURN", "kSWITCH",
+  "kTHIS", "kTHROW", "kTRUE", "kFALSE", "kTRY", "kTYPEOF", "kVAR", "kVOID",
+  "kWHILE", "kWITH", "tANDAND", "tOROR", "tINC", "tDEC", "tHTMLCOMMENT",
+  "kDIVEQ", "kDCOL", "'}'", "tIdentifier", "tAssignOper", "tEqOper",
   "tShiftOper", "tRelOper", "tNumericLiteral", "tBooleanLiteral",
   "tStringLiteral", "tEOF", "LOWER_THAN_ELSE", "'{'", "','", "'='", "';'",
   "':'", "'?'", "'|'", "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'",
@@ -671,9 +664,9 @@ static const char *const yytname[] =
   "LeftHandSideExpression", "NewExpression", "MemberExpression",
   "CallExpression", "Arguments", "ArgumentList", "PrimaryExpression",
   "ArrayLiteral", "ElementList", "Elision", "Elision_opt", "ObjectLiteral",
-  "PropertyNameAndValueList", "PropertyName", "Identifier_opt", "Literal",
-  "BooleanLiteral", "semicolon_opt", "left_bracket", "right_bracket",
-  "semicolon", YY_NULLPTR
+  "PropertyNameAndValueList", "PropertyName", "Identifier_opt",
+  "IdentifierName", "ReservedAsIdentifier", "Literal", "BooleanLiteral",
+  "semicolon_opt", "left_bracket", "right_bracket", "semicolon", YY_NULL
 };
 #endif
 
@@ -692,12 +685,12 @@ static const yytype_uint16 yytoknum[] =
 };
 # endif
 
-#define YYPACT_NINF -336
+#define YYPACT_NINF -349
 
 #define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-336)))
+  (!!((Yystate) == (-349)))
 
-#define YYTABLE_NINF -199
+#define YYTABLE_NINF -231
 
 #define yytable_value_is_error(Yytable_value) \
   0
@@ -706,45 +699,50 @@ static const yytype_uint16 yytoknum[] =
      STATE-NUM.  */
 static const yytype_int16 yypact[] =
 {
-    -336,    33,   515,  -336,   -17,   -17,   983,   767,    37,    37,
-    1017,  -336,   983,    37,  -336,   983,  -336,  -336,   -12,   983,
-       9,   983,    37,    37,   983,   983,  -336,  -336,  -336,     8,
-    -336,  -336,  -336,   578,  -336,   983,   983,  -336,   983,   983,
-      57,   983,     4,   427,     6,  -336,  -336,  -336,  -336,  -336,
-    -336,  -336,  -336,  -336,  -336,  -336,  -336,  -336,  -336,  -336,
-      56,  -336,  -336,   -10,    90,    38,    46,    65,    83,    96,
-      86,    94,   168,  -336,  -336,   114,  -336,   159,   169,  -336,
-    -336,  -336,  -336,  -336,  -336,    14,    14,  -336,   122,  -336,
-    -336,   180,   107,  -336,  -336,   388,   875,  -336,   159,    14,
-     113,   983,    56,   641,    42,  -336,   124,    75,  -336,  -336,
-     388,   983,  -336,  -336,   767,   460,     8,   120,   141,  -336,
-     704,    79,   156,  -336,  -336,  -336,  -336,  -336,  -336,    84,
-      91,   983,    63,  -336,    41,   177,  -336,   983,  -336,  -336,
-     983,   983,   983,   983,   983,   983,   983,   983,   983,   983,
-     983,   983,   983,   983,   983,   983,  -336,  -336,  -336,  -336,
-     983,   983,   983,   199,   821,  -336,   983,   200,  -336,  -336,
-    -336,  -336,  -336,  -336,  -336,    37,  -336,    22,   113,   201,
-    -336,   192,  -336,  -336,    72,   213,   189,   190,   188,   206,
-      17,    86,   105,  -336,  -336,    35,  -336,  -336,    37,   -12,
-     236,  -336,   983,  -336,  -336,     9,  -336,    22,    35,  -336,
-    -336,  -336,  -336,   125,   983,   202,  -336,  -336,  -336,  -336,
-    -336,   211,   177,  -336,   204,    22,  -336,    90,   198,    38,
-      46,    65,    83,    96,    86,    86,    86,    94,   168,   168,
-    -336,  -336,  -336,  -336,  -336,    92,  -336,  -336,  -336,    64,
-      93,  -336,   388,  -336,  -336,   767,   210,   205,   243,    45,
-     983,   983,   983,   983,   983,   983,   983,   983,   983,   983,
-     388,   983,   983,   214,   223,  -336,  -336,  -336,  -336,   767,
-     767,   212,  -336,   216,   929,    37,    22,   225,   218,   983,
-    -336,   983,  -336,  -336,    22,   258,   983,  -336,  -336,   201,
-      45,   388,  -336,  -336,   983,  -336,   182,   213,   217,   189,
-     190,   188,   206,    17,    86,    86,    22,  -336,  -336,   265,
-    -336,    22,  -336,  -336,   983,  -336,  -336,   177,   222,  -336,
-    -336,  -336,  -336,    14,   767,  -336,  -336,   983,    22,  -336,
-     983,   767,   983,    18,   265,  -336,   -12,  -336,    22,  -336,
-     767,   234,  -336,  -336,  -336,   767,    45,  -336,  -336,   117,
-     220,  -336,   265,  -336,  -336,   226,   238,  -336,    45,  -336,
-     983,   767,   767,   245,  -336,  -336,   983,    22,   767,  -336,
-    -336,  -336,   246,    22,   767,  -336,   767,  -336,  -336
+    -349,    55,   650,  -349,    37,    37,  1094,   839,  -349,    28,
+      28,   248,  -349,  1094,    28,  -349,  1094,  -349,  -349,   -15,
+    1094,    59,  1094,    28,    28,  1094,  1094,  -349,  -349,     4,
+    -349,  -349,  -349,   587,  -349,  1094,  1094,  -349,  1094,  1094,
+      -8,  1094,    66,   490,    35,  -349,  -349,  -349,  -349,  -349,
+    -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,
+     109,  -349,  -349,     7,    69,    56,    46,    86,   107,    25,
+     129,   125,   200,  -349,  -349,   196,  -349,   122,   147,  -349,
+    -349,  -349,  -349,  -349,  -349,    47,    47,  -349,  1160,  -349,
+    -349,   177,   162,  -349,  -349,   431,   937,  -349,   122,    47,
+     176,  1094,   109,   713,   134,  -349,   180,   113,  -349,  -349,
+     431,  1094,  -349,  -349,   839,    34,  -349,  -349,   127,  -349,
+    1094,   839,  -349,   181,    63,  -349,    64,  -349,  -349,   248,
+     184,   986,    65,   190,  1094,   192,   195,   -15,  1094,    59,
+    1094,    70,    92,   522,     4,   202,   211,  -349,   776,   -22,
+     214,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,   102,
+     108,  1094,    20,  -349,    53,   231,  -349,  1094,  -349,  -349,
+    1094,  1094,  1094,  1094,  1094,  1094,  1094,  1094,  1094,  1094,
+    1094,  1094,  1094,  1094,  1094,  1094,  -349,  -349,  -349,  -349,
+    1094,  1094,  1094,  1248,   888,  -349,  1094,  1248,  -349,  -349,
+    -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,
+    -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,
+    -349,  -349,  -349,  -349,  -349,  -349,    28,  -349,    23,   176,
+     234,  -349,   203,  -349,  -349,    40,   245,   222,   223,   221,
+     239,     2,   129,   142,  -349,  -349,    19,  -349,  -349,    28,
+     -15,   268,  -349,  1094,  -349,  -349,    59,  -349,    23,    19,
+    -349,  -349,  -349,  -349,  1204,  1094,   232,  -349,  -349,  -349,
+    -349,  -349,   244,   231,  -349,   236,    23,  -349,    69,   235,
+      56,    46,    86,   107,    25,   129,   129,   129,   125,   200,
+     200,  -349,  -349,  -349,  -349,  -349,   119,  -349,  -349,  -349,
+      84,   120,  -349,   431,  -349,  -349,   839,   240,   250,   275,
+      77,  1094,  1094,  1094,  1094,  1094,  1094,  1094,  1094,  1094,
+    1094,   431,  1094,  1094,   249,   262,  -349,  -349,  -349,  -349,
+     839,   839,   252,  -349,   253,  1035,    28,    23,   263,   257,
+    1094,  -349,  1094,  -349,  -349,    23,   298,  1094,  -349,  -349,
+     234,    77,   431,  -349,  -349,  1094,  -349,   206,   245,   258,
+     222,   223,   221,   239,     2,   129,   129,    23,  -349,  -349,
+     306,  -349,    23,  -349,  -349,  1094,  -349,  -349,   231,   265,
+    -349,  -349,  -349,  -349,    47,   839,  -349,  -349,  1094,    23,
+    -349,  1094,   839,  1094,    18,   306,  -349,   -15,  -349,    23,
+    -349,   839,   274,  -349,  -349,  -349,   839,    77,  -349,  -349,
+      87,   266,  -349,   306,  -349,  -349,   269,   277,  -349,    77,
+    -349,  1094,   839,   839,   283,  -349,  -349,  1094,    23,   839,
+    -349,  -349,  -349,   284,    23,   839,  -349,   839,  -349,  -349
 };
 
   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -752,75 +750,80 @@ static const yytype_int16 yypact[] =
      means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       5,     0,     4,     1,   199,   199,     0,     0,     0,     0,
-       0,   201,    84,     0,   176,     0,   207,   208,     0,     0,
-       0,     0,     0,     0,     0,     0,     3,   206,    10,   177,
-     203,   209,   204,     0,    50,     0,     0,   205,     0,     0,
+       5,     0,     4,     1,   199,   199,     0,     0,    10,     0,
+       0,     0,   231,    84,     0,   176,     0,   237,   238,     0,
+       0,     0,     0,     0,     0,     0,     0,     3,   236,   177,
+     233,   239,   234,     0,    50,     0,     0,   235,     0,     0,
      190,     0,     0,    19,     0,     6,    16,    17,    18,    20,
       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
        0,    88,    96,   102,   106,   110,   114,   118,   122,   126,
      130,   137,   139,   142,   146,   156,   159,   161,   160,   163,
-     179,   180,   178,   202,   200,     0,     0,   177,     0,   164,
-     147,   156,     0,   213,   212,     0,    90,   162,   161,     0,
+     179,   180,   178,   232,   200,     0,     0,   177,     0,   164,
+     147,   156,     0,   243,   242,     0,    90,   162,   161,     0,
       85,     0,     0,     0,     0,   149,    44,     0,    38,   148,
-       0,     0,   150,   151,     0,    36,   177,   203,   204,    31,
-       0,     0,     0,   152,   153,   154,   155,   188,   182,     0,
-     191,     0,     0,     2,     0,    14,   211,     0,   210,    51,
+       0,     0,   150,   151,     0,   199,   204,   205,   199,   207,
+     208,   209,   210,    10,     0,   212,     0,   216,   217,   218,
+     231,    84,     0,   176,   223,   237,   238,   225,   226,   227,
+     228,     0,     0,    36,   177,   233,   234,    31,     0,     0,
+       0,   196,   202,   152,   153,   154,   155,   188,   182,     0,
+     191,     0,     0,     2,     0,    14,   241,     0,   240,    51,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,   157,   158,    95,    94,
        0,     0,     0,     0,     0,   168,     0,     0,   169,    65,
-      64,   192,   196,   198,   197,     0,    87,     0,    86,     0,
-      56,    91,    92,    99,   104,   108,   112,   116,   120,   124,
-     128,   134,   156,   167,    66,     0,    78,    36,     0,     0,
-      79,    80,     0,    42,    45,     0,    37,     0,     0,    68,
-      35,    32,   193,     0,     0,   190,   184,   189,   183,   186,
-     181,     0,    14,    12,    15,     0,    89,   107,     0,   111,
-     115,   119,   123,   127,   133,   132,   131,   138,   140,   141,
-     143,   144,   145,    97,    98,     0,   166,   172,   174,     0,
-       0,   171,     0,   215,   214,     0,    47,    59,    40,     0,
+      64,   203,   206,   208,   209,   214,   215,   213,   218,   219,
+     220,   221,   222,   223,   224,   211,   225,   226,   227,   228,
+     229,   230,   192,   201,   198,   197,     0,    87,     0,    86,
+       0,    56,    91,    92,    99,   104,   108,   112,   116,   120,
+     124,   128,   134,   156,   167,    66,     0,    78,    36,     0,
+       0,    79,    80,     0,    42,    45,     0,    37,     0,     0,
+      68,    35,    32,   193,     0,     0,   190,   184,   189,   183,
+     186,   181,     0,    14,    12,    15,     0,    89,   107,     0,
+     111,   115,   119,   123,   127,   133,   132,   131,   138,   140,
+     141,   143,   144,   145,    97,    98,     0,   166,   172,   174,
+       0,     0,   171,     0,   245,   244,     0,    47,    59,    40,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,    83,    81,    46,    39,     0,
-       0,     0,   194,   191,     0,     0,     0,     0,     0,     0,
-     165,     0,   173,   170,     0,    53,     0,    43,    48,     0,
-       0,     0,   217,   216,    84,    93,   156,   109,     0,   113,
-     117,   121,   125,   129,   136,   135,     0,   100,   101,    72,
-      69,     0,    55,    67,     0,   185,   187,    14,     0,    13,
-       5,   103,   175,     0,     0,    49,    41,    84,     0,    57,
-       0,     0,     0,     0,    73,    74,     0,   195,     0,     5,
-      11,     0,    54,    52,    60,     0,     0,   105,    62,     0,
-       0,    70,    72,    75,    82,     0,     0,     7,     0,    63,
-      84,    33,    33,     0,     5,     8,    84,     0,    34,    76,
-      77,    71,     0,     0,     0,     9,     0,    58,    61
+       0,     0,     0,     0,     0,     0,    83,    81,    46,    39,
+       0,     0,     0,   194,   191,     0,     0,     0,     0,     0,
+       0,   165,     0,   173,   170,     0,    53,     0,    43,    48,
+       0,     0,     0,   247,   246,    84,    93,   156,   109,     0,
+     113,   117,   121,   125,   129,   136,   135,     0,   100,   101,
+      72,    69,     0,    55,    67,     0,   185,   187,    14,     0,
+      13,     5,   103,   175,     0,     0,    49,    41,    84,     0,
+      57,     0,     0,     0,     0,    73,    74,     0,   195,     0,
+       5,    11,     0,    54,    52,    60,     0,     0,   105,    62,
+       0,     0,    70,    72,    75,    82,     0,     0,     7,     0,
+      63,    84,    33,    33,     0,     5,     8,    84,     0,    34,
+      76,    77,    71,     0,     0,     0,     9,     0,    58,    61
 };
 
   /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -336,  -336,  -336,   274,    -2,  -336,  -335,  -336,  -211,     1,
-    -180,   -87,    -9,  -336,  -336,  -336,    81,    -8,  -336,  -336,
-    -336,  -336,  -336,  -336,  -336,  -336,  -336,  -336,  -336,  -336,
-    -336,  -336,  -336,  -336,  -336,  -336,  -336,   -75,  -336,   -56,
-    -336,  -336,  -336,  -336,    89,  -287,  -108,   -11,  -336,  -336,
-     229,   -66,  -244,  -336,  -336,  -336,  -336,   152,    47,   165,
-      48,   166,    49,   170,    50,   167,    51,   173,    53,   -61,
-     171,    69,    43,  -336,    34,   306,   312,  -336,   -35,  -336,
-    -336,  -336,  -336,   108,   109,  -336,  -336,   112,   322,  -336,
-    -336,   -73,    -3,    24,  -276
+    -349,  -349,  -349,   323,    -2,  -349,  -348,  -349,  -269,     1,
+    -172,   -98,   -12,  -349,  -349,  -349,    71,   -24,  -349,  -349,
+    -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,  -349,
+    -349,  -349,  -349,  -349,  -349,  -349,  -349,   -80,  -349,   -61,
+    -349,  -349,  -349,  -349,    99,  -341,  -108,    -4,  -349,  -349,
+     278,   -86,  -296,  -349,  -349,  -349,  -349,   182,    42,   183,
+      43,   185,    41,   186,    45,   187,    49,   188,    52,   -95,
+     179,    93,   343,  -349,    24,    -5,    -1,  -349,    58,  -349,
+    -349,  -349,  -349,   101,   106,  -349,  -349,   110,     8,   -16,
+    -349,  -349,  -349,   -64,     9,  -104,  -340
 };
 
   /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,     1,    42,   350,    89,    44,   351,   224,   225,   119,
-     120,   379,    46,    47,   107,   257,   108,   258,   203,   204,
-     297,   298,    48,    49,    50,    51,   259,   356,   300,   368,
-      52,    53,    54,    55,    56,    57,   320,   343,   344,   345,
-     362,    58,    59,   200,   201,    99,   177,    60,   180,   181,
-     272,    61,   182,    62,   183,    63,   184,    64,   185,    65,
-     186,    66,   187,    67,   188,    68,   189,    69,   190,    70,
-      71,    72,    73,    74,    75,    76,    77,    78,   165,   249,
-      79,    80,   129,   130,   131,    81,   121,   122,    85,    82,
-      83,   139,    95,   255,   304
+      -1,     1,    42,   401,    89,    44,   402,   275,   276,   147,
+     148,   430,    46,    47,   107,   308,   108,   309,   254,   255,
+     348,   349,    48,    49,    50,    51,   310,   407,   351,   419,
+      52,    53,    54,    55,    56,    57,   371,   394,   395,   396,
+     413,    58,    59,   251,   252,    99,   228,    60,   231,   232,
+     323,    61,   233,    62,   234,    63,   235,    64,   236,    65,
+     237,    66,   238,    67,   239,    68,   240,    69,   241,    70,
+      71,    72,    73,    74,    75,    76,    77,    78,   195,   300,
+      79,    80,   159,   160,   161,    81,   149,   150,    85,   151,
+     152,    82,    83,   169,    95,   306,   355
 };
 
   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
@@ -828,273 +831,318 @@ static const yytype_int16 yydefgoto[] =
      number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_int16 yytable[] =
 {
-      43,   100,   207,    45,   102,    43,    96,    93,    92,   104,
-     101,   286,   169,   170,   366,   136,   305,   339,   308,   110,
-     111,   140,    84,   253,   337,   360,   194,   317,   318,   196,
-     132,    43,   268,     3,   206,   191,   253,   103,    93,   382,
-      91,   135,    93,   168,   141,   134,   302,   198,   106,    90,
-     354,   133,   335,    91,   199,    91,   361,   136,    91,    91,
-     269,   114,   105,   193,   109,   219,   138,   112,   113,    91,
-      91,   226,    91,    91,    94,   228,   136,   221,   123,   124,
-     370,   125,   126,   377,   178,   137,   234,   235,   236,   383,
-     195,   254,   376,   143,   243,   244,   357,   303,   248,   178,
-     208,    43,   144,   261,   254,    94,   137,   127,   138,    94,
-     147,   148,    43,   137,   291,   209,   348,   212,    43,   270,
-     142,   211,   145,   128,   146,   205,   262,   138,   150,   213,
-     192,   222,   220,   292,   215,   175,   277,   156,   157,   149,
-     158,   217,   137,   137,   294,   159,   156,   157,   282,   158,
-     216,   245,   151,   152,   159,   250,   271,   218,   290,   293,
-     171,   172,   316,   137,   172,   160,   173,   137,   174,   173,
-     371,   174,   252,  -198,    91,   202,    91,    91,    91,    91,
+      43,   242,   258,    45,   337,    43,    97,   104,    92,   100,
+      98,   388,   102,    86,   390,   356,   263,   359,   319,    96,
+     304,   199,   200,   101,   304,   411,   368,   369,   264,    93,
+      91,    43,   110,   111,   103,   245,    93,   162,   247,   170,
+     177,   178,   157,   257,    91,   320,    91,   405,   166,    91,
+      91,   386,   417,   165,    93,     3,   412,   114,   158,    91,
+      91,   171,    91,    91,    93,    93,    93,   421,   179,   167,
+     167,    93,   312,    84,   164,   270,    84,   433,   353,   427,
+     428,   277,   285,   286,   287,   279,   434,  -203,   305,   271,
+     272,   229,   305,    93,   313,   408,    94,   246,   106,   168,
+     172,    43,   174,    94,   294,   295,   229,   259,   299,   399,
+     166,   173,    43,   163,   166,   260,  -215,  -213,  -221,    43,
+     243,    94,    92,  -229,    97,   104,    86,   100,    98,   354,
+     102,    94,    94,    94,   342,    96,   198,   167,    94,   249,
+     422,   101,   324,   175,    91,  -230,    43,   250,   176,   262,
+     110,   111,   266,   343,   330,   331,   244,   321,   268,   167,
+      94,   168,    91,   256,    91,   168,    84,   328,   267,   167,
+     167,   180,   339,   273,   269,   186,   187,   297,   188,   333,
+    -206,   302,   189,   181,   182,   341,   344,   192,   296,   193,
+     194,   226,   301,   322,    91,   345,    91,    91,    91,    91,
       91,    91,    91,    91,    91,    91,    91,    91,    91,    91,
-     275,   378,   378,   338,  -197,   274,   240,   241,   242,   191,
-     191,   191,   191,   191,   191,   191,   191,   314,   315,   214,
-     191,   191,   156,   157,   156,   157,   223,   158,   326,   273,
-     238,   239,   159,   331,   162,   332,   163,   164,   153,   154,
-     155,   279,   280,   271,   166,   191,   167,   164,   246,   251,
-     256,   178,   260,   263,   264,   266,   265,   267,   199,   288,
-     285,   289,   127,    43,   287,   299,   295,   301,   347,   178,
-     352,   296,   321,   319,   329,   324,   217,   330,   334,   342,
-     340,   349,   367,   372,     2,   374,   375,    43,    43,   191,
-     322,   323,   327,   381,   385,   380,   278,   373,   363,   276,
-     178,   336,   227,   100,   306,    91,   306,    91,    91,    91,
-      91,    91,    91,    91,   161,   306,   306,   229,   307,   230,
-     328,   309,   232,   310,   231,   311,    97,   312,   333,   233,
-     313,   237,    98,   283,   284,   281,   100,    86,     0,     0,
-     306,   359,    43,     0,     0,   353,     0,   364,     0,    43,
-     341,     0,   358,     0,     0,   346,     0,     0,    43,     0,
-       0,    45,     0,    43,     0,     0,   369,     0,     0,   100,
-       0,     0,   355,     0,     0,   100,     0,     0,     0,    43,
-      43,     0,   365,     0,   306,     0,    43,     0,     0,   211,
-       0,     0,    43,     0,    43,   387,     0,   388,     0,   176,
-       0,     0,     0,     0,     0,     0,     6,     0,     0,     0,
-       0,   384,     0,     0,    10,    11,     0,   386,    14,     0,
-      16,    17,     0,    19,     0,    21,     0,     0,     0,     0,
-      24,    25,     0,    27,     0,    28,     0,    87,  -164,     0,
+     186,   187,   196,   367,   197,   194,   242,   242,   242,   242,
+     242,   242,   242,   242,   365,   366,   167,   242,   242,   186,
+     187,   253,   188,   379,  -214,   303,   189,  -219,   326,   186,
+     187,   384,   188,  -222,   389,  -224,   189,   190,  -211,   377,
+     429,   429,   242,   311,   382,  -198,   383,   322,   325,     8,
+     183,   184,   185,   392,  -197,    11,    12,   265,   397,    15,
+     274,    17,    18,   307,   289,   290,   314,   315,   317,   316,
+     318,   250,   157,   336,    28,   406,   338,    87,   340,   398,
+     352,   347,    30,    31,    32,   416,   242,    88,   370,   229,
+     350,   372,   380,   268,    43,   375,   381,   346,   385,    37,
+     393,   391,   418,    40,   400,   426,    41,   229,   425,   423,
+     403,   432,   436,     2,   435,   431,   387,   329,    43,    43,
+     437,   373,   374,   424,   414,   357,    91,   357,    91,    91,
+      91,    91,    91,    91,    91,   378,   357,   357,   229,    90,
+     327,   100,   278,   191,   358,   280,   361,   360,   281,   288,
+     282,   362,   283,   105,   284,   109,   363,   334,   112,   113,
+     364,   357,   335,     0,   332,     0,     0,     0,   153,   154,
+       0,   155,   156,    43,   100,   415,   404,     0,     0,   410,
+      43,     0,     0,   409,     0,     0,     0,     0,     0,    43,
+       0,     0,    45,     0,    43,     0,     0,   420,     0,     0,
+       0,     0,     0,     0,     0,   357,     0,   100,     0,     0,
+      43,    43,     0,   100,     0,     0,     0,    43,     0,     0,
+     262,     0,   227,    43,     0,    43,   438,     0,   439,     6,
+       0,     0,     8,     0,     0,     0,     0,     0,    11,    12,
+       0,     0,    15,     0,    17,    18,     0,    20,     0,    22,
+       0,     0,     0,    90,    25,    26,     0,    28,     0,     0,
+      87,     0,     0,     0,     0,    30,    31,    32,     0,     0,
+      88,   105,     0,   109,     0,     0,     0,     0,     0,    35,
+      36,  -164,    37,     0,    38,    39,    40,     0,     0,    41,
+       0,     0,     0,     0,     0,  -164,  -164,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,  -164,  -164,  -192,     0,     0,   291,   292,   293,     0,
+    -164,  -164,  -164,  -164,     0,     0,     0,  -192,  -192,     0,
+    -164,  -164,     0,     0,  -164,  -164,  -164,  -164,     0,     0,
+    -164,     0,  -164,  -192,  -192,     0,     0,  -164,     0,     0,
+       0,     0,  -192,  -192,  -192,  -192,     0,     0,     0,     0,
+       0,     0,  -192,  -192,     0,     0,  -192,  -192,  -192,  -192,
+       0,     0,  -192,     0,  -192,     0,     0,     0,     0,  -192,
+     115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
+     125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
+     135,   136,   137,   138,   139,   140,   141,   142,     0,     0,
+      25,    26,     0,    28,     0,   143,   144,     0,     0,     0,
+       0,   145,    31,   146,     0,     0,    33,     0,     0,    34,
+       0,     0,     0,     0,     0,    35,    36,     0,    37,     0,
+      38,    39,    40,     4,     0,    41,     5,     0,     6,     7,
+       0,     8,     9,     0,    10,     0,     0,    11,    12,    13,
+      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
+      24,     0,     0,    25,    26,    27,    28,     0,     0,    29,
+       0,     0,     0,     0,    30,    31,    32,     0,     0,    33,
+       0,     0,    34,     0,     0,     0,     0,     0,    35,    36,
+       0,    37,     0,    38,    39,    40,     4,     0,    41,     5,
+       0,     6,     7,     0,     8,     9,     0,    10,     0,     0,
+      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,     0,     0,    25,    26,     0,    28,
+       0,   248,    29,     0,     0,     0,     0,    30,    31,    32,
+       0,     0,    33,     0,     0,    34,     0,     0,     0,     0,
+       0,    35,    36,     0,    37,     0,    38,    39,    40,     4,
+       0,    41,     5,     0,     6,     7,     0,     8,     9,     0,
+      10,     0,     0,    11,    12,    13,    14,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,     0,     0,    25,
+      26,     0,    28,     0,   261,    29,     0,     0,     0,     0,
+      30,    31,    32,     0,     0,    33,     0,     0,    34,     0,
+       0,     0,     0,     0,    35,    36,     0,    37,     0,    38,
+      39,    40,     4,     0,    41,     5,     0,     6,     7,     0,
+       8,     9,     0,    10,     0,     0,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
+       0,     0,    25,    26,     0,    28,     0,     0,    29,     0,
+       0,     0,     0,    30,    31,    32,     0,     0,    33,     0,
+       0,    34,     0,     0,     0,     0,     6,    35,    36,     8,
+      37,     0,    38,    39,    40,    11,    12,    41,     0,    15,
+       0,    17,    18,     0,    20,     0,    22,     0,     0,     0,
+       0,    25,    26,     0,    28,     0,     0,    87,     0,     0,
        0,     0,    30,    31,    32,     0,     0,    88,     0,     0,
-       0,  -164,  -164,     0,     0,     0,    35,    36,     0,    37,
-       0,    38,    39,    40,     0,     0,    41,  -164,  -164,     0,
-       0,  -192,     0,     0,     0,     0,     0,  -164,  -164,  -164,
-    -164,     0,     0,     0,  -192,  -192,     0,  -164,  -164,     0,
-       0,  -164,  -164,  -164,  -164,     0,     0,  -164,     0,  -164,
-    -192,  -192,     0,     0,  -164,     0,     0,     0,     0,     0,
-    -192,  -192,  -192,  -192,     0,     0,     0,     0,     0,     0,
-    -192,  -192,     0,     0,  -192,  -192,  -192,  -192,     4,     0,
-    -192,     5,  -192,     6,     7,     0,     8,  -192,     9,     0,
-       0,    10,    11,    12,    13,    14,    15,    16,    17,    18,
-      19,    20,    21,    22,    23,     0,     0,    24,    25,    26,
-      27,     0,    28,     0,    29,     0,     0,     0,     0,    30,
-      31,    32,     0,     0,    33,     0,     0,    34,     0,     0,
+       0,     0,     0,     0,     0,     6,    35,    36,     8,    37,
+       0,    38,    39,    40,    11,    12,    41,   298,    15,     0,
+      17,    18,     0,    20,   230,    22,     0,     0,     0,     0,
+      25,    26,     0,    28,     0,     0,    87,     0,     0,     0,
+       0,    30,    31,    32,     0,     0,    88,     0,     0,     0,
+       0,     0,     0,     0,     6,    35,    36,     8,    37,     0,
+      38,    39,    40,    11,    12,    41,     0,    15,     0,    17,
+      18,     0,    20,     0,    22,     0,     0,     0,     0,    25,
+      26,     0,    28,     0,     0,    87,     0,     0,     0,     0,
+      30,    31,    32,     0,     0,    88,     0,     0,     0,  -220,
+       0,     0,     0,     6,    35,    36,     8,    37,     0,    38,
+      39,    40,    11,    12,    41,     0,    15,     0,    17,    18,
+       0,    20,     0,    22,     0,     0,     0,     0,    25,    26,
+       0,    28,     0,     0,    87,     0,     0,     0,     0,    30,
+      31,    32,     0,     0,    88,     0,     0,     0,     0,     0,
        0,     0,     0,    35,    36,     0,    37,     0,    38,    39,
-      40,     4,     0,    41,     5,     0,     6,     7,     0,     8,
-       0,     9,     0,     0,    10,    11,    12,    13,    14,    15,
-      16,    17,    18,    19,    20,    21,    22,    23,     0,     0,
-      24,    25,     0,    27,     0,    28,   115,   116,     0,     0,
-       0,     0,   117,    31,   118,     0,     0,    33,     0,     0,
-      34,     0,     0,     0,     0,     0,    35,    36,     0,    37,
-       0,    38,    39,    40,     4,     0,    41,     5,     0,     6,
-       7,     0,     8,     0,     9,     0,     0,    10,    11,    12,
-      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,     0,     0,    24,    25,     0,    27,     0,    28,   197,
-      29,     0,     0,     0,     0,    30,    31,    32,     0,     0,
-      33,     0,     0,    34,     0,     0,     0,     0,     0,    35,
-      36,     0,    37,     0,    38,    39,    40,     4,     0,    41,
-       5,     0,     6,     7,     0,     8,     0,     9,     0,     0,
-      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
-      20,    21,    22,    23,     0,     0,    24,    25,     0,    27,
-       0,    28,   210,    29,     0,     0,     0,     0,    30,    31,
-      32,     0,     0,    33,     0,     0,    34,     0,     0,     0,
+      40,   376,     6,    41,     0,     8,     0,     0,     0,     0,
+       0,    11,    12,     0,     0,    15,     0,    17,    18,     0,
+      20,     0,    22,     0,     0,     0,     0,    25,    26,     0,
+      28,     0,     0,    87,     0,     0,     0,     0,    30,    31,
+      32,     0,     0,    88,     0,     0,     0,     0,     0,     0,
        0,     0,    35,    36,     0,    37,     0,    38,    39,    40,
-       4,     0,    41,     5,     0,     6,     7,     0,     8,     0,
-       9,     0,     0,    10,    11,    12,    13,    14,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,     0,     0,    24,
-      25,     0,    27,     0,    28,     0,    29,     0,     0,     0,
-       0,    30,    31,    32,     0,     0,    33,     0,     0,    34,
-       0,     0,     0,     0,     0,    35,    36,     0,    37,     6,
-      38,    39,    40,     0,     0,    41,     0,    10,    11,     0,
-       0,    14,     0,    16,    17,     0,    19,     0,    21,     0,
-       0,     0,     0,    24,    25,     0,    27,     0,    28,     0,
-      87,     0,     0,     0,     0,    30,    31,    32,     0,     0,
-      88,     0,     0,     0,     0,     0,     0,     0,     0,    35,
-      36,     0,    37,     6,    38,    39,    40,     0,     0,    41,
-     247,    10,    11,     0,     0,    14,     0,    16,    17,     0,
-      19,   179,    21,     0,     0,     0,     0,    24,    25,     0,
-      27,     0,    28,     0,    87,     0,     0,     0,     0,    30,
-      31,    32,     0,     0,    88,     0,     0,     0,     0,     0,
-       0,     0,     0,    35,    36,     0,    37,     6,    38,    39,
-      40,     0,     0,    41,     0,    10,    11,     0,     0,    14,
-       0,    16,    17,     0,    19,     0,    21,     0,     0,     0,
-       0,    24,    25,     0,    27,     0,    28,     0,    87,     0,
-       0,     0,     0,    30,    31,    32,     0,     0,    88,     0,
-       0,     0,     0,     0,     0,     0,     0,    35,    36,     0,
-      37,     6,    38,    39,    40,   325,     0,    41,     0,    10,
-      11,     0,     0,    14,     0,    16,    17,     0,    19,     0,
-      21,     0,     0,     0,     0,    24,    25,     0,    27,     0,
-      28,     0,    87,     0,     0,     0,     0,    30,    31,    32,
-       0,     0,    88,    10,    11,     0,     0,    14,     0,    16,
-      17,    35,    36,     0,    37,     0,    38,    39,    40,     0,
-       0,    41,    27,     0,    28,     0,    87,     0,     0,     0,
-       0,    30,    31,    32,     0,     0,    88,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    37,     0,
-       0,     0,    40,     0,     0,    41
+       0,     0,    41,   201,   116,   117,   202,   119,   203,   204,
+     122,   205,   206,   125,   207,   127,   128,   208,   209,   210,
+     211,   212,   213,   214,   215,   216,   217,   218,   219,   220,
+     221,     0,     0,     0,     0,     0,     0,     0,   222,   223,
+       0,     0,     0,     0,   224,     0,   225,   201,   116,   117,
+     202,   119,   203,   204,   122,   205,   206,   125,   207,   127,
+     128,   208,   209,   210,   211,   212,   213,   214,   215,   216,
+     217,   218,   219,   220,   221,     0,     0,     0,     0,     0,
+       0,     0,     0,   223,     0,     0,     0,     0,   224,     0,
+     225,   201,   116,   117,   202,   119,   203,   204,   122,   205,
+     206,   125,   207,   127,   128,   208,   209,   210,   211,   212,
+     213,   214,   215,   216,   217,   218,   219,   220,   221,     0,
+       0,     0,     0,     0,     0,     0,     0,   223
 };
 
 static const yytype_int16 yycheck[] =
 {
-       2,    12,   110,     2,    15,     7,     9,     1,     7,    18,
-      13,   222,    85,    86,   349,     1,   260,   304,   262,    22,
-      23,    31,    39,     1,   300,     7,    99,   271,   272,   102,
-      41,    33,    15,     0,   107,    96,     1,    49,     1,   374,
-       6,    44,     1,    78,    54,    39,     1,     5,    39,     6,
-     337,    47,   296,    19,    12,    21,    38,     1,    24,    25,
-      43,    53,    19,    98,    21,   131,    52,    24,    25,    35,
-      36,   137,    38,    39,    68,   141,     1,    36,    35,    36,
-     356,    38,    39,   370,    95,    50,   147,   148,   149,   376,
-     101,    69,   368,    55,   160,   161,   340,    52,   164,   110,
-     111,   103,    56,    31,    69,    68,    50,    50,    52,    68,
-      14,    15,   114,    50,    50,   114,   327,    38,   120,    14,
-      30,   120,    57,    66,    41,    50,    54,    52,    42,    50,
-      96,   134,    69,    69,    50,    28,   202,    32,    33,    43,
-      35,    50,    50,    50,   252,    40,    32,    33,   214,    35,
-      66,   162,    58,    59,    40,   166,    51,    66,    66,    66,
-      38,    39,   270,    50,    39,    51,    44,    50,    46,    44,
-      53,    46,   175,    53,   140,    51,   142,   143,   144,   145,
-     146,   147,   148,   149,   150,   151,   152,   153,   154,   155,
-     199,   371,   372,   301,    53,   198,   153,   154,   155,   260,
-     261,   262,   263,   264,   265,   266,   267,   268,   269,    53,
-     271,   272,    32,    33,    32,    33,    39,    35,   284,   195,
-     151,   152,    40,   289,    65,   291,    67,    68,    60,    61,
-      62,   207,   208,    51,    65,   296,    67,    68,    39,    39,
-      39,   252,    50,    30,    55,    57,    56,    41,    12,   225,
-      39,    53,    50,   255,    50,    50,   255,    14,   324,   270,
-     333,    51,    39,    49,    39,    53,    50,    49,    10,     4,
-      53,    49,    38,    53,     0,    49,    38,   279,   280,   340,
-     279,   280,   285,    38,    38,   372,   205,   362,   344,   200,
-     301,   299,   140,   304,   260,   261,   262,   263,   264,   265,
-     266,   267,   268,   269,    75,   271,   272,   142,   261,   143,
-     286,   263,   145,   264,   144,   265,    10,   266,   294,   146,
-     267,   150,    10,   215,   215,   213,   337,     5,    -1,    -1,
-     296,   342,   334,    -1,    -1,   334,    -1,   346,    -1,   341,
-     316,    -1,   341,    -1,    -1,   321,    -1,    -1,   350,    -1,
-      -1,   350,    -1,   355,    -1,    -1,   355,    -1,    -1,   370,
-      -1,    -1,   338,    -1,    -1,   376,    -1,    -1,    -1,   371,
-     372,    -1,   348,    -1,   340,    -1,   378,    -1,    -1,   378,
-      -1,    -1,   384,    -1,   386,   384,    -1,   386,    -1,     1,
-      -1,    -1,    -1,    -1,    -1,    -1,     8,    -1,    -1,    -1,
-      -1,   377,    -1,    -1,    16,    17,    -1,   383,    20,    -1,
-      22,    23,    -1,    25,    -1,    27,    -1,    -1,    -1,    -1,
-      32,    33,    -1,    35,    -1,    37,    -1,    39,     1,    -1,
-      -1,    -1,    44,    45,    46,    -1,    -1,    49,    -1,    -1,
-      -1,    14,    15,    -1,    -1,    -1,    58,    59,    -1,    61,
-      -1,    63,    64,    65,    -1,    -1,    68,    30,    31,    -1,
-      -1,     1,    -1,    -1,    -1,    -1,    -1,    40,    41,    42,
-      43,    -1,    -1,    -1,    14,    15,    -1,    50,    51,    -1,
-      -1,    54,    55,    56,    57,    -1,    -1,    60,    -1,    62,
-      30,    31,    -1,    -1,    67,    -1,    -1,    -1,    -1,    -1,
-      40,    41,    42,    43,    -1,    -1,    -1,    -1,    -1,    -1,
-      50,    51,    -1,    -1,    54,    55,    56,    57,     3,    -1,
-      60,     6,    62,     8,     9,    -1,    11,    67,    13,    -1,
-      -1,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,    27,    28,    29,    -1,    -1,    32,    33,    34,
-      35,    -1,    37,    -1,    39,    -1,    -1,    -1,    -1,    44,
-      45,    46,    -1,    -1,    49,    -1,    -1,    52,    -1,    -1,
-      -1,    -1,    -1,    58,    59,    -1,    61,    -1,    63,    64,
-      65,     3,    -1,    68,     6,    -1,     8,     9,    -1,    11,
-      -1,    13,    -1,    -1,    16,    17,    18,    19,    20,    21,
-      22,    23,    24,    25,    26,    27,    28,    29,    -1,    -1,
-      32,    33,    -1,    35,    -1,    37,    38,    39,    -1,    -1,
-      -1,    -1,    44,    45,    46,    -1,    -1,    49,    -1,    -1,
-      52,    -1,    -1,    -1,    -1,    -1,    58,    59,    -1,    61,
-      -1,    63,    64,    65,     3,    -1,    68,     6,    -1,     8,
-       9,    -1,    11,    -1,    13,    -1,    -1,    16,    17,    18,
-      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
-      29,    -1,    -1,    32,    33,    -1,    35,    -1,    37,    38,
+       2,    96,   110,     2,   273,     7,    11,    19,     7,    13,
+      11,   351,    16,     5,   355,   311,    38,   313,    16,    10,
+       1,    85,    86,    14,     1,     7,   322,   323,    50,     1,
+       6,    33,    23,    24,    49,    99,     1,    41,   102,    32,
+      15,    16,    50,   107,    20,    43,    22,   388,     1,    25,
+      26,   347,   400,    44,     1,     0,    38,    53,    66,    35,
+      36,    54,    38,    39,     1,     1,     1,   407,    43,    50,
+      50,     1,    32,    39,    39,   161,    39,   425,     1,   419,
+     421,   167,   177,   178,   179,   171,   427,    53,    69,    69,
+      37,    95,    69,     1,    54,   391,    68,   101,    39,    52,
+      31,   103,    56,    68,   190,   191,   110,   111,   194,   378,
+       1,    55,   114,    47,     1,   114,    53,    53,    53,   121,
+      96,    68,   121,    53,   129,   137,   118,   131,   129,    52,
+     134,    68,    68,    68,    50,   126,    78,    50,    68,     5,
+      53,   132,   246,    57,   120,    53,   148,    13,    41,   148,
+     141,   142,    50,    69,   258,   259,    98,    15,    50,    50,
+      68,    52,   138,    50,   140,    52,    39,   253,    66,    50,
+      50,    42,   276,   164,    66,    33,    34,   193,    36,   265,
+      53,   197,    40,    58,    59,    66,    66,    65,   192,    67,
+      68,    29,   196,    51,   170,   303,   172,   173,   174,   175,
+     176,   177,   178,   179,   180,   181,   182,   183,   184,   185,
+      33,    34,    65,   321,    67,    68,   311,   312,   313,   314,
+     315,   316,   317,   318,   319,   320,    50,   322,   323,    33,
+      34,    51,    36,   337,    53,   226,    40,    53,   250,    33,
+      34,   345,    36,    53,   352,    53,    40,    51,    53,   335,
+     422,   423,   347,    50,   340,    53,   342,    51,   249,    11,
+      60,    61,    62,   367,    53,    17,    18,    53,   372,    21,
+      39,    23,    24,    39,   181,   182,    31,    55,    57,    56,
+      41,    13,    50,    39,    36,   389,    50,    39,    53,   375,
+      15,    51,    44,    45,    46,   399,   391,    49,    49,   303,
+      50,    39,    39,    50,   306,    53,    49,   306,    10,    61,
+       4,    53,    38,    65,    49,    38,    68,   321,    49,    53,
+     384,    38,    38,     0,   428,   423,   350,   256,   330,   331,
+     434,   330,   331,   413,   395,   311,   312,   313,   314,   315,
+     316,   317,   318,   319,   320,   336,   322,   323,   352,     6,
+     251,   355,   170,    75,   312,   172,   315,   314,   173,   180,
+     174,   316,   175,    20,   176,    22,   317,   266,    25,    26,
+     318,   347,   266,    -1,   264,    -1,    -1,    -1,    35,    36,
+      -1,    38,    39,   385,   388,   397,   385,    -1,    -1,   393,
+     392,    -1,    -1,   392,    -1,    -1,    -1,    -1,    -1,   401,
+      -1,    -1,   401,    -1,   406,    -1,    -1,   406,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   391,    -1,   421,    -1,    -1,
+     422,   423,    -1,   427,    -1,    -1,    -1,   429,    -1,    -1,
+     429,    -1,     1,   435,    -1,   437,   435,    -1,   437,     8,
+      -1,    -1,    11,    -1,    -1,    -1,    -1,    -1,    17,    18,
+      -1,    -1,    21,    -1,    23,    24,    -1,    26,    -1,    28,
+      -1,    -1,    -1,   120,    33,    34,    -1,    36,    -1,    -1,
       39,    -1,    -1,    -1,    -1,    44,    45,    46,    -1,    -1,
-      49,    -1,    -1,    52,    -1,    -1,    -1,    -1,    -1,    58,
-      59,    -1,    61,    -1,    63,    64,    65,     3,    -1,    68,
-       6,    -1,     8,     9,    -1,    11,    -1,    13,    -1,    -1,
-      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,    -1,    -1,    32,    33,    -1,    35,
-      -1,    37,    38,    39,    -1,    -1,    -1,    -1,    44,    45,
-      46,    -1,    -1,    49,    -1,    -1,    52,    -1,    -1,    -1,
-      -1,    -1,    58,    59,    -1,    61,    -1,    63,    64,    65,
-       3,    -1,    68,     6,    -1,     8,     9,    -1,    11,    -1,
-      13,    -1,    -1,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    25,    26,    27,    28,    29,    -1,    -1,    32,
-      33,    -1,    35,    -1,    37,    -1,    39,    -1,    -1,    -1,
+      49,   138,    -1,   140,    -1,    -1,    -1,    -1,    -1,    58,
+      59,     1,    61,    -1,    63,    64,    65,    -1,    -1,    68,
+      -1,    -1,    -1,    -1,    -1,    15,    16,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    31,    32,     1,    -1,    -1,   183,   184,   185,    -1,
+      40,    41,    42,    43,    -1,    -1,    -1,    15,    16,    -1,
+      50,    51,    -1,    -1,    54,    55,    56,    57,    -1,    -1,
+      60,    -1,    62,    31,    32,    -1,    -1,    67,    -1,    -1,
+      -1,    -1,    40,    41,    42,    43,    -1,    -1,    -1,    -1,
+      -1,    -1,    50,    51,    -1,    -1,    54,    55,    56,    57,
+      -1,    -1,    60,    -1,    62,    -1,    -1,    -1,    -1,    67,
+       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
+      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
+      23,    24,    25,    26,    27,    28,    29,    30,    -1,    -1,
+      33,    34,    -1,    36,    -1,    38,    39,    -1,    -1,    -1,
       -1,    44,    45,    46,    -1,    -1,    49,    -1,    -1,    52,
-      -1,    -1,    -1,    -1,    -1,    58,    59,    -1,    61,     8,
-      63,    64,    65,    -1,    -1,    68,    -1,    16,    17,    -1,
-      -1,    20,    -1,    22,    23,    -1,    25,    -1,    27,    -1,
-      -1,    -1,    -1,    32,    33,    -1,    35,    -1,    37,    -1,
-      39,    -1,    -1,    -1,    -1,    44,    45,    46,    -1,    -1,
-      49,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,
-      59,    -1,    61,     8,    63,    64,    65,    -1,    -1,    68,
-      69,    16,    17,    -1,    -1,    20,    -1,    22,    23,    -1,
-      25,    26,    27,    -1,    -1,    -1,    -1,    32,    33,    -1,
-      35,    -1,    37,    -1,    39,    -1,    -1,    -1,    -1,    44,
-      45,    46,    -1,    -1,    49,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    58,    59,    -1,    61,     8,    63,    64,
-      65,    -1,    -1,    68,    -1,    16,    17,    -1,    -1,    20,
-      -1,    22,    23,    -1,    25,    -1,    27,    -1,    -1,    -1,
-      -1,    32,    33,    -1,    35,    -1,    37,    -1,    39,    -1,
+      -1,    -1,    -1,    -1,    -1,    58,    59,    -1,    61,    -1,
+      63,    64,    65,     3,    -1,    68,     6,    -1,     8,     9,
+      -1,    11,    12,    -1,    14,    -1,    -1,    17,    18,    19,
+      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
+      30,    -1,    -1,    33,    34,    35,    36,    -1,    -1,    39,
+      -1,    -1,    -1,    -1,    44,    45,    46,    -1,    -1,    49,
+      -1,    -1,    52,    -1,    -1,    -1,    -1,    -1,    58,    59,
+      -1,    61,    -1,    63,    64,    65,     3,    -1,    68,     6,
+      -1,     8,     9,    -1,    11,    12,    -1,    14,    -1,    -1,
+      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+      27,    28,    29,    30,    -1,    -1,    33,    34,    -1,    36,
+      -1,    38,    39,    -1,    -1,    -1,    -1,    44,    45,    46,
+      -1,    -1,    49,    -1,    -1,    52,    -1,    -1,    -1,    -1,
+      -1,    58,    59,    -1,    61,    -1,    63,    64,    65,     3,
+      -1,    68,     6,    -1,     8,     9,    -1,    11,    12,    -1,
+      14,    -1,    -1,    17,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,    30,    -1,    -1,    33,
+      34,    -1,    36,    -1,    38,    39,    -1,    -1,    -1,    -1,
+      44,    45,    46,    -1,    -1,    49,    -1,    -1,    52,    -1,
+      -1,    -1,    -1,    -1,    58,    59,    -1,    61,    -1,    63,
+      64,    65,     3,    -1,    68,     6,    -1,     8,     9,    -1,
+      11,    12,    -1,    14,    -1,    -1,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      -1,    -1,    33,    34,    -1,    36,    -1,    -1,    39,    -1,
       -1,    -1,    -1,    44,    45,    46,    -1,    -1,    49,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,    59,    -1,
-      61,     8,    63,    64,    65,    66,    -1,    68,    -1,    16,
-      17,    -1,    -1,    20,    -1,    22,    23,    -1,    25,    -1,
-      27,    -1,    -1,    -1,    -1,    32,    33,    -1,    35,    -1,
-      37,    -1,    39,    -1,    -1,    -1,    -1,    44,    45,    46,
-      -1,    -1,    49,    16,    17,    -1,    -1,    20,    -1,    22,
-      23,    58,    59,    -1,    61,    -1,    63,    64,    65,    -1,
-      -1,    68,    35,    -1,    37,    -1,    39,    -1,    -1,    -1,
+      -1,    52,    -1,    -1,    -1,    -1,     8,    58,    59,    11,
+      61,    -1,    63,    64,    65,    17,    18,    68,    -1,    21,
+      -1,    23,    24,    -1,    26,    -1,    28,    -1,    -1,    -1,
+      -1,    33,    34,    -1,    36,    -1,    -1,    39,    -1,    -1,
+      -1,    -1,    44,    45,    46,    -1,    -1,    49,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,     8,    58,    59,    11,    61,
+      -1,    63,    64,    65,    17,    18,    68,    69,    21,    -1,
+      23,    24,    -1,    26,    27,    28,    -1,    -1,    -1,    -1,
+      33,    34,    -1,    36,    -1,    -1,    39,    -1,    -1,    -1,
       -1,    44,    45,    46,    -1,    -1,    49,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    61,    -1,
-      -1,    -1,    65,    -1,    -1,    68
+      -1,    -1,    -1,    -1,     8,    58,    59,    11,    61,    -1,
+      63,    64,    65,    17,    18,    68,    -1,    21,    -1,    23,
+      24,    -1,    26,    -1,    28,    -1,    -1,    -1,    -1,    33,
+      34,    -1,    36,    -1,    -1,    39,    -1,    -1,    -1,    -1,
+      44,    45,    46,    -1,    -1,    49,    -1,    -1,    -1,    53,
+      -1,    -1,    -1,     8,    58,    59,    11,    61,    -1,    63,
+      64,    65,    17,    18,    68,    -1,    21,    -1,    23,    24,
+      -1,    26,    -1,    28,    -1,    -1,    -1,    -1,    33,    34,
+      -1,    36,    -1,    -1,    39,    -1,    -1,    -1,    -1,    44,
+      45,    46,    -1,    -1,    49,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    58,    59,    -1,    61,    -1,    63,    64,
+      65,    66,     8,    68,    -1,    11,    -1,    -1,    -1,    -1,
+      -1,    17,    18,    -1,    -1,    21,    -1,    23,    24,    -1,
+      26,    -1,    28,    -1,    -1,    -1,    -1,    33,    34,    -1,
+      36,    -1,    -1,    39,    -1,    -1,    -1,    -1,    44,    45,
+      46,    -1,    -1,    49,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    58,    59,    -1,    61,    -1,    63,    64,    65,
+      -1,    -1,    68,     3,     4,     5,     6,     7,     8,     9,
+      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
+      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
+      30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    38,    39,
+      -1,    -1,    -1,    -1,    44,    -1,    46,     3,     4,     5,
+       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,    30,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    39,    -1,    -1,    -1,    -1,    44,    -1,
+      46,     3,     4,     5,     6,     7,     8,     9,    10,    11,
+      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,    29,    30,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    39
 };
 
   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
      symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,    71,    73,     0,     3,     6,     8,     9,    11,    13,
-      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,    32,    33,    34,    35,    37,    39,
+       0,    71,    73,     0,     3,     6,     8,     9,    11,    12,
+      14,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,    30,    33,    34,    35,    36,    39,
       44,    45,    46,    49,    52,    58,    59,    61,    63,    64,
       65,    68,    72,    74,    75,    79,    82,    83,    92,    93,
       94,    95,   100,   101,   102,   103,   104,   105,   111,   112,
      117,   121,   123,   125,   127,   129,   131,   133,   135,   137,
      139,   140,   141,   142,   143,   144,   145,   146,   147,   150,
-     151,   155,   159,   160,    39,   158,   158,    39,    49,    74,
-     142,   144,    79,     1,    68,   162,   162,   145,   146,   115,
-     117,   162,   117,    49,    82,   142,    39,    84,    86,   142,
-     162,   162,   142,   142,    53,    38,    39,    44,    46,    79,
-      80,   156,   157,   142,   142,   142,   142,    50,    66,   152,
-     153,   154,   117,    47,    39,   162,     1,    50,    52,   161,
-      31,    54,    30,    55,    56,    57,    41,    14,    15,    43,
-      42,    58,    59,    60,    61,    62,    32,    33,    35,    40,
-      51,   120,    65,    67,    68,   148,    65,    67,   148,   161,
-     161,    38,    39,    44,    46,    28,     1,   116,   117,    26,
-     118,   119,   122,   124,   126,   128,   130,   132,   134,   136,
-     138,   139,   144,   148,   161,   117,   161,    38,     5,    12,
-     113,   114,    51,    88,    89,    50,   161,   116,   117,    79,
-      38,    79,    38,    50,    53,    50,    66,    50,    66,   121,
-      69,    36,   162,    39,    77,    78,   121,   127,   121,   129,
-     131,   133,   135,   137,   139,   139,   139,   140,   141,   141,
-     142,   142,   142,   121,   121,   117,    39,    69,   121,   149,
-     117,    39,   162,     1,    69,   163,    39,    85,    87,    96,
-      50,    31,    54,    30,    55,    56,    57,    41,    15,    43,
-      14,    51,   120,   163,   162,    82,   114,   121,    86,   163,
-     163,   157,   121,   153,   154,    39,    78,    50,   163,    53,
-      66,    50,    69,    66,   116,    79,    51,    90,    91,    50,
-      98,    14,     1,    52,   164,   122,   144,   128,   122,   130,
-     132,   134,   136,   138,   139,   139,   116,   122,   122,    49,
-     106,    39,    79,    79,    53,    66,   121,   162,   163,    39,
-      49,   121,   121,   163,    10,   122,    87,   164,   116,   115,
-      53,   163,     4,   107,   108,   109,   163,   121,    78,    49,
-      73,    76,   161,    79,   115,   163,    97,   122,    79,   117,
-       7,    38,   110,   109,    82,   163,    76,    38,    99,    79,
-     164,    53,    53,   107,    49,    38,   164,   115,    80,    81,
-      81,    38,    76,   115,   163,    38,   163,    79,    79
+     151,   155,   161,   162,    39,   158,   158,    39,    49,    74,
+     142,   144,    79,     1,    68,   164,   164,   145,   146,   115,
+     117,   164,   117,    49,    82,   142,    39,    84,    86,   142,
+     164,   164,   142,   142,    53,     3,     4,     5,     6,     7,
+       8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
+      28,    29,    30,    38,    39,    44,    46,    79,    80,   156,
+     157,   159,   160,   142,   142,   142,   142,    50,    66,   152,
+     153,   154,   117,    47,    39,   164,     1,    50,    52,   163,
+      32,    54,    31,    55,    56,    57,    41,    15,    16,    43,
+      42,    58,    59,    60,    61,    62,    33,    34,    36,    40,
+      51,   120,    65,    67,    68,   148,    65,    67,   148,   163,
+     163,     3,     6,     8,     9,    11,    12,    14,    17,    18,
+      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    30,    38,    39,    44,    46,    29,     1,   116,   117,
+      27,   118,   119,   122,   124,   126,   128,   130,   132,   134,
+     136,   138,   139,   144,   148,   163,   117,   163,    38,     5,
+      13,   113,   114,    51,    88,    89,    50,   163,   116,   117,
+      79,    38,    79,    38,    50,    53,    50,    66,    50,    66,
+     121,    69,    37,   164,    39,    77,    78,   121,   127,   121,
+     129,   131,   133,   135,   137,   139,   139,   139,   140,   141,
+     141,   142,   142,   142,   121,   121,   117,   159,    69,   121,
+     149,   117,   159,   164,     1,    69,   165,    39,    85,    87,
+      96,    50,    32,    54,    31,    55,    56,    57,    41,    16,
+      43,    15,    51,   120,   165,   164,    82,   114,   121,    86,
+     165,   165,   157,   121,   153,   154,    39,    78,    50,   165,
+      53,    66,    50,    69,    66,   116,    79,    51,    90,    91,
+      50,    98,    15,     1,    52,   166,   122,   144,   128,   122,
+     130,   132,   134,   136,   138,   139,   139,   116,   122,   122,
+      49,   106,    39,    79,    79,    53,    66,   121,   164,   165,
+      39,    49,   121,   121,   165,    10,   122,    87,   166,   116,
+     115,    53,   165,     4,   107,   108,   109,   165,   121,    78,
+      49,    73,    76,   163,    79,   115,   165,    97,   122,    79,
+     117,     7,    38,   110,   109,    82,   165,    76,    38,    99,
+      79,   166,    53,    53,   107,    49,    38,   166,   115,    80,
+      81,    81,    38,    76,   115,   165,    38,   165,    79,    79
 };
 
   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
@@ -1120,8 +1168,11 @@ static const yytype_uint8 yyr1[] =
      147,   147,   148,   148,   149,   149,   150,   150,   150,   150,
      150,   150,   151,   151,   151,   151,   152,   152,   153,   153,
      154,   154,   155,   155,   156,   156,   157,   157,   157,   158,
-     158,   159,   159,   159,   159,   159,   159,   160,   160,   160,
-     161,   161,   162,   162,   163,   163,   164,   164
+     158,   159,   159,   160,   160,   160,   160,   160,   160,   160,
+     160,   160,   160,   160,   160,   160,   160,   160,   160,   160,
+     160,   160,   160,   160,   160,   160,   160,   160,   160,   160,
+     160,   161,   161,   161,   161,   161,   161,   162,   162,   162,
+     163,   163,   164,   164,   165,   165,   166,   166
 };
 
   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
@@ -1148,6 +1199,9 @@ static const yytype_uint8 yyr2[] =
        1,     3,     2,     3,     3,     5,     2,     4,     1,     2,
        0,     1,     2,     3,     3,     5,     1,     1,     1,     0,
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1
 };
 
@@ -1433,11 +1487,11 @@ static int
 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yytype_int16 *yyssp, int yytoken)
 {
-  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
   YYSIZE_T yysize = yysize0;
   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   /* Internationalized format string. */
-  const char *yyformat = YY_NULLPTR;
+  const char *yyformat = YY_NULL;
   /* Arguments of yyformat. */
   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   /* Number of reported tokens (one for the "unexpected", one per
@@ -1494,7 +1548,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                   }
                 yyarg[yycount++] = yytname[yyx];
                 {
-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
                   if (! (yysize <= yysize1
                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                     return 2;
@@ -1831,1281 +1885,1468 @@ yyreduce:
   switch (yyn)
     {
         case 2:
-#line 253 "parser.y" /* yacc.c:1646  */
+#line 254 "parser.y" /* yacc.c:1646  */
     { program_parsed(ctx, (yyvsp[-2].source_elements)); }
-#line 1843 "parser.tab.c" /* yacc.c:1646  */
+#line 1891 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 3:
-#line 256 "parser.y" /* yacc.c:1646  */
+#line 257 "parser.y" /* yacc.c:1646  */
     {}
-#line 1849 "parser.tab.c" /* yacc.c:1646  */
+#line 1897 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 4:
-#line 257 "parser.y" /* yacc.c:1646  */
+#line 258 "parser.y" /* yacc.c:1646  */
     {}
-#line 1855 "parser.tab.c" /* yacc.c:1646  */
+#line 1903 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 5:
-#line 261 "parser.y" /* yacc.c:1646  */
+#line 262 "parser.y" /* yacc.c:1646  */
     { (yyval.source_elements) = new_source_elements(ctx); }
-#line 1861 "parser.tab.c" /* yacc.c:1646  */
+#line 1909 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 6:
-#line 263 "parser.y" /* yacc.c:1646  */
+#line 264 "parser.y" /* yacc.c:1646  */
     { (yyval.source_elements) = source_elements_add_statement((yyvsp[-1].source_elements), (yyvsp[0].statement)); }
-#line 1867 "parser.tab.c" /* yacc.c:1646  */
+#line 1915 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 7:
-#line 268 "parser.y" /* yacc.c:1646  */
+#line 269 "parser.y" /* yacc.c:1646  */
     { (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); }
-#line 1873 "parser.tab.c" /* yacc.c:1646  */
+#line 1921 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 8:
-#line 270 "parser.y" /* yacc.c:1646  */
+#line 271 "parser.y" /* yacc.c:1646  */
     { (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); }
-#line 1879 "parser.tab.c" /* yacc.c:1646  */
+#line 1927 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 9:
-#line 272 "parser.y" /* yacc.c:1646  */
+#line 273 "parser.y" /* yacc.c:1646  */
     { (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); }
-#line 1885 "parser.tab.c" /* yacc.c:1646  */
+#line 1933 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 10:
-#line 275 "parser.y" /* yacc.c:1646  */
-    { (yyval.srcptr) = (yyvsp[0].srcptr); }
-#line 1891 "parser.tab.c" /* yacc.c:1646  */
+#line 276 "parser.y" /* yacc.c:1646  */
+    { (yyval.srcptr) = ctx->ptr - 8; }
+#line 1939 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 11:
-#line 279 "parser.y" /* yacc.c:1646  */
+#line 280 "parser.y" /* yacc.c:1646  */
     { (yyval.source_elements) = (yyvsp[0].source_elements); }
-#line 1897 "parser.tab.c" /* yacc.c:1646  */
+#line 1945 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 12:
-#line 283 "parser.y" /* yacc.c:1646  */
+#line 284 "parser.y" /* yacc.c:1646  */
     { (yyval.parameter_list) = new_parameter_list(ctx, (yyvsp[0].identifier)); }
-#line 1903 "parser.tab.c" /* yacc.c:1646  */
+#line 1951 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 13:
-#line 285 "parser.y" /* yacc.c:1646  */
+#line 286 "parser.y" /* yacc.c:1646  */
     { (yyval.parameter_list) = parameter_list_add(ctx, (yyvsp[-2].parameter_list), (yyvsp[0].identifier)); }
-#line 1909 "parser.tab.c" /* yacc.c:1646  */
+#line 1957 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 14:
-#line 289 "parser.y" /* yacc.c:1646  */
+#line 290 "parser.y" /* yacc.c:1646  */
     { (yyval.parameter_list) = NULL; }
-#line 1915 "parser.tab.c" /* yacc.c:1646  */
+#line 1963 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 15:
-#line 290 "parser.y" /* yacc.c:1646  */
+#line 291 "parser.y" /* yacc.c:1646  */
     { (yyval.parameter_list) = (yyvsp[0].parameter_list); }
-#line 1921 "parser.tab.c" /* yacc.c:1646  */
+#line 1969 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 16:
-#line 294 "parser.y" /* yacc.c:1646  */
+#line 295 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1927 "parser.tab.c" /* yacc.c:1646  */
+#line 1975 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 17:
-#line 295 "parser.y" /* yacc.c:1646  */
+#line 296 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1933 "parser.tab.c" /* yacc.c:1646  */
+#line 1981 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 18:
-#line 296 "parser.y" /* yacc.c:1646  */
+#line 297 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1939 "parser.tab.c" /* yacc.c:1646  */
+#line 1987 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 19:
-#line 297 "parser.y" /* yacc.c:1646  */
+#line 298 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_expression_statement(ctx, (yyvsp[0].expr)); }
-#line 1945 "parser.tab.c" /* yacc.c:1646  */
+#line 1993 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 20:
-#line 298 "parser.y" /* yacc.c:1646  */
+#line 299 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1951 "parser.tab.c" /* yacc.c:1646  */
+#line 1999 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 21:
-#line 299 "parser.y" /* yacc.c:1646  */
+#line 300 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1957 "parser.tab.c" /* yacc.c:1646  */
+#line 2005 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 22:
-#line 300 "parser.y" /* yacc.c:1646  */
+#line 301 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1963 "parser.tab.c" /* yacc.c:1646  */
+#line 2011 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 23:
-#line 301 "parser.y" /* yacc.c:1646  */
+#line 302 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1969 "parser.tab.c" /* yacc.c:1646  */
+#line 2017 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 24:
-#line 302 "parser.y" /* yacc.c:1646  */
+#line 303 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1975 "parser.tab.c" /* yacc.c:1646  */
+#line 2023 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 25:
-#line 303 "parser.y" /* yacc.c:1646  */
+#line 304 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1981 "parser.tab.c" /* yacc.c:1646  */
+#line 2029 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 26:
-#line 304 "parser.y" /* yacc.c:1646  */
+#line 305 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1987 "parser.tab.c" /* yacc.c:1646  */
+#line 2035 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 27:
-#line 305 "parser.y" /* yacc.c:1646  */
+#line 306 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1993 "parser.tab.c" /* yacc.c:1646  */
+#line 2041 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 28:
-#line 306 "parser.y" /* yacc.c:1646  */
+#line 307 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 1999 "parser.tab.c" /* yacc.c:1646  */
+#line 2047 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 29:
-#line 307 "parser.y" /* yacc.c:1646  */
+#line 308 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 2005 "parser.tab.c" /* yacc.c:1646  */
+#line 2053 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 30:
-#line 308 "parser.y" /* yacc.c:1646  */
+#line 309 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 2011 "parser.tab.c" /* yacc.c:1646  */
+#line 2059 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 31:
-#line 312 "parser.y" /* yacc.c:1646  */
+#line 313 "parser.y" /* yacc.c:1646  */
     { (yyval.statement_list) = new_statement_list(ctx, (yyvsp[0].statement)); }
-#line 2017 "parser.tab.c" /* yacc.c:1646  */
+#line 2065 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 32:
-#line 314 "parser.y" /* yacc.c:1646  */
+#line 315 "parser.y" /* yacc.c:1646  */
     { (yyval.statement_list) = statement_list_add((yyvsp[-1].statement_list), (yyvsp[0].statement)); }
-#line 2023 "parser.tab.c" /* yacc.c:1646  */
+#line 2071 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 33:
-#line 318 "parser.y" /* yacc.c:1646  */
+#line 319 "parser.y" /* yacc.c:1646  */
     { (yyval.statement_list) = NULL; }
-#line 2029 "parser.tab.c" /* yacc.c:1646  */
+#line 2077 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 34:
-#line 319 "parser.y" /* yacc.c:1646  */
+#line 320 "parser.y" /* yacc.c:1646  */
     { (yyval.statement_list) = (yyvsp[0].statement_list); }
-#line 2035 "parser.tab.c" /* yacc.c:1646  */
+#line 2083 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 35:
-#line 323 "parser.y" /* yacc.c:1646  */
+#line 324 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_block_statement(ctx, (yyvsp[-1].statement_list)); }
-#line 2041 "parser.tab.c" /* yacc.c:1646  */
+#line 2089 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 36:
-#line 324 "parser.y" /* yacc.c:1646  */
+#line 325 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_block_statement(ctx, NULL); }
-#line 2047 "parser.tab.c" /* yacc.c:1646  */
+#line 2095 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 37:
-#line 329 "parser.y" /* yacc.c:1646  */
+#line 330 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_var_statement(ctx, (yyvsp[-1].variable_list)); }
-#line 2053 "parser.tab.c" /* yacc.c:1646  */
+#line 2101 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 38:
-#line 333 "parser.y" /* yacc.c:1646  */
+#line 334 "parser.y" /* yacc.c:1646  */
     { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[0].variable_declaration)); }
-#line 2059 "parser.tab.c" /* yacc.c:1646  */
+#line 2107 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 39:
-#line 335 "parser.y" /* yacc.c:1646  */
+#line 336 "parser.y" /* yacc.c:1646  */
     { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[-2].variable_list), (yyvsp[0].variable_declaration)); }
-#line 2065 "parser.tab.c" /* yacc.c:1646  */
+#line 2113 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 40:
-#line 340 "parser.y" /* yacc.c:1646  */
+#line 341 "parser.y" /* yacc.c:1646  */
     { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[0].variable_declaration)); }
-#line 2071 "parser.tab.c" /* yacc.c:1646  */
+#line 2119 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 41:
-#line 342 "parser.y" /* yacc.c:1646  */
+#line 343 "parser.y" /* yacc.c:1646  */
     { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[-2].variable_list), (yyvsp[0].variable_declaration)); }
-#line 2077 "parser.tab.c" /* yacc.c:1646  */
+#line 2125 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 42:
-#line 347 "parser.y" /* yacc.c:1646  */
+#line 348 "parser.y" /* yacc.c:1646  */
     { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[-1].identifier), (yyvsp[0].expr)); }
-#line 2083 "parser.tab.c" /* yacc.c:1646  */
+#line 2131 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 43:
-#line 352 "parser.y" /* yacc.c:1646  */
+#line 353 "parser.y" /* yacc.c:1646  */
     { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[-1].identifier), (yyvsp[0].expr)); }
-#line 2089 "parser.tab.c" /* yacc.c:1646  */
+#line 2137 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 44:
-#line 356 "parser.y" /* yacc.c:1646  */
+#line 357 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = NULL; }
-#line 2095 "parser.tab.c" /* yacc.c:1646  */
+#line 2143 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 45:
-#line 357 "parser.y" /* yacc.c:1646  */
+#line 358 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2101 "parser.tab.c" /* yacc.c:1646  */
+#line 2149 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 46:
-#line 362 "parser.y" /* yacc.c:1646  */
+#line 363 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2107 "parser.tab.c" /* yacc.c:1646  */
+#line 2155 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 47:
-#line 366 "parser.y" /* yacc.c:1646  */
+#line 367 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = NULL; }
-#line 2113 "parser.tab.c" /* yacc.c:1646  */
+#line 2161 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 48:
-#line 367 "parser.y" /* yacc.c:1646  */
+#line 368 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2119 "parser.tab.c" /* yacc.c:1646  */
+#line 2167 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 49:
-#line 372 "parser.y" /* yacc.c:1646  */
+#line 373 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2125 "parser.tab.c" /* yacc.c:1646  */
+#line 2173 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 50:
-#line 376 "parser.y" /* yacc.c:1646  */
+#line 377 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_statement(ctx, STAT_EMPTY, 0); }
-#line 2131 "parser.tab.c" /* yacc.c:1646  */
+#line 2179 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 51:
-#line 381 "parser.y" /* yacc.c:1646  */
+#line 382 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_expression_statement(ctx, (yyvsp[-1].expr)); }
-#line 2137 "parser.tab.c" /* yacc.c:1646  */
+#line 2185 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 52:
-#line 386 "parser.y" /* yacc.c:1646  */
+#line 387 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_if_statement(ctx, (yyvsp[-4].expr), (yyvsp[-2].statement), (yyvsp[0].statement)); }
-#line 2143 "parser.tab.c" /* yacc.c:1646  */
+#line 2191 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 53:
-#line 388 "parser.y" /* yacc.c:1646  */
+#line 389 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_if_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].statement), NULL); }
-#line 2149 "parser.tab.c" /* yacc.c:1646  */
+#line 2197 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 54:
-#line 393 "parser.y" /* yacc.c:1646  */
+#line 394 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_while_statement(ctx, TRUE, (yyvsp[-2].expr), (yyvsp[-5].statement)); }
-#line 2155 "parser.tab.c" /* yacc.c:1646  */
+#line 2203 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 55:
-#line 395 "parser.y" /* yacc.c:1646  */
+#line 396 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_while_statement(ctx, FALSE, (yyvsp[-2].expr), (yyvsp[0].statement)); }
-#line 2161 "parser.tab.c" /* yacc.c:1646  */
+#line 2209 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 56:
-#line 397 "parser.y" /* yacc.c:1646  */
+#line 398 "parser.y" /* yacc.c:1646  */
     { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; }
-#line 2167 "parser.tab.c" /* yacc.c:1646  */
+#line 2215 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 57:
-#line 399 "parser.y" /* yacc.c:1646  */
+#line 400 "parser.y" /* yacc.c:1646  */
     { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; }
-#line 2173 "parser.tab.c" /* yacc.c:1646  */
+#line 2221 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 58:
-#line 401 "parser.y" /* yacc.c:1646  */
+#line 402 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_for_statement(ctx, NULL, (yyvsp[-8].expr), (yyvsp[-5].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); }
-#line 2179 "parser.tab.c" /* yacc.c:1646  */
+#line 2227 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 59:
-#line 403 "parser.y" /* yacc.c:1646  */
+#line 404 "parser.y" /* yacc.c:1646  */
     { if(!explicit_error(ctx, (yyvsp[0].variable_list), ';')) YYABORT; }
-#line 2185 "parser.tab.c" /* yacc.c:1646  */
+#line 2233 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 60:
-#line 405 "parser.y" /* yacc.c:1646  */
+#line 406 "parser.y" /* yacc.c:1646  */
     { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; }
-#line 2191 "parser.tab.c" /* yacc.c:1646  */
+#line 2239 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 61:
-#line 407 "parser.y" /* yacc.c:1646  */
+#line 408 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_for_statement(ctx, (yyvsp[-8].variable_list), NULL, (yyvsp[-5].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); }
-#line 2197 "parser.tab.c" /* yacc.c:1646  */
+#line 2245 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 62:
-#line 409 "parser.y" /* yacc.c:1646  */
+#line 410 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_forin_statement(ctx, NULL, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); }
-#line 2203 "parser.tab.c" /* yacc.c:1646  */
+#line 2251 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 63:
-#line 411 "parser.y" /* yacc.c:1646  */
+#line 412 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_forin_statement(ctx, (yyvsp[-4].variable_declaration), NULL, (yyvsp[-2].expr), (yyvsp[0].statement)); }
-#line 2209 "parser.tab.c" /* yacc.c:1646  */
+#line 2257 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 64:
-#line 416 "parser.y" /* yacc.c:1646  */
+#line 417 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_continue_statement(ctx, (yyvsp[-1].identifier)); }
-#line 2215 "parser.tab.c" /* yacc.c:1646  */
+#line 2263 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 65:
-#line 421 "parser.y" /* yacc.c:1646  */
+#line 422 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_break_statement(ctx, (yyvsp[-1].identifier)); }
-#line 2221 "parser.tab.c" /* yacc.c:1646  */
+#line 2269 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 66:
-#line 426 "parser.y" /* yacc.c:1646  */
+#line 427 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_return_statement(ctx, (yyvsp[-1].expr)); }
-#line 2227 "parser.tab.c" /* yacc.c:1646  */
+#line 2275 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 67:
-#line 431 "parser.y" /* yacc.c:1646  */
+#line 432 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_with_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].statement)); }
-#line 2233 "parser.tab.c" /* yacc.c:1646  */
+#line 2281 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 68:
-#line 436 "parser.y" /* yacc.c:1646  */
+#line 437 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_labelled_statement(ctx, (yyvsp[-2].identifier), (yyvsp[0].statement)); }
-#line 2239 "parser.tab.c" /* yacc.c:1646  */
+#line 2287 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 69:
-#line 441 "parser.y" /* yacc.c:1646  */
+#line 442 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_switch_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].case_clausule)); }
-#line 2245 "parser.tab.c" /* yacc.c:1646  */
+#line 2293 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 70:
-#line 446 "parser.y" /* yacc.c:1646  */
+#line 447 "parser.y" /* yacc.c:1646  */
     { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[-1].case_list), NULL, NULL); }
-#line 2251 "parser.tab.c" /* yacc.c:1646  */
+#line 2299 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 71:
-#line 448 "parser.y" /* yacc.c:1646  */
+#line 449 "parser.y" /* yacc.c:1646  */
     { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[-3].case_list), (yyvsp[-2].case_clausule), (yyvsp[-1].case_list)); }
-#line 2257 "parser.tab.c" /* yacc.c:1646  */
+#line 2305 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 72:
-#line 452 "parser.y" /* yacc.c:1646  */
+#line 453 "parser.y" /* yacc.c:1646  */
     { (yyval.case_list) = NULL; }
-#line 2263 "parser.tab.c" /* yacc.c:1646  */
+#line 2311 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 73:
-#line 453 "parser.y" /* yacc.c:1646  */
+#line 454 "parser.y" /* yacc.c:1646  */
     { (yyval.case_list) = (yyvsp[0].case_list); }
-#line 2269 "parser.tab.c" /* yacc.c:1646  */
+#line 2317 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 74:
-#line 457 "parser.y" /* yacc.c:1646  */
+#line 458 "parser.y" /* yacc.c:1646  */
     { (yyval.case_list) = new_case_list(ctx, (yyvsp[0].case_clausule)); }
-#line 2275 "parser.tab.c" /* yacc.c:1646  */
+#line 2323 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 75:
-#line 459 "parser.y" /* yacc.c:1646  */
+#line 460 "parser.y" /* yacc.c:1646  */
     { (yyval.case_list) = case_list_add(ctx, (yyvsp[-1].case_list), (yyvsp[0].case_clausule)); }
-#line 2281 "parser.tab.c" /* yacc.c:1646  */
+#line 2329 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 76:
-#line 464 "parser.y" /* yacc.c:1646  */
+#line 465 "parser.y" /* yacc.c:1646  */
     { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[-2].expr), (yyvsp[0].statement_list)); }
-#line 2287 "parser.tab.c" /* yacc.c:1646  */
+#line 2335 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 77:
-#line 469 "parser.y" /* yacc.c:1646  */
+#line 470 "parser.y" /* yacc.c:1646  */
     { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[0].statement_list)); }
-#line 2293 "parser.tab.c" /* yacc.c:1646  */
+#line 2341 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 78:
-#line 474 "parser.y" /* yacc.c:1646  */
+#line 475 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_throw_statement(ctx, (yyvsp[-1].expr)); }
-#line 2299 "parser.tab.c" /* yacc.c:1646  */
+#line 2347 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 79:
-#line 478 "parser.y" /* yacc.c:1646  */
+#line 479 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_try_statement(ctx, (yyvsp[-1].statement), (yyvsp[0].catch_block), NULL); }
-#line 2305 "parser.tab.c" /* yacc.c:1646  */
+#line 2353 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 80:
-#line 479 "parser.y" /* yacc.c:1646  */
+#line 480 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_try_statement(ctx, (yyvsp[-1].statement), NULL, (yyvsp[0].statement)); }
-#line 2311 "parser.tab.c" /* yacc.c:1646  */
+#line 2359 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 81:
-#line 481 "parser.y" /* yacc.c:1646  */
+#line 482 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = new_try_statement(ctx, (yyvsp[-2].statement), (yyvsp[-1].catch_block), (yyvsp[0].statement)); }
-#line 2317 "parser.tab.c" /* yacc.c:1646  */
+#line 2365 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 82:
-#line 486 "parser.y" /* yacc.c:1646  */
+#line 487 "parser.y" /* yacc.c:1646  */
     { (yyval.catch_block) = new_catch_block(ctx, (yyvsp[-2].identifier), (yyvsp[0].statement)); }
-#line 2323 "parser.tab.c" /* yacc.c:1646  */
+#line 2371 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 83:
-#line 490 "parser.y" /* yacc.c:1646  */
+#line 491 "parser.y" /* yacc.c:1646  */
     { (yyval.statement) = (yyvsp[0].statement); }
-#line 2329 "parser.tab.c" /* yacc.c:1646  */
+#line 2377 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 84:
-#line 494 "parser.y" /* yacc.c:1646  */
+#line 495 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = NULL; }
-#line 2335 "parser.tab.c" /* yacc.c:1646  */
+#line 2383 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 85:
-#line 495 "parser.y" /* yacc.c:1646  */
+#line 496 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2341 "parser.tab.c" /* yacc.c:1646  */
+#line 2389 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 86:
-#line 498 "parser.y" /* yacc.c:1646  */
+#line 499 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2347 "parser.tab.c" /* yacc.c:1646  */
+#line 2395 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 87:
-#line 499 "parser.y" /* yacc.c:1646  */
+#line 500 "parser.y" /* yacc.c:1646  */
     { set_error(ctx, JS_E_SYNTAX); YYABORT; }
-#line 2353 "parser.tab.c" /* yacc.c:1646  */
+#line 2401 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 88:
-#line 503 "parser.y" /* yacc.c:1646  */
+#line 504 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2359 "parser.tab.c" /* yacc.c:1646  */
+#line 2407 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 89:
-#line 505 "parser.y" /* yacc.c:1646  */
+#line 506 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2365 "parser.tab.c" /* yacc.c:1646  */
+#line 2413 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 90:
-#line 509 "parser.y" /* yacc.c:1646  */
+#line 510 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = NULL; }
-#line 2371 "parser.tab.c" /* yacc.c:1646  */
+#line 2419 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 91:
-#line 510 "parser.y" /* yacc.c:1646  */
+#line 511 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2377 "parser.tab.c" /* yacc.c:1646  */
+#line 2425 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 92:
-#line 515 "parser.y" /* yacc.c:1646  */
+#line 516 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2383 "parser.tab.c" /* yacc.c:1646  */
+#line 2431 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 93:
-#line 517 "parser.y" /* yacc.c:1646  */
+#line 518 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2389 "parser.tab.c" /* yacc.c:1646  */
+#line 2437 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 94:
-#line 520 "parser.y" /* yacc.c:1646  */
+#line 521 "parser.y" /* yacc.c:1646  */
     { (yyval.ival) = (yyvsp[0].ival); }
-#line 2395 "parser.tab.c" /* yacc.c:1646  */
+#line 2443 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 95:
-#line 521 "parser.y" /* yacc.c:1646  */
+#line 522 "parser.y" /* yacc.c:1646  */
     { (yyval.ival) = EXPR_ASSIGNDIV; }
-#line 2401 "parser.tab.c" /* yacc.c:1646  */
+#line 2449 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 96:
-#line 525 "parser.y" /* yacc.c:1646  */
+#line 526 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2407 "parser.tab.c" /* yacc.c:1646  */
+#line 2455 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 97:
-#line 527 "parser.y" /* yacc.c:1646  */
+#line 528 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2413 "parser.tab.c" /* yacc.c:1646  */
+#line 2461 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 98:
-#line 529 "parser.y" /* yacc.c:1646  */
+#line 530 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2419 "parser.tab.c" /* yacc.c:1646  */
+#line 2467 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 99:
-#line 534 "parser.y" /* yacc.c:1646  */
+#line 535 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2425 "parser.tab.c" /* yacc.c:1646  */
+#line 2473 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 100:
-#line 536 "parser.y" /* yacc.c:1646  */
+#line 537 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2431 "parser.tab.c" /* yacc.c:1646  */
+#line 2479 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 101:
-#line 538 "parser.y" /* yacc.c:1646  */
+#line 539 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2437 "parser.tab.c" /* yacc.c:1646  */
+#line 2485 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 102:
-#line 542 "parser.y" /* yacc.c:1646  */
+#line 543 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2443 "parser.tab.c" /* yacc.c:1646  */
+#line 2491 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 103:
-#line 544 "parser.y" /* yacc.c:1646  */
+#line 545 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2449 "parser.tab.c" /* yacc.c:1646  */
+#line 2497 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 104:
-#line 549 "parser.y" /* yacc.c:1646  */
+#line 550 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2455 "parser.tab.c" /* yacc.c:1646  */
+#line 2503 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 105:
-#line 551 "parser.y" /* yacc.c:1646  */
+#line 552 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2461 "parser.tab.c" /* yacc.c:1646  */
+#line 2509 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 106:
-#line 555 "parser.y" /* yacc.c:1646  */
+#line 556 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2467 "parser.tab.c" /* yacc.c:1646  */
+#line 2515 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 107:
-#line 557 "parser.y" /* yacc.c:1646  */
+#line 558 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2473 "parser.tab.c" /* yacc.c:1646  */
+#line 2521 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 108:
-#line 562 "parser.y" /* yacc.c:1646  */
+#line 563 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2479 "parser.tab.c" /* yacc.c:1646  */
+#line 2527 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 109:
-#line 564 "parser.y" /* yacc.c:1646  */
+#line 565 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2485 "parser.tab.c" /* yacc.c:1646  */
+#line 2533 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 110:
-#line 568 "parser.y" /* yacc.c:1646  */
+#line 569 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2491 "parser.tab.c" /* yacc.c:1646  */
+#line 2539 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 111:
-#line 570 "parser.y" /* yacc.c:1646  */
+#line 571 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2497 "parser.tab.c" /* yacc.c:1646  */
+#line 2545 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 112:
-#line 575 "parser.y" /* yacc.c:1646  */
+#line 576 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2503 "parser.tab.c" /* yacc.c:1646  */
+#line 2551 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 113:
-#line 577 "parser.y" /* yacc.c:1646  */
+#line 578 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2509 "parser.tab.c" /* yacc.c:1646  */
+#line 2557 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 114:
-#line 581 "parser.y" /* yacc.c:1646  */
+#line 582 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2515 "parser.tab.c" /* yacc.c:1646  */
+#line 2563 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 115:
-#line 583 "parser.y" /* yacc.c:1646  */
+#line 584 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2521 "parser.tab.c" /* yacc.c:1646  */
+#line 2569 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 116:
-#line 588 "parser.y" /* yacc.c:1646  */
+#line 589 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2527 "parser.tab.c" /* yacc.c:1646  */
+#line 2575 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 117:
-#line 590 "parser.y" /* yacc.c:1646  */
+#line 591 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2533 "parser.tab.c" /* yacc.c:1646  */
+#line 2581 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 118:
-#line 594 "parser.y" /* yacc.c:1646  */
+#line 595 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2539 "parser.tab.c" /* yacc.c:1646  */
+#line 2587 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 119:
-#line 596 "parser.y" /* yacc.c:1646  */
+#line 597 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2545 "parser.tab.c" /* yacc.c:1646  */
+#line 2593 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 120:
-#line 601 "parser.y" /* yacc.c:1646  */
+#line 602 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2551 "parser.tab.c" /* yacc.c:1646  */
+#line 2599 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 121:
-#line 603 "parser.y" /* yacc.c:1646  */
+#line 604 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2557 "parser.tab.c" /* yacc.c:1646  */
+#line 2605 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 122:
-#line 607 "parser.y" /* yacc.c:1646  */
+#line 608 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2563 "parser.tab.c" /* yacc.c:1646  */
+#line 2611 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 123:
-#line 609 "parser.y" /* yacc.c:1646  */
+#line 610 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2569 "parser.tab.c" /* yacc.c:1646  */
+#line 2617 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 124:
-#line 614 "parser.y" /* yacc.c:1646  */
+#line 615 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2575 "parser.tab.c" /* yacc.c:1646  */
+#line 2623 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 125:
-#line 616 "parser.y" /* yacc.c:1646  */
+#line 617 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2581 "parser.tab.c" /* yacc.c:1646  */
+#line 2629 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 126:
-#line 620 "parser.y" /* yacc.c:1646  */
+#line 621 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2587 "parser.tab.c" /* yacc.c:1646  */
+#line 2635 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 127:
-#line 622 "parser.y" /* yacc.c:1646  */
+#line 623 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2593 "parser.tab.c" /* yacc.c:1646  */
+#line 2641 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 128:
-#line 626 "parser.y" /* yacc.c:1646  */
+#line 627 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2599 "parser.tab.c" /* yacc.c:1646  */
+#line 2647 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 129:
-#line 628 "parser.y" /* yacc.c:1646  */
+#line 629 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2605 "parser.tab.c" /* yacc.c:1646  */
+#line 2653 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 130:
-#line 632 "parser.y" /* yacc.c:1646  */
+#line 633 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2611 "parser.tab.c" /* yacc.c:1646  */
+#line 2659 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 131:
-#line 634 "parser.y" /* yacc.c:1646  */
+#line 635 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2617 "parser.tab.c" /* yacc.c:1646  */
+#line 2665 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 132:
-#line 636 "parser.y" /* yacc.c:1646  */
+#line 637 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2623 "parser.tab.c" /* yacc.c:1646  */
+#line 2671 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 133:
-#line 638 "parser.y" /* yacc.c:1646  */
+#line 639 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_IN, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2629 "parser.tab.c" /* yacc.c:1646  */
+#line 2677 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 134:
-#line 642 "parser.y" /* yacc.c:1646  */
+#line 643 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2635 "parser.tab.c" /* yacc.c:1646  */
+#line 2683 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 135:
-#line 644 "parser.y" /* yacc.c:1646  */
+#line 645 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2641 "parser.tab.c" /* yacc.c:1646  */
+#line 2689 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 136:
-#line 646 "parser.y" /* yacc.c:1646  */
+#line 647 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2647 "parser.tab.c" /* yacc.c:1646  */
+#line 2695 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 137:
-#line 650 "parser.y" /* yacc.c:1646  */
+#line 651 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2653 "parser.tab.c" /* yacc.c:1646  */
+#line 2701 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 138:
-#line 652 "parser.y" /* yacc.c:1646  */
+#line 653 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2659 "parser.tab.c" /* yacc.c:1646  */
+#line 2707 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 139:
-#line 657 "parser.y" /* yacc.c:1646  */
+#line 658 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2665 "parser.tab.c" /* yacc.c:1646  */
+#line 2713 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 140:
-#line 659 "parser.y" /* yacc.c:1646  */
+#line 660 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2671 "parser.tab.c" /* yacc.c:1646  */
+#line 2719 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 141:
-#line 661 "parser.y" /* yacc.c:1646  */
+#line 662 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2677 "parser.tab.c" /* yacc.c:1646  */
+#line 2725 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 142:
-#line 665 "parser.y" /* yacc.c:1646  */
+#line 666 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2683 "parser.tab.c" /* yacc.c:1646  */
+#line 2731 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 143:
-#line 667 "parser.y" /* yacc.c:1646  */
+#line 668 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2689 "parser.tab.c" /* yacc.c:1646  */
+#line 2737 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 144:
-#line 669 "parser.y" /* yacc.c:1646  */
+#line 670 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2695 "parser.tab.c" /* yacc.c:1646  */
+#line 2743 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 145:
-#line 671 "parser.y" /* yacc.c:1646  */
+#line 672 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[-2].expr), (yyvsp[0].expr)); }
-#line 2701 "parser.tab.c" /* yacc.c:1646  */
+#line 2749 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 146:
-#line 675 "parser.y" /* yacc.c:1646  */
+#line 676 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2707 "parser.tab.c" /* yacc.c:1646  */
+#line 2755 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 147:
-#line 677 "parser.y" /* yacc.c:1646  */
+#line 678 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_DELETE, (yyvsp[0].expr)); }
-#line 2713 "parser.tab.c" /* yacc.c:1646  */
+#line 2761 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 148:
-#line 678 "parser.y" /* yacc.c:1646  */
+#line 679 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_VOID, (yyvsp[0].expr)); }
-#line 2719 "parser.tab.c" /* yacc.c:1646  */
+#line 2767 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 149:
-#line 680 "parser.y" /* yacc.c:1646  */
+#line 681 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_TYPEOF, (yyvsp[0].expr)); }
-#line 2725 "parser.tab.c" /* yacc.c:1646  */
+#line 2773 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 150:
-#line 681 "parser.y" /* yacc.c:1646  */
+#line 682 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_PREINC, (yyvsp[0].expr)); }
-#line 2731 "parser.tab.c" /* yacc.c:1646  */
+#line 2779 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 151:
-#line 682 "parser.y" /* yacc.c:1646  */
+#line 683 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_PREDEC, (yyvsp[0].expr)); }
-#line 2737 "parser.tab.c" /* yacc.c:1646  */
+#line 2785 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 152:
-#line 683 "parser.y" /* yacc.c:1646  */
+#line 684 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_PLUS, (yyvsp[0].expr)); }
-#line 2743 "parser.tab.c" /* yacc.c:1646  */
+#line 2791 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 153:
-#line 684 "parser.y" /* yacc.c:1646  */
+#line 685 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_MINUS, (yyvsp[0].expr)); }
-#line 2749 "parser.tab.c" /* yacc.c:1646  */
+#line 2797 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 154:
-#line 685 "parser.y" /* yacc.c:1646  */
+#line 686 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_BITNEG, (yyvsp[0].expr)); }
-#line 2755 "parser.tab.c" /* yacc.c:1646  */
+#line 2803 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 155:
-#line 686 "parser.y" /* yacc.c:1646  */
+#line 687 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_LOGNEG, (yyvsp[0].expr)); }
-#line 2761 "parser.tab.c" /* yacc.c:1646  */
+#line 2809 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 156:
-#line 691 "parser.y" /* yacc.c:1646  */
+#line 692 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2767 "parser.tab.c" /* yacc.c:1646  */
+#line 2815 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 157:
-#line 693 "parser.y" /* yacc.c:1646  */
+#line 694 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTINC, (yyvsp[-1].expr)); }
-#line 2773 "parser.tab.c" /* yacc.c:1646  */
+#line 2821 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 158:
-#line 695 "parser.y" /* yacc.c:1646  */
+#line 696 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTDEC, (yyvsp[-1].expr)); }
-#line 2779 "parser.tab.c" /* yacc.c:1646  */
+#line 2827 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 159:
-#line 700 "parser.y" /* yacc.c:1646  */
+#line 701 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2785 "parser.tab.c" /* yacc.c:1646  */
+#line 2833 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 160:
-#line 701 "parser.y" /* yacc.c:1646  */
+#line 702 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2791 "parser.tab.c" /* yacc.c:1646  */
+#line 2839 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 161:
-#line 705 "parser.y" /* yacc.c:1646  */
+#line 706 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2797 "parser.tab.c" /* yacc.c:1646  */
+#line 2845 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 162:
-#line 706 "parser.y" /* yacc.c:1646  */
+#line 707 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_new_expression(ctx, (yyvsp[0].expr), NULL); }
-#line 2803 "parser.tab.c" /* yacc.c:1646  */
+#line 2851 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 163:
-#line 710 "parser.y" /* yacc.c:1646  */
+#line 711 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2809 "parser.tab.c" /* yacc.c:1646  */
+#line 2857 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 164:
-#line 711 "parser.y" /* yacc.c:1646  */
+#line 712 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2815 "parser.tab.c" /* yacc.c:1646  */
+#line 2863 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 165:
-#line 713 "parser.y" /* yacc.c:1646  */
+#line 714 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_ARRAY, (yyvsp[-3].expr), (yyvsp[-1].expr)); }
-#line 2821 "parser.tab.c" /* yacc.c:1646  */
+#line 2869 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 166:
-#line 715 "parser.y" /* yacc.c:1646  */
+#line 716 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_member_expression(ctx, (yyvsp[-2].expr), (yyvsp[0].identifier)); }
-#line 2827 "parser.tab.c" /* yacc.c:1646  */
+#line 2875 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 167:
-#line 717 "parser.y" /* yacc.c:1646  */
+#line 718 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_new_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); }
-#line 2833 "parser.tab.c" /* yacc.c:1646  */
+#line 2881 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 168:
-#line 722 "parser.y" /* yacc.c:1646  */
+#line 723 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_call_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); }
-#line 2839 "parser.tab.c" /* yacc.c:1646  */
+#line 2887 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 169:
-#line 724 "parser.y" /* yacc.c:1646  */
+#line 725 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_call_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); }
-#line 2845 "parser.tab.c" /* yacc.c:1646  */
+#line 2893 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 170:
-#line 726 "parser.y" /* yacc.c:1646  */
+#line 727 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_binary_expression(ctx, EXPR_ARRAY, (yyvsp[-3].expr), (yyvsp[-1].expr)); }
-#line 2851 "parser.tab.c" /* yacc.c:1646  */
+#line 2899 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 171:
-#line 728 "parser.y" /* yacc.c:1646  */
+#line 729 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_member_expression(ctx, (yyvsp[-2].expr), (yyvsp[0].identifier)); }
-#line 2857 "parser.tab.c" /* yacc.c:1646  */
+#line 2905 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 172:
-#line 732 "parser.y" /* yacc.c:1646  */
+#line 733 "parser.y" /* yacc.c:1646  */
     { (yyval.argument_list) = NULL; }
-#line 2863 "parser.tab.c" /* yacc.c:1646  */
+#line 2911 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 173:
-#line 733 "parser.y" /* yacc.c:1646  */
+#line 734 "parser.y" /* yacc.c:1646  */
     { (yyval.argument_list) = (yyvsp[-1].argument_list); }
-#line 2869 "parser.tab.c" /* yacc.c:1646  */
+#line 2917 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 174:
-#line 737 "parser.y" /* yacc.c:1646  */
+#line 738 "parser.y" /* yacc.c:1646  */
     { (yyval.argument_list) = new_argument_list(ctx, (yyvsp[0].expr)); }
-#line 2875 "parser.tab.c" /* yacc.c:1646  */
+#line 2923 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 175:
-#line 739 "parser.y" /* yacc.c:1646  */
+#line 740 "parser.y" /* yacc.c:1646  */
     { (yyval.argument_list) = argument_list_add(ctx, (yyvsp[-2].argument_list), (yyvsp[0].expr)); }
-#line 2881 "parser.tab.c" /* yacc.c:1646  */
+#line 2929 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 176:
-#line 743 "parser.y" /* yacc.c:1646  */
+#line 744 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_expression(ctx, EXPR_THIS, 0); }
-#line 2887 "parser.tab.c" /* yacc.c:1646  */
+#line 2935 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 177:
-#line 744 "parser.y" /* yacc.c:1646  */
+#line 745 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_identifier_expression(ctx, (yyvsp[0].identifier)); }
-#line 2893 "parser.tab.c" /* yacc.c:1646  */
+#line 2941 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 178:
-#line 745 "parser.y" /* yacc.c:1646  */
+#line 746 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_literal_expression(ctx, (yyvsp[0].literal)); }
-#line 2899 "parser.tab.c" /* yacc.c:1646  */
+#line 2947 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 179:
-#line 746 "parser.y" /* yacc.c:1646  */
+#line 747 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2905 "parser.tab.c" /* yacc.c:1646  */
+#line 2953 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 180:
-#line 747 "parser.y" /* yacc.c:1646  */
+#line 748 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[0].expr); }
-#line 2911 "parser.tab.c" /* yacc.c:1646  */
+#line 2959 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 181:
-#line 748 "parser.y" /* yacc.c:1646  */
+#line 749 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = (yyvsp[-1].expr); }
-#line 2917 "parser.tab.c" /* yacc.c:1646  */
+#line 2965 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 182:
-#line 752 "parser.y" /* yacc.c:1646  */
+#line 753 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_array_literal_expression(ctx, NULL, 0); }
-#line 2923 "parser.tab.c" /* yacc.c:1646  */
+#line 2971 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 183:
-#line 753 "parser.y" /* yacc.c:1646  */
+#line 754 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_array_literal_expression(ctx, NULL, (yyvsp[-1].ival)+1); }
-#line 2929 "parser.tab.c" /* yacc.c:1646  */
+#line 2977 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 184:
-#line 754 "parser.y" /* yacc.c:1646  */
+#line 755 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[-1].element_list), 0); }
-#line 2935 "parser.tab.c" /* yacc.c:1646  */
+#line 2983 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 185:
-#line 756 "parser.y" /* yacc.c:1646  */
+#line 757 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[-3].element_list), (yyvsp[-1].ival)+1); }
-#line 2941 "parser.tab.c" /* yacc.c:1646  */
+#line 2989 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 186:
-#line 761 "parser.y" /* yacc.c:1646  */
+#line 762 "parser.y" /* yacc.c:1646  */
     { (yyval.element_list) = new_element_list(ctx, (yyvsp[-1].ival), (yyvsp[0].expr)); }
-#line 2947 "parser.tab.c" /* yacc.c:1646  */
+#line 2995 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 187:
-#line 763 "parser.y" /* yacc.c:1646  */
+#line 764 "parser.y" /* yacc.c:1646  */
     { (yyval.element_list) = element_list_add(ctx, (yyvsp[-3].element_list), (yyvsp[-1].ival), (yyvsp[0].expr)); }
-#line 2953 "parser.tab.c" /* yacc.c:1646  */
+#line 3001 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 188:
-#line 767 "parser.y" /* yacc.c:1646  */
+#line 768 "parser.y" /* yacc.c:1646  */
     { (yyval.ival) = 1; }
-#line 2959 "parser.tab.c" /* yacc.c:1646  */
+#line 3007 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 189:
-#line 768 "parser.y" /* yacc.c:1646  */
+#line 769 "parser.y" /* yacc.c:1646  */
     { (yyval.ival) = (yyvsp[-1].ival) + 1; }
-#line 2965 "parser.tab.c" /* yacc.c:1646  */
+#line 3013 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 190:
-#line 772 "parser.y" /* yacc.c:1646  */
+#line 773 "parser.y" /* yacc.c:1646  */
     { (yyval.ival) = 0; }
-#line 2971 "parser.tab.c" /* yacc.c:1646  */
+#line 3019 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 191:
-#line 773 "parser.y" /* yacc.c:1646  */
+#line 774 "parser.y" /* yacc.c:1646  */
     { (yyval.ival) = (yyvsp[0].ival); }
-#line 2977 "parser.tab.c" /* yacc.c:1646  */
+#line 3025 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 192:
-#line 777 "parser.y" /* yacc.c:1646  */
+#line 778 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_prop_and_value_expression(ctx, NULL); }
-#line 2983 "parser.tab.c" /* yacc.c:1646  */
+#line 3031 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 193:
-#line 779 "parser.y" /* yacc.c:1646  */
+#line 780 "parser.y" /* yacc.c:1646  */
     { (yyval.expr) = new_prop_and_value_expression(ctx, (yyvsp[-1].property_list)); }
-#line 2989 "parser.tab.c" /* yacc.c:1646  */
+#line 3037 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 194:
-#line 784 "parser.y" /* yacc.c:1646  */
+#line 785 "parser.y" /* yacc.c:1646  */
     { (yyval.property_list) = new_property_list(ctx, (yyvsp[-2].literal), (yyvsp[0].expr)); }
-#line 2995 "parser.tab.c" /* yacc.c:1646  */
+#line 3043 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 195:
-#line 786 "parser.y" /* yacc.c:1646  */
+#line 787 "parser.y" /* yacc.c:1646  */
     { (yyval.property_list) = property_list_add(ctx, (yyvsp[-4].property_list), (yyvsp[-2].literal), (yyvsp[0].expr)); }
-#line 3001 "parser.tab.c" /* yacc.c:1646  */
+#line 3049 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 196:
-#line 790 "parser.y" /* yacc.c:1646  */
+#line 791 "parser.y" /* yacc.c:1646  */
     { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].identifier)); }
-#line 3007 "parser.tab.c" /* yacc.c:1646  */
+#line 3055 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 197:
-#line 791 "parser.y" /* yacc.c:1646  */
+#line 792 "parser.y" /* yacc.c:1646  */
     { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].wstr)); }
-#line 3013 "parser.tab.c" /* yacc.c:1646  */
+#line 3061 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 198:
-#line 792 "parser.y" /* yacc.c:1646  */
+#line 793 "parser.y" /* yacc.c:1646  */
     { (yyval.literal) = (yyvsp[0].literal); }
-#line 3019 "parser.tab.c" /* yacc.c:1646  */
+#line 3067 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 199:
-#line 796 "parser.y" /* yacc.c:1646  */
+#line 797 "parser.y" /* yacc.c:1646  */
     { (yyval.identifier) = NULL; }
-#line 3025 "parser.tab.c" /* yacc.c:1646  */
+#line 3073 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 200:
-#line 797 "parser.y" /* yacc.c:1646  */
+#line 798 "parser.y" /* yacc.c:1646  */
     { (yyval.identifier) = (yyvsp[0].identifier); }
-#line 3031 "parser.tab.c" /* yacc.c:1646  */
+#line 3079 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 201:
-#line 801 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = new_null_literal(ctx); }
-#line 3037 "parser.tab.c" /* yacc.c:1646  */
+#line 802 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3085 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 202:
-#line 802 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = (yyvsp[0].literal); }
-#line 3043 "parser.tab.c" /* yacc.c:1646  */
+#line 804 "parser.y" /* yacc.c:1646  */
+    {
+            if(ctx->script->version < SCRIPTLANGUAGEVERSION_ES5) {
+                WARN("%s keyword used as an identifier in legacy mode.\n",
+                     debugstr_w((yyvsp[0].identifier)));
+                YYABORT;
+            }
+            (yyval.identifier) = (yyvsp[0].identifier);
+        }
+#line 3098 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 203:
-#line 803 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = (yyvsp[0].literal); }
-#line 3049 "parser.tab.c" /* yacc.c:1646  */
+#line 814 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3104 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 204:
-#line 804 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].wstr)); }
-#line 3055 "parser.tab.c" /* yacc.c:1646  */
+#line 815 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3110 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 205:
-#line 805 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = parse_regexp(ctx);
-                                  if(!(yyval.literal)) YYABORT; }
-#line 3062 "parser.tab.c" /* yacc.c:1646  */
+#line 816 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3116 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 206:
-#line 807 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = parse_regexp(ctx);
-                                  if(!(yyval.literal)) YYABORT; }
-#line 3069 "parser.tab.c" /* yacc.c:1646  */
+#line 817 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3122 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 207:
-#line 812 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = new_boolean_literal(ctx, VARIANT_TRUE); }
-#line 3075 "parser.tab.c" /* yacc.c:1646  */
+#line 818 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3128 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 208:
-#line 813 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = new_boolean_literal(ctx, VARIANT_FALSE); }
-#line 3081 "parser.tab.c" /* yacc.c:1646  */
+#line 819 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3134 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 209:
-#line 814 "parser.y" /* yacc.c:1646  */
-    { (yyval.literal) = (yyvsp[0].literal); }
-#line 3087 "parser.tab.c" /* yacc.c:1646  */
+#line 820 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3140 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 210:
+#line 821 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3146 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 211:
-#line 818 "parser.y" /* yacc.c:1646  */
-    { if(!allow_auto_semicolon(ctx)) {YYABORT;} }
-#line 3093 "parser.tab.c" /* yacc.c:1646  */
+#line 822 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3152 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 212:
+#line 823 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3158 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 213:
-#line 822 "parser.y" /* yacc.c:1646  */
-    { set_error(ctx, JS_E_MISSING_LBRACKET); YYABORT; }
-#line 3099 "parser.tab.c" /* yacc.c:1646  */
+#line 824 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3164 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 214:
+#line 825 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3170 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 215:
 #line 826 "parser.y" /* yacc.c:1646  */
-    { set_error(ctx, JS_E_MISSING_RBRACKET); YYABORT; }
-#line 3105 "parser.tab.c" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3176 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 216:
+#line 827 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3182 "parser.tab.c" /* yacc.c:1646  */
     break;
 
   case 217:
+#line 828 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3188 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 218:
+#line 829 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3194 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 219:
 #line 830 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3200 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 220:
+#line 831 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3206 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 221:
+#line 832 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3212 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 222:
+#line 833 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3218 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 223:
+#line 834 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3224 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 224:
+#line 835 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3230 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 225:
+#line 836 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3236 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 226:
+#line 837 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3242 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 227:
+#line 838 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3248 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 228:
+#line 839 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3254 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 229:
+#line 840 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3260 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 230:
+#line 841 "parser.y" /* yacc.c:1646  */
+    { (yyval.identifier) = (yyvsp[0].identifier); }
+#line 3266 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 231:
+#line 845 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = new_null_literal(ctx); }
+#line 3272 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 232:
+#line 846 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = (yyvsp[0].literal); }
+#line 3278 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 233:
+#line 847 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = (yyvsp[0].literal); }
+#line 3284 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 234:
+#line 848 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].wstr)); }
+#line 3290 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 235:
+#line 849 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = parse_regexp(ctx);
+                                  if(!(yyval.literal)) YYABORT; }
+#line 3297 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 236:
+#line 851 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = parse_regexp(ctx);
+                                  if(!(yyval.literal)) YYABORT; }
+#line 3304 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 237:
+#line 856 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = new_boolean_literal(ctx, VARIANT_TRUE); }
+#line 3310 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 238:
+#line 857 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = new_boolean_literal(ctx, VARIANT_FALSE); }
+#line 3316 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 239:
+#line 858 "parser.y" /* yacc.c:1646  */
+    { (yyval.literal) = (yyvsp[0].literal); }
+#line 3322 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 241:
+#line 862 "parser.y" /* yacc.c:1646  */
+    { if(!allow_auto_semicolon(ctx)) {YYABORT;} }
+#line 3328 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 243:
+#line 866 "parser.y" /* yacc.c:1646  */
+    { set_error(ctx, JS_E_MISSING_LBRACKET); YYABORT; }
+#line 3334 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 245:
+#line 870 "parser.y" /* yacc.c:1646  */
+    { set_error(ctx, JS_E_MISSING_RBRACKET); YYABORT; }
+#line 3340 "parser.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 247:
+#line 874 "parser.y" /* yacc.c:1646  */
     { set_error(ctx, JS_E_MISSING_SEMICOLON); YYABORT; }
-#line 3111 "parser.tab.c" /* yacc.c:1646  */
+#line 3346 "parser.tab.c" /* yacc.c:1646  */
     break;
 
 
-#line 3115 "parser.tab.c" /* yacc.c:1646  */
+#line 3350 "parser.tab.c" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -3333,7 +3574,7 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 832 "parser.y" /* yacc.c:1906  */
+#line 876 "parser.y" /* yacc.c:1906  */
 
 
 static BOOL allow_auto_semicolon(parser_ctx_t *ctx)
index 0233eaf..181c030 100644 (file)
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.0.2.  */
+/* A Bison parser, made by GNU Bison 3.0.  */
 
 /* Bison interface for Yacc-like parsers in C
 
@@ -30,8 +30,8 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
-#ifndef YY_PARSER_PARSER_TAB_H_INCLUDED
-# define YY_PARSER_PARSER_TAB_H_INCLUDED
+#ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED
+# define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED
 /* Debug traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
@@ -53,33 +53,33 @@ extern int parser_debug;
     kDELETE = 263,
     kDO = 264,
     kELSE = 265,
-    kIF = 266,
-    kFINALLY = 267,
-    kFOR = 268,
-    kIN = 269,
-    kINSTANCEOF = 270,
-    kNEW = 271,
-    kNULL = 272,
-    kRETURN = 273,
-    kSWITCH = 274,
-    kTHIS = 275,
-    kTHROW = 276,
-    kTRUE = 277,
-    kFALSE = 278,
-    kTRY = 279,
-    kTYPEOF = 280,
-    kVAR = 281,
-    kVOID = 282,
-    kWHILE = 283,
-    kWITH = 284,
-    tANDAND = 285,
-    tOROR = 286,
-    tINC = 287,
-    tDEC = 288,
-    tHTMLCOMMENT = 289,
-    kDIVEQ = 290,
-    kDCOL = 291,
-    kFUNCTION = 292,
+    kFUNCTION = 266,
+    kIF = 267,
+    kFINALLY = 268,
+    kFOR = 269,
+    kIN = 270,
+    kINSTANCEOF = 271,
+    kNEW = 272,
+    kNULL = 273,
+    kRETURN = 274,
+    kSWITCH = 275,
+    kTHIS = 276,
+    kTHROW = 277,
+    kTRUE = 278,
+    kFALSE = 279,
+    kTRY = 280,
+    kTYPEOF = 281,
+    kVAR = 282,
+    kVOID = 283,
+    kWHILE = 284,
+    kWITH = 285,
+    tANDAND = 286,
+    tOROR = 287,
+    tINC = 288,
+    tDEC = 289,
+    tHTMLCOMMENT = 290,
+    kDIVEQ = 291,
+    kDCOL = 292,
     tIdentifier = 293,
     tAssignOper = 294,
     tEqOper = 295,
@@ -129,4 +129,4 @@ union YYSTYPE
 
 int parser_parse (parser_ctx_t *ctx);
 
-#endif /* !YY_PARSER_PARSER_TAB_H_INCLUDED  */
+#endif /* !YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED  */
index b97e7fd..a40b813 100644 (file)
 %{
 
 #include "jscript.h"
+#include "engine.h"
+#include "parser.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 static int parser_error(parser_ctx_t*,const char*);
 static void set_error(parser_ctx_t*,UINT);
@@ -158,11 +164,11 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
 }
 
 /* keywords */
-%token kBREAK kCASE kCATCH kCONTINUE kDEFAULT kDELETE kDO kELSE kIF kFINALLY kFOR kIN
-%token kINSTANCEOF kNEW kNULL kRETURN kSWITCH kTHIS kTHROW kTRUE kFALSE kTRY kTYPEOF kVAR kVOID kWHILE kWITH
+%token <identifier> kBREAK kCASE kCATCH kCONTINUE kDEFAULT kDELETE kDO kELSE kFUNCTION kIF kFINALLY kFOR kIN
+%token <identifier> kINSTANCEOF kNEW kNULL kRETURN kSWITCH kTHIS kTHROW kTRUE kFALSE kTRY kTYPEOF kVAR kVOID kWHILE kWITH
 %token tANDAND tOROR tINC tDEC tHTMLCOMMENT kDIVEQ kDCOL
 
-%token <srcptr> kFUNCTION '}'
+%token <srcptr> '}'
 
 /* tokens */
 %token <identifier> tIdentifier
@@ -235,6 +241,7 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
 %type <literal> BooleanLiteral
 %type <srcptr> KFunction
 %type <ival> AssignOper
+%type <identifier> IdentifierName ReservedAsIdentifier
 
 %nonassoc LOWER_THAN_ELSE
 %nonassoc kELSE
@@ -266,7 +273,7 @@ FunctionExpression
                                 { $$ = new_function_expression(ctx, $4, $6, $9, $2, $1, $10-$1+1); }
 
 KFunction
-        : kFUNCTION             { $$ = $1; }
+        : kFUNCTION             { $$ = ctx->ptr - 8; }
 
 /* ECMA-262 3rd Edition    13 */
 FunctionBody
@@ -705,7 +712,7 @@ MemberExpression
         | FunctionExpression    { $$ = $1; }
         | MemberExpression '[' Expression ']'
                                 { $$ = new_binary_expression(ctx, EXPR_ARRAY, $1, $3); }
-        | MemberExpression '.' tIdentifier
+        | MemberExpression '.' IdentifierName
                                 { $$ = new_member_expression(ctx, $1, $3); }
         | kNEW MemberExpression Arguments
                                 { $$ = new_new_expression(ctx, $2, $3); }
@@ -718,7 +725,7 @@ CallExpression
                                 { $$ = new_call_expression(ctx, $1, $2); }
         | CallExpression '[' Expression ']'
                                 { $$ = new_binary_expression(ctx, EXPR_ARRAY, $1, $3); }
-        | CallExpression '.' tIdentifier
+        | CallExpression '.' IdentifierName
                                 { $$ = new_member_expression(ctx, $1, $3); }
 
 /* ECMA-262 3rd Edition    11.2 */
@@ -781,7 +788,7 @@ PropertyNameAndValueList
 
 /* ECMA-262 3rd Edition    11.1.5 */
 PropertyName
-        : tIdentifier           { $$ = new_string_literal(ctx, $1); }
+        : IdentifierName        { $$ = new_string_literal(ctx, $1); }
         | tStringLiteral        { $$ = new_string_literal(ctx, $1); }
         | tNumericLiteral       { $$ = $1; }
 
@@ -790,6 +797,49 @@ Identifier_opt
         : /* empty*/            { $$ = NULL; }
         | tIdentifier           { $$ = $1; }
 
+/* ECMA-262 5.1 Edition    7.6 */
+IdentifierName
+        : tIdentifier           { $$ = $1; }
+        | ReservedAsIdentifier
+        {
+            if(ctx->script->version < SCRIPTLANGUAGEVERSION_ES5) {
+                WARN("%s keyword used as an identifier in legacy mode.\n",
+                     debugstr_w($1));
+                YYABORT;
+            }
+            $$ = $1;
+        }
+
+ReservedAsIdentifier
+        : kBREAK                { $$ = $1; }
+        | kCASE                 { $$ = $1; }
+        | kCATCH                { $$ = $1; }
+        | kCONTINUE             { $$ = $1; }
+        | kDEFAULT              { $$ = $1; }
+        | kDELETE               { $$ = $1; }
+        | kDO                   { $$ = $1; }
+        | kELSE                 { $$ = $1; }
+        | kFALSE                { $$ = $1; }
+        | kFINALLY              { $$ = $1; }
+        | kFOR                  { $$ = $1; }
+        | kFUNCTION             { $$ = $1; }
+        | kIF                   { $$ = $1; }
+        | kIN                   { $$ = $1; }
+        | kINSTANCEOF           { $$ = $1; }
+        | kNEW                  { $$ = $1; }
+        | kNULL                 { $$ = $1; }
+        | kRETURN               { $$ = $1; }
+        | kSWITCH               { $$ = $1; }
+        | kTHIS                 { $$ = $1; }
+        | kTHROW                { $$ = $1; }
+        | kTRUE                 { $$ = $1; }
+        | kTRY                  { $$ = $1; }
+        | kTYPEOF               { $$ = $1; }
+        | kVAR                  { $$ = $1; }
+        | kVOID                 { $$ = $1; }
+        | kWHILE                { $$ = $1; }
+        | kWITH                 { $$ = $1; }
+
 /* ECMA-262 3rd Edition    7.8 */
 Literal
         : kNULL                 { $$ = new_null_literal(ctx); }
diff --git a/dll/win32/jscript/precomp.h b/dll/win32/jscript/precomp.h
new file mode 100644 (file)
index 0000000..abd64f1
--- /dev/null
@@ -0,0 +1,24 @@
+
+#ifndef _JSCRIPT_PRECOMP_H
+#define _JSCRIPT_PRECOMP_H
+
+#include <wine/config.h>
+#include <wine/port.h>
+
+#include <assert.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#include "jscript.h"
+
+#include <objsafe.h>
+
+#include <wine/debug.h>
+
+#include "engine.h"
+#include "parser.h"
+#include "regexp.h"
+
+#endif /* !_JSCRIPT_PRECOMP_H */
index 6152ea0..cca7cc5 100644 (file)
  * the Initial Developer. All Rights Reserved.
  */
 
+#include <assert.h>
+
 #include "jscript.h"
+#include "regexp.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 /* FIXME: Better error handling */
 #define ReportRegExpError(a,b,c)
index f5184bd..de5d405 100644 (file)
@@ -18,6 +18,8 @@
 
 #pragma once
 
+#include <windef.h>
+
 #define JSCRIPT_MAJOR_VERSION 5
 #define JSCRIPT_MINOR_VERSION 8
 #define JSCRIPT_BUILD_VERSION 16475
@@ -56,6 +58,7 @@
 #define IDS_INVALID_DELETE                  0x1394
 #define IDS_NOT_VBARRAY                     0x1395
 #define IDS_JSCRIPT_EXPECTED                0x1396
+#define IDS_NOT_ENUMERATOR                  0x1397
 #define IDS_REGEXP_SYNTAX_ERROR             0x1399
 #define IDS_URI_INVALID_CHAR                0x13A0
 #define IDS_URI_INVALID_CODING              0x13A1
@@ -63,3 +66,9 @@
 #define IDS_PRECISION_OUT_OF_RANGE          0x13A3
 #define IDS_INVALID_LENGTH                  0x13A5
 #define IDS_ARRAY_EXPECTED                  0x13A7
+#define IDS_INVALID_WRITABLE_PROP_DESC      0x13AC
+#define IDS_NONCONFIGURABLE_REDEFINED       0x13D6
+#define IDS_NONWRITABLE_MODIFIED            0x13D7
+/* FIXME: This is not compatible with native, but we would
+ * conflict with IDS_UNSUPPORTED_ACTION otherwise */
+#define IDS_PROP_DESC_MISMATCH              0x1F00
index ea0bdb9..f843d1e 100644 (file)
@@ -16,8 +16,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include <windef.h>
-
 #include "resource.h"
 
 /* @makedep: jscript.rgs */
index 5d636e6..e6e4997 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "jscript.h"
+#include "regexp.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
 
 typedef struct {
     jsdisp_t dispex;
@@ -55,6 +63,7 @@ static const WCHAR toLowerCaseW[] = {'t','o','L','o','w','e','r','C','a','s','e'
 static const WCHAR toUpperCaseW[] = {'t','o','U','p','p','e','r','C','a','s','e',0};
 static const WCHAR toLocaleLowerCaseW[] = {'t','o','L','o','c','a','l','e','L','o','w','e','r','C','a','s','e',0};
 static const WCHAR toLocaleUpperCaseW[] = {'t','o','L','o','c','a','l','e','U','p','p','e','r','C','a','s','e',0};
+static const WCHAR trimW[] = {'t','r','i','m',0};
 static const WCHAR localeCompareW[] = {'l','o','c','a','l','e','C','o','m','p','a','r','e',0};
 static const WCHAR fromCharCodeW[] = {'f','r','o','m','C','h','a','r','C','o','d','e',0};
 
@@ -111,12 +120,6 @@ static HRESULT String_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r
     return S_OK;
 }
 
-static HRESULT String_set_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
-{
-    FIXME("%p\n", jsthis);
-    return E_NOTIMPL;
-}
-
 static HRESULT stringobj_to_string(vdisp_t *jsthis, jsval_t *r)
 {
     StringInstance *string;
@@ -1463,6 +1466,41 @@ static HRESULT String_toLocaleUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD
     return E_NOTIMPL;
 }
 
+static HRESULT String_trim(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc,
+        jsval_t *argv, jsval_t *r)
+{
+    const WCHAR *str, *begin, *end;
+    jsstr_t *jsstr;
+    unsigned len;
+    HRESULT hres;
+
+    hres = to_flat_string(ctx, jsval_disp(jsthis->u.disp), &jsstr, &str);
+    if(FAILED(hres)) {
+        WARN("to_flat_string failed: %08x\n", hres);
+        return hres;
+    }
+    len = jsstr_length(jsstr);
+    TRACE("%s\n", debugstr_wn(str, len));
+
+    for(begin = str, end = str + len; begin < end && isspaceW(*begin); begin++);
+    while(end > begin + 1 && isspaceW(*(end-1))) end--;
+
+    if(r) {
+        jsstr_t *ret;
+
+        if(begin == str && end == str + len)
+            ret = jsstr_addref(jsstr);
+        else
+            ret = jsstr_alloc_len(begin, end - begin);
+        if(ret)
+            *r = jsval_string(ret);
+        else
+            hres = E_OUTOFMEMORY;
+    }
+    jsstr_release(jsstr);
+    return hres;
+}
+
 static HRESULT String_localeCompare(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
@@ -1531,7 +1569,7 @@ static const builtin_prop_t String_props[] = {
     {indexOfW,               String_indexOf,               PROPF_METHOD|2},
     {italicsW,               String_italics,               PROPF_METHOD},
     {lastIndexOfW,           String_lastIndexOf,           PROPF_METHOD|2},
-    {lengthW,                NULL,0,                       String_get_length, String_set_length},
+    {lengthW,                NULL,0,                       String_get_length},
     {linkW,                  String_link,                  PROPF_METHOD|1},
     {localeCompareW,         String_localeCompare,         PROPF_METHOD|1},
     {matchW,                 String_match,                 PROPF_METHOD|1},
@@ -1550,6 +1588,7 @@ static const builtin_prop_t String_props[] = {
     {toLowerCaseW,           String_toLowerCase,           PROPF_METHOD},
     {toStringW,              String_toString,              PROPF_METHOD},
     {toUpperCaseW,           String_toUpperCase,           PROPF_METHOD},
+    {trimW,                  String_trim,                  PROPF_ES5|PROPF_METHOD},
     {valueOfW,               String_valueOf,               PROPF_METHOD}
 };
 
@@ -1563,7 +1602,7 @@ static const builtin_info_t String_info = {
 };
 
 static const builtin_prop_t StringInst_props[] = {
-    {lengthW,                NULL,0,                       String_get_length, String_set_length}
+    {lengthW,                NULL,0,                       String_get_length}
 };
 
 static const builtin_info_t StringInst_info = {
index 3f38b58..2312228 100644 (file)
 
 #include "jscript.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
 typedef struct {
     jsdisp_t dispex;
 
index 7f2e9e6..d1eb9ce 100644 (file)
@@ -85,7 +85,7 @@ reactos/dll/win32/inseng              # Synced to Wine-3.0
 reactos/dll/win32/iphlpapi            # Out of sync
 reactos/dll/win32/itircl              # Synced to WineStaging-2.9
 reactos/dll/win32/itss                # Synced to Wine-3.0
-reactos/dll/win32/jscript             # Synced to Wine-3.0
+reactos/dll/win32/jscript             # Synced to WineStaging-3.9
 reactos/dll/win32/jsproxy             # Synced to WineStaging-2.16
 reactos/dll/win32/loadperf            # Synced to WineStaging-2.9
 reactos/dll/win32/lz32                # Synced to WineStaging-2.9
diff --git a/sdk/include/reactos/wine/heap.h b/sdk/include/reactos/wine/heap.h
new file mode 100644 (file)
index 0000000..97d3a56
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Wine heap memory allocation wrappers
+ *
+ * Copyright 2006 Jacek Caban for CodeWeavers
+ * Copyright 2013, 2018 Michael Stefaniuc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_WINE_HEAP_H
+#define __WINE_WINE_HEAP_H
+
+#include <winbase.h>
+
+static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(SIZE_T len)
+{
+    return HeapAlloc(GetProcessHeap(), 0, len);
+}
+
+static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(SIZE_T len)
+{
+    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+}
+
+static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, SIZE_T len)
+{
+    if (!mem)
+        return HeapAlloc(GetProcessHeap(), 0, len);
+    return HeapReAlloc(GetProcessHeap(), 0, mem, len);
+}
+
+static inline void heap_free(void *mem)
+{
+    HeapFree(GetProcessHeap(), 0, mem);
+}
+
+static inline void *heap_calloc(SIZE_T count, SIZE_T size)
+{
+    SIZE_T len = count * size;
+
+    if (size && len / size != count)
+        return NULL;
+    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+}
+
+#endif  /* __WINE_WINE_HEAP_H */