Commit 69de0798 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent f9edb683
......@@ -356,6 +356,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr)
switch(expr->type) {
case EXPR_ADD:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_add);
case EXPR_AND:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_and);
case EXPR_BOOL:
return push_instr_int(ctx, OP_bool, ((bool_expression_t*)expr)->value);
case EXPR_CONCAT:
......
......@@ -564,6 +564,12 @@ static HRESULT interp_not(exec_ctx_t *ctx)
return stack_push(ctx, &v);
}
static HRESULT interp_and(exec_ctx_t *ctx)
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT cmp_oper(exec_ctx_t *ctx)
{
variant_val_t l, r;
......
......@@ -18,6 +18,7 @@
typedef enum {
EXPR_ADD,
EXPR_AND,
EXPR_BOOL,
EXPR_CONCAT,
EXPR_DIV,
......
......@@ -98,7 +98,7 @@ static arg_decl_t *new_argument_decl(parser_ctx_t*,const WCHAR*,BOOL);
%type <statement> Statement StatementNl StatementsNl StatementsNl_opt IfStatement Else_opt
%type <expression> Expression LiteralExpression PrimaryExpression EqualityExpression CallExpression
%type <expression> ConcatExpression AdditiveExpression ModExpression IntdivExpression MultiplicativeExpression ExpExpression
%type <expression> NotExpression UnaryExpression
%type <expression> NotExpression UnaryExpression AndExpression
%type <member> MemberExpression
%type <expression> Arguments_opt ArgumentList_opt ArgumentList
%type <bool> OptionExplicit_opt
......@@ -188,7 +188,11 @@ EmptyBrackets_opt
| tEMPTYBRACKETS
Expression
: NotExpression { $$ = $1; }
: AndExpression { $$ = $1; }
AndExpression
: NotExpression { $$ = $1; }
| AndExpression tAND NotExpression { $$ = new_binary_expression(ctx, EXPR_AND, $1, $3); CHECK_ERROR; }
NotExpression
: EqualityExpression { $$ = $1; }
......
......@@ -117,6 +117,7 @@ typedef enum {
#define OP_LIST \
X(add, 1, 0, 0) \
X(and, 1, 0, 0) \
X(assign_ident, 1, ARG_BSTR, 0) \
X(assign_member, 1, ARG_BSTR, 0) \
X(bool, 1, ARG_INT, 0) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment