Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
adccafb4
Commit
adccafb4
authored
Dec 22, 2016
by
Damien George
Browse files
tests/basics/lexer: Add a test for newline-escaping within a string.
parent
1b44987d
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/lexer.c
View file @
adccafb4
...
...
@@ -431,7 +431,7 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, bool first_token) {
}
else
{
switch
(
c
)
{
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
;
...
...
tests/basics/lexer.py
View file @
adccafb4
...
...
@@ -19,6 +19,10 @@ print(eval("1\r"))
print
(
eval
(
"12
\r
"
))
print
(
eval
(
"123
\r
"
))
# backslash used to escape a line-break in a string
print
(
'a
\
b'
)
# lots of indentation
def
a
(
x
):
if
x
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment