From: Francis De Brabandere <francisdb@gmail.com> --- dlls/vbscript/lex.c | 10 ++++++++++ dlls/vbscript/parse.h | 1 + dlls/vbscript/tests/lang.vbs | 15 +++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index 8c5c69ea429..37a368ce3eb 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -440,6 +440,14 @@ static int parse_next_token(void *lval, unsigned *loc, parser_ctx_t *ctx) ctx->ptr++; return '.'; } + /* After line continuation, ptr[-1] is a newline or space, but the dot + * is logically on the same line as the previous token. */ + if(ctx->after_continuation + && (ctx->last_token == tIdentifier || ctx->last_token == ')' + || ctx->last_token == tEMPTYBRACKETS)) { + ctx->ptr++; + return '.'; + } c = ctx->ptr[1]; if('0' <= c && c <= '9') return parse_numeric_literal(ctx, lval); @@ -538,6 +546,7 @@ int parser_lex(void *lval, unsigned *loc, parser_ctx_t *ctx) ctx->ptr++; if(*ctx->ptr == '\n') ctx->ptr++; + ctx->after_continuation = TRUE; continue; } if(ret != tNL || ctx->last_token != tNL) @@ -546,5 +555,6 @@ int parser_lex(void *lval, unsigned *loc, parser_ctx_t *ctx) ctx->last_nl = ctx->ptr-ctx->code; } + ctx->after_continuation = FALSE; return (ctx->last_token = ret); } diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h index 64c3dee2a69..71fc713ea9c 100644 --- a/dlls/vbscript/parse.h +++ b/dlls/vbscript/parse.h @@ -302,6 +302,7 @@ typedef struct { int last_token; unsigned last_nl; + BOOL after_continuation; statement_t *stats; statement_t *stats_tail; diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 0025bfeddcf..df8e0e80403 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -245,6 +245,21 @@ x =_ x _ = 3 +Class ChainedCallTarget + Public Function Ret() + Set Ret = Me + End Function +End Class + +Dim chainObj +Set chainObj = New ChainedCallTarget +chainObj.Ret().Ret() +chainObj.Ret() _ +.Ret() +chainObj _ +.Ret() _ +.Ret() + x = 3 if true then y = true : x = y -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10312