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
081f9325
Commit
081f9325
authored
Sep 07, 2015
by
Damien George
Browse files
py/lexer: Raise NotImplError for unicode name escape, instead of assert.
parent
a7ffa972
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/lexer.c
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'
)
{
...
...
tests/misc/non_compliant_lexer.py
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}"'
)
tests/misc/non_compliant_lexer.py.exp
View file @
081f9325
...
...
@@ -2,3 +2,4 @@ SyntaxError
SyntaxError
SyntaxError
SyntaxError
NotImplementedError
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