Support backslash at end of line as continuation

This commit is contained in:
K. Lange 2021-01-14 14:17:02 +09:00
parent 976db6f954
commit a08b76adb5
2 changed files with 11 additions and 1 deletions

View File

@ -547,10 +547,14 @@ _finishArgs:
* continue to accept input. Our compiler isn't really
* set up to let us compile "on the fly" so we can't just
* run lines through it and see if it wants more... */
if (lineLength > 2 && lines[i][lineLength-2] == ':') {
if (lineLength > 1 && lines[i][lineLength-2] == ':') {
inBlock = 1;
blockWidth = countSpaces + 4;
continue;
} else if (lineLength > 1 && lines[i][lineLength-2] == '\\') {
inBlock = 1;
blockWidth = 0;
continue;
} else if (inBlock && lineLength != 1) {
if (isSpaces) {
free(lines[i]);

View File

@ -308,6 +308,12 @@ KrkToken krk_scanToken() {
return out;
}
if (c == '\\' && peek() == '\n') {
advance();
nextLine();
return makeToken(TOKEN_RETRY);
}
/* Not indentation, not a linefeed on an empty line, must be not be start of line any more */
scanner.startOfLine = 0;