Jacek Caban : vbscript: Added '\' expression parser/compiler implementation .

Alexandre Julliard julliard at winehq.org
Tue Sep 13 12:18:10 CDT 2011


Module: wine
Branch: master
Commit: 3c47b1d2f033b170d781e6efed0c48f5bcbd03ad
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3c47b1d2f033b170d781e6efed0c48f5bcbd03ad

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Sep 13 11:40:14 2011 +0200

vbscript: Added '\' expression parser/compiler implementation.

---

 dlls/vbscript/compile.c  |    2 ++
 dlls/vbscript/interp.c   |    6 ++++++
 dlls/vbscript/parse.h    |    1 +
 dlls/vbscript/parser.y   |    8 ++++++--
 dlls/vbscript/vbscript.h |    1 +
 5 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index 99505f6..98b8abd 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -359,6 +359,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr)
         return push_instr(ctx, OP_empty) != -1 ? S_OK : E_OUTOFMEMORY;
     case EXPR_EQUAL:
         return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_equal);
+    case EXPR_IDIV:
+        return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_idiv);
     case EXPR_MEMBER:
         return compile_member_expression(ctx, (member_expression_t*)expr, TRUE);
     case EXPR_MOD:
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 49b4621..602a259 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -666,6 +666,12 @@ static HRESULT interp_mod(exec_ctx_t *ctx)
     return stack_push(ctx, &v);
 }
 
+static HRESULT interp_idiv(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 fde8512..3d180ce 100644
--- a/dlls/vbscript/parse.h
+++ b/dlls/vbscript/parse.h
@@ -23,6 +23,7 @@ typedef enum {
     EXPR_DOUBLE,
     EXPR_EMPTY,
     EXPR_EQUAL,
+    EXPR_IDIV,
     EXPR_MEMBER,
     EXPR_MOD,
     EXPR_NEG,
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 4f8aa23..89cc569 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 IntdivExpression
+%type <expression> ConcatExpression AdditiveExpression ModExpression IntdivExpression MultiplicativeExpression
 %type <expression> NotExpression UnaryExpression
 %type <member> MemberExpression
 %type <expression> Arguments_opt ArgumentList_opt ArgumentList
@@ -198,8 +198,12 @@ ModExpression
     | ModExpression tMOD IntdivExpression       { $$ = new_binary_expression(ctx, EXPR_MOD, $1, $3); CHECK_ERROR; }
 
 IntdivExpression
-    : UnaryExpression /* FIXME */   { $$ = $1; }
+    : MultiplicativeExpression                  { $$ = $1; }
+    | IntdivExpression '\\' MultiplicativeExpression
+                                                { $$ = new_binary_expression(ctx, EXPR_IDIV, $1, $3); CHECK_ERROR; }
 
+MultiplicativeExpression
+    : UnaryExpression /* FIXME */   { $$ = $1; }
 
 UnaryExpression
     : LiteralExpression             { $$ = $1; }
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index a33b570..a460233 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -108,6 +108,7 @@ typedef enum {
     X(equal,          1, 0,           0)          \
     X(icall,          1, ARG_BSTR,    ARG_UINT)   \
     X(icallv,         1, ARG_BSTR,    ARG_UINT)   \
+    X(idiv,           1, 0,           0)          \
     X(jmp,            0, ARG_ADDR,    0)          \
     X(jmp_false,      0, ARG_ADDR,    0)          \
     X(long,           1, ARG_INT,     0)          \




More information about the wine-cvs mailing list