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

vbscript: Better function call parsing.

parent 1ac1ffba
......@@ -39,6 +39,8 @@ static member_expression_t *new_member_expression(parser_ctx_t*,expression_t*,co
static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
#define CHECK_ERROR if(((parser_ctx_t*)ctx)->hres != S_OK) YYABORT
%}
%pure_parser
......@@ -47,6 +49,7 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
%union {
const WCHAR *string;
statement_t *statement;
expression_t *expression;
member_expression_t *member;
}
......@@ -55,6 +58,7 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
%type <statement> Statement StatementNl
%type <member> MemberExpression
%type <expression> Arguments_opt ArgumentList_opt
%%
......@@ -69,12 +73,20 @@ StatementNl
: Statement tNL { $$ = $1; }
Statement
: MemberExpression /* FIXME: Arguments_opt */ { $$ = new_call_statement(ctx, $1); }
: MemberExpression Arguments_opt { $1->args = $2; $$ = new_call_statement(ctx, $1); CHECK_ERROR; }
MemberExpression
: tIdentifier { $$ = new_member_expression(ctx, NULL, $1); }
: tIdentifier { $$ = new_member_expression(ctx, NULL, $1); CHECK_ERROR; }
/* FIXME: MemberExpressionArgs '.' tIdentifier */
Arguments_opt
: /* empty */ { $$ = NULL; }
| '(' ArgumentList_opt ')' { $$ = $2; }
ArgumentList_opt
: /* empty */ { $$ = NULL; }
/* | ArgumentList { $$ = $1; } */
%%
static int parser_error(const char *str)
......
......@@ -469,6 +469,12 @@ static void run_tests(void)
parse_script_a("reportSuccess");
CHECK_CALLED(global_success_d);
CHECK_CALLED(global_success_i);
SET_EXPECT(global_success_d);
SET_EXPECT(global_success_i);
parse_script_a("reportSuccess()");
CHECK_CALLED(global_success_d);
CHECK_CALLED(global_success_i);
}
static BOOL check_vbscript(void)
......
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