jscript: Added parser.

This commit is contained in:
Jacek Caban 2008-09-03 00:25:21 +02:00 committed by Alexandre Julliard
parent e670b5c831
commit 9ebdd11126
7 changed files with 2474 additions and 0 deletions

2
.gitignore vendored
View File

@ -37,6 +37,8 @@ dlls/display.drv16
dlls/gdi.exe16
dlls/imm.dll16
dlls/jscript/jsglobal.tlb
dlls/jscript/parser.tab.c
dlls/jscript/parser.tab.h
dlls/kernel32/nls/winerr_deu.mc.rc
dlls/kernel32/nls/winerr_enu.mc.rc
dlls/kernel32/nls/winerr_fra.mc.rc

View File

@ -9,11 +9,15 @@ RC_SRCS = rsrc.rc
C_SRCS = \
dispex.c \
engine.c \
jscript.c \
jscript_main.c
IDL_TLB_SRCS = jsglobal.idl
BISON_SRCS = \
parser.y
@MAKE_DLL_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend

481
dlls/jscript/engine.c Normal file
View File

@ -0,0 +1,481 @@
/*
* Copyright 2008 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"
#include "engine.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
HRESULT block_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT var_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT empty_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT expression_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT if_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT dowhile_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT while_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT for_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT forin_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT continue_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT break_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT return_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT with_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT labelled_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT switch_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT throw_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT try_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt, VARIANT *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT function_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT conditional_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT array_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT member_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT member_new_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT call_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT this_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT identifier_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT literal_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT array_literal_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT property_value_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT comma_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT logical_or_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT logical_and_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT binary_or_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT binary_xor_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT binary_and_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT instanceof_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT in_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT add_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT sub_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT mul_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT div_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT mod_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT delete_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT void_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT typeof_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT minus_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT plus_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT post_increment_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT post_decrement_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT pre_increment_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT pre_decrement_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT new_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT equal_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT equal2_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT not_equal_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT not_equal2_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT less_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT lesseq_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT greater_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT greatereq_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT binary_negation_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT logical_negation_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT left_shift_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT right_shift_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT right2_shift_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_lshift_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_rshift_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_rrshift_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_add_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_sub_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_mul_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_div_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_mod_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_and_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_or_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}
HRESULT assign_xor_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
}

424
dlls/jscript/engine.h Normal file
View File

@ -0,0 +1,424 @@
/*
* Copyright 2008 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
*/
typedef struct _source_elements_t source_elements_t;
typedef struct _parser_ctx_t {
LONG ref;
const WCHAR *ptr;
const WCHAR *begin;
const WCHAR *end;
script_ctx_t *script;
source_elements_t *source;
BOOL nl;
HRESULT hres;
} parser_ctx_t;
HRESULT script_parse(script_ctx_t*,const WCHAR*,parser_ctx_t**);
void parser_release(parser_ctx_t*);
int parser_lex(void*,parser_ctx_t*);
static inline void parser_addref(parser_ctx_t *ctx)
{
ctx->ref++;
}
static inline void *parser_alloc(parser_ctx_t *ctx, DWORD size)
{
return heap_alloc(size); /* FIXME */
}
static inline void *parser_alloc_tmp(parser_ctx_t *ctx, DWORD size)
{
return heap_alloc(size); /* FIXME */
}
typedef struct {
enum{
RT_NORMAL,
RT_RETURN,
RT_BREAK
} type;
} return_type_t;
typedef struct _exec_ctx_t {
parser_ctx_t *parser;
} exec_ctx_t;
typedef struct _statement_t statement_t;
typedef struct _expression_t expression_t;
typedef struct _parameter_t parameter_t;
typedef struct {
VARTYPE vt;
union {
LONG lval;
double dval;
const WCHAR *wstr;
VARIANT_BOOL bval;
IDispatch *disp;
} u;
} literal_t;
typedef struct _variable_declaration_t {
const WCHAR *identifier;
expression_t *expr;
struct _variable_declaration_t *next;
} variable_declaration_t;
typedef HRESULT (*statement_eval_t)(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
struct _statement_t {
statement_eval_t eval;
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;
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;
HRESULT block_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT var_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT empty_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT expression_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT if_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT dowhile_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT while_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT for_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT forin_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT continue_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT break_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT return_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT with_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT labelled_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT switch_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT throw_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
HRESULT try_statement_eval(exec_ctx_t*,statement_t*,return_type_t*,VARIANT*);
typedef struct exprval_t exprval_t;
typedef struct jsexcept_t jsexcept_t;
typedef HRESULT (*expression_eval_t)(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
struct _expression_t {
expression_eval_t eval;
};
struct _parameter_t {
const WCHAR *identifier;
struct _parameter_t *next;
};
typedef struct _function_declaration_t {
const WCHAR *identifier;
parameter_t *parameter_list;
source_elements_t *source_elements;
struct _function_declaration_t *next;
} function_declaration_t;
struct _source_elements_t {
statement_t *statement;
statement_t *statement_tail;
function_declaration_t *functions;
function_declaration_t *functions_tail;
};
typedef struct {
expression_t expr;
const WCHAR *identifier;
parameter_t *parameter_list;
source_elements_t *source_elements;
} 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 *member_expr;
expression_t *expression;
} array_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;
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_NEW,
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
} expression_type_t;
HRESULT function_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT conditional_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT array_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT member_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT member_new_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT call_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT this_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT identifier_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT literal_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT array_literal_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT property_value_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT comma_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT logical_or_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT logical_and_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT binary_or_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT binary_xor_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT binary_and_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT instanceof_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT in_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT add_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT sub_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT mul_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT div_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT mod_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT delete_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT void_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT typeof_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT minus_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT plus_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT post_increment_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT post_decrement_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT pre_increment_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT pre_decrement_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT new_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT equal_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT equal2_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT not_equal_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT not_equal2_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT less_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT lesseq_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT greater_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT greatereq_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT binary_negation_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT logical_negation_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT left_shift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT right_shift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT right2_shift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_lshift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_rshift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_rrshift_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_add_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_sub_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_mul_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_div_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_mod_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_and_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_or_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
HRESULT assign_xor_expression_eval(exec_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);

View File

@ -17,6 +17,7 @@
*/
#include "jscript.h"
#include "engine.h"
#include "objsafe.h"
#include "wine/debug.h"
@ -394,9 +395,18 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
{
JScript *This = ASPARSE_THIS(iface);
parser_ctx_t *parser_ctx;
HRESULT hres;
FIXME("(%p)->(%s %s %p %s %x %u %x %p %p)\n", This, debugstr_w(pstrCode),
debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
dwSourceContextCookie, ulStartingLine, dwFlags, pvarResult, pexcepinfo);
hres = script_parse(This->ctx, pstrCode, &parser_ctx);
if(FAILED(hres))
return hres;
parser_release(parser_ctx);
return E_NOTIMPL;
}

View File

@ -28,6 +28,8 @@
#include "dispex.h"
#include "activscp.h"
#include "wine/unicode.h"
typedef struct _script_ctx_t script_ctx_t;
typedef struct DispatchEx {

1551
dlls/jscript/parser.y Normal file

File diff suppressed because it is too large Load Diff