Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net --- dlls/vbscript/lex.c | 10 +++++++++- dlls/vbscript/tests/lang.vbs | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index 251374d90e6..78fca8271cc 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -99,6 +99,14 @@ static inline BOOL is_identifier_char(WCHAR c) return iswalnum(c) || c == '_'; }
+static BOOL is_identifier( int token) +{ + if (token == tIdentifier || token == tDEFAULT || token == tERROR || + token == tEXPLICIT || token == tPROPERTY || token == tSTEP) + return TRUE; + return FALSE; +} + static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval) { const WCHAR *p1 = ctx->ptr; @@ -425,7 +433,7 @@ static int parse_next_token(void *lval, unsigned *loc, parser_ctx_t *ctx) * Parser can't predict if bracket is part of argument expression or an argument * in call expression. We predict it here instead. */ - if(ctx->last_token == tIdentifier || ctx->last_token == ')') + if(is_identifier(ctx->last_token) || ctx->last_token == ')') return '('; return tEXPRLBRACKET; case '"': diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 65f8a458cd7..570bb7fbcb3 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1631,9 +1631,31 @@ sub test_identifiers Dim step step = "xx" Call ok(step = "xx", "step = " & step & " expected ""xx""") + + Dim property + property = "xx" + Call ok(property = "xx", "property = " & property & " expected ""xx""") end sub call test_identifiers()
+Class class_test_identifiers_as_function_name + Sub Property ( par ) + End Sub + + Function Error( par ) + End Function + + Sub Default () + End Sub + + Function Explicit (par) + Explicit = par + End Function + + Sub Step ( default ) + End Sub +End Class + sub test_dotIdentifiers ' test keywords that can also be an identifier after a dot Call ok(testObj.rem = 10, "testObj.rem = " & testObj.rem & " expected 10") -- 2.26.2
On 10/26/20 11:17 PM, Robert Wilhelm wrote:
Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net
dlls/vbscript/lex.c | 10 +++++++++- dlls/vbscript/tests/lang.vbs | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index 251374d90e6..78fca8271cc 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -99,6 +99,14 @@ static inline BOOL is_identifier_char(WCHAR c) return iswalnum(c) || c == '_'; }
+static BOOL is_identifier( int token) +{
- if (token == tIdentifier || token == tDEFAULT || token == tERROR ||
token == tEXPLICIT || token == tPROPERTY || token == tSTEP)
return TRUE;
- return FALSE;
+}
- static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval) { const WCHAR *p1 = ctx->ptr;
@@ -425,7 +433,7 @@ static int parse_next_token(void *lval, unsigned *loc, parser_ctx_t *ctx) * Parser can't predict if bracket is part of argument expression or an argument * in call expression. We predict it here instead. */
if(ctx->last_token == tIdentifier || ctx->last_token == ')')
if(is_identifier(ctx->last_token) || ctx->last_token == ')')
This should work, but I think we'd ideally distinguish if last token was actually used as an identifier and have that logic in one place. What do you think about something like the attached patch?
Thanks, Jacek