mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 23:07:17 +00:00
Berry Allow comments in multi-line strings (#18848)
This commit is contained in:
parent
5cb9bae72c
commit
5da84c52ff
@ -394,7 +394,9 @@ static int skip_delimiter(blexer *lexer) {
|
||||
int c = lgetc(lexer);
|
||||
int delimeter_present = 0;
|
||||
while (1) {
|
||||
if (c == '\r' || c == '\n') {
|
||||
if (c == '#') {
|
||||
skip_comment(lexer);
|
||||
} else if (c == '\r' || c == '\n') {
|
||||
skip_newline(lexer);
|
||||
} else if (c == ' ' || c == '\t' || c == '\f' || c == '\v') {
|
||||
next(lexer);
|
||||
|
@ -88,3 +88,25 @@ assert(string.replace("hellollo", "aa", "xx") == "hellollo")
|
||||
assert(string.replace("hello", "ll", "") == "heo")
|
||||
assert(string.replace("hello", "", "xx") == "hello")
|
||||
assert(string.replace("hello", "", "") == "hello")
|
||||
|
||||
# multi-line strings
|
||||
var s = "a" "b""c"
|
||||
assert(s == 'abc')
|
||||
|
||||
s = 'a'"b"'''c'
|
||||
assert(s == 'abc')
|
||||
|
||||
s = "a"
|
||||
'b'
|
||||
""
|
||||
"c"
|
||||
assert(s == 'abc')
|
||||
|
||||
s = "a" #- b -# "b" #--# "c"
|
||||
assert(s == 'abc')
|
||||
|
||||
s = "a"#
|
||||
# "z"
|
||||
"b" # zz
|
||||
"c"
|
||||
assert(s == 'abc')
|
||||
|
Loading…
x
Reference in New Issue
Block a user