DIRECTOR: LINGO: Keep continuations in skipped lines

This should keep line numbers more consistent.
This commit is contained in:
djsrv 2021-07-21 21:56:51 -04:00
parent 8ac5130740
commit c716ded122

View File

@ -155,12 +155,15 @@ Common::U32String LingoCompiler::codePreprocessor(const Common::U32String &code,
res1.clear();
// Get next line
int continuationCount = 0;
while (*s && *s != '\n') { // If we see a whitespace
res1 += *s;
line += tolower(*s++);
if (*s == CONTINUATION)
if (*s == CONTINUATION) {
linenumber++;
continuationCount++;
}
}
debugC(2, kDebugParse | kDebugPreprocess, "line: '%s'", line.encode().c_str());
@ -170,6 +173,9 @@ Common::U32String LingoCompiler::codePreprocessor(const Common::U32String &code,
defFound = true;
} else {
debugC(2, kDebugParse | kDebugPreprocess, "skipping line before first definition");
for (int i = 0; i < continuationCount; i++) {
res += CONTINUATION;
}
linenumber++;
if (*s) // copy newline symbol
res += *s++;