Module: wine Branch: master Commit: fb5509ec06939b26647e8054dd439aba9c0913c2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fb5509ec06939b26647e8054dd...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Sep 12 12:31:37 2011 +0200
vbscript: Added negation expression parser/compiler implementation.
---
dlls/vbscript/compile.c | 2 ++ dlls/vbscript/interp.c | 6 ++++++ dlls/vbscript/parse.h | 1 + dlls/vbscript/parser.y | 11 ++++++++--- dlls/vbscript/vbscript.h | 1 + 5 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 9e59fe1..baaa078 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -246,6 +246,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr) return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_equal); case EXPR_MEMBER: return compile_member_expression(ctx, (member_expression_t*)expr, TRUE); + case EXPR_NEG: + return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_neg); 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 90531fb..a70ca5f 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -391,6 +391,12 @@ static HRESULT interp_concat(exec_ctx_t *ctx) return stack_push(ctx, &v); }
+static HRESULT interp_neg(exec_ctx_t *ctx) +{ + FIXME("\n"); + return E_NOTIMPL; +} + static const instr_func_t op_funcs[] = { #define X(x,n,a,b) interp_ ## x, OP_LIST diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h index b47360c..0c87209 100644 --- a/dlls/vbscript/parse.h +++ b/dlls/vbscript/parse.h @@ -23,6 +23,7 @@ typedef enum { EXPR_EMPTY, EXPR_EQUAL, EXPR_MEMBER, + EXPR_NEG, EXPR_NOT, EXPR_NULL, EXPR_STRING, diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 756cf6a..316957c 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -84,7 +84,7 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*); %type <statement> Statement StatementNl %type <expression> Expression LiteralExpression PrimaryExpression EqualityExpression CallExpression %type <expression> ConcatExpression AdditiveExpression -%type <expression> NotExpression +%type <expression> NotExpression UnaryExpression %type <member> MemberExpression %type <expression> Arguments_opt ArgumentList_opt ArgumentList %type <bool> OptionExplicit_opt @@ -145,8 +145,13 @@ ConcatExpression | ConcatExpression '&' AdditiveExpression { $$ = new_binary_expression(ctx, EXPR_CONCAT, $1, $3); CHECK_ERROR; }
AdditiveExpression - : LiteralExpression /* FIXME */ { $$ = $1; } - | CallExpression /* FIXME */ { $$ = $1; } + : UnaryExpression /* FIXME */ { $$ = $1; } + + +UnaryExpression + : LiteralExpression { $$ = $1; } + | CallExpression { $$ = $1; } + | '-' UnaryExpression { $$ = new_unary_expression(ctx, EXPR_NEG, $2); CHECK_ERROR; }
CallExpression : PrimaryExpression { $$ = $1; } diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 2abbc9d..9db2692 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -96,6 +96,7 @@ typedef enum { X(icall, 1, ARG_BSTR, ARG_UINT) \ X(icallv, 1, ARG_BSTR, ARG_UINT) \ X(long, 1, ARG_INT, 0) \ + X(neg, 1, 0, 0) \ X(not, 1, 0, 0) \ X(null, 1, 0, 0) \ X(ret, 0, 0, 0) \