[PATCH 0/1] MR10494: vbscript: Return error 1005 for missing opening parenthesis in Sub/Function.
When a Sub or Function declaration has a closing parenthesis without a matching opening one (e.g. "Sub x)"), Windows returns error 1005 ("expected '('"). Add error productions in FunctionDecl that detect this and set the correct VBSE_EXPECTED_LPAREN error code. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10494
From: Francis De Brabandere <francisdb@gmail.com> When a Sub or Function declaration has a closing parenthesis without a matching opening one (e.g. "Sub x)"), Windows returns error 1005 ("expected '('"). Add error productions in FunctionDecl that detect this and set the correct VBSE_EXPECTED_LPAREN error code. --- dlls/vbscript/parser.y | 4 ++++ dlls/vbscript/tests/run.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index c1a5b944268..214956ac73e 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -507,6 +507,10 @@ FunctionDecl { $$ = new_function_decl(ctx, $3, FUNC_FUNCTION, $1, NULL, $5); CHECK_ERROR; } | Storage_opt tFUNCTION Identifier ArgumentsDecl Nl_opt BodyStatements tEND tFUNCTION { $$ = new_function_decl(ctx, $3, FUNC_FUNCTION, $1, $4, $6); CHECK_ERROR; } + | Storage_opt tSUB Identifier error + { ctx->hres = MAKE_VBSERROR(VBSE_EXPECTED_LPAREN); YYABORT; } + | Storage_opt tFUNCTION Identifier error + { ctx->hres = MAKE_VBSERROR(VBSE_EXPECTED_LPAREN); YYABORT; } Storage_opt : /* empty*/ { $$ = 0; } diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index d3aebff098a..7b2d1bd87bf 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -2915,7 +2915,7 @@ static void test_parse_errors(void) /* Expected '(' - error 1005 */ L"Sub x)\nEnd Sub\n", 0, 5, - NULL, S_OK, -1005 + NULL, S_OK, 1005 }, { /* Expected '=' - error 1011 */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10494
participants (2)
-
Francis De Brabandere -
Francis De Brabandere (@francisdb)