Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 5235b29

Browse files
committed
[[ Bug 19927 ]] Allow ignorable whitespace after continuation char
This patch modifies the SEPARATOR rule in lc-compile's tokenizer so that any number of ignorable whitespace (tabs and spaces) can appear after the continuation char, but before the newline char.
1 parent c49afee commit 5235b29

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

docs/guides/LiveCode Builder Language Reference.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ A LiveCode builder statement or declaration can be continued onto
7979
multiple lines of code by placing the line continuation character `\`
8080
at the end each line.
8181

82-
- **Line continuation**: \\(\n|\r\n|\r)
82+
- **Line continuation**: \\[\t ]*(\n|\r\n|\r)
83+
84+
> **Note:** Tab and space characters are allowed after the `\` and before the
85+
> newline, but no other characters.
8386
8487
> **Note:** A line continuation cannot occur within a comment.
8588

docs/lcb/notes/19927.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# LiveCode Builder Tools
2+
## lc-compile
3+
4+
# [19927] Allow ignorable whitespace after continuation chars

tests/lcb/compiler/frontend/line-continuation.compilertest

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ end module
2525
%SUCCESS
2626
%ENDTEST
2727

28+
%% Continuation characters may be followed by any number of spaces and tabs
29+
%TEST ContinuationWhiteSpace
30+
module \
31+
compiler_test
32+
end module
33+
%EXPECT PASS
34+
%SUCCESS
35+
%ENDTEST
36+
2837
%% Line continuation characters can't occur within a line, because
2938
%% they consume a following newline.
3039
%TEST ContinuationNoNewline

toolchain/lc-compile/src/SEPARATOR.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
\\(\n|\r|\r\n) {
1+
\\[ \t]*(\n|\r|\r\n) {
22
AdvanceCurrentPosition(1);
33
AdvanceCurrentPositionToNextRow();
44
}

0 commit comments

Comments
 (0)