Zebediah Figura : vbscript: Treat \r as a newline separator.

Alexandre Julliard julliard at winehq.org
Tue Jun 19 14:52:01 CDT 2018


Module: wine
Branch: master
Commit: 5800c9ed23a5c720843445d91c8547925493df8a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5800c9ed23a5c720843445d91c8547925493df8a

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sat Jun 16 19:05:30 2018 -0500

vbscript: Treat \r as a newline separator.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vbscript/lex.c       |  6 ++++--
 dlls/vbscript/tests/run.c | 12 ++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c
index 98b4cbb..b0fac48 100644
--- a/dlls/vbscript/lex.c
+++ b/dlls/vbscript/lex.c
@@ -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 '\'':
diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c
index 6b57540..191f5a7 100644
--- a/dlls/vbscript/tests/run.c
+++ b/dlls/vbscript/tests/run.c
@@ -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");




More information about the wine-cvs mailing list