Commit 1bd7dbfb authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

vbscript: Handle carriage return in more places.

This fixes a regression introduced by 5800c9ed. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46772Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6d35c10a
...@@ -225,7 +225,7 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret) ...@@ -225,7 +225,7 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret)
int len = 0; int len = 0;
while(ctx->ptr < ctx->end) { while(ctx->ptr < ctx->end) {
if(*ctx->ptr == '\n') { if(*ctx->ptr == '\n' || *ctx->ptr == '\r') {
FIXME("newline inside string literal\n"); FIXME("newline inside string literal\n");
return 0; return 0;
} }
...@@ -497,11 +497,14 @@ int parser_lex(void *lval, parser_ctx_t *ctx) ...@@ -497,11 +497,14 @@ int parser_lex(void *lval, parser_ctx_t *ctx)
ret = parse_next_token(lval, ctx); ret = parse_next_token(lval, ctx);
if(ret == '_') { if(ret == '_') {
skip_spaces(ctx); skip_spaces(ctx);
if(*ctx->ptr != '\n') { if(*ctx->ptr != '\n' && *ctx->ptr != '\r') {
FIXME("'_' not followed by newline\n"); FIXME("'_' not followed by newline\n");
return 0; return 0;
} }
ctx->ptr++; if(*ctx->ptr == '\r')
ctx->ptr++;
if(*ctx->ptr == '\n')
ctx->ptr++;
continue; continue;
} }
if(ret != tNL || ctx->last_token != tNL) if(ret != tNL || ctx->last_token != tNL)
......
...@@ -2481,6 +2481,9 @@ static void run_tests(void) ...@@ -2481,6 +2481,9 @@ static void run_tests(void)
SET_EXPECT(global_success_d); SET_EXPECT(global_success_d);
SET_EXPECT(global_success_i); SET_EXPECT(global_success_i);
parse_script_a("' comment\r" parse_script_a("' comment\r"
"x = _\r3\r"
"x = _\n3\r"
"x = _\r\n3\r"
"Sub testsub(arg)\r" "Sub testsub(arg)\r"
"If arg = 1 Then\r\r" "If arg = 1 Then\r\r"
"Call reportSuccess()\n\n" "Call reportSuccess()\n\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment