tests/basics/lexer: Add a test for newline-escaping within a string.
This commit is contained in:
parent
1b44987d0c
commit
adccafb42a
@ -431,7 +431,7 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, bool first_token) {
|
|||||||
} else {
|
} else {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case MP_LEXER_EOF: break; // TODO a proper error message?
|
case MP_LEXER_EOF: break; // TODO a proper error message?
|
||||||
case '\n': c = MP_LEXER_EOF; break; // TODO check this works correctly (we are supposed to ignore it
|
case '\n': c = MP_LEXER_EOF; break; // backslash escape the newline, just ignore it
|
||||||
case '\\': break;
|
case '\\': break;
|
||||||
case '\'': break;
|
case '\'': break;
|
||||||
case '"': break;
|
case '"': break;
|
||||||
|
@ -19,6 +19,10 @@ print(eval("1\r"))
|
|||||||
print(eval("12\r"))
|
print(eval("12\r"))
|
||||||
print(eval("123\r"))
|
print(eval("123\r"))
|
||||||
|
|
||||||
|
# backslash used to escape a line-break in a string
|
||||||
|
print('a\
|
||||||
|
b')
|
||||||
|
|
||||||
# lots of indentation
|
# lots of indentation
|
||||||
def a(x):
|
def a(x):
|
||||||
if x:
|
if x:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user