vbscript: Allow keywords to be used as function name.

Signed-off-by: Robert Wilhelm <robert.wilhelm@gmx.net>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Robert Wilhelm 2020-11-05 23:12:15 +01:00 committed by Alexandre Julliard
parent f5831eda2e
commit 72977a75a4
2 changed files with 27 additions and 5 deletions

View file

@ -490,11 +490,11 @@ ArgumentDecl
/* these keywords may also be an identifier, depending on context */
Identifier
: tIdentifier { $$ = $1; }
| tDEFAULT { $$ = $1; }
| tERROR { $$ = $1; }
| tEXPLICIT { $$ = $1; }
| tPROPERTY { $$ = $1; }
| tSTEP { $$ = $1; }
| tDEFAULT { ctx->last_token = tIdentifier; $$ = $1; }
| tERROR { ctx->last_token = tIdentifier; $$ = $1; }
| tEXPLICIT { ctx->last_token = tIdentifier; $$ = $1; }
| tPROPERTY { ctx->last_token = tIdentifier; $$ = $1; }
| tSTEP { ctx->last_token = tIdentifier; $$ = $1; }
/* Most statements accept both new line and ':' as separators */
StSep

View file

@ -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")