Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
adccafb4
Commit
adccafb4
authored
Dec 21, 2016
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
tests/basics/lexer: Add a test for newline-escaping within a string.
parent
1b44987d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
py/lexer.c
+1
-1
1 addition, 1 deletion
py/lexer.c
tests/basics/lexer.py
+4
-0
4 additions, 0 deletions
tests/basics/lexer.py
with
5 additions
and
1 deletion
py/lexer.c
+
1
−
1
View file @
adccafb4
...
@@ -431,7 +431,7 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, bool first_token) {
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
tests/basics/lexer.py
+
4
−
0
View file @
adccafb4
...
@@ -19,6 +19,10 @@ print(eval("1\r"))
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment