Support backslash at end of line as continuation
This commit is contained in:
parent
976db6f954
commit
a08b76adb5
6
kuroko.c
6
kuroko.c
@ -547,10 +547,14 @@ _finishArgs:
|
|||||||
* continue to accept input. Our compiler isn't really
|
* continue to accept input. Our compiler isn't really
|
||||||
* set up to let us compile "on the fly" so we can't just
|
* set up to let us compile "on the fly" so we can't just
|
||||||
* run lines through it and see if it wants more... */
|
* 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;
|
inBlock = 1;
|
||||||
blockWidth = countSpaces + 4;
|
blockWidth = countSpaces + 4;
|
||||||
continue;
|
continue;
|
||||||
|
} else if (lineLength > 1 && lines[i][lineLength-2] == '\\') {
|
||||||
|
inBlock = 1;
|
||||||
|
blockWidth = 0;
|
||||||
|
continue;
|
||||||
} else if (inBlock && lineLength != 1) {
|
} else if (inBlock && lineLength != 1) {
|
||||||
if (isSpaces) {
|
if (isSpaces) {
|
||||||
free(lines[i]);
|
free(lines[i]);
|
||||||
|
@ -308,6 +308,12 @@ KrkToken krk_scanToken() {
|
|||||||
return out;
|
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 */
|
/* Not indentation, not a linefeed on an empty line, must be not be start of line any more */
|
||||||
scanner.startOfLine = 0;
|
scanner.startOfLine = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user