[PATCH 0/1] MR10490: vbscript: Return specific error codes for integer constant and Property declarations.
Add error productions in the bison grammar for two cases: - Expected integer constant in Dim array bounds (error 1026) e.g. Dim x("a") where a numeric value is required. - Expected Let, Set, or Get after Property keyword (error 1049) e.g. Property x without specifying the accessor type. Previously these fell through to the generic E_FAIL path in parser_error(). Now each sets the correct VBSE_EXPECTED_* error code via MAKE_VBSERROR before aborting the parse. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10490
From: Francis De Brabandere <francisdb@gmail.com> Add error productions in the bison grammar for two cases: - Expected integer constant in Dim array bounds (error 1026) e.g. Dim x("a") where a numeric value is required. - Expected Let, Set, or Get after Property keyword (error 1049) e.g. Property x without specifying the accessor type. Previously these fell through to the generic E_FAIL path in parser_error(). Now each sets the correct VBSE_EXPECTED_* error code via MAKE_VBSERROR before aborting the parse. --- dlls/vbscript/parser.y | 2 ++ dlls/vbscript/tests/run.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index c1a5b944268..176ce51c782 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -288,6 +288,7 @@ DimDecl DimList : IntegerValue { $$ = new_dim(ctx, $1, NULL); } | IntegerValue ',' DimList { $$ = new_dim(ctx, $1, $3); } + | error { ctx->hres = MAKE_VBSERROR(VBSE_EXPECTED_INTEGER_CONSTANT); YYABORT; } ConstDeclList : ConstDecl { $$ = $1; } @@ -497,6 +498,7 @@ PropertyDecl { $$ = new_function_decl(ctx, $4, FUNC_PROPLET, $1, $6, $9); CHECK_ERROR; } | Storage_opt tPROPERTY tSET Identifier '(' ArgumentDeclList ')' StSep BodyStatements tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPSET, $1, $6, $9); CHECK_ERROR; } + | Storage_opt tPROPERTY error { ctx->hres = MAKE_VBSERROR(VBSE_EXPECTED_LET_SET_GET); YYABORT; } FunctionDecl : Storage_opt tSUB Identifier StSep BodyStatements tEND tSUB diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index d3aebff098a..35ca1700729 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -2963,7 +2963,7 @@ static void test_parse_errors(void) /* Expected integer constant - error 1026 */ L"Dim x(\"a\")\n", 0, 6, - NULL, S_OK, -1026 + NULL, S_OK, 1026 }, { /* Invalid number - error 1031 */ @@ -2999,7 +2999,7 @@ static void test_parse_errors(void) /* Expected Let or Set or Get - error 1049 */ L"Class C\nProperty x\nEnd Property\nEnd Class\n", 1, 9, - NULL, S_OK, -1049 + NULL, S_OK, 1049 }, /* TODO: Wine allows arguments on Class_Initialize/Class_Terminate { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10490
participants (2)
-
Francis De Brabandere -
Francis De Brabandere (@francisdb)