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

oldstable
Jacek Caban 2011-09-14 12:59:02 +02:00 committed by Alexandre Julliard
parent f9edb683d2
commit 69de07981a
5 changed files with 16 additions and 2 deletions

View File

@ -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:

View File

@ -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;

View File

@ -18,6 +18,7 @@
typedef enum {
EXPR_ADD,
EXPR_AND,
EXPR_BOOL,
EXPR_CONCAT,
EXPR_DIV,

View File

@ -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; }

View File

@ -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) \