Commit 408a1bf6 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added new expression parser/compiler implemetation.

parent f683832a
......@@ -390,6 +390,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr)
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_neg);
case EXPR_NEQUAL:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_nequal);
case EXPR_NEW:
return push_instr_str(ctx, OP_new, ((string_expression_t*)expr)->value);
case EXPR_NOT:
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_not);
case EXPR_NULL:
......
......@@ -444,6 +444,13 @@ static HRESULT interp_set_member(exec_ctx_t *ctx)
return E_NOTIMPL;
}
static HRESULT interp_new(exec_ctx_t *ctx)
{
const WCHAR *arg = ctx->instr->arg1.bstr;
FIXME("%s\n", debugstr_w(arg));
return E_NOTIMPL;
}
static HRESULT interp_jmp(exec_ctx_t *ctx)
{
const unsigned arg = ctx->instr->arg1.uint;
......
......@@ -34,6 +34,7 @@ typedef enum {
EXPR_MUL,
EXPR_NEG,
EXPR_NEQUAL,
EXPR_NEW,
EXPR_NOT,
EXPR_NULL,
EXPR_OR,
......
......@@ -43,6 +43,7 @@ static expression_t *new_long_expression(parser_ctx_t*,expression_type_t,LONG);
static expression_t *new_double_expression(parser_ctx_t*,double);
static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*);
static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*);
static expression_t *new_new_expression(parser_ctx_t*,const WCHAR*);
static member_expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*);
......@@ -256,6 +257,7 @@ ExpExpression
UnaryExpression
: LiteralExpression { $$ = $1; }
| CallExpression { $$ = $1; }
| tNEW tIdentifier { $$ = new_new_expression(ctx, $2); CHECK_ERROR; }
| '-' UnaryExpression { $$ = new_unary_expression(ctx, EXPR_NEG, $2); CHECK_ERROR; }
CallExpression
......@@ -430,6 +432,18 @@ static member_expression_t *new_member_expression(parser_ctx_t *ctx, expression_
return expr;
}
static expression_t *new_new_expression(parser_ctx_t *ctx, const WCHAR *identifier)
{
string_expression_t *expr;
expr = new_expression(ctx, EXPR_NEW, sizeof(*expr));
if(!expr)
return NULL;
expr->value = identifier;
return &expr->expr;
}
static void *new_statement(parser_ctx_t *ctx, statement_type_t type, size_t size)
{
statement_t *stat;
......
......@@ -146,6 +146,7 @@ typedef enum {
X(mul, 1, 0, 0) \
X(neg, 1, 0, 0) \
X(nequal, 1, 0, 0) \
X(new, 1, ARG_STR, 0) \
X(not, 1, 0, 0) \
X(null, 1, 0, 0) \
X(or, 1, 0, 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