Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
9ad27523
Kaydet (Commit)
9ad27523
authored
Şub 21, 2001
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use re in stead of regex, so we get rid of the annoying warning during startup.
üst
2d0589be
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
47 deletions
+54
-47
PyBrowser.py
Mac/Tools/IDE/PyBrowser.py
+8
-4
PyDocSearch.py
Mac/Tools/IDE/PyDocSearch.py
+5
-5
PyEdit.py
Mac/Tools/IDE/PyEdit.py
+23
-19
PyFontify.py
Mac/Tools/IDE/PyFontify.py
+9
-11
Wtext.py
Mac/Tools/IDE/Wtext.py
+9
-8
No files found.
Mac/Tools/IDE/PyBrowser.py
Dosyayı görüntüle @
9ad27523
...
...
@@ -3,7 +3,7 @@ import Wkeys
import
struct
import
string
import
types
import
re
gex
import
re
nullid
=
'
\0\0
'
closedid
=
struct
.
pack
(
'h'
,
468
)
...
...
@@ -13,11 +13,15 @@ opensolidid = struct.pack('h', 471)
arrows
=
(
nullid
,
closedid
,
openid
,
closedsolidid
,
opensolidid
)
has_ctlcharsRE
=
regex
.
compile
(
'[
\000
-
\037\177
-
\377
]'
)
has_ctlcharsRE
=
re
.
compile
(
'[
\000
-
\037\177
-
\377
]'
)
def
ctlcharsREsearch
(
str
):
if
has_ctlcharsRE
(
str
)
is
None
:
return
-
1
return
1
def
double_repr
(
key
,
value
,
truncvalue
=
0
,
type
=
type
,
StringType
=
types
.
StringType
,
has_ctlchars
=
has_ctlcharsRE
.
search
,
_repr
=
repr
,
str
=
str
):
has_ctlchars
=
ctlcharsRE
search
,
_repr
=
repr
,
str
=
str
):
if
type
(
key
)
==
StringType
and
has_ctlchars
(
key
)
<
0
:
key
=
str
(
key
)
else
:
...
...
Mac/Tools/IDE/PyDocSearch.py
Dosyayı görüntüle @
9ad27523
...
...
@@ -2,7 +2,7 @@ import aetools
import
Standard_Suite
import
Required_Suite
import
WWW_Suite
import
re
gex
import
re
import
W
import
macfs
import
os
...
...
@@ -29,16 +29,16 @@ app = W.getapplication()
#SIGNATURE='MSIE' # MS Explorer
SIGNATURE
=
'MOSS'
# Netscape
_titlepat
=
re
gex
.
compile
(
'<title>
\
([^<]*
\
)</title>'
)
_titlepat
=
re
.
compile
(
'<title>
\
([^<]*
\
)</title>'
)
def
sucktitle
(
path
):
f
=
open
(
path
)
text
=
f
.
read
(
1024
)
# assume the title is in the first 1024 bytes
f
.
close
()
lowertext
=
string
.
lower
(
text
)
if
_titlepat
.
search
(
lowertext
)
>
0
:
a
,
b
=
_titlepat
.
regs
[
1
]
return
text
[
a
:
b
]
matcher
=
_titlepat
.
search
(
lowertext
)
if
matcher
:
return
matcher
.
group
(
1
)
return
path
def
verifydocpath
(
docpath
):
...
...
Mac/Tools/IDE/PyEdit.py
Dosyayı görüntüle @
9ad27523
...
...
@@ -15,7 +15,7 @@ import imp
import
sys
import
string
import
marshal
import
re
gex
import
re
try
:
import
Wthreading
...
...
@@ -25,7 +25,8 @@ else:
haveThreading
=
Wthreading
.
haveThreading
_scriptuntitledcounter
=
1
_wordchars
=
string
.
letters
+
string
.
digits
+
"_"
# _wordchars = string.letters + string.digits + "_"
_wordchars
=
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
runButtonLabels
=
[
"Run all"
,
"Stop!"
]
...
...
@@ -553,7 +554,6 @@ class Editor(W.Window):
if
indent
==
1
:
classname
=
''
alllines
=
string
.
split
(
alltext
,
'
\r
'
)
identifieRE_match
=
_identifieRE
.
match
for
i
in
range
(
selfirstline
-
1
,
-
1
,
-
1
):
line
=
alllines
[
i
]
if
line
[:
6
]
==
'class '
:
...
...
@@ -673,7 +673,6 @@ class Editor(W.Window):
def
getclasslist
(
self
):
from
string
import
find
,
strip
import
re
methodRE
=
re
.
compile
(
r"\r[ \t]+def "
)
findMethod
=
methodRE
.
search
editor
=
self
.
editgroup
.
editor
...
...
@@ -715,7 +714,6 @@ class Editor(W.Window):
offsetToLine
=
editor
.
ted
.
WEOffsetToLine
getLineRange
=
editor
.
ted
.
WEGetLineRange
append
=
classlist
.
append
identifieRE_match
=
_identifieRE
.
match
for
pos
,
tag
in
list
:
lineno
=
offsetToLine
(
pos
)
lineStart
,
lineEnd
=
getLineRange
(
lineno
)
...
...
@@ -794,14 +792,13 @@ def _makewholewordpattern(word):
# first, escape special regex chars
for
esc
in
"
\\
[].*^+$?"
:
word
=
_escape
(
word
,
esc
)
import
regex
notwordcharspat
=
'[^'
+
_wordchars
+
']'
pattern
=
'
\
('
+
word
+
'
\
)'
pattern
=
'
('
+
word
+
'
)'
if
word
[
0
]
in
_wordchars
:
pattern
=
notwordcharspat
+
pattern
if
word
[
-
1
]
in
_wordchars
:
pattern
=
pattern
+
notwordcharspat
return
re
gex
.
compile
(
pattern
)
return
re
.
compile
(
pattern
)
class
SearchEngine
:
...
...
@@ -935,9 +932,9 @@ class SearchEngine:
while
1
:
if
self
.
parms
[
"wholeword"
]:
wholewordRE
=
_makewholewordpattern
(
find
)
wholewordRE
.
search
(
text
,
pos
)
if
wholewordRE
.
regs
:
pos
=
wholewordRE
.
regs
[
1
][
0
]
match
=
wholewordRE
.
search
(
text
,
pos
)
if
match
:
pos
=
match
.
start
(
1
)
else
:
pos
=
-
1
else
:
...
...
@@ -997,9 +994,9 @@ class SearchEngine:
selstart
,
selend
=
min
(
selstart
,
selend
),
max
(
selstart
,
selend
)
if
self
.
parms
[
"wholeword"
]:
wholewordRE
=
_makewholewordpattern
(
find
)
wholewordRE
.
search
(
text
,
selend
)
if
wholewordRE
.
regs
:
pos
=
wholewordRE
.
regs
[
1
][
0
]
match
=
wholewordRE
.
search
(
text
,
selend
)
if
match
:
pos
=
match
.
start
(
1
)
else
:
pos
=
-
1
else
:
...
...
@@ -1009,9 +1006,9 @@ class SearchEngine:
return
1
elif
self
.
parms
[
"wrap"
]:
if
self
.
parms
[
"wholeword"
]:
wholewordRE
.
search
(
text
,
0
)
if
wholewordRE
.
regs
:
pos
=
wholewordRE
.
regs
[
1
][
0
]
match
=
wholewordRE
.
search
(
text
,
0
)
if
match
:
pos
=
match
.
start
(
1
)
else
:
pos
=
-
1
else
:
...
...
@@ -1169,12 +1166,19 @@ def execstring(pytext, globals, locals, filename="<string>", debugging=0,
PyDebugger
.
stop
()
_identifieRE
=
regex
.
compile
(
"[A-Za-z_][A-Za-z_0-9]*"
)
_identifieRE
=
re
.
compile
(
"[A-Za-z_][A-Za-z_0-9]*"
)
def
identifieRE_match
(
str
):
match
=
_identifieRE
.
match
(
str
)
if
not
match
:
return
-
1
return
match
.
end
()
def
_filename_as_modname
(
fname
):
if
fname
[
-
3
:]
==
'.py'
:
modname
=
fname
[:
-
3
]
if
_identifieRE
.
match
(
modname
)
==
len
(
modname
):
match
=
_identifieRE
.
match
(
modname
)
if
match
and
match
.
start
()
==
0
and
match
.
end
()
==
len
(
modname
):
return
string
.
join
(
string
.
split
(
modname
,
'.'
),
'_'
)
def
findeditor
(
topwindow
,
fromtop
=
0
):
...
...
Mac/Tools/IDE/PyFontify.py
Dosyayı görüntüle @
9ad27523
...
...
@@ -27,7 +27,7 @@ sublist is not used, hence always None.
__version__
=
"0.3.3"
import
string
,
re
gex
import
string
,
re
# First a little helper, since I don't like to repeat things. (Tismer speaking)
import
string
...
...
@@ -87,10 +87,10 @@ for keyword in keywordsList:
keyPat
=
keyPat
[:
-
2
]
+
"
\
)"
+
nonKeyPat
matchPat
=
commentPat
+
"
\
|"
+
keyPat
+
"
\
|"
+
tripleQuotePat
+
"
\
|"
+
quotePat
matchRE
=
re
gex
.
compile
(
matchPat
)
matchRE
=
re
.
compile
(
matchPat
)
idKeyPat
=
"[
\t
]*[A-Za-z_][A-Za-z_0-9.]*"
# Ident w. leading whitespace.
idRE
=
re
gex
.
compile
(
idKeyPat
)
idRE
=
re
.
compile
(
idKeyPat
)
def
fontify
(
pytext
,
searchfrom
=
0
,
searchto
=
None
):
...
...
@@ -98,9 +98,7 @@ def fontify(pytext, searchfrom = 0, searchto = None):
searchto
=
len
(
pytext
)
# Cache a few attributes for quicker reference.
search
=
matchRE
.
search
group
=
matchRE
.
group
idSearch
=
idRE
.
search
idGroup
=
idRE
.
group
tags
=
[]
tags_append
=
tags
.
append
...
...
@@ -112,10 +110,10 @@ def fontify(pytext, searchfrom = 0, searchto = None):
start
=
0
end
=
searchfrom
while
1
:
start
=
search
(
pytext
,
end
)
if
start
<
0
or
start
>=
searchto
:
m
=
search
(
pytext
,
end
)
if
not
m
or
m
.
start
()
>=
searchto
:
break
# EXIT LOOP
match
=
group
(
0
)
match
=
m
.
group
(
0
)
end
=
start
+
len
(
match
)
c
=
match
[
0
]
if
c
not
in
"#'
\"
"
:
...
...
@@ -133,9 +131,9 @@ def fontify(pytext, searchfrom = 0, searchto = None):
# If this was a defining keyword, look ahead to the
# following identifier.
if
match
in
[
"def"
,
"class"
]:
start
=
idSearch
(
pytext
,
end
)
if
start
==
end
:
match
=
idG
roup
(
0
)
m
=
idSearch
(
pytext
,
end
)
if
m
and
m
.
start
()
==
end
:
match
=
m
.
g
roup
(
0
)
end
=
start
+
len
(
match
)
tags_append
((
identifierTag
,
start
,
end
,
None
))
elif
c
==
"#"
:
...
...
Mac/Tools/IDE/Wtext.py
Dosyayı görüntüle @
9ad27523
...
...
@@ -603,9 +603,9 @@ class TextEditor(EditText):
self
.
drawselframe
(
1
)
import
re
gex
commentPat
=
re
gex
.
compile
(
"[
\t
]*
\
(#
\
)"
)
indentPat
=
re
gex
.
compile
(
"
\t
*"
)
import
re
commentPat
=
re
.
compile
(
"[
\t
]*
\
(#
\
)"
)
indentPat
=
re
.
compile
(
"
\t
*"
)
class
PyEditor
(
TextEditor
):
...
...
@@ -659,9 +659,9 @@ class PyEditor(TextEditor):
snippet
=
self
.
getselectedtext
()
lines
=
string
.
split
(
snippet
,
'
\r
'
)
for
i
in
range
(
len
(
lines
)):
res
=
commentPat
.
match
(
lines
[
i
])
>=
0
if
res
>
0
:
pos
=
commentPat
.
regs
[
1
][
0
]
m
=
commentPat
.
match
(
lines
[
i
])
if
m
:
pos
=
m
.
start
(
1
)
lines
[
i
]
=
lines
[
i
][:
pos
]
+
lines
[
i
][
pos
+
1
:]
snippet
=
string
.
join
(
lines
,
'
\r
'
)
self
.
insert
(
snippet
)
...
...
@@ -676,8 +676,9 @@ class PyEditor(TextEditor):
indent
=
3000
# arbitrary large number...
for
line
in
lines
:
if
string
.
strip
(
line
):
if
indentPat
.
match
(
line
):
indent
=
min
(
indent
,
indentPat
.
regs
[
0
][
1
])
m
=
indentPat
.
match
(
line
)
if
m
:
indent
=
min
(
indent
,
m
.
regs
[
0
][
1
])
else
:
indent
=
0
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