[JSCRIPT] Sync with Wine Staging 1.7.37. CORE-9246

svn path=/trunk/; revision=66877
This commit is contained in:
Amine Khaldi 2015-03-25 15:58:08 +00:00
parent 65d7d6a954
commit ff44482672
44 changed files with 3634 additions and 1433 deletions

View file

@ -10,6 +10,7 @@ list(APPEND SOURCE
activex.c
array.c
bool.c
cc_parser.tab.c
compile.c
date.c
decode.c

View file

@ -40,9 +40,14 @@ static const WCHAR unshiftW[] = {'u','n','s','h','i','f','t',0};
static const WCHAR default_separatorW[] = {',',0};
static inline ArrayInstance *array_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, ArrayInstance, dispex);
}
static inline ArrayInstance *array_from_vdisp(vdisp_t *vdisp)
{
return (ArrayInstance*)vdisp->u.jsdisp;
return array_from_jsdisp(vdisp->u.jsdisp);
}
static inline ArrayInstance *array_this(vdisp_t *jsthis)
@ -104,44 +109,38 @@ static WCHAR *idx_to_str(DWORD idx, WCHAR *ptr)
return ptr+1;
}
static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT Array_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
ArrayInstance *This = array_from_vdisp(jsthis);
TRACE("%p\n", jsthis);
*r = jsval_number(array_from_jsdisp(jsthis)->length);
return S_OK;
}
static HRESULT Array_set_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
{
ArrayInstance *This = array_from_jsdisp(jsthis);
DOUBLE len = -1;
DWORD i;
HRESULT hres;
TRACE("%p %d\n", This, This->length);
switch(flags) {
case DISPATCH_PROPERTYGET:
*r = jsval_number(This->length);
break;
case DISPATCH_PROPERTYPUT: {
DOUBLE len = -1;
DWORD i;
HRESULT hres;
hres = to_number(ctx, value, &len);
if(FAILED(hres))
return hres;
hres = to_number(ctx, argv[0], &len);
len = floor(len);
if(len!=(DWORD)len)
return throw_range_error(ctx, JS_E_INVALID_LENGTH, NULL);
for(i=len; i < This->length; i++) {
hres = jsdisp_delete_idx(&This->dispex, i);
if(FAILED(hres))
return hres;
len = floor(len);
if(len!=(DWORD)len)
return throw_range_error(ctx, JS_E_INVALID_LENGTH, NULL);
for(i=len; i<This->length; i++) {
hres = jsdisp_delete_idx(&This->dispex, i);
if(FAILED(hres))
return hres;
}
This->length = len;
break;
}
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
This->length = len;
return S_OK;
}
@ -496,9 +495,7 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
hres = set_length(jsthis, 0);
if(FAILED(hres))
return hres;
}
if(!length) {
if(r)
*r = jsval_undefined();
return S_OK;
@ -995,22 +992,13 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
return S_OK;
}
static HRESULT Array_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT Array_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
ArrayInstance *array = array_from_jsdisp(jsthis);
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL);
case INVOKE_PROPERTYGET:
return array_join(ctx, jsthis->u.jsdisp, array_from_vdisp(jsthis)->length, default_separatorW, r);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
return array_join(ctx, &array->dispex, array->length, default_separatorW, r);
}
static void Array_destructor(jsdisp_t *dispex)
@ -1042,7 +1030,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},
{joinW, Array_join, PROPF_METHOD|1},
{lengthW, Array_length, 0},
{lengthW, NULL,0, Array_get_length, Array_set_length},
{popW, Array_pop, PROPF_METHOD},
{pushW, Array_push, PROPF_METHOD|1},
{reverseW, Array_reverse, PROPF_METHOD},
@ -1057,7 +1045,7 @@ static const builtin_prop_t Array_props[] = {
static const builtin_info_t Array_info = {
JSCLASS_ARRAY,
{NULL, Array_value, 0},
{NULL, NULL,0, Array_get_value},
sizeof(Array_props)/sizeof(*Array_props),
Array_props,
Array_destructor,
@ -1065,12 +1053,12 @@ static const builtin_info_t Array_info = {
};
static const builtin_prop_t ArrayInst_props[] = {
{lengthW, Array_length, 0}
{lengthW, NULL,0, Array_get_length, Array_set_length}
};
static const builtin_info_t ArrayInst_info = {
JSCLASS_ARRAY,
{NULL, Array_value, 0},
{NULL, NULL,0, Array_get_value},
sizeof(ArrayInst_props)/sizeof(*ArrayInst_props),
ArrayInst_props,
Array_destructor,

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,229 @@
/*
* Copyright 2014 Jacek Caban for CodeWeavers
*
* 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 "jscript.h"
%}
%lex-param { parser_ctx_t *ctx }
%parse-param { parser_ctx_t *ctx }
%pure-parser
%start CCExpr
%union {
ccval_t ccval;
}
%token tEQ tEQEQ tNEQ tNEQEQ tLSHIFT tRSHIFT tRRSHIFT tOR tAND tLEQ tGEQ
%token <ccval> tCCValue
%type <ccval> CCUnaryExpression CCLogicalORExpression CCLogicalANDExpression
%type <ccval> CCBitwiseORExpression CCBitwiseXORExpression CCBitwiseANDExpression
%type <ccval> CCEqualityExpression CCRelationalExpression CCShiftExpression CCAdditiveExpression CCMultiplicativeExpression
%{
static int cc_parser_error(parser_ctx_t *ctx, const char *str)
{
if(SUCCEEDED(ctx->hres)) {
WARN("%s\n", str);
ctx->hres = JS_E_SYNTAX;
}
return 0;
}
static int cc_parser_lex(void *lval, parser_ctx_t *ctx)
{
int r;
r = try_parse_ccval(ctx, lval);
if(r)
return r > 0 ? tCCValue : -1;
switch(*ctx->ptr) {
case '(':
case ')':
case '+':
case '-':
case '*':
case '/':
case '~':
case '%':
case '^':
return *ctx->ptr++;
case '=':
if(*++ctx->ptr == '=') {
if(*++ctx->ptr == '=') {
ctx->ptr++;
return tEQEQ;
}
return tEQ;
}
break;
case '!':
if(*++ctx->ptr == '=') {
if(*++ctx->ptr == '=') {
ctx->ptr++;
return tNEQEQ;
}
return tNEQ;
}
return '!';
case '<':
switch(*++ctx->ptr) {
case '<':
ctx->ptr++;
return tLSHIFT;
case '=':
ctx->ptr++;
return tLEQ;
default:
return '<';
}
case '>':
switch(*++ctx->ptr) {
case '>':
if(*++ctx->ptr == '>') {
ctx->ptr++;
return tRRSHIFT;
}
return tRSHIFT;
case '=':
ctx->ptr++;
return tGEQ;
default:
return '>';
}
case '|':
if(*++ctx->ptr == '|') {
ctx->ptr++;
return tOR;
}
return '|';
case '&':
if(*++ctx->ptr == '&') {
ctx->ptr++;
return tAND;
}
return '&';
}
WARN("Failed to interpret %s\n", debugstr_w(ctx->ptr));
return -1;
}
%}
%%
/* FIXME: Implement missing expressions. */
CCExpr
: CCUnaryExpression { ctx->ccval = $1; YYACCEPT; }
CCUnaryExpression
: tCCValue { $$ = $1; }
| '(' CCLogicalORExpression ')' { $$ = $2; }
| '!' CCUnaryExpression { $$ = ccval_bool(!get_ccbool($2)); };
| '~' CCUnaryExpression { FIXME("'~' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
| '+' CCUnaryExpression { FIXME("'+' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
| '-' CCUnaryExpression { FIXME("'-' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
CCLogicalORExpression
: CCLogicalANDExpression { $$ = $1; }
| CCLogicalORExpression tOR CCLogicalANDExpression
{ FIXME("'||' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
CCLogicalANDExpression
: CCBitwiseORExpression { $$ = $1; }
| CCBitwiseANDExpression tAND CCBitwiseORExpression
{ FIXME("'&&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
CCBitwiseORExpression
: CCBitwiseXORExpression { $$ = $1; }
| CCBitwiseORExpression '|' CCBitwiseXORExpression
{ FIXME("'|' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
CCBitwiseXORExpression
: CCBitwiseANDExpression { $$ = $1; }
| CCBitwiseXORExpression '^' CCBitwiseANDExpression
{ FIXME("'^' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
CCBitwiseANDExpression
: CCEqualityExpression { $$ = $1; }
| CCBitwiseANDExpression '&' CCEqualityExpression
{ FIXME("'&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
CCEqualityExpression
: CCRelationalExpression { $$ = $1; }
| CCEqualityExpression tEQ CCRelationalExpression
{ $$ = ccval_bool(get_ccnum($1) == get_ccnum($3)); }
| CCEqualityExpression tNEQ CCRelationalExpression
{ $$ = ccval_bool(get_ccnum($1) != get_ccnum($3)); }
| CCEqualityExpression tEQEQ CCRelationalExpression
{ FIXME("'===' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
| CCEqualityExpression tNEQEQ CCRelationalExpression
{ FIXME("'!==' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
CCRelationalExpression
: CCShiftExpression { $$ = $1; }
| CCRelationalExpression '<' CCShiftExpression
{ $$ = ccval_bool(get_ccnum($1) < get_ccnum($3)); }
| CCRelationalExpression tLEQ CCShiftExpression
{ $$ = ccval_bool(get_ccnum($1) <= get_ccnum($3)); }
| CCRelationalExpression '>' CCShiftExpression
{ $$ = ccval_bool(get_ccnum($1) > get_ccnum($3)); }
| CCRelationalExpression tGEQ CCShiftExpression
{ $$ = ccval_bool(get_ccnum($1) >= get_ccnum($3)); }
CCShiftExpression
: CCAdditiveExpression { $$ = $1; }
| CCShiftExpression tLSHIFT CCAdditiveExpression
{ FIXME("'<<' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
| CCShiftExpression tRSHIFT CCAdditiveExpression
{ FIXME("'>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
| CCShiftExpression tRRSHIFT CCAdditiveExpression
{ FIXME("'>>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
CCAdditiveExpression
: CCMultiplicativeExpression { $$ = $1; }
| CCAdditiveExpression '+' CCMultiplicativeExpression
{ $$ = ccval_num(get_ccnum($1) + get_ccnum($3)); }
| CCAdditiveExpression '-' CCMultiplicativeExpression
{ $$ = ccval_num(get_ccnum($1) - get_ccnum($3)); }
CCMultiplicativeExpression
: CCUnaryExpression { $$ = $1; }
| CCMultiplicativeExpression '*' CCUnaryExpression
{ $$ = ccval_num(get_ccnum($1) * get_ccnum($3)); }
| CCMultiplicativeExpression '/' CCUnaryExpression
{ $$ = ccval_num(get_ccnum($1) / get_ccnum($3)); }
| CCMultiplicativeExpression '%' CCUnaryExpression
{ FIXME("'%%' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
%%
BOOL parse_cc_expr(parser_ctx_t *ctx)
{
ctx->hres = S_OK;
cc_parser_parse(ctx);
return SUCCEEDED(ctx->hres);
}

View file

@ -83,9 +83,14 @@ static const WCHAR setYearW[] = {'s','e','t','Y','e','a','r',0};
static const WCHAR UTCW[] = {'U','T','C',0};
static const WCHAR parseW[] = {'p','a','r','s','e',0};
static inline DateInstance *date_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, DateInstance, dispex);
}
static inline DateInstance *date_this(vdisp_t *jsthis)
{
return is_vclass(jsthis, JSCLASS_DATE) ? (DateInstance*)jsthis->u.jsdisp : NULL;
return is_vclass(jsthis, JSCLASS_DATE) ? date_from_jsdisp(jsthis->u.jsdisp) : NULL;
}
/*ECMA-262 3rd Edition 15.9.1.2 */
@ -1906,20 +1911,11 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
return S_OK;
}
static HRESULT Date_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT Date_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
return dateobj_to_string(date_from_jsdisp(jsthis), r);
}
static const builtin_prop_t Date_props[] = {
@ -1971,7 +1967,7 @@ static const builtin_prop_t Date_props[] = {
static const builtin_info_t Date_info = {
JSCLASS_DATE,
{NULL, Date_value, 0},
{NULL, NULL,0, Date_get_value},
sizeof(Date_props)/sizeof(*Date_props),
Date_props,
NULL,
@ -1980,7 +1976,7 @@ static const builtin_info_t Date_info = {
static const builtin_info_t DateInst_info = {
JSCLASS_DATE,
{NULL, Date_value, 0},
{NULL, NULL,0, Date_get_value},
0, NULL,
NULL,
NULL
@ -2495,7 +2491,7 @@ static const builtin_prop_t DateConstr_props[] = {
static const builtin_info_t DateConstr_info = {
JSCLASS_FUNCTION,
{NULL, Function_value, 0},
DEFAULT_FUNCTION_VALUE,
sizeof(DateConstr_props)/sizeof(*DateConstr_props),
DateConstr_props,
NULL,

View file

@ -413,8 +413,12 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
switch(prop->type) {
case PROP_BUILTIN:
if(prop->u.p->flags & PROPF_METHOD) {
if(prop->u.p->getter) {
hres = prop->u.p->getter(This->ctx, This, r);
}else {
jsdisp_t *obj;
assert(prop->u.p->invoke != NULL);
hres = create_builtin_function(This->ctx, prop->u.p->invoke, prop->u.p->name, NULL,
prop->u.p->flags, NULL, &obj);
if(FAILED(hres))
@ -425,12 +429,6 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp,
jsdisp_addref(obj);
*r = jsval_obj(obj);
}else {
vdisp_t vthis;
set_jsdisp(&vthis, This);
hres = prop->u.p->invoke(This->ctx, &vthis, DISPATCH_PROPERTYGET, 0, NULL, r);
vdisp_release(&vthis);
}
break;
case PROP_PROTREF:
@ -465,13 +463,12 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServi
switch(prop->type) {
case PROP_BUILTIN:
if(!(prop->flags & PROPF_METHOD)) {
vdisp_t vthis;
if(prop->u.p->setter)
return prop->u.p->setter(This->ctx, This, val);
set_jsdisp(&vthis, This);
hres = prop->u.p->invoke(This->ctx, &vthis, DISPATCH_PROPERTYPUT, 1, &val, NULL);
vdisp_release(&vthis);
return hres;
if(prop->u.p->setter) {
FIXME("getter with no setter\n");
return E_FAIL;
}
/* fall through */
case PROP_PROTREF:
@ -503,6 +500,12 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServi
return S_OK;
}
HRESULT builtin_set_const(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
{
TRACE("%p %s\n", jsthis, debugstr_jsval(value));
return S_OK;
}
static HRESULT fill_protrefs(jsdisp_t *This)
{
dispex_prop_t *iter, *prop;
@ -900,7 +903,7 @@ HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *b
jsdisp_addref(prototype);
dispex->prop_cnt = 1;
if(builtin_info->value_prop.invoke) {
if(builtin_info->value_prop.invoke || builtin_info->value_prop.getter) {
dispex->props[0].type = PROP_BUILTIN;
dispex->props[0].u.p = &builtin_info->value_prop;
}else {
@ -1050,11 +1053,18 @@ HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsig
{
HRESULT hres;
assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT)));
if(is_class(jsfunc, JSCLASS_FUNCTION)) {
hres = Function_invoke(jsfunc, jsthis, flags, argc, argv, r);
}else {
vdisp_t vdisp;
if(!jsfunc->builtin_info->value_prop.invoke) {
WARN("Not a function\n");
return throw_type_error(jsfunc->ctx, JS_E_FUNCTION_EXPECTED, NULL);
}
set_disp(&vdisp, jsthis);
hres = jsfunc->builtin_info->value_prop.invoke(jsfunc->ctx, &vdisp, flags, argc, argv, r);
vdisp_release(&vdisp);
@ -1183,13 +1193,10 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
unsigned i;
HRESULT hres;
assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT)));
jsdisp = iface_to_jsdisp((IUnknown*)disp);
if(jsdisp) {
if(flags & DISPATCH_PROPERTYPUT) {
FIXME("disp_call(propput) on builtin object\n");
return E_FAIL;
}
hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, r);
jsdisp_release(jsdisp);
return hres;
@ -1339,6 +1346,7 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
jsdisp_release(jsdisp);
}else {
DISPID dispid = DISPID_PROPERTYPUT;
DWORD flags = DISPATCH_PROPERTYPUT;
VARIANT var;
DISPPARAMS dp = {&var, &dispid, 1, 1};
IDispatchEx *dispex;
@ -1347,17 +1355,20 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
if(FAILED(hres))
return hres;
if(V_VT(&var) == VT_DISPATCH)
flags |= DISPATCH_PROPERTYPUTREF;
clear_ei(ctx);
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
if(SUCCEEDED(hres)) {
hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, DISPATCH_PROPERTYPUT, &dp, NULL, &ctx->ei.ei,
hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, &dp, NULL, &ctx->ei.ei,
&ctx->jscaller->IServiceProvider_iface);
IDispatchEx_Release(dispex);
}else {
ULONG err = 0;
TRACE("using IDispatch\n");
hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, DISPATCH_PROPERTYPUT, &dp, NULL, &ctx->ei.ei, &err);
hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, &dp, NULL, &ctx->ei.ei, &err);
}
VariantClear(&var);

View file

@ -35,6 +35,21 @@ struct _except_frame_t {
except_frame_t *next;
};
typedef struct {
enum {
EXPRVAL_JSVAL,
EXPRVAL_IDREF,
EXPRVAL_INVALID
} type;
union {
jsval_t val;
struct {
IDispatch *disp;
DISPID id;
} idref;
} u;
} exprval_t;
static HRESULT stack_push(exec_ctx_t *ctx, jsval_t v)
{
if(!ctx->stack_size) {
@ -372,11 +387,6 @@ static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name
return hres;
}
static inline BOOL var_is_null(const VARIANT *v)
{
return V_VT(v) == VT_NULL || (V_VT(v) == VT_DISPATCH && !V_DISPATCH(v));
}
static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, BOOL *ret)
{
IObjectIdentity *identity;

View file

@ -18,26 +18,6 @@
#pragma once
typedef struct _source_elements_t source_elements_t;
typedef struct _expression_t expression_t;
typedef struct _statement_t statement_t;
typedef struct {
const WCHAR *begin;
const WCHAR *end;
const WCHAR *ptr;
script_ctx_t *script;
source_elements_t *source;
BOOL nl;
BOOL implicit_nl_semicolon;
BOOL is_html;
BOOL lexer_error;
HRESULT hres;
heap_pool_t heap;
} parser_ctx_t;
#define OP_LIST \
X(add, 1, 0,0) \
X(and, 1, 0,0) \
@ -193,21 +173,6 @@ static inline void bytecode_addref(bytecode_t *code)
code->ref++;
}
HRESULT script_parse(script_ctx_t*,const WCHAR*,const WCHAR*,BOOL,parser_ctx_t**) DECLSPEC_HIDDEN;
void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN;
int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN;
static inline void *parser_alloc(parser_ctx_t *ctx, DWORD size)
{
return heap_pool_alloc(&ctx->heap, size);
}
static inline void *parser_alloc_tmp(parser_ctx_t *ctx, DWORD size)
{
return heap_pool_alloc(&ctx->script->tmp_heap, size);
}
typedef struct _scope_chain_t {
LONG ref;
jsdisp_t *jsobj;
@ -224,11 +189,12 @@ static inline void scope_addref(scope_chain_t *scope)
}
typedef struct _except_frame_t except_frame_t;
struct _parser_ctx_t;
struct _exec_ctx_t {
LONG ref;
parser_ctx_t *parser;
struct _parser_ctx_t *parser;
bytecode_t *code;
script_ctx_t *script;
scope_chain_t *scope_chain;
@ -255,320 +221,3 @@ void exec_release(exec_ctx_t*) DECLSPEC_HIDDEN;
HRESULT create_exec_ctx(script_ctx_t*,IDispatch*,jsdisp_t*,scope_chain_t*,BOOL,exec_ctx_t**) DECLSPEC_HIDDEN;
HRESULT exec_source(exec_ctx_t*,bytecode_t*,function_code_t*,BOOL,jsval_t*) DECLSPEC_HIDDEN;
HRESULT create_source_function(script_ctx_t*,bytecode_t*,function_code_t*,scope_chain_t*,jsdisp_t**) DECLSPEC_HIDDEN;
typedef enum {
LT_DOUBLE,
LT_STRING,
LT_BOOL,
LT_NULL,
LT_REGEXP
}literal_type_t;
typedef struct {
literal_type_t type;
union {
double dval;
const WCHAR *wstr;
BOOL bval;
struct {
const WCHAR *str;
DWORD str_len;
DWORD flags;
} regexp;
} u;
} literal_t;
literal_t *parse_regexp(parser_ctx_t*) DECLSPEC_HIDDEN;
literal_t *new_boolean_literal(parser_ctx_t*,BOOL) DECLSPEC_HIDDEN;
typedef struct _variable_declaration_t {
const WCHAR *identifier;
expression_t *expr;
struct _variable_declaration_t *next;
struct _variable_declaration_t *global_next; /* for compiler */
} variable_declaration_t;
typedef enum {
STAT_BLOCK,
STAT_BREAK,
STAT_CONTINUE,
STAT_EMPTY,
STAT_EXPR,
STAT_FOR,
STAT_FORIN,
STAT_IF,
STAT_LABEL,
STAT_RETURN,
STAT_SWITCH,
STAT_THROW,
STAT_TRY,
STAT_VAR,
STAT_WHILE,
STAT_WITH
} statement_type_t;
struct _statement_t {
statement_type_t type;
statement_t *next;
};
typedef struct {
statement_t stat;
statement_t *stat_list;
} block_statement_t;
typedef struct {
statement_t stat;
variable_declaration_t *variable_list;
} var_statement_t;
typedef struct {
statement_t stat;
expression_t *expr;
} expression_statement_t;
typedef struct {
statement_t stat;
expression_t *expr;
statement_t *if_stat;
statement_t *else_stat;
} if_statement_t;
typedef struct {
statement_t stat;
BOOL do_while;
expression_t *expr;
statement_t *statement;
} while_statement_t;
typedef struct {
statement_t stat;
variable_declaration_t *variable_list;
expression_t *begin_expr;
expression_t *expr;
expression_t *end_expr;
statement_t *statement;
} for_statement_t;
typedef struct {
statement_t stat;
variable_declaration_t *variable;
expression_t *expr;
expression_t *in_expr;
statement_t *statement;
} forin_statement_t;
typedef struct {
statement_t stat;
const WCHAR *identifier;
} branch_statement_t;
typedef struct {
statement_t stat;
expression_t *expr;
statement_t *statement;
} with_statement_t;
typedef struct {
statement_t stat;
const WCHAR *identifier;
statement_t *statement;
} labelled_statement_t;
typedef struct _case_clausule_t {
expression_t *expr;
statement_t *stat;
struct _case_clausule_t *next;
} case_clausule_t;
typedef struct {
statement_t stat;
expression_t *expr;
case_clausule_t *case_list;
} switch_statement_t;
typedef struct {
const WCHAR *identifier;
statement_t *statement;
} catch_block_t;
typedef struct {
statement_t stat;
statement_t *try_statement;
catch_block_t *catch_block;
statement_t *finally_statement;
} try_statement_t;
typedef struct {
enum {
EXPRVAL_JSVAL,
EXPRVAL_IDREF,
EXPRVAL_INVALID
} type;
union {
jsval_t val;
struct {
IDispatch *disp;
DISPID id;
} idref;
} u;
} exprval_t;
typedef enum {
EXPR_COMMA,
EXPR_OR,
EXPR_AND,
EXPR_BOR,
EXPR_BXOR,
EXPR_BAND,
EXPR_INSTANCEOF,
EXPR_IN,
EXPR_ADD,
EXPR_SUB,
EXPR_MUL,
EXPR_DIV,
EXPR_MOD,
EXPR_DELETE,
EXPR_VOID,
EXPR_TYPEOF,
EXPR_MINUS,
EXPR_PLUS,
EXPR_POSTINC,
EXPR_POSTDEC,
EXPR_PREINC,
EXPR_PREDEC,
EXPR_EQ,
EXPR_EQEQ,
EXPR_NOTEQ,
EXPR_NOTEQEQ,
EXPR_LESS,
EXPR_LESSEQ,
EXPR_GREATER,
EXPR_GREATEREQ,
EXPR_BITNEG,
EXPR_LOGNEG,
EXPR_LSHIFT,
EXPR_RSHIFT,
EXPR_RRSHIFT,
EXPR_ASSIGN,
EXPR_ASSIGNLSHIFT,
EXPR_ASSIGNRSHIFT,
EXPR_ASSIGNRRSHIFT,
EXPR_ASSIGNADD,
EXPR_ASSIGNSUB,
EXPR_ASSIGNMUL,
EXPR_ASSIGNDIV,
EXPR_ASSIGNMOD,
EXPR_ASSIGNAND,
EXPR_ASSIGNOR,
EXPR_ASSIGNXOR,
EXPR_COND,
EXPR_ARRAY,
EXPR_MEMBER,
EXPR_NEW,
EXPR_CALL,
EXPR_THIS,
EXPR_FUNC,
EXPR_IDENT,
EXPR_ARRAYLIT,
EXPR_PROPVAL,
EXPR_LITERAL
} expression_type_t;
struct _expression_t {
expression_type_t type;
};
typedef struct _parameter_t {
const WCHAR *identifier;
struct _parameter_t *next;
} parameter_t;
struct _source_elements_t {
statement_t *statement;
statement_t *statement_tail;
};
typedef struct _function_expression_t {
expression_t expr;
const WCHAR *identifier;
parameter_t *parameter_list;
source_elements_t *source_elements;
const WCHAR *src_str;
DWORD src_len;
struct _function_expression_t *next; /* for compiler */
} function_expression_t;
typedef struct {
expression_t expr;
expression_t *expression1;
expression_t *expression2;
} binary_expression_t;
typedef struct {
expression_t expr;
expression_t *expression;
} unary_expression_t;
typedef struct {
expression_t expr;
expression_t *expression;
expression_t *true_expression;
expression_t *false_expression;
} conditional_expression_t;
typedef struct {
expression_t expr;
expression_t *expression;
const WCHAR *identifier;
} member_expression_t;
typedef struct _argument_t {
expression_t *expr;
struct _argument_t *next;
} argument_t;
typedef struct {
expression_t expr;
expression_t *expression;
argument_t *argument_list;
} call_expression_t;
typedef struct {
expression_t expr;
const WCHAR *identifier;
} identifier_expression_t;
typedef struct {
expression_t expr;
literal_t *literal;
} literal_expression_t;
typedef struct _array_element_t {
int elision;
expression_t *expr;
struct _array_element_t *next;
} array_element_t;
typedef struct {
expression_t expr;
array_element_t *element_list;
int length;
} array_literal_expression_t;
typedef struct _prop_val_t {
literal_t *name;
expression_t *value;
struct _prop_val_t *next;
} prop_val_t;
typedef struct {
expression_t expr;
prop_val_t *property_list;
} property_value_expression_t;

View file

@ -36,9 +36,14 @@ typedef struct {
jsdisp_t *var_obj;
} ArgumentsInstance;
static inline FunctionInstance *function_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, FunctionInstance, dispex);
}
static inline FunctionInstance *function_from_vdisp(vdisp_t *vdisp)
{
return (FunctionInstance*)vdisp->u.jsdisp;
return function_from_jsdisp(vdisp->u.jsdisp);
}
static inline FunctionInstance *function_this(vdisp_t *jsthis)
@ -198,6 +203,11 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
scope_chain_t *scope;
HRESULT hres;
if(ctx->state == SCRIPTSTATE_UNINITIALIZED || ctx->state == SCRIPTSTATE_CLOSED) {
WARN("Script engine state does not allow running code.\n");
return E_UNEXPECTED;
}
if(!function->func_code) {
FIXME("no source\n");
return E_FAIL;
@ -350,25 +360,20 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsi
return invoke_source(function->dispex.ctx, function, jsthis, argc, argv, r);
}
static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
FunctionInstance *This = function_from_vdisp(jsthis);
TRACE("%p %d\n", This, This->length);
switch(flags) {
case DISPATCH_PROPERTYGET:
*r = jsval_number(This->length);
break;
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
TRACE("%p\n", jsthis);
*r = jsval_number(function_from_jsdisp(jsthis)->length);
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)
{
@ -525,56 +530,33 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
function = (FunctionInstance*)jsthis->u.jsdisp;
switch(flags) {
case DISPATCH_METHOD:
assert(function->value_proc != NULL);
return invoke_value_proc(ctx, function, NULL, flags, argc, argv, r);
case DISPATCH_PROPERTYGET: {
HRESULT hres;
jsstr_t *str;
hres = function_to_string(function, &str);
if(FAILED(hres))
return hres;
*r = jsval_string(str);
break;
}
case DISPATCH_CONSTRUCT:
assert(function->value_proc != NULL);
return invoke_value_proc(ctx, function, NULL, flags, argc, argv, r);
default:
FIXME("not implemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
assert(function->value_proc != NULL);
return invoke_value_proc(ctx, function, NULL, flags, argc, argv, r);
}
static HRESULT Function_arguments(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT Function_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
FunctionInstance *function = (FunctionInstance*)jsthis->u.jsdisp;
HRESULT hres = S_OK;
jsstr_t *str;
HRESULT hres;
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET: {
*r = function->arguments ? jsval_obj(jsdisp_addref(function->arguments)) : jsval_null();
break;
}
case DISPATCH_PROPERTYPUT:
break;
default:
FIXME("unimplemented flags %x\n", flags);
hres = E_NOTIMPL;
}
hres = function_to_string(function_from_jsdisp(jsthis), &str);
if(FAILED(hres))
return hres;
return hres;
*r = jsval_string(str);
return S_OK;
}
static HRESULT Function_get_arguments(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
FunctionInstance *function = function_from_jsdisp(jsthis);
TRACE("\n");
*r = function->arguments ? jsval_obj(jsdisp_addref(function->arguments)) : jsval_null();
return S_OK;
}
static void Function_destructor(jsdisp_t *dispex)
@ -590,15 +572,15 @@ static void Function_destructor(jsdisp_t *dispex)
static const builtin_prop_t Function_props[] = {
{applyW, Function_apply, PROPF_METHOD|2},
{argumentsW, Function_arguments, 0},
{argumentsW, NULL, 0, Function_get_arguments, builtin_set_const},
{callW, Function_call, PROPF_METHOD|1},
{lengthW, Function_length, 0},
{lengthW, NULL, 0, Function_get_length, Function_set_length},
{toStringW, Function_toString, PROPF_METHOD}
};
static const builtin_info_t Function_info = {
JSCLASS_FUNCTION,
{NULL, Function_value, 0},
DEFAULT_FUNCTION_VALUE,
sizeof(Function_props)/sizeof(*Function_props),
Function_props,
Function_destructor,
@ -606,13 +588,13 @@ static const builtin_info_t Function_info = {
};
static const builtin_prop_t FunctionInst_props[] = {
{argumentsW, Function_arguments, 0},
{lengthW, Function_length, 0}
{argumentsW, NULL, 0, Function_get_arguments, builtin_set_const},
{lengthW, NULL, 0, Function_get_length, Function_set_length}
};
static const builtin_info_t FunctionInst_info = {
JSCLASS_FUNCTION,
{NULL, Function_value, 0},
DEFAULT_FUNCTION_VALUE,
sizeof(FunctionInst_props)/sizeof(*FunctionInst_props),
FunctionInst_props,
Function_destructor,

View file

@ -102,159 +102,6 @@ static WCHAR int_to_char(int i)
return 'A'+i-10;
}
static HRESULT constructor_call(jsdisp_t *constr, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
{
if(flags != DISPATCH_PROPERTYGET)
return jsdisp_call_value(constr, NULL, flags, argc, argv, r);
*r = jsval_obj(jsdisp_addref(constr));
return S_OK;
}
static HRESULT JSGlobal_Array(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->array_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_Boolean(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->bool_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_Date(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->date_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_Error(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_EvalError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->eval_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_RangeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->range_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_RegExpError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->regexp_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_ReferenceError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->reference_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_SyntaxError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->syntax_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_TypeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->type_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_URIError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->uri_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_Function(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->function_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_Number(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->number_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_Object(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->object_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_String(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->string_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->regexp_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->activex_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_VBArray(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->vbarray_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_Enumerator(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
@ -1077,31 +924,13 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
}
static const builtin_prop_t JSGlobal_props[] = {
{ActiveXObjectW, JSGlobal_ActiveXObject, PROPF_CONSTR|1},
{ArrayW, JSGlobal_Array, PROPF_CONSTR|1},
{BooleanW, JSGlobal_Boolean, PROPF_CONSTR|1},
{CollectGarbageW, JSGlobal_CollectGarbage, PROPF_METHOD},
{DateW, JSGlobal_Date, PROPF_CONSTR|7},
{EnumeratorW, JSGlobal_Enumerator, PROPF_METHOD|7},
{ErrorW, JSGlobal_Error, PROPF_CONSTR|1},
{EvalErrorW, JSGlobal_EvalError, PROPF_CONSTR|1},
{FunctionW, JSGlobal_Function, PROPF_CONSTR|1},
{_GetObjectW, JSGlobal_GetObject, PROPF_METHOD|2},
{NumberW, JSGlobal_Number, PROPF_CONSTR|1},
{ObjectW, JSGlobal_Object, PROPF_CONSTR|1},
{RangeErrorW, JSGlobal_RangeError, PROPF_CONSTR|1},
{ReferenceErrorW, JSGlobal_ReferenceError, PROPF_CONSTR|1},
{RegExpW, JSGlobal_RegExp, PROPF_CONSTR|2},
{RegExpErrorW, JSGlobal_RegExpError, PROPF_CONSTR|1},
{ScriptEngineW, JSGlobal_ScriptEngine, PROPF_METHOD},
{ScriptEngineBuildVersionW, JSGlobal_ScriptEngineBuildVersion, PROPF_METHOD},
{ScriptEngineMajorVersionW, JSGlobal_ScriptEngineMajorVersion, PROPF_METHOD},
{ScriptEngineMinorVersionW, JSGlobal_ScriptEngineMinorVersion, PROPF_METHOD},
{StringW, JSGlobal_String, PROPF_CONSTR|1},
{SyntaxErrorW, JSGlobal_SyntaxError, PROPF_CONSTR|1},
{TypeErrorW, JSGlobal_TypeError, PROPF_CONSTR|1},
{URIErrorW, JSGlobal_URIError, PROPF_CONSTR|1},
{VBArrayW, JSGlobal_VBArray, PROPF_CONSTR|1},
{decodeURIW, JSGlobal_decodeURI, PROPF_METHOD|1},
{decodeURIComponentW, JSGlobal_decodeURIComponent, PROPF_METHOD|1},
{encodeURIW, JSGlobal_encodeURI, PROPF_METHOD|1},
@ -1132,11 +961,15 @@ 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));
if(FAILED(hres))
return hres;
hres = create_object_constr(ctx, object_prototype, &ctx->object_constr);
if(FAILED(hres))
return hres;
hres = create_activex_constr(ctx, &ctx->activex_constr);
hres = jsdisp_propput_dontenum(ctx->global, ObjectW, jsval_obj(ctx->object_constr));
if(FAILED(hres))
return hres;
@ -1144,45 +977,109 @@ 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));
if(FAILED(hres))
return hres;
hres = create_bool_constr(ctx, object_prototype, &ctx->bool_constr);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, BooleanW, jsval_obj(ctx->bool_constr));
if(FAILED(hres))
return hres;
hres = create_date_constr(ctx, object_prototype, &ctx->date_constr);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, DateW, jsval_obj(ctx->date_constr));
if(FAILED(hres))
return hres;
hres = init_error_constr(ctx, object_prototype);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, ErrorW, jsval_obj(ctx->error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, EvalErrorW, jsval_obj(ctx->eval_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, RangeErrorW, jsval_obj(ctx->range_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, ReferenceErrorW, jsval_obj(ctx->reference_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, RegExpErrorW, jsval_obj(ctx->regexp_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, SyntaxErrorW, jsval_obj(ctx->syntax_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, TypeErrorW, jsval_obj(ctx->type_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, URIErrorW, jsval_obj(ctx->uri_error_constr));
if(FAILED(hres))
return hres;
hres = create_number_constr(ctx, object_prototype, &ctx->number_constr);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, NumberW, jsval_obj(ctx->number_constr));
if(FAILED(hres))
return hres;
hres = create_regexp_constr(ctx, object_prototype, &ctx->regexp_constr);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, RegExpW, jsval_obj(ctx->regexp_constr));
if(FAILED(hres))
return hres;
hres = create_string_constr(ctx, object_prototype, &ctx->string_constr);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, StringW, jsval_obj(ctx->string_constr));
if(FAILED(hres))
return hres;
hres = create_vbarray_constr(ctx, object_prototype, &ctx->vbarray_constr);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, VBArrayW, jsval_obj(ctx->vbarray_constr));
if(FAILED(hres))
return hres;
return S_OK;
}
HRESULT init_global(script_ctx_t *ctx)
{
jsdisp_t *math, *object_prototype;
jsdisp_t *math, *object_prototype, *constr;
HRESULT hres;
if(ctx->global)
return S_OK;
hres = create_dispex(ctx, &JSGlobal_info, NULL, &ctx->global);
if(FAILED(hres))
return hres;
hres = create_object_prototype(ctx, &object_prototype);
if(FAILED(hres))
return hres;
@ -1192,10 +1089,6 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
hres = create_dispex(ctx, &JSGlobal_info, NULL, &ctx->global);
if(FAILED(hres))
return hres;
hres = create_math(ctx, &math);
if(FAILED(hres))
return hres;
@ -1205,6 +1098,15 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
hres = create_activex_constr(ctx, &constr);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, ActiveXObjectW, jsval_obj(constr));
jsdisp_release(constr);
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, undefinedW, jsval_undefined());
if(FAILED(hres))
return hres;

View file

@ -201,11 +201,17 @@ static inline jsdisp_t *get_jsdisp(vdisp_t *vdisp)
}
typedef HRESULT (*builtin_invoke_t)(script_ctx_t*,vdisp_t*,WORD,unsigned,jsval_t*,jsval_t*);
typedef HRESULT (*builtin_getter_t)(script_ctx_t*,jsdisp_t*,jsval_t*);
typedef HRESULT (*builtin_setter_t)(script_ctx_t*,jsdisp_t*,jsval_t);
HRESULT builtin_set_const(script_ctx_t*,jsdisp_t*,jsval_t) DECLSPEC_HIDDEN;
typedef struct {
const WCHAR *name;
builtin_invoke_t invoke;
DWORD flags;
builtin_getter_t getter;
builtin_setter_t setter;
} builtin_prop_t;
typedef struct {
@ -301,9 +307,12 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons
jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
HRESULT create_builtin_constructor(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD,
jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
HRESULT Function_value(script_ctx_t*,vdisp_t*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
HRESULT Function_invoke(jsdisp_t*,IDispatch*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
HRESULT Function_value(script_ctx_t*,vdisp_t*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
HRESULT Function_get_value(script_ctx_t*,jsdisp_t*,jsval_t*) DECLSPEC_HIDDEN;
#define DEFAULT_FUNCTION_VALUE {NULL, Function_value,0, Function_get_value}
HRESULT throw_eval_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
HRESULT throw_generic_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
HRESULT throw_range_error(script_ctx_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN;
@ -409,7 +418,6 @@ struct _script_ctx_t {
jsdisp_t *global;
jsdisp_t *function_constr;
jsdisp_t *activex_constr;
jsdisp_t *array_constr;
jsdisp_t *bool_constr;
jsdisp_t *date_constr;
@ -508,6 +516,8 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
#define JS_E_MISSING_SEMICOLON MAKE_JSERROR(IDS_SEMICOLON)
#define JS_E_MISSING_LBRACKET MAKE_JSERROR(IDS_LBRACKET)
#define JS_E_MISSING_RBRACKET MAKE_JSERROR(IDS_RBRACKET)
#define JS_E_EXPECTED_IDENTIFIER MAKE_JSERROR(IDS_EXPECTED_IDENTIFIER)
#define JS_E_EXPECTED_ASSIGN MAKE_JSERROR(IDS_EXPECTED_ASSIGN)
#define JS_E_INVALID_CHAR MAKE_JSERROR(IDS_INVALID_CHAR)
#define JS_E_UNTERMINATED_STRING MAKE_JSERROR(IDS_UNTERMINATED_STR)
#define JS_E_MISPLACED_RETURN MAKE_JSERROR(IDS_MISPLACED_RETURN)
@ -515,7 +525,9 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
#define JS_E_INVALID_CONTINUE MAKE_JSERROR(IDS_INVALID_CONTINUE)
#define JS_E_LABEL_REDEFINED MAKE_JSERROR(IDS_LABEL_REDEFINED)
#define JS_E_LABEL_NOT_FOUND MAKE_JSERROR(IDS_LABEL_NOT_FOUND)
#define JS_E_EXPECTED_CCEND MAKE_JSERROR(IDS_EXPECTED_CCEND)
#define JS_E_DISABLED_CC MAKE_JSERROR(IDS_DISABLED_CC)
#define JS_E_EXPECTED_AT MAKE_JSERROR(IDS_EXPECTED_AT)
#define JS_E_FUNCTION_EXPECTED MAKE_JSERROR(IDS_NOT_FUNC)
#define JS_E_DATE_EXPECTED MAKE_JSERROR(IDS_NOT_DATE)
#define JS_E_NUMBER_EXPECTED MAKE_JSERROR(IDS_NOT_NUM)
@ -556,6 +568,7 @@ static inline void unlock_module(void)
}
#include "engine.h"
#include "parser.h"
#include "regexp.h"
#endif /* _WINE_JSCRIPT_H */

View file

@ -51,11 +51,14 @@ static const WCHAR idx7W[] = {'$','7',0};
static const WCHAR idx8W[] = {'$','8',0};
static const WCHAR idx9W[] = {'$','9',0};
static const WCHAR emptyW[] = {0};
static inline RegExpInstance *regexp_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, RegExpInstance, dispex);
}
static inline RegExpInstance *regexp_from_vdisp(vdisp_t *vdisp)
{
return (RegExpInstance*)vdisp->u.jsdisp;
return regexp_from_jsdisp(vdisp->u.jsdisp);
}
static void set_last_index(RegExpInstance *This, DWORD last_index)
@ -238,41 +241,51 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr,
return S_OK;
}
static HRESULT RegExp_source(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT RegExp_get_source(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET: {
RegExpInstance *This = regexp_from_vdisp(jsthis);
*r = jsval_string(jsstr_addref(This->str));
break;
}
default:
FIXME("Unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
*r = jsval_string(jsstr_addref(regexp_from_jsdisp(jsthis)->str));
return S_OK;
}
static HRESULT RegExp_global(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT RegExp_set_source(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT RegExp_ignoreCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT RegExp_get_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT RegExp_multiline(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
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)
{
FIXME("\n");
return E_NOTIMPL;
}
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)
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT RegExp_set_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
{
FIXME("\n");
return E_NOTIMPL;
@ -293,33 +306,27 @@ static INT index_from_val(script_ctx_t *ctx, jsval_t v)
return is_int32(n) ? n : 0;
}
static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT RegExp_get_lastIndex(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
RegExpInstance *regexp = regexp_from_jsdisp(jsthis);
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET: {
RegExpInstance *regexp = regexp_from_vdisp(jsthis);
return jsval_copy(regexp->last_index_val, r);
}
return jsval_copy(regexp->last_index_val, r);
}
case DISPATCH_PROPERTYPUT: {
RegExpInstance *regexp = regexp_from_vdisp(jsthis);
HRESULT hres;
static HRESULT RegExp_set_lastIndex(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
{
RegExpInstance *regexp = regexp_from_jsdisp(jsthis);
HRESULT hres;
hres = jsval_copy(argv[0], &regexp->last_index_val);
if(FAILED(hres))
return hres;
TRACE("\n");
regexp->last_index = index_from_val(ctx, argv[0]);
break;
}
default:
FIXME("unimplemented flags: %x\n", flags);
return E_NOTIMPL;
}
hres = jsval_copy(value, &regexp->last_index_val);
if(FAILED(hres))
return hres;
regexp->last_index = index_from_val(ctx, value);
return S_OK;
}
@ -586,11 +593,11 @@ static void RegExp_destructor(jsdisp_t *dispex)
static const builtin_prop_t RegExp_props[] = {
{execW, RegExp_exec, PROPF_METHOD|1},
{globalW, RegExp_global, 0},
{ignoreCaseW, RegExp_ignoreCase, 0},
{lastIndexW, RegExp_lastIndex, 0},
{multilineW, RegExp_multiline, 0},
{sourceW, RegExp_source, 0},
{globalW, NULL,0, RegExp_get_global, RegExp_set_global},
{ignoreCaseW, NULL,0, RegExp_get_ignoreCase, RegExp_set_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},
{testW, RegExp_test, PROPF_METHOD|1},
{toStringW, RegExp_toString, PROPF_METHOD}
};
@ -605,11 +612,11 @@ static const builtin_info_t RegExp_info = {
};
static const builtin_prop_t RegExpInst_props[] = {
{globalW, RegExp_global, 0},
{ignoreCaseW, RegExp_ignoreCase, 0},
{lastIndexW, RegExp_lastIndex, 0},
{multilineW, RegExp_multiline, 0},
{sourceW, RegExp_source, 0}
{globalW, NULL,0, RegExp_get_global, RegExp_set_global},
{ignoreCaseW, NULL,0, RegExp_get_ignoreCase, RegExp_set_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}
};
static const builtin_info_t RegExpInst_info = {
@ -831,142 +838,98 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsv
return hres;
}
static HRESULT global_idx(script_ctx_t *ctx, DWORD flags, DWORD idx, jsval_t *r)
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
{
switch(flags) {
case DISPATCH_PROPERTYGET: {
jsstr_t *ret;
jsstr_t *ret;
ret = jsstr_substr(ctx->last_match, ctx->match_parens[idx].index, ctx->match_parens[idx].length);
if(!ret)
return E_OUTOFMEMORY;
*r = jsval_string(ret);
break;
}
case DISPATCH_PROPERTYPUT:
break;
default:
FIXME("unsupported flags\n");
return E_NOTIMPL;
}
ret = jsstr_substr(ctx->last_match, ctx->match_parens[idx].index, ctx->match_parens[idx].length);
if(!ret)
return E_OUTOFMEMORY;
*r = jsval_string(ret);
return S_OK;
}
static HRESULT RegExpConstr_idx1(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx1(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 0, r);
return global_idx(ctx, 0, r);
}
static HRESULT RegExpConstr_idx2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx2(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 1, r);
return global_idx(ctx, 1, r);
}
static HRESULT RegExpConstr_idx3(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx3(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 2, r);
return global_idx(ctx, 2, r);
}
static HRESULT RegExpConstr_idx4(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx4(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 3, r);
return global_idx(ctx, 3, r);
}
static HRESULT RegExpConstr_idx5(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx5(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 4, r);
return global_idx(ctx, 4, r);
}
static HRESULT RegExpConstr_idx6(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx6(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 5, r);
return global_idx(ctx, 5, r);
}
static HRESULT RegExpConstr_idx7(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx7(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 6, r);
return global_idx(ctx, 6, r);
}
static HRESULT RegExpConstr_idx8(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx8(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 7, r);
return global_idx(ctx, 7, r);
}
static HRESULT RegExpConstr_idx9(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_idx9(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
TRACE("\n");
return global_idx(ctx, flags, 8, r);
return global_idx(ctx, 8, r);
}
static HRESULT RegExpConstr_leftContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_leftContext(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
jsstr_t *ret;
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET: {
jsstr_t *ret;
ret = jsstr_substr(ctx->last_match, 0, ctx->last_match_index);
if(!ret)
return E_OUTOFMEMORY;
*r = jsval_string(ret);
break;
}
case DISPATCH_PROPERTYPUT:
break;
default:
FIXME("unsupported flags\n");
return E_NOTIMPL;
}
ret = jsstr_substr(ctx->last_match, 0, ctx->last_match_index);
if(!ret)
return E_OUTOFMEMORY;
*r = jsval_string(ret);
return S_OK;
}
static HRESULT RegExpConstr_rightContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT RegExpConstr_get_rightContext(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
jsstr_t *ret;
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET: {
jsstr_t *ret;
ret = jsstr_substr(ctx->last_match, ctx->last_match_index+ctx->last_match_length,
jsstr_length(ctx->last_match) - ctx->last_match_index - ctx->last_match_length);
if(!ret)
return E_OUTOFMEMORY;
*r = jsval_string(ret);
break;
}
case DISPATCH_PROPERTYPUT:
break;
default:
FIXME("unsupported flags\n");
return E_NOTIMPL;
}
ret = jsstr_substr(ctx->last_match, ctx->last_match_index+ctx->last_match_length,
jsstr_length(ctx->last_match) - ctx->last_match_index - ctx->last_match_length);
if(!ret)
return E_OUTOFMEMORY;
*r = jsval_string(ret);
return S_OK;
}
@ -1026,22 +989,22 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
static const builtin_prop_t RegExpConstr_props[] = {
{idx1W, RegExpConstr_idx1, 0},
{idx2W, RegExpConstr_idx2, 0},
{idx3W, RegExpConstr_idx3, 0},
{idx4W, RegExpConstr_idx4, 0},
{idx5W, RegExpConstr_idx5, 0},
{idx6W, RegExpConstr_idx6, 0},
{idx7W, RegExpConstr_idx7, 0},
{idx8W, RegExpConstr_idx8, 0},
{idx9W, RegExpConstr_idx9, 0},
{leftContextW, RegExpConstr_leftContext, 0},
{rightContextW, RegExpConstr_rightContext, 0}
{idx1W, NULL,0, RegExpConstr_get_idx1, builtin_set_const},
{idx2W, NULL,0, RegExpConstr_get_idx2, builtin_set_const},
{idx3W, NULL,0, RegExpConstr_get_idx3, builtin_set_const},
{idx4W, NULL,0, RegExpConstr_get_idx4, builtin_set_const},
{idx5W, NULL,0, RegExpConstr_get_idx5, builtin_set_const},
{idx6W, NULL,0, RegExpConstr_get_idx6, builtin_set_const},
{idx7W, NULL,0, RegExpConstr_get_idx7, builtin_set_const},
{idx8W, NULL,0, RegExpConstr_get_idx8, builtin_set_const},
{idx9W, NULL,0, RegExpConstr_get_idx9, builtin_set_const},
{leftContextW, NULL,0, RegExpConstr_get_leftContext, builtin_set_const},
{rightContextW, NULL,0, RegExpConstr_get_rightContext, builtin_set_const}
};
static const builtin_info_t RegExpConstr_info = {
JSCLASS_FUNCTION,
{NULL, Function_value, 0},
DEFAULT_FUNCTION_VALUE,
sizeof(RegExpConstr_props)/sizeof(*RegExpConstr_props),
RegExpConstr_props,
NULL,

View file

@ -236,6 +236,9 @@ HRESULT jsval_copy(jsval_t v, jsval_t *r)
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
{
if(V_VT(var) == (VT_VARIANT|VT_BYREF))
var = V_VARIANTREF(var);
switch(V_VT(var)) {
case VT_EMPTY:
*r = jsval_undefined();
@ -278,6 +281,9 @@ HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
case VT_INT:
*r = jsval_number(V_INT(var));
return S_OK;
case VT_UI4:
*r = jsval_number(V_UI4(var));
return S_OK;
case VT_UNKNOWN:
if(V_UNKNOWN(var)) {
IDispatch *disp;

View file

@ -35,6 +35,8 @@ STRINGTABLE
IDS_SEMICOLON "Forventet ';'"
IDS_LBRACKET "Forventet '('"
IDS_RBRACKET "Forventet ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Uafsluttet streng konstant"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -42,7 +44,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Funktion forventet"
IDS_NOT_DATE "[objekt]' er ikke en dato objekt"
IDS_NOT_NUM "Nummer forventet"

View file

@ -34,6 +34,8 @@ STRINGTABLE
IDS_SEMICOLON "';' erwartet"
IDS_LBRACKET "'(' erwartet"
IDS_RBRACKET "')' erwartet"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "konstante Zeichenkette wurde nicht abgeschlossen"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -41,7 +43,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Funktion erwartet"
IDS_NOT_DATE "'[Objekt]' ist kein Datums-Objekt"
IDS_NOT_NUM "Zahl erwartet"

View file

@ -32,6 +32,8 @@ STRINGTABLE
IDS_SEMICOLON "Expected ';'"
IDS_LBRACKET "Expected '('"
IDS_RBRACKET "Expected ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Unterminated string constant"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -39,7 +41,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Function expected"
IDS_NOT_DATE "'[object]' is not a date object"
IDS_NOT_NUM "Number expected"

View file

@ -35,6 +35,8 @@ STRINGTABLE
IDS_SEMICOLON "Esperado ';'"
IDS_LBRACKET "Esperado '('"
IDS_RBRACKET "Esperado ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Constante de cadena no terminada"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -42,7 +44,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Función esperada"
IDS_NOT_DATE "'[objeto]' no es un objeto fecha"
IDS_NOT_NUM "Numero esperado"

View file

@ -37,6 +37,8 @@ STRINGTABLE
IDS_SEMICOLON "« ; » attendu"
IDS_LBRACKET "« ( » attendu"
IDS_RBRACKET "« ) » attendu"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Constante chaîne de caractères non clôturée"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -44,7 +46,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Fonction attendue"
IDS_NOT_DATE "« [objet] » n'est pas un objet de type date"
IDS_NOT_NUM "Nombre attendu"

View file

@ -34,6 +34,8 @@ STRINGTABLE
IDS_SEMICOLON "צפוי ';'"
IDS_LBRACKET "צפוי '('"
IDS_RBRACKET "צפוי ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Unterminated string constant"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -41,7 +43,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "פונקציה הייתה צפוייה"
IDS_NOT_DATE "'[object]' is not a date object"
IDS_NOT_NUM "מספר היה צפוי"

View file

@ -35,6 +35,8 @@ STRINGTABLE
IDS_SEMICOLON "Hiányzó ';'"
IDS_LBRACKET "Hiányzó '('"
IDS_RBRACKET "Hiányzó ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Lezáratlan sztring konstans"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -42,7 +44,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Függvényt vártam"
IDS_NOT_DATE "'Az [object]' nem egy date (dátum) objektum"
IDS_NOT_NUM "Számot vártam"

View file

@ -36,6 +36,8 @@ STRINGTABLE
IDS_SEMICOLON "Richiesto ';'"
IDS_LBRACKET "Richiesto '('"
IDS_RBRACKET "Richiesto ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Costante stringa non terminata"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -43,7 +45,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Richiesta una funzione"
IDS_NOT_DATE "'[oggetto]' non è un oggetto data"
IDS_NOT_NUM "Richiesto un numero"

View file

@ -36,6 +36,8 @@ STRINGTABLE
IDS_SEMICOLON "';'を期待していました"
IDS_LBRACKET "'('を期待していました"
IDS_RBRACKET "')'を期待していました"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "文字列定数が終端していません"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -43,7 +45,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "関数を期待していました"
IDS_NOT_DATE "'[object]' は日付オブジェクトではありません"
IDS_NOT_NUM "数値を期待していました"

View file

@ -36,6 +36,8 @@ STRINGTABLE
IDS_SEMICOLON "';' 가 필요합니다"
IDS_LBRACKET "'(' 가 필요합니다"
IDS_RBRACKET "')' 가 필요합니다"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "띁나지 않은 문자열 상수"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -43,7 +45,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "함수가 필요합니다"
IDS_NOT_DATE "'[객체]' 는 날짜 객체가 아닙니다"
IDS_NOT_NUM "숫자가 필요합니다"

View file

@ -35,6 +35,8 @@ STRINGTABLE
IDS_SEMICOLON "Tikėtasi „;“"
IDS_LBRACKET "Tikėtasi „(“"
IDS_RBRACKET "Tikėtasi „)“"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Nebaigta eilutės konstanta"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -42,7 +44,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Tikėtasi funkcijos"
IDS_NOT_DATE "„[objektas]“ nėra datos objektas"
IDS_NOT_NUM "Tikėtasi skaičiaus"

View file

@ -34,6 +34,8 @@ STRINGTABLE
IDS_SEMICOLON "';' verwacht"
IDS_LBRACKET "'(' verwacht"
IDS_RBRACKET "')' verwacht"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Onafgesloten tekenreeksconstante"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -41,7 +43,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Functie verwacht"
IDS_NOT_DATE "'[object]' is geen datum object"
IDS_NOT_NUM "Getal verwacht"

View file

@ -34,6 +34,8 @@ STRINGTABLE
IDS_SEMICOLON "Forventet ';'"
IDS_LBRACKET "Forventet '('"
IDS_RBRACKET "Forventet ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Uavsluttet strengkonstant"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -41,7 +43,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Forventet funksjon"
IDS_NOT_DATE "'[object]' er ikke et dataobjekt"
IDS_NOT_NUM "Forventet nummer"

View file

@ -32,6 +32,8 @@ STRINGTABLE
IDS_SEMICOLON "Oczekiwane ';'"
IDS_LBRACKET "Oczekiwane '('"
IDS_RBRACKET "Oczekiwane ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Niezakończona stała znakowa"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -39,7 +41,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Oczekiwana funkcja"
IDS_NOT_DATE "'[obiekt]' nie jest obiektem daty"
IDS_NOT_NUM "Oczekiwana liczba"

View file

@ -35,6 +35,8 @@ STRINGTABLE
IDS_SEMICOLON "';' esperado"
IDS_LBRACKET "'(' esperado"
IDS_RBRACKET "')' esperado"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Constante de string não terminada"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -42,7 +44,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Função esperada"
IDS_NOT_DATE "'[object]' não é um objeto de data"
IDS_NOT_NUM "Número esperado"
@ -78,6 +82,8 @@ STRINGTABLE
IDS_SEMICOLON "';' esperado"
IDS_LBRACKET "'(' esperado"
IDS_RBRACKET "')' esperado"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Constante de string não terminada"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -85,7 +91,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Função esperada"
IDS_NOT_DATE "'[object]' não é um objecto de data"
IDS_NOT_NUM "Número esperado"

View file

@ -37,6 +37,8 @@ STRINGTABLE
IDS_SEMICOLON "Se așteaptă „;”"
IDS_LBRACKET "Se așteaptă „(”"
IDS_RBRACKET "Se așteaptă „)”"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Caracter nevalid"
IDS_UNTERMINATED_STR "Șir constant neterminat"
IDS_MISPLACED_RETURN "Poziția 'return' este în afara funcției"
@ -44,7 +46,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Nu se poate admite 'continue' în afara buclelor"
IDS_LABEL_REDEFINED "Eticheta este redefinită"
IDS_LABEL_NOT_FOUND "Etichetă nu este găsită"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Compilarea condițională este dezactivată"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Se așteaptă o funcție"
IDS_NOT_DATE "„[obiect]” nu este un obiect de tip dată"
IDS_NOT_NUM "Se așteaptă un număr"

View file

@ -36,6 +36,8 @@ STRINGTABLE
IDS_SEMICOLON "Предполагается наличие ';'"
IDS_LBRACKET "Предполагается наличие '('"
IDS_RBRACKET "Предполагается наличие ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Недопустимый символ"
IDS_UNTERMINATED_STR "Незавершённая строковая константа"
IDS_MISPLACED_RETURN "Инструкция 'return' вне функции"
@ -43,7 +45,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Инструкция 'continue' не может находиться вне блока loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Ожидается функция"
IDS_NOT_DATE "'[object]' не объект типа 'date'"
IDS_NOT_NUM "Ожидается число"

View file

@ -34,6 +34,8 @@ STRINGTABLE
IDS_SEMICOLON "Pričakujem ';'"
IDS_LBRACKET "Pričakujem '('"
IDS_RBRACKET "Pričakujem ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Nezaključen niz"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -41,7 +43,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Pričakujem funkcijo"
IDS_NOT_DATE "'[object]' ni date objekt"
IDS_NOT_NUM "Pričakujem število"

View file

@ -35,6 +35,8 @@ STRINGTABLE
IDS_SEMICOLON "Pritej ';'"
IDS_LBRACKET "Pritej '('"
IDS_RBRACKET "Pritej ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "String i pambyllur konstant"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -42,7 +44,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Funksioni Pritej"
IDS_NOT_DATE "'[objekt]' nuk eshte nje objekt date"
IDS_NOT_NUM "Numri Pritej"

View file

@ -32,6 +32,8 @@ STRINGTABLE
IDS_SEMICOLON """;"" bekleniyordu."
IDS_LBRACKET """("" bekleniyordu."
IDS_RBRACKET """)"" bekleniyordu."
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Geçersiz damga."
IDS_UNTERMINATED_STR "Sonlandırılmamış dizgi değişmezi."
IDS_MISPLACED_RETURN """return"" deyişi işlecin dışında."
@ -39,7 +41,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Döngü dışında ""continue"" olamaz."
IDS_LABEL_REDEFINED "Etiket yeniden tanımlandı."
IDS_LABEL_NOT_FOUND "Etiket bulunamadı."
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Şartlı derleme kapalı."
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "İşleç bekleniyordu."
IDS_NOT_DATE """[nesne]"" bir zaman nesnesi değil."
IDS_NOT_NUM "Sayı bekleniyordu."

View file

@ -36,6 +36,8 @@ STRINGTABLE
IDS_SEMICOLON "Очікується ';'"
IDS_LBRACKET "Очікується '('"
IDS_RBRACKET "Очікується ')'"
IDS_EXPECTED_IDENTIFIER "Expected identifier"
IDS_EXPECTED_ASSIGN "Expected '='"
IDS_INVALID_CHAR "Invalid character"
IDS_UNTERMINATED_STR "Незавершена рядкова константа"
IDS_MISPLACED_RETURN "'return' statement outside of function"
@ -43,7 +45,9 @@ STRINGTABLE
IDS_INVALID_CONTINUE "Can't have 'continue' outside of loop"
IDS_LABEL_REDEFINED "Label redefined"
IDS_LABEL_NOT_FOUND "Label not found"
IDS_EXPECTED_CCEND "Expected '@end'"
IDS_DISABLED_CC "Conditional compilation is turned off"
IDS_EXPECTED_AT "Expected '@'"
IDS_NOT_FUNC "Очікується функція"
IDS_NOT_DATE "'[object]' не об'єкт типу date"
IDS_NOT_NUM "Очікується число"

View file

@ -51,6 +51,9 @@ static const WCHAR voidW[] = {'v','o','i','d',0};
static const WCHAR whileW[] = {'w','h','i','l','e',0};
static const WCHAR withW[] = {'w','i','t','h',0};
static const WCHAR elifW[] = {'e','l','i','f',0};
static const WCHAR endW[] = {'e','n','d',0};
static const struct {
const WCHAR *word;
int token;
@ -99,6 +102,11 @@ static BOOL is_identifier_char(WCHAR c)
return isalnumW(c) || c == '$' || c == '_' || c == '\\';
}
static BOOL is_identifier_first_char(WCHAR c)
{
return isalphaW(c) || c == '$' || c == '_' || c == '\\';
}
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
{
const WCHAR *p1 = ctx->ptr;
@ -219,6 +227,16 @@ static BOOL skip_comment(parser_ctx_t *ctx)
return TRUE;
}
static BOOL skip_spaces(parser_ctx_t *ctx)
{
while(ctx->ptr < ctx->end && (isspaceW(*ctx->ptr) || *ctx->ptr == 0xFEFF /* UTF16 BOM */)) {
if(is_endline(*ctx->ptr++))
ctx->nl = TRUE;
}
return ctx->ptr != ctx->end;
}
static BOOL unescape(WCHAR *str)
{
WCHAR *pd, *p, c;
@ -376,7 +394,7 @@ literal_t *new_boolean_literal(parser_ctx_t *ctx, BOOL bval)
return ret;
}
static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **literal)
static BOOL parse_double_literal(parser_ctx_t *ctx, LONG int_part, double *ret)
{
LONGLONG d, hlp;
int exp = 0;
@ -423,13 +441,15 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
ctx->ptr++;
}else if(!isdigitW(*ctx->ptr)) {
WARN("Expected exponent part\n");
return lex_error(ctx, E_FAIL);
lex_error(ctx, E_FAIL);
return FALSE;
}
}
if(ctx->ptr == ctx->end) {
WARN("unexpected end of file\n");
return lex_error(ctx, E_FAIL);
lex_error(ctx, E_FAIL);
return FALSE;
}
while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) {
@ -445,14 +465,15 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
if(is_identifier_char(*ctx->ptr)) {
WARN("wrong char after zero\n");
return lex_error(ctx, JS_E_MISSING_SEMICOLON);
lex_error(ctx, JS_E_MISSING_SEMICOLON);
return FALSE;
}
*literal = new_double_literal(ctx, exp>=0 ? d*pow(10, exp) : d/pow(10, -exp));
return tNumericLiteral;
*ret = exp>=0 ? d*pow(10, exp) : d/pow(10, -exp);
return TRUE;
}
static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
{
LONG l, d;
@ -461,7 +482,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
if(*ctx->ptr == 'x' || *ctx->ptr == 'X') {
if(++ctx->ptr == ctx->end) {
ERR("unexpected end of file\n");
return 0;
return FALSE;
}
while(ctx->ptr < ctx->end && (d = hex_to_int(*ctx->ptr)) != -1) {
@ -471,11 +492,12 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
if(ctx->ptr < ctx->end && is_identifier_char(*ctx->ptr)) {
WARN("unexpected identifier char\n");
return lex_error(ctx, JS_E_MISSING_SEMICOLON);
lex_error(ctx, JS_E_MISSING_SEMICOLON);
return FALSE;
}
*literal = new_double_literal(ctx, l);
return tNumericLiteral;
*ret = l;
return TRUE;
}
if(isdigitW(*ctx->ptr)) {
@ -497,30 +519,28 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
/* FIXME: Do we need it here? */
if(ctx->ptr < ctx->end && (is_identifier_char(*ctx->ptr) || *ctx->ptr == '.')) {
WARN("wrong char after octal literal: '%c'\n", *ctx->ptr);
return lex_error(ctx, JS_E_MISSING_SEMICOLON);
lex_error(ctx, JS_E_MISSING_SEMICOLON);
return FALSE;
}
*literal = new_double_literal(ctx, val);
return tNumericLiteral;
*ret = val;
return TRUE;
}
if(is_identifier_char(*ctx->ptr)) {
WARN("wrong char after zero\n");
return lex_error(ctx, JS_E_MISSING_SEMICOLON);
lex_error(ctx, JS_E_MISSING_SEMICOLON);
return FALSE;
}
}
return parse_double_literal(ctx, l, literal);
return parse_double_literal(ctx, l, ret);
}
static int next_token(parser_ctx_t *ctx, void *lval)
{
do {
while(ctx->ptr < ctx->end && isspaceW(*ctx->ptr)) {
if(is_endline(*ctx->ptr++))
ctx->nl = TRUE;
}
if(ctx->ptr == ctx->end)
if(!skip_spaces(ctx))
return tEOF;
}while(skip_comment(ctx) || skip_html_comment(ctx));
@ -538,8 +558,15 @@ static int next_token(parser_ctx_t *ctx, void *lval)
return parse_identifier(ctx, lval);
}
if(isdigitW(*ctx->ptr))
return parse_numeric_literal(ctx, lval);
if(isdigitW(*ctx->ptr)) {
double n;
if(!parse_numeric_literal(ctx, &n))
return -1;
*(literal_t**)lval = new_double_literal(ctx, n);
return tNumericLiteral;
}
switch(*ctx->ptr) {
case '{':
@ -559,8 +586,13 @@ static int next_token(parser_ctx_t *ctx, void *lval)
return '}';
case '.':
if(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr))
return parse_double_literal(ctx, 0, lval);
if(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) {
double n;
if(!parse_double_literal(ctx, 0, &n))
return -1;
*(literal_t**)lval = new_double_literal(ctx, n);
return tNumericLiteral;
}
return '.';
case '<':
@ -759,11 +791,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
}
struct _cc_var_t {
BOOL is_num;
union {
BOOL b;
DOUBLE n;
} u;
ccval_t val;
struct _cc_var_t *next;
unsigned name_len;
WCHAR name[0];
@ -781,18 +809,18 @@ void release_cc(cc_ctx_t *cc)
heap_free(cc);
}
static BOOL add_cc_var(cc_ctx_t *cc, const WCHAR *name, cc_var_t *v)
static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
{
cc_var_t *new_v;
unsigned len;
len = strlenW(name);
if(len == -1)
len = strlenW(name);
new_v = heap_alloc(sizeof(cc_var_t) + (len+1)*sizeof(WCHAR));
if(!new_v)
return FALSE;
memcpy(new_v, v, sizeof(*v));
new_v->val = v;
memcpy(new_v->name, name, (len+1)*sizeof(WCHAR));
new_v->name_len = len;
new_v->next = cc->vars;
@ -812,10 +840,9 @@ static cc_var_t *find_cc_var(cc_ctx_t *cc, const WCHAR *name, unsigned name_len)
return NULL;
}
static int init_cc(parser_ctx_t *ctx)
static BOOL init_cc(parser_ctx_t *ctx)
{
cc_ctx_t *cc;
cc_var_t v;
static const WCHAR _win32W[] = {'_','w','i','n','3','2',0};
static const WCHAR _win64W[] = {'_','w','i','n','6','4',0};
@ -826,39 +853,144 @@ static int init_cc(parser_ctx_t *ctx)
static const WCHAR _jscript_versionW[] = {'_','j','s','c','r','i','p','t','_','v','e','r','s','i','o','n',0};
if(ctx->script->cc)
return 0;
return TRUE;
cc = heap_alloc(sizeof(cc_ctx_t));
if(!cc)
return lex_error(ctx, E_OUTOFMEMORY);
if(!cc) {
lex_error(ctx, E_OUTOFMEMORY);
return FALSE;
}
cc->vars = NULL;
v.is_num = FALSE;
v.u.b = TRUE;
if(!add_cc_var(cc, _jscriptW, &v)
|| !add_cc_var(cc, sizeof(void*) == 8 ? _win64W : _win32W, &v)
|| !add_cc_var(cc, sizeof(void*) == 8 ? _amd64W : _x86W, &v)) {
release_cc(cc);
return lex_error(ctx, E_OUTOFMEMORY);
}
v.is_num = TRUE;
v.u.n = JSCRIPT_BUILD_VERSION;
if(!add_cc_var(cc, _jscript_buildW, &v)) {
if(!new_cc_var(cc, _jscriptW, -1, ccval_bool(TRUE))
|| !new_cc_var(cc, sizeof(void*) == 8 ? _win64W : _win32W, -1, ccval_bool(TRUE))
|| !new_cc_var(cc, sizeof(void*) == 8 ? _amd64W : _x86W, -1, ccval_bool(TRUE))
|| !new_cc_var(cc, _jscript_versionW, -1, ccval_num(JSCRIPT_MAJOR_VERSION + (DOUBLE)JSCRIPT_MINOR_VERSION/10.0))
|| !new_cc_var(cc, _jscript_buildW, -1, ccval_num(JSCRIPT_BUILD_VERSION))) {
release_cc(cc);
return lex_error(ctx, E_OUTOFMEMORY);
}
v.u.n = JSCRIPT_MAJOR_VERSION + (DOUBLE)JSCRIPT_MINOR_VERSION/10.0;
if(!add_cc_var(cc, _jscript_versionW, &v)) {
release_cc(cc);
return lex_error(ctx, E_OUTOFMEMORY);
lex_error(ctx, E_OUTOFMEMORY);
return FALSE;
}
ctx->script->cc = cc;
return TRUE;
}
static BOOL parse_cc_identifier(parser_ctx_t *ctx, const WCHAR **ret, unsigned *ret_len)
{
if(*ctx->ptr != '@') {
lex_error(ctx, JS_E_EXPECTED_AT);
return FALSE;
}
if(!is_identifier_first_char(*++ctx->ptr)) {
lex_error(ctx, JS_E_EXPECTED_IDENTIFIER);
return FALSE;
}
*ret = ctx->ptr;
while(++ctx->ptr < ctx->end && is_identifier_char(*ctx->ptr));
*ret_len = ctx->ptr - *ret;
return TRUE;
}
int try_parse_ccval(parser_ctx_t *ctx, ccval_t *r)
{
if(!skip_spaces(ctx))
return -1;
if(isdigitW(*ctx->ptr)) {
double n;
if(!parse_numeric_literal(ctx, &n))
return -1;
*r = ccval_num(n);
return 1;
}
if(*ctx->ptr == '@') {
const WCHAR *ident;
unsigned ident_len;
cc_var_t *cc_var;
if(!parse_cc_identifier(ctx, &ident, &ident_len))
return -1;
cc_var = find_cc_var(ctx->script->cc, ident, ident_len);
*r = cc_var ? cc_var->val : ccval_num(NAN);
return 1;
}
if(!check_keyword(ctx, trueW, NULL)) {
*r = ccval_bool(TRUE);
return 1;
}
if(!check_keyword(ctx, falseW, NULL)) {
*r = ccval_bool(FALSE);
return 1;
}
return 0;
}
static int skip_code(parser_ctx_t *ctx, BOOL exec_else)
{
int if_depth = 1;
const WCHAR *ptr;
while(1) {
ptr = strchrW(ctx->ptr, '@');
if(!ptr) {
WARN("No @end\n");
return lex_error(ctx, JS_E_EXPECTED_CCEND);
}
ctx->ptr = ptr+1;
if(!check_keyword(ctx, endW, NULL)) {
if(--if_depth)
continue;
return 0;
}
if(exec_else && !check_keyword(ctx, elifW, NULL)) {
if(if_depth > 1)
continue;
if(!skip_spaces(ctx) || *ctx->ptr != '(')
return lex_error(ctx, JS_E_MISSING_LBRACKET);
if(!parse_cc_expr(ctx))
return -1;
if(!get_ccbool(ctx->ccval))
continue; /* skip block of code */
/* continue parsing */
ctx->cc_if_depth++;
return 0;
}
if(exec_else && !check_keyword(ctx, elseW, NULL)) {
if(if_depth > 1)
continue;
/* parse else block */
ctx->cc_if_depth++;
return 0;
}
if(!check_keyword(ctx, ifW, NULL)) {
if_depth++;
continue;
}
ctx->ptr++;
}
}
static int cc_token(parser_ctx_t *ctx, void *lval)
{
unsigned id_len = 0;
@ -866,37 +998,78 @@ static int cc_token(parser_ctx_t *ctx, void *lval)
static const WCHAR cc_onW[] = {'c','c','_','o','n',0};
static const WCHAR setW[] = {'s','e','t',0};
static const WCHAR elifW[] = {'e','l','i','f',0};
static const WCHAR endW[] = {'e','n','d',0};
ctx->ptr++;
if(!check_keyword(ctx, cc_onW, NULL))
return init_cc(ctx);
return init_cc(ctx) ? 0 : -1;
if(!check_keyword(ctx, setW, NULL)) {
FIXME("@set not implemented\n");
return lex_error(ctx, E_NOTIMPL);
const WCHAR *ident;
unsigned ident_len;
cc_var_t *var;
if(!init_cc(ctx))
return -1;
if(!skip_spaces(ctx))
return lex_error(ctx, JS_E_EXPECTED_AT);
if(!parse_cc_identifier(ctx, &ident, &ident_len))
return -1;
if(!skip_spaces(ctx) || *ctx->ptr != '=')
return lex_error(ctx, JS_E_EXPECTED_ASSIGN);
ctx->ptr++;
if(!parse_cc_expr(ctx)) {
WARN("parsing CC expression failed\n");
return -1;
}
var = find_cc_var(ctx->script->cc, ident, ident_len);
if(var) {
var->val = ctx->ccval;
}else {
if(!new_cc_var(ctx->script->cc, ident, ident_len, ctx->ccval))
return lex_error(ctx, E_OUTOFMEMORY);
}
return 0;
}
if(!check_keyword(ctx, ifW, NULL)) {
FIXME("@if not implemented\n");
return lex_error(ctx, E_NOTIMPL);
if(!init_cc(ctx))
return -1;
if(!skip_spaces(ctx) || *ctx->ptr != '(')
return lex_error(ctx, JS_E_MISSING_LBRACKET);
if(!parse_cc_expr(ctx))
return -1;
if(get_ccbool(ctx->ccval)) {
/* continue parsing block inside if */
ctx->cc_if_depth++;
return 0;
}
return skip_code(ctx, TRUE);
}
if(!check_keyword(ctx, elifW, NULL)) {
FIXME("@elif not implemented\n");
return lex_error(ctx, E_NOTIMPL);
}
if(!check_keyword(ctx, elifW, NULL) || !check_keyword(ctx, elseW, NULL)) {
if(!ctx->cc_if_depth)
return lex_error(ctx, JS_E_SYNTAX);
if(!check_keyword(ctx, elseW, NULL)) {
FIXME("@else not implemented\n");
return lex_error(ctx, E_NOTIMPL);
return skip_code(ctx, FALSE);
}
if(!check_keyword(ctx, endW, NULL)) {
FIXME("@end not implemented\n");
return lex_error(ctx, E_NOTIMPL);
if(!ctx->cc_if_depth)
return lex_error(ctx, JS_E_SYNTAX);
ctx->cc_if_depth--;
return 0;
}
if(!ctx->script->cc)
@ -911,12 +1084,12 @@ static int cc_token(parser_ctx_t *ctx, void *lval)
var = find_cc_var(ctx->script->cc, ctx->ptr, id_len);
ctx->ptr += id_len;
if(!var || var->is_num) {
*(literal_t**)lval = new_double_literal(ctx, var ? var->u.n : NAN);
if(!var || var->val.is_num) {
*(literal_t**)lval = new_double_literal(ctx, var ? var->val.u.n : NAN);
return tNumericLiteral;
}
*(literal_t**)lval = new_boolean_literal(ctx, var->u.b);
*(literal_t**)lval = new_boolean_literal(ctx, var->val.u.b);
return tBooleanLiteral;
}

View file

@ -34,9 +34,14 @@ static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
#define NUMBER_TOSTRING_BUF_SIZE 64
#define NUMBER_DTOA_SIZE 18
static inline NumberInstance *number_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, NumberInstance, dispex);
}
static inline NumberInstance *number_from_vdisp(vdisp_t *vdisp)
{
return (NumberInstance*)vdisp->u.jsdisp;
return number_from_jsdisp(vdisp->u.jsdisp);
}
static inline NumberInstance *number_this(vdisp_t *jsthis)
@ -490,23 +495,13 @@ static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
return S_OK;
}
static HRESULT Number_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT Number_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
NumberInstance *number = number_from_vdisp(jsthis);
NumberInstance *number = number_from_jsdisp(jsthis);
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL);
case DISPATCH_PROPERTYGET:
*r = jsval_number(number->value);
break;
default:
FIXME("flags %x\n", flags);
return E_NOTIMPL;
}
TRACE("(%p)\n", number);
*r = jsval_number(number->value);
return S_OK;
}
@ -521,7 +516,7 @@ static const builtin_prop_t Number_props[] = {
static const builtin_info_t Number_info = {
JSCLASS_NUMBER,
{NULL, Number_value, 0},
{NULL, NULL,0, Number_get_value},
sizeof(Number_props)/sizeof(*Number_props),
Number_props,
NULL,
@ -530,7 +525,7 @@ static const builtin_info_t Number_info = {
static const builtin_info_t NumberInst_info = {
JSCLASS_NUMBER,
{NULL, Number_value, 0},
{NULL, NULL,0, Number_get_value},
0, NULL,
NULL,
NULL

View file

@ -201,26 +201,17 @@ static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
return E_NOTIMPL;
}
static HRESULT Object_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT Object_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
jsstr_t *ret;
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL);
case DISPATCH_PROPERTYGET: {
jsstr_t *ret = jsstr_alloc(default_valueW);
if(!ret)
return E_OUTOFMEMORY;
*r = jsval_string(ret);
break;
}
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
ret = jsstr_alloc(default_valueW);
if(!ret)
return E_OUTOFMEMORY;
*r = jsval_string(ret);
return S_OK;
}
@ -240,7 +231,7 @@ static const builtin_prop_t Object_props[] = {
static const builtin_info_t Object_info = {
JSCLASS_OBJECT,
{NULL, Object_value, 0},
{NULL, NULL,0, Object_get_value},
sizeof(Object_props)/sizeof(*Object_props),
Object_props,
Object_destructor,
@ -249,7 +240,7 @@ static const builtin_info_t Object_info = {
static const builtin_info_t ObjectInst_info = {
JSCLASS_OBJECT,
{NULL, Object_value, 0},
{NULL, NULL,0, Object_get_value},
0, NULL,
Object_destructor,
NULL

View file

@ -0,0 +1,396 @@
/*
* Copyright 2014 Jacek Caban for CodeWeavers
*
* 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
*/
#pragma once
typedef struct _source_elements_t source_elements_t;
typedef struct _expression_t expression_t;
typedef struct _statement_t statement_t;
typedef struct {
BOOL is_num;
union {
BOOL b;
double n;
} u;
} ccval_t;
typedef struct _parser_ctx_t {
const WCHAR *begin;
const WCHAR *end;
const WCHAR *ptr;
script_ctx_t *script;
source_elements_t *source;
BOOL nl;
BOOL implicit_nl_semicolon;
BOOL is_html;
BOOL lexer_error;
HRESULT hres;
ccval_t ccval;
unsigned cc_if_depth;
heap_pool_t heap;
} parser_ctx_t;
HRESULT script_parse(script_ctx_t*,const WCHAR*,const WCHAR*,BOOL,parser_ctx_t**) DECLSPEC_HIDDEN;
void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN;
int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN;
static inline void *parser_alloc(parser_ctx_t *ctx, DWORD size)
{
return heap_pool_alloc(&ctx->heap, size);
}
static inline void *parser_alloc_tmp(parser_ctx_t *ctx, DWORD size)
{
return heap_pool_alloc(&ctx->script->tmp_heap, size);
}
typedef enum {
LT_DOUBLE,
LT_STRING,
LT_BOOL,
LT_NULL,
LT_REGEXP
}literal_type_t;
typedef struct {
literal_type_t type;
union {
double dval;
const WCHAR *wstr;
BOOL bval;
struct {
const WCHAR *str;
DWORD str_len;
DWORD flags;
} regexp;
} u;
} literal_t;
literal_t *parse_regexp(parser_ctx_t*) DECLSPEC_HIDDEN;
literal_t *new_boolean_literal(parser_ctx_t*,BOOL) DECLSPEC_HIDDEN;
typedef struct _variable_declaration_t {
const WCHAR *identifier;
expression_t *expr;
struct _variable_declaration_t *next;
struct _variable_declaration_t *global_next; /* for compiler */
} variable_declaration_t;
typedef enum {
STAT_BLOCK,
STAT_BREAK,
STAT_CONTINUE,
STAT_EMPTY,
STAT_EXPR,
STAT_FOR,
STAT_FORIN,
STAT_IF,
STAT_LABEL,
STAT_RETURN,
STAT_SWITCH,
STAT_THROW,
STAT_TRY,
STAT_VAR,
STAT_WHILE,
STAT_WITH
} statement_type_t;
struct _statement_t {
statement_type_t type;
statement_t *next;
};
typedef struct {
statement_t stat;
statement_t *stat_list;
} block_statement_t;
typedef struct {
statement_t stat;
variable_declaration_t *variable_list;
} var_statement_t;
typedef struct {
statement_t stat;
expression_t *expr;
} expression_statement_t;
typedef struct {
statement_t stat;
expression_t *expr;
statement_t *if_stat;
statement_t *else_stat;
} if_statement_t;
typedef struct {
statement_t stat;
BOOL do_while;
expression_t *expr;
statement_t *statement;
} while_statement_t;
typedef struct {
statement_t stat;
variable_declaration_t *variable_list;
expression_t *begin_expr;
expression_t *expr;
expression_t *end_expr;
statement_t *statement;
} for_statement_t;
typedef struct {
statement_t stat;
variable_declaration_t *variable;
expression_t *expr;
expression_t *in_expr;
statement_t *statement;
} forin_statement_t;
typedef struct {
statement_t stat;
const WCHAR *identifier;
} branch_statement_t;
typedef struct {
statement_t stat;
expression_t *expr;
statement_t *statement;
} with_statement_t;
typedef struct {
statement_t stat;
const WCHAR *identifier;
statement_t *statement;
} labelled_statement_t;
typedef struct _case_clausule_t {
expression_t *expr;
statement_t *stat;
struct _case_clausule_t *next;
} case_clausule_t;
typedef struct {
statement_t stat;
expression_t *expr;
case_clausule_t *case_list;
} switch_statement_t;
typedef struct {
const WCHAR *identifier;
statement_t *statement;
} catch_block_t;
typedef struct {
statement_t stat;
statement_t *try_statement;
catch_block_t *catch_block;
statement_t *finally_statement;
} try_statement_t;
typedef enum {
EXPR_COMMA,
EXPR_OR,
EXPR_AND,
EXPR_BOR,
EXPR_BXOR,
EXPR_BAND,
EXPR_INSTANCEOF,
EXPR_IN,
EXPR_ADD,
EXPR_SUB,
EXPR_MUL,
EXPR_DIV,
EXPR_MOD,
EXPR_DELETE,
EXPR_VOID,
EXPR_TYPEOF,
EXPR_MINUS,
EXPR_PLUS,
EXPR_POSTINC,
EXPR_POSTDEC,
EXPR_PREINC,
EXPR_PREDEC,
EXPR_EQ,
EXPR_EQEQ,
EXPR_NOTEQ,
EXPR_NOTEQEQ,
EXPR_LESS,
EXPR_LESSEQ,
EXPR_GREATER,
EXPR_GREATEREQ,
EXPR_BITNEG,
EXPR_LOGNEG,
EXPR_LSHIFT,
EXPR_RSHIFT,
EXPR_RRSHIFT,
EXPR_ASSIGN,
EXPR_ASSIGNLSHIFT,
EXPR_ASSIGNRSHIFT,
EXPR_ASSIGNRRSHIFT,
EXPR_ASSIGNADD,
EXPR_ASSIGNSUB,
EXPR_ASSIGNMUL,
EXPR_ASSIGNDIV,
EXPR_ASSIGNMOD,
EXPR_ASSIGNAND,
EXPR_ASSIGNOR,
EXPR_ASSIGNXOR,
EXPR_COND,
EXPR_ARRAY,
EXPR_MEMBER,
EXPR_NEW,
EXPR_CALL,
EXPR_THIS,
EXPR_FUNC,
EXPR_IDENT,
EXPR_ARRAYLIT,
EXPR_PROPVAL,
EXPR_LITERAL
} expression_type_t;
struct _expression_t {
expression_type_t type;
};
typedef struct _parameter_t {
const WCHAR *identifier;
struct _parameter_t *next;
} parameter_t;
struct _source_elements_t {
statement_t *statement;
statement_t *statement_tail;
};
typedef struct _function_expression_t {
expression_t expr;
const WCHAR *identifier;
parameter_t *parameter_list;
source_elements_t *source_elements;
const WCHAR *src_str;
DWORD src_len;
struct _function_expression_t *next; /* for compiler */
} function_expression_t;
typedef struct {
expression_t expr;
expression_t *expression1;
expression_t *expression2;
} binary_expression_t;
typedef struct {
expression_t expr;
expression_t *expression;
} unary_expression_t;
typedef struct {
expression_t expr;
expression_t *expression;
expression_t *true_expression;
expression_t *false_expression;
} conditional_expression_t;
typedef struct {
expression_t expr;
expression_t *expression;
const WCHAR *identifier;
} member_expression_t;
typedef struct _argument_t {
expression_t *expr;
struct _argument_t *next;
} argument_t;
typedef struct {
expression_t expr;
expression_t *expression;
argument_t *argument_list;
} call_expression_t;
typedef struct {
expression_t expr;
const WCHAR *identifier;
} identifier_expression_t;
typedef struct {
expression_t expr;
literal_t *literal;
} literal_expression_t;
typedef struct _array_element_t {
int elision;
expression_t *expr;
struct _array_element_t *next;
} array_element_t;
typedef struct {
expression_t expr;
array_element_t *element_list;
int length;
} array_literal_expression_t;
typedef struct _prop_val_t {
literal_t *name;
expression_t *value;
struct _prop_val_t *next;
} prop_val_t;
typedef struct {
expression_t expr;
prop_val_t *property_list;
} property_value_expression_t;
BOOL try_parse_ccval(parser_ctx_t*,ccval_t*) DECLSPEC_HIDDEN;
BOOL parse_cc_expr(parser_ctx_t*) DECLSPEC_HIDDEN;
static inline ccval_t ccval_num(double n)
{
ccval_t r;
r.is_num = TRUE;
r.u.n = n;
return r;
}
static inline ccval_t ccval_bool(BOOL b)
{
ccval_t r;
r.is_num = FALSE;
r.u.b = b;
return r;
}
static inline BOOL get_ccbool(ccval_t v)
{
return v.is_num ? v.u.n != 0 : v.u.b;
}
static inline double get_ccnum(ccval_t v)
{
return v.is_num ? v.u.n : v.u.b;
}

File diff suppressed because it is too large Load diff

View file

@ -97,7 +97,7 @@ extern int parser_debug;
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 144 "parser.y" /* yacc.c:1909 */
#line 145 "parser.y" /* yacc.c:1909 */
int ival;
const WCHAR *srcptr;

View file

@ -19,11 +19,6 @@
%{
#include "jscript.h"
#include "engine.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);

View file

@ -34,6 +34,8 @@
#define IDS_SEMICOLON 0x03EC
#define IDS_LBRACKET 0x03ED
#define IDS_RBRACKET 0x03EE
#define IDS_EXPECTED_IDENTIFIER 0x03f2
#define IDS_EXPECTED_ASSIGN 0x03f3
#define IDS_INVALID_CHAR 0x03F6
#define IDS_UNTERMINATED_STR 0x03F7
#define IDS_MISPLACED_RETURN 0x03FA
@ -41,7 +43,9 @@
#define IDS_INVALID_CONTINUE 0x03FC
#define IDS_LABEL_REDEFINED 0x0401
#define IDS_LABEL_NOT_FOUND 0x0402
#define IDS_EXPECTED_CCEND 0x0405
#define IDS_DISABLED_CC 0x0406
#define IDS_EXPECTED_AT 0x0408
#define IDS_NOT_FUNC 0x138A
#define IDS_NOT_DATE 0x138E
#define IDS_NOT_NUM 0x1389

View file

@ -60,9 +60,14 @@ static const WCHAR toLocaleUpperCaseW[] = {'t','o','L','o','c','a','l','e','U','
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};
static inline StringInstance *string_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, StringInstance, dispex);
}
static inline StringInstance *string_from_vdisp(vdisp_t *vdisp)
{
return (StringInstance*)vdisp->u.jsdisp;
return string_from_jsdisp(vdisp->u.jsdisp);
}
static inline StringInstance *string_this(vdisp_t *jsthis)
@ -98,26 +103,22 @@ static HRESULT get_string_flat_val(script_ctx_t *ctx, vdisp_t *jsthis, jsstr_t *
return E_OUTOFMEMORY;
}
static HRESULT String_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT String_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
StringInstance *string = (StringInstance*)jsthis;
TRACE("%p\n", jsthis);
switch(flags) {
case DISPATCH_PROPERTYGET: {
StringInstance *string = string_from_vdisp(jsthis);
*r = jsval_number(jsstr_length(string->str));
break;
}
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
*r = jsval_number(jsstr_length(string->str));
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,25 +1464,13 @@ static HRESULT String_localeCompare(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
return E_NOTIMPL;
}
static HRESULT String_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
static HRESULT String_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
{
StringInstance *This = string_from_vdisp(jsthis);
StringInstance *This = (StringInstance*)jsthis;
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL);
case DISPATCH_PROPERTYGET: {
*r = jsval_string(jsstr_addref(This->str));
break;
}
default:
FIXME("flags %x\n", flags);
return E_NOTIMPL;
}
*r = jsval_string(jsstr_addref(This->str));
return S_OK;
}
@ -1536,7 +1525,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, String_length, 0},
{lengthW, NULL,0, String_get_length, String_set_length},
{linkW, String_link, PROPF_METHOD|1},
{localeCompareW, String_localeCompare, PROPF_METHOD|1},
{matchW, String_match, PROPF_METHOD|1},
@ -1560,7 +1549,7 @@ static const builtin_prop_t String_props[] = {
static const builtin_info_t String_info = {
JSCLASS_STRING,
{NULL, String_value, 0},
{NULL, NULL,0, String_get_value},
sizeof(String_props)/sizeof(*String_props),
String_props,
String_destructor,
@ -1568,12 +1557,12 @@ static const builtin_info_t String_info = {
};
static const builtin_prop_t StringInst_props[] = {
{lengthW, String_length, 0}
{lengthW, NULL,0, String_get_length, String_set_length}
};
static const builtin_info_t StringInst_info = {
JSCLASS_STRING,
{NULL, String_value, 0},
{NULL, NULL,0, String_get_value},
sizeof(StringInst_props)/sizeof(*StringInst_props),
StringInst_props,
String_destructor,
@ -1691,7 +1680,7 @@ static const builtin_prop_t StringConstr_props[] = {
static const builtin_info_t StringConstr_info = {
JSCLASS_FUNCTION,
{NULL, Function_value, 0},
DEFAULT_FUNCTION_VALUE,
sizeof(StringConstr_props)/sizeof(*StringConstr_props),
StringConstr_props,
NULL,

View file

@ -94,7 +94,7 @@ reactos/dll/win32/inseng # Synced to Wine-1.7.27
reactos/dll/win32/iphlpapi # Out of sync
reactos/dll/win32/itircl # Synced to Wine-1.7.27
reactos/dll/win32/itss # Synced to Wine-1.7.27
reactos/dll/win32/jscript # Synced to Wine-1.7.27
reactos/dll/win32/jscript # Synced to WineStaging-1.7.37
reactos/dll/win32/jsproxy # Synced to Wine-1.7.27
reactos/dll/win32/loadperf # Synced to Wine-1.7.27
reactos/dll/win32/localspl # Synced to Wine-1.7.27