Kaynağa Gözat

Fix that manage '\r' at the start of long string.

mingodad 11 yıl önce
ebeveyn
işleme
a32531100f
1 değiştirilmiş dosya ile 13 ekleme ve 4 silme
  1. 13 4
      SquiLu/squirrel/sqlexer.cpp

+ 13 - 4
SquiLu/squirrel/sqlexer.cpp

@@ -398,10 +398,19 @@ SQInteger SQLexer::ReadString(SQInteger ndelim,bool verbatim)
 	}
 	NEXT();
 	if(IS_EOB()) return -1;
-	if(start_equals && CUR_CHAR == _SC('\n')) {
-	    ++_currentline;
-	    NEXT(); //if a new line follows the start of delimiter drop it
-        if(IS_EOB()) return -1;
+	if(start_equals) {
+	    int cr_nl = CUR_CHAR == _SC('\r');
+        if(cr_nl) NEXT();
+        cr_nl = CUR_CHAR == _SC('\n');
+        if(cr_nl) NEXT();
+        if(cr_nl) {//if a new line follows the start of delimiter drop it
+            ++_currentline;
+            if(IS_EOB())
+            {
+                Error(_SC("unfinished string"));
+                return -1;
+            }
+        }
 	}
 	for(;;) {
 		while(CUR_CHAR != ndelim) {