[PATCH 1/2] vbscript: Treat \r as a newline separator.

Zebediah Figura z.figura12 at gmail.com
Mon May 21 20:32:39 CDT 2018


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/vbscript/lex.c       | 3 ++-
 dlls/vbscript/tests/run.c | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c
index 98b4cbb..21fe2e4 100644
--- a/dlls/vbscript/lex.c
+++ b/dlls/vbscript/lex.c
@@ -383,7 +383,7 @@ 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++;
 }
 
@@ -421,6 +421,7 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
 
     switch(c) {
     case '\n':
+    case '\r':
         ctx->ptr++;
         return tNL;
     case '\'':
diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c
index 6b57540..2f50377 100644
--- a/dlls/vbscript/tests/run.c
+++ b/dlls/vbscript/tests/run.c
@@ -2394,6 +2394,13 @@ static void run_tests(void)
     ok(FAILED(hres), "script didn't fail\n");
     todo_wine CHECK_CALLED(OnScriptError);
 
+    parse_script_a("Sub testsub(arg)\r"
+                   "If arg = 1 Then\r\r"
+                   "arg = 2\n\n"
+                   "End If\r\n"
+                   "End Sub\n\r"
+                   "Call testsub(1)");
+
     run_from_res("lang.vbs");
     run_from_res("api.vbs");
     run_from_res("regexp.vbs");
-- 
2.7.4




More information about the wine-devel mailing list