Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
a7bd92e2
Commit
a7bd92e2
authored
Mar 06, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes for escape sequences in unicode literals
parent
33c9c463
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
Cython/Compiler/Lexicon.py
Cython/Compiler/Lexicon.py
+3
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+11
-6
No files found.
Cython/Compiler/Lexicon.py
View file @
a7bd92e2
...
...
@@ -61,7 +61,9 @@ def make_lexicon():
two_oct
=
octdigit
+
octdigit
three_oct
=
octdigit
+
octdigit
+
octdigit
two_hex
=
hexdigit
+
hexdigit
escapeseq
=
Str
(
"
\
\
"
)
+
(
two_oct
|
three_oct
|
two_hex
|
AnyChar
)
four_hex
=
two_hex
+
two_hex
escapeseq
=
Str
(
"
\
\
"
)
+
(
two_oct
|
three_oct
|
two_hex
|
Str
(
'u'
)
+
four_hex
|
Str
(
'x'
)
+
two_hex
|
AnyChar
)
bra
=
Any
(
"([{"
)
ket
=
Any
(
")]}"
)
...
...
Cython/Compiler/Parsing.py
View file @
a7bd92e2
...
...
@@ -565,11 +565,18 @@ def p_string_literal(s):
c
=
systr
[
1
]
if
c
in
"'
\
"
\
\
abfnrtv01234567"
:
chars
.
append
(
systr
)
elif
c
==
'x'
:
chars
.
append
(
'
\
\
x0'
+
systr
[
2
:])
elif
c
==
'
\
n
'
:
pass
elif
c
==
'u'
:
elif
c
in
'ux'
:
if
kind
==
'u'
:
try
:
chars
.
append
(
systr
.
decode
(
'unicode_escape'
))
except
UnicodeDecodeError
:
s
.
error
(
"Invalid unicode escape '%s'"
%
systr
,
pos
=
pos
)
elif
c
==
'x'
:
chars
.
append
(
'
\
\
x0'
+
systr
[
2
:])
else
:
chars
.
append
(
systr
)
else
:
chars
.
append
(
r'\\'
+
systr
[
1
:])
...
...
@@ -585,8 +592,6 @@ def p_string_literal(s):
(
sy
,
s
.
systring
))
s
.
next
()
value
=
''
.
join
(
chars
)
if
kind
==
'u'
:
value
=
value
.
decode
(
'raw_unicode_escape'
)
#print "p_string_literal: value =", repr(value) ###
return
kind
,
value
...
...
Write
Preview
Markdown
is supported
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