From 693591bdc3491133f2aa90498c4ad8d3aadd0eb7 Mon Sep 17 00:00:00 2001 From: Zeex Date: Thu, 26 Oct 2017 04:36:19 +0600 Subject: [PATCH] Don't delete trailing whitespace before '\' new s [] = "hello \ world"; ^ needs to be "hello world", not "helloworld". --- source/compiler/sc2.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index 2c9fd1a..0a69611 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -417,12 +417,9 @@ static void readline(unsigned char *line) ptr--; /* skip trailing whitespace */ if (*ptr=='\\') { cont=TRUE; - while (*(ptr-1)<=' ' && *(ptr-1)!='\0') - ptr--; /* set '\a' at the position of '\\' to make it possible to check * for a line continuation in a single line comment (error 49) */ - /* delete trailing whitespace before continuation */ *ptr++='\a'; *ptr='\0'; /* erase '\n' (and any trailing whitespace) */ } /* if */ @@ -557,7 +554,7 @@ static void stripcom(unsigned char *line) } /* if */ } /* if */ if (*line == '\a') { - *line = ' '; + memmove(line,line+1,strlen(line+1)+1); } } /* while */ #if !defined SC_LIGHT