Module: wine Branch: master Commit: 408a1bf6820cd43b5929a0ee93755103bdcdf095 URL: http://source.winehq.org/git/wine.git/?a=commit;h=408a1bf6820cd43b5929a0ee93...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Sep 15 14:18:12 2011 +0200
vbscript: Added new expression parser/compiler implemetation.
---
dlls/vbscript/compile.c | 2 ++ dlls/vbscript/interp.c | 7 +++++++ dlls/vbscript/parse.h | 1 + dlls/vbscript/parser.y | 14 ++++++++++++++ dlls/vbscript/vbscript.h | 1 + 5 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index d1720cf..b9e05bd9 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -390,6 +390,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr) return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_neg); case EXPR_NEQUAL: return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_nequal); + case EXPR_NEW: + return push_instr_str(ctx, OP_new, ((string_expression_t*)expr)->value); case EXPR_NOT: return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_not); case EXPR_NULL: diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 705992c..dd4f4ff 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -444,6 +444,13 @@ static HRESULT interp_set_member(exec_ctx_t *ctx) return E_NOTIMPL; }
+static HRESULT interp_new(exec_ctx_t *ctx) +{ + const WCHAR *arg = ctx->instr->arg1.bstr; + FIXME("%s\n", debugstr_w(arg)); + return E_NOTIMPL; +} + static HRESULT interp_jmp(exec_ctx_t *ctx) { const unsigned arg = ctx->instr->arg1.uint; diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h index 76f8775..21f0d60 100644 --- a/dlls/vbscript/parse.h +++ b/dlls/vbscript/parse.h @@ -34,6 +34,7 @@ typedef enum { EXPR_MUL, EXPR_NEG, EXPR_NEQUAL, + EXPR_NEW, EXPR_NOT, EXPR_NULL, EXPR_OR, diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 2e0140e..48a5ab4 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -43,6 +43,7 @@ static expression_t *new_long_expression(parser_ctx_t*,expression_type_t,LONG); static expression_t *new_double_expression(parser_ctx_t*,double); static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*); static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*); +static expression_t *new_new_expression(parser_ctx_t*,const WCHAR*);
static member_expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*);
@@ -256,6 +257,7 @@ ExpExpression UnaryExpression : LiteralExpression { $$ = $1; } | CallExpression { $$ = $1; } + | tNEW tIdentifier { $$ = new_new_expression(ctx, $2); CHECK_ERROR; } | '-' UnaryExpression { $$ = new_unary_expression(ctx, EXPR_NEG, $2); CHECK_ERROR; }
CallExpression @@ -430,6 +432,18 @@ static member_expression_t *new_member_expression(parser_ctx_t *ctx, expression_ return expr; }
+static expression_t *new_new_expression(parser_ctx_t *ctx, const WCHAR *identifier) +{ + string_expression_t *expr; + + expr = new_expression(ctx, EXPR_NEW, sizeof(*expr)); + if(!expr) + return NULL; + + expr->value = identifier; + return &expr->expr; +} + static void *new_statement(parser_ctx_t *ctx, statement_type_t type, size_t size) { statement_t *stat; diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 9655978..3e3af5b 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -146,6 +146,7 @@ typedef enum { X(mul, 1, 0, 0) \ X(neg, 1, 0, 0) \ X(nequal, 1, 0, 0) \ + X(new, 1, ARG_STR, 0) \ X(not, 1, 0, 0) \ X(null, 1, 0, 0) \ X(or, 1, 0, 0) \