Commit e63c4472 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added assign statement parser implementation.

parent 43f6a684
......@@ -78,6 +78,7 @@ typedef struct {
} member_expression_t;
typedef enum {
STAT_ASSIGN,
STAT_CALL
} statement_type_t;
......@@ -92,6 +93,12 @@ typedef struct {
} call_statement_t;
typedef struct {
statement_t stat;
member_expression_t *member_expr;
expression_t *value_expr;
} assign_statement_t;
typedef struct {
const WCHAR *code;
const WCHAR *ptr;
const WCHAR *end;
......
......@@ -46,6 +46,7 @@ static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expre
static member_expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*);
static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
static statement_t *new_assign_statement(parser_ctx_t*,member_expression_t*,expression_t*);
#define CHECK_ERROR if(((parser_ctx_t*)ctx)->hres != S_OK) YYABORT
......@@ -108,6 +109,8 @@ StatementNl
Statement
: MemberExpression ArgumentList_opt { $1->args = $2; $$ = new_call_statement(ctx, $1); CHECK_ERROR; }
| tCALL MemberExpression Arguments_opt { $2->args = $3; $$ = new_call_statement(ctx, $2); CHECK_ERROR; }
| MemberExpression Arguments_opt '=' Expression
{ $1->args = $2; $$ = new_assign_statement(ctx, $1, $4); CHECK_ERROR; }
MemberExpression
: tIdentifier { $$ = new_member_expression(ctx, NULL, $1); CHECK_ERROR; }
......@@ -325,6 +328,19 @@ static statement_t *new_call_statement(parser_ctx_t *ctx, member_expression_t *e
return &stat->stat;
}
static statement_t *new_assign_statement(parser_ctx_t *ctx, member_expression_t *left, expression_t *right)
{
assign_statement_t *stat;
stat = new_statement(ctx, STAT_ASSIGN, sizeof(*stat));
if(!stat)
return NULL;
stat->member_expr = left;
stat->value_expr = right;
return &stat->stat;
}
void *parser_alloc(parser_ctx_t *ctx, size_t size)
{
void *ret;
......
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