Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3269cc8b
Commit
3269cc8b
authored
Jul 13, 2001
by
Kurt B. Kaiser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py-cvs-rel2_1 (Rev 1.6 - 1.8) merge
Fix autoindent bug and deflect Unicode from text.get()
parent
48b03144
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
Lib/idlelib/PyParse.py
Lib/idlelib/PyParse.py
+23
-4
No files found.
Lib/idlelib/PyParse.py
View file @
3269cc8b
...
...
@@ -105,6 +105,11 @@ for ch in "\"'\\\n#":
_tran
=
string
.
join
(
_tran
,
''
)
del
ch
try
:
UnicodeType
=
type
(
unicode
(
""
))
except
NameError
:
UnicodeType
=
None
class
Parser
:
def
__init__
(
self
,
indentwidth
,
tabwidth
):
...
...
@@ -113,6 +118,19 @@ class Parser:
def
set_str
(
self
,
str
):
assert
len
(
str
)
==
0
or
str
[
-
1
]
==
'
\
n
'
if
type
(
str
)
is
UnicodeType
:
# The parse functions have no idea what to do with Unicode, so
# replace all Unicode characters with "x". This is "safe"
# so long as the only characters germane to parsing the structure
# of Python are 7-bit ASCII. It's *necessary* because Unicode
# strings don't have a .translate() method that supports
# deletechars.
uniphooey
=
str
str
=
[]
push
=
str
.
append
for
raw
in
map
(
ord
,
uniphooey
):
push
(
raw
<
127
and
chr
(
raw
)
or
"x"
)
str
=
""
.
join
(
str
)
self
.
str
=
str
self
.
study_level
=
0
...
...
@@ -385,13 +403,14 @@ class Parser:
m
=
_chew_ordinaryre
(
str
,
p
,
q
)
if
m
:
# we skipped at least one boring char
p
=
m
.
end
()
new
p
=
m
.
end
()
# back up over totally boring whitespace
i
=
p
-
1
# index of last boring char
while
i
>=
0
and
str
[
i
]
in
"
\
t
\
n
"
:
i
=
newp
-
1
# index of last boring char
while
i
>=
p
and
str
[
i
]
in
"
\
t
\
n
"
:
i
=
i
-
1
if
i
>=
0
:
if
i
>=
p
:
lastch
=
str
[
i
]
p
=
newp
if
p
>=
q
:
break
...
...
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