Module: wine Branch: master Commit: 1c2ec6d44febc5117893f9cb94029824832744fe URL: http://source.winehq.org/git/wine.git/?a=commit;h=1c2ec6d44febc5117893f9cb94...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Sep 13 11:39:53 2011 +0200
vbscript: Added mod expression parser/compiler implementation.
---
dlls/vbscript/compile.c | 2 ++ dlls/vbscript/interp.c | 6 ++++++ dlls/vbscript/parse.h | 1 + dlls/vbscript/parser.y | 6 +++++- dlls/vbscript/vbscript.h | 1 + 5 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 71af0f3..99505f6 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -361,6 +361,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_MOD: + return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_mod); case EXPR_NEG: return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_neg); case EXPR_NEQUAL: diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index d768aab..4858b0b 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -642,6 +642,12 @@ static HRESULT interp_sub(exec_ctx_t *ctx) return stack_push(ctx, &v); }
+static HRESULT interp_mod(exec_ctx_t *ctx) +{ + FIXME("\n"); + return E_NOTIMPL; +} + static HRESULT interp_neg(exec_ctx_t *ctx) { variant_val_t val; diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h index c8ed7f0..fde8512 100644 --- a/dlls/vbscript/parse.h +++ b/dlls/vbscript/parse.h @@ -24,6 +24,7 @@ typedef enum { EXPR_EMPTY, EXPR_EQUAL, EXPR_MEMBER, + EXPR_MOD, EXPR_NEG, EXPR_NEQUAL, EXPR_NOT, diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 8efcc5a..4f8aa23 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -91,7 +91,7 @@ static elseif_decl_t *new_elseif_decl(parser_ctx_t*,expression_t*,statement_t*);
%type <statement> Statement StatementNl StatementsNl IfStatement Else_opt %type <expression> Expression LiteralExpression PrimaryExpression EqualityExpression CallExpression -%type <expression> ConcatExpression AdditiveExpression ModExpression +%type <expression> ConcatExpression AdditiveExpression ModExpression IntdivExpression %type <expression> NotExpression UnaryExpression %type <member> MemberExpression %type <expression> Arguments_opt ArgumentList_opt ArgumentList @@ -194,6 +194,10 @@ AdditiveExpression | AdditiveExpression '-' ModExpression { $$ = new_binary_expression(ctx, EXPR_SUB, $1, $3); CHECK_ERROR; }
ModExpression + : IntdivExpression { $$ = $1; } + | ModExpression tMOD IntdivExpression { $$ = new_binary_expression(ctx, EXPR_MOD, $1, $3); CHECK_ERROR; } + +IntdivExpression : UnaryExpression /* FIXME */ { $$ = $1; }
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index cf32705..a33b570 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -111,6 +111,7 @@ typedef enum { X(jmp, 0, ARG_ADDR, 0) \ X(jmp_false, 0, ARG_ADDR, 0) \ X(long, 1, ARG_INT, 0) \ + X(mod, 1, 0, 0) \ X(neg, 1, 0, 0) \ X(nequal, 1, 0, 0) \ X(not, 1, 0, 0) \