Explorar o código

Fixed bug with "/*"

ceriel %!s(int64=30) %!d(string=hai) anos
pai
achega
9fbd4783a7
Modificáronse 1 ficheiros con 22 adicións e 0 borrados
  1. 22 0
      util/cpp/skip.c

+ 22 - 0
util/cpp/skip.c

@@ -62,6 +62,28 @@ skipline()
 
 	LoadChar(c);
 	while (class(c) != STNL && c != EOI) {
+		if (class(c) == STSTR || class(c) == STCHAR) {
+			register int stopc = c;
+			int escaped;
+			do {
+				escaped = 0;
+				LoadChar(c);
+				if (class(c) == STNL || c == EOI) {
+					break;
+				}
+				if (c == '\\') {
+					LoadChar(c);
+					if (c == '\n') {
+						++LineNumber;
+					}
+					else escaped = 1;
+				}
+			} while (escaped || c != stopc);
+			if (class(c) != STNL && c != EOI) {
+				LoadChar(c);
+			}
+			continue;
+		}
 		if (c == '\\') {
 			LoadChar(c);
 			if (class(c) == STNL)