vbscript: Treat \r as a newline separator.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-06-16 19:05:30 -05:00 committed by Alexandre Julliard
parent d0451d5734
commit 5800c9ed23
2 changed files with 16 additions and 2 deletions

View File

@ -383,13 +383,14 @@ static int parse_hex_literal(parser_ctx_t *ctx, LONG *ret)
static void skip_spaces(parser_ctx_t *ctx)
{
while(*ctx->ptr == ' ' || *ctx->ptr == '\t' || *ctx->ptr == '\r')
while(*ctx->ptr == ' ' || *ctx->ptr == '\t')
ctx->ptr++;
}
static int comment_line(parser_ctx_t *ctx)
{
ctx->ptr = strchrW(ctx->ptr, '\n');
static const WCHAR newlineW[] = {'\n','\r',0};
ctx->ptr = strpbrkW(ctx->ptr, newlineW);
if(ctx->ptr)
ctx->ptr++;
else
@ -421,6 +422,7 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
switch(c) {
case '\n':
case '\r':
ctx->ptr++;
return tNL;
case '\'':

View File

@ -2394,6 +2394,18 @@ static void run_tests(void)
ok(FAILED(hres), "script didn't fail\n");
todo_wine CHECK_CALLED(OnScriptError);
SET_EXPECT(global_success_d);
SET_EXPECT(global_success_i);
parse_script_a("' comment\r"
"Sub testsub(arg)\r"
"If arg = 1 Then\r\r"
"Call reportSuccess()\n\n"
"End If\r\n"
"End Sub\n\r"
"Call testsub(1)");
CHECK_CALLED(global_success_d);
CHECK_CALLED(global_success_i);
run_from_res("lang.vbs");
run_from_res("api.vbs");
run_from_res("regexp.vbs");