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
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
081f9325
Commit
081f9325
authored
9 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py/lexer: Raise NotImplError for unicode name escape, instead of assert.
parent
a7ffa972
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/lexer.c
+2
-1
2 additions, 1 deletion
py/lexer.c
tests/misc/non_compliant_lexer.py
+12
-0
12 additions, 0 deletions
tests/misc/non_compliant_lexer.py
tests/misc/non_compliant_lexer.py.exp
+1
-0
1 addition, 0 deletions
tests/misc/non_compliant_lexer.py.exp
with
15 additions
and
1 deletion
py/lexer.c
+
2
−
1
View file @
081f9325
...
...
@@ -29,6 +29,7 @@
#include
"py/mpstate.h"
#include
"py/lexer.h"
#include
"py/runtime.h"
#define TAB_SIZE (8)
...
...
@@ -466,7 +467,7 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, bool first_token) {
// 3MB of text; even gzip-compressed and with minimal structure, it'll take
// roughly half a meg of storage. This form of Unicode escape may be added
// later on, but it's definitely not a priority right now. -- CJA 20140607
assert
(
!
"U
nicode name escapes
not supported
"
);
mp_not_implemented
(
"u
nicode name escapes"
);
break
;
default:
if
(
c
>=
'0'
&&
c
<=
'7'
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/misc/non_compliant_lexer.py
+
12
−
0
View file @
081f9325
# lexer tests for things that are not implemented, or have non-compliant behaviour
def
test
(
code
):
try
:
exec
(
code
)
print
(
'
no Error
'
)
except
SyntaxError
:
print
(
'
SyntaxError
'
)
except
NotImplementedError
:
print
(
'
NotImplementedError
'
)
# uPy requires spaces between literal numbers and keywords, CPy doesn't
try
:
eval
(
'
1and 0
'
)
...
...
@@ -17,3 +26,6 @@ try:
eval
(
'
1if 0else 0
'
)
except
SyntaxError
:
print
(
'
SyntaxError
'
)
# unicode name escapes are not implemented
test
(
'"
\\
N{LATIN SMALL LETTER A}
"'
)
This diff is collapsed.
Click to expand it.
tests/misc/non_compliant_lexer.py.exp
+
1
−
0
View file @
081f9325
...
...
@@ -2,3 +2,4 @@ SyntaxError
SyntaxError
SyntaxError
SyntaxError
NotImplementedError
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