[PATCH] vbscript: Treat tokens after a '.' as identifier

Brendan McGrath brendan at redmandi.com
Tue Dec 18 18:52:09 CST 2018


Currently, a vbscript using an identifier that is also a keyword fails
with a parser error. For example:
Set oLocator = CreateObject("Wbemscripting.SWbemLocator")
Set oReg = oLocator.ConnectServer("", "root\default", "", "").Get("StdRegProv")

results in:
0009:fixme:vbscript:parse_script parser failed around L"efault\", \"\", \"\").Get(\"StdRegProv\")\n"


The 'Get' method here causes the parser error as it is also a vbscript
keyword.

This patch treats any token after a '.' as an identifier.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46318
Signed-off-by: Brendan McGrath <brendan at redmandi.com>
---

I _think_ this patch is OK - but I don't have a lot of experience with
vbscript. There may be a scenario where a keyword can immediately follow
a '.'.

I've also created the bug linked above (where this patch is
proposed).

 dlls/vbscript/lex.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c
index 571854db58e..0d27c2423c7 100644
--- a/dlls/vbscript/lex.c
+++ b/dlls/vbscript/lex.c
@@ -412,7 +412,10 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
         return parse_numeric_literal(ctx, lval);
 
     if(isalphaW(c)) {
-        int ret = check_keywords(ctx);
+        int ret = 0;
+
+        if(ctx->last_token != '.')
+            ret = check_keywords(ctx);
         if(!ret)
             return parse_identifier(ctx, lval);
         if(ret != tREM)
-- 
2.17.1




More information about the wine-devel mailing list