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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
46 deletions
+53
-46
PyBrowser.py
Mac/Tools/IDE/PyBrowser.py
+7
-3
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
...
@@ -3,7 +3,7 @@ import Wkeys
import
struct
import
struct
import
string
import
string
import
types
import
types
import
re
gex
import
re
nullid
=
'
\0\0
'
nullid
=
'
\0\0
'
closedid
=
struct
.
pack
(
'h'
,
468
)
closedid
=
struct
.
pack
(
'h'
,
468
)
...
@@ -13,11 +13,15 @@ opensolidid = struct.pack('h', 471)
...
@@ -13,11 +13,15 @@ opensolidid = struct.pack('h', 471)
arrows
=
(
nullid
,
closedid
,
openid
,
closedsolidid
,
opensolidid
)
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
,
def
double_repr
(
key
,
value
,
truncvalue
=
0
,
type
=
type
,
StringType
=
types
.
StringType
,
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
:
if
type
(
key
)
==
StringType
and
has_ctlchars
(
key
)
<
0
:
key
=
str
(
key
)
key
=
str
(
key
)
else
:
else
:
...
...
Mac/Tools/IDE/PyDocSearch.py
Dosyayı görüntüle @
9ad27523
...
@@ -2,7 +2,7 @@ import aetools
...
@@ -2,7 +2,7 @@ import aetools
import
Standard_Suite
import
Standard_Suite
import
Required_Suite
import
Required_Suite
import
WWW_Suite
import
WWW_Suite
import
re
gex
import
re
import
W
import
W
import
macfs
import
macfs
import
os
import
os
...
@@ -29,16 +29,16 @@ app = W.getapplication()
...
@@ -29,16 +29,16 @@ app = W.getapplication()
#SIGNATURE='MSIE' # MS Explorer
#SIGNATURE='MSIE' # MS Explorer
SIGNATURE
=
'MOSS'
# Netscape
SIGNATURE
=
'MOSS'
# Netscape
_titlepat
=
re
gex
.
compile
(
'<title>
\
([^<]*
\
)</title>'
)
_titlepat
=
re
.
compile
(
'<title>
\
([^<]*
\
)</title>'
)
def
sucktitle
(
path
):
def
sucktitle
(
path
):
f
=
open
(
path
)
f
=
open
(
path
)
text
=
f
.
read
(
1024
)
# assume the title is in the first 1024 bytes
text
=
f
.
read
(
1024
)
# assume the title is in the first 1024 bytes
f
.
close
()
f
.
close
()
lowertext
=
string
.
lower
(
text
)
lowertext
=
string
.
lower
(
text
)
if
_titlepat
.
search
(
lowertext
)
>
0
:
matcher
=
_titlepat
.
search
(
lowertext
)
a
,
b
=
_titlepat
.
regs
[
1
]
if
matcher
:
return
text
[
a
:
b
]
return
matcher
.
group
(
1
)
return
path
return
path
def
verifydocpath
(
docpath
):
def
verifydocpath
(
docpath
):
...
...
Mac/Tools/IDE/PyEdit.py
Dosyayı görüntüle @
9ad27523
...
@@ -15,7 +15,7 @@ import imp
...
@@ -15,7 +15,7 @@ import imp
import
sys
import
sys
import
string
import
string
import
marshal
import
marshal
import
re
gex
import
re
try
:
try
:
import
Wthreading
import
Wthreading
...
@@ -25,7 +25,8 @@ else:
...
@@ -25,7 +25,8 @@ else:
haveThreading
=
Wthreading
.
haveThreading
haveThreading
=
Wthreading
.
haveThreading
_scriptuntitledcounter
=
1
_scriptuntitledcounter
=
1
_wordchars
=
string
.
letters
+
string
.
digits
+
"_"
# _wordchars = string.letters + string.digits + "_"
_wordchars
=
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
runButtonLabels
=
[
"Run all"
,
"Stop!"
]
runButtonLabels
=
[
"Run all"
,
"Stop!"
]
...
@@ -553,7 +554,6 @@ class Editor(W.Window):
...
@@ -553,7 +554,6 @@ class Editor(W.Window):
if
indent
==
1
:
if
indent
==
1
:
classname
=
''
classname
=
''
alllines
=
string
.
split
(
alltext
,
'
\r
'
)
alllines
=
string
.
split
(
alltext
,
'
\r
'
)
identifieRE_match
=
_identifieRE
.
match
for
i
in
range
(
selfirstline
-
1
,
-
1
,
-
1
):
for
i
in
range
(
selfirstline
-
1
,
-
1
,
-
1
):
line
=
alllines
[
i
]
line
=
alllines
[
i
]
if
line
[:
6
]
==
'class '
:
if
line
[:
6
]
==
'class '
:
...
@@ -673,7 +673,6 @@ class Editor(W.Window):
...
@@ -673,7 +673,6 @@ class Editor(W.Window):
def
getclasslist
(
self
):
def
getclasslist
(
self
):
from
string
import
find
,
strip
from
string
import
find
,
strip
import
re
methodRE
=
re
.
compile
(
r"\r[ \t]+def "
)
methodRE
=
re
.
compile
(
r"\r[ \t]+def "
)
findMethod
=
methodRE
.
search
findMethod
=
methodRE
.
search
editor
=
self
.
editgroup
.
editor
editor
=
self
.
editgroup
.
editor
...
@@ -715,7 +714,6 @@ class Editor(W.Window):
...
@@ -715,7 +714,6 @@ class Editor(W.Window):
offsetToLine
=
editor
.
ted
.
WEOffsetToLine
offsetToLine
=
editor
.
ted
.
WEOffsetToLine
getLineRange
=
editor
.
ted
.
WEGetLineRange
getLineRange
=
editor
.
ted
.
WEGetLineRange
append
=
classlist
.
append
append
=
classlist
.
append
identifieRE_match
=
_identifieRE
.
match
for
pos
,
tag
in
list
:
for
pos
,
tag
in
list
:
lineno
=
offsetToLine
(
pos
)
lineno
=
offsetToLine
(
pos
)
lineStart
,
lineEnd
=
getLineRange
(
lineno
)
lineStart
,
lineEnd
=
getLineRange
(
lineno
)
...
@@ -794,14 +792,13 @@ def _makewholewordpattern(word):
...
@@ -794,14 +792,13 @@ def _makewholewordpattern(word):
# first, escape special regex chars
# first, escape special regex chars
for
esc
in
"
\\
[].*^+$?"
:
for
esc
in
"
\\
[].*^+$?"
:
word
=
_escape
(
word
,
esc
)
word
=
_escape
(
word
,
esc
)
import
regex
notwordcharspat
=
'[^'
+
_wordchars
+
']'
notwordcharspat
=
'[^'
+
_wordchars
+
']'
pattern
=
'
\
('
+
word
+
'
\
)'
pattern
=
'
('
+
word
+
'
)'
if
word
[
0
]
in
_wordchars
:
if
word
[
0
]
in
_wordchars
:
pattern
=
notwordcharspat
+
pattern
pattern
=
notwordcharspat
+
pattern
if
word
[
-
1
]
in
_wordchars
:
if
word
[
-
1
]
in
_wordchars
:
pattern
=
pattern
+
notwordcharspat
pattern
=
pattern
+
notwordcharspat
return
re
gex
.
compile
(
pattern
)
return
re
.
compile
(
pattern
)
class
SearchEngine
:
class
SearchEngine
:
...
@@ -935,9 +932,9 @@ class SearchEngine:
...
@@ -935,9 +932,9 @@ class SearchEngine:
while
1
:
while
1
:
if
self
.
parms
[
"wholeword"
]:
if
self
.
parms
[
"wholeword"
]:
wholewordRE
=
_makewholewordpattern
(
find
)
wholewordRE
=
_makewholewordpattern
(
find
)
wholewordRE
.
search
(
text
,
pos
)
match
=
wholewordRE
.
search
(
text
,
pos
)
if
wholewordRE
.
regs
:
if
match
:
pos
=
wholewordRE
.
regs
[
1
][
0
]
pos
=
match
.
start
(
1
)
else
:
else
:
pos
=
-
1
pos
=
-
1
else
:
else
:
...
@@ -997,9 +994,9 @@ class SearchEngine:
...
@@ -997,9 +994,9 @@ class SearchEngine:
selstart
,
selend
=
min
(
selstart
,
selend
),
max
(
selstart
,
selend
)
selstart
,
selend
=
min
(
selstart
,
selend
),
max
(
selstart
,
selend
)
if
self
.
parms
[
"wholeword"
]:
if
self
.
parms
[
"wholeword"
]:
wholewordRE
=
_makewholewordpattern
(
find
)
wholewordRE
=
_makewholewordpattern
(
find
)
wholewordRE
.
search
(
text
,
selend
)
match
=
wholewordRE
.
search
(
text
,
selend
)
if
wholewordRE
.
regs
:
if
match
:
pos
=
wholewordRE
.
regs
[
1
][
0
]
pos
=
match
.
start
(
1
)
else
:
else
:
pos
=
-
1
pos
=
-
1
else
:
else
:
...
@@ -1009,9 +1006,9 @@ class SearchEngine:
...
@@ -1009,9 +1006,9 @@ class SearchEngine:
return
1
return
1
elif
self
.
parms
[
"wrap"
]:
elif
self
.
parms
[
"wrap"
]:
if
self
.
parms
[
"wholeword"
]:
if
self
.
parms
[
"wholeword"
]:
wholewordRE
.
search
(
text
,
0
)
match
=
wholewordRE
.
search
(
text
,
0
)
if
wholewordRE
.
regs
:
if
match
:
pos
=
wholewordRE
.
regs
[
1
][
0
]
pos
=
match
.
start
(
1
)
else
:
else
:
pos
=
-
1
pos
=
-
1
else
:
else
:
...
@@ -1169,12 +1166,19 @@ def execstring(pytext, globals, locals, filename="<string>", debugging=0,
...
@@ -1169,12 +1166,19 @@ def execstring(pytext, globals, locals, filename="<string>", debugging=0,
PyDebugger
.
stop
()
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
):
def
_filename_as_modname
(
fname
):
if
fname
[
-
3
:]
==
'.py'
:
if
fname
[
-
3
:]
==
'.py'
:
modname
=
fname
[:
-
3
]
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
,
'.'
),
'_'
)
return
string
.
join
(
string
.
split
(
modname
,
'.'
),
'_'
)
def
findeditor
(
topwindow
,
fromtop
=
0
):
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.
...
@@ -27,7 +27,7 @@ sublist is not used, hence always None.
__version__
=
"0.3.3"
__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)
# First a little helper, since I don't like to repeat things. (Tismer speaking)
import
string
import
string
...
@@ -87,10 +87,10 @@ for keyword in keywordsList:
...
@@ -87,10 +87,10 @@ for keyword in keywordsList:
keyPat
=
keyPat
[:
-
2
]
+
"
\
)"
+
nonKeyPat
keyPat
=
keyPat
[:
-
2
]
+
"
\
)"
+
nonKeyPat
matchPat
=
commentPat
+
"
\
|"
+
keyPat
+
"
\
|"
+
tripleQuotePat
+
"
\
|"
+
quotePat
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.
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
):
def
fontify
(
pytext
,
searchfrom
=
0
,
searchto
=
None
):
...
@@ -98,9 +98,7 @@ def fontify(pytext, searchfrom = 0, searchto = None):
...
@@ -98,9 +98,7 @@ def fontify(pytext, searchfrom = 0, searchto = None):
searchto
=
len
(
pytext
)
searchto
=
len
(
pytext
)
# Cache a few attributes for quicker reference.
# Cache a few attributes for quicker reference.
search
=
matchRE
.
search
search
=
matchRE
.
search
group
=
matchRE
.
group
idSearch
=
idRE
.
search
idSearch
=
idRE
.
search
idGroup
=
idRE
.
group
tags
=
[]
tags
=
[]
tags_append
=
tags
.
append
tags_append
=
tags
.
append
...
@@ -112,10 +110,10 @@ def fontify(pytext, searchfrom = 0, searchto = None):
...
@@ -112,10 +110,10 @@ def fontify(pytext, searchfrom = 0, searchto = None):
start
=
0
start
=
0
end
=
searchfrom
end
=
searchfrom
while
1
:
while
1
:
start
=
search
(
pytext
,
end
)
m
=
search
(
pytext
,
end
)
if
start
<
0
or
start
>=
searchto
:
if
not
m
or
m
.
start
()
>=
searchto
:
break
# EXIT LOOP
break
# EXIT LOOP
match
=
group
(
0
)
match
=
m
.
group
(
0
)
end
=
start
+
len
(
match
)
end
=
start
+
len
(
match
)
c
=
match
[
0
]
c
=
match
[
0
]
if
c
not
in
"#'
\"
"
:
if
c
not
in
"#'
\"
"
:
...
@@ -133,9 +131,9 @@ def fontify(pytext, searchfrom = 0, searchto = None):
...
@@ -133,9 +131,9 @@ def fontify(pytext, searchfrom = 0, searchto = None):
# If this was a defining keyword, look ahead to the
# If this was a defining keyword, look ahead to the
# following identifier.
# following identifier.
if
match
in
[
"def"
,
"class"
]:
if
match
in
[
"def"
,
"class"
]:
start
=
idSearch
(
pytext
,
end
)
m
=
idSearch
(
pytext
,
end
)
if
start
==
end
:
if
m
and
m
.
start
()
==
end
:
match
=
idG
roup
(
0
)
match
=
m
.
g
roup
(
0
)
end
=
start
+
len
(
match
)
end
=
start
+
len
(
match
)
tags_append
((
identifierTag
,
start
,
end
,
None
))
tags_append
((
identifierTag
,
start
,
end
,
None
))
elif
c
==
"#"
:
elif
c
==
"#"
:
...
...
Mac/Tools/IDE/Wtext.py
Dosyayı görüntüle @
9ad27523
...
@@ -603,9 +603,9 @@ class TextEditor(EditText):
...
@@ -603,9 +603,9 @@ class TextEditor(EditText):
self
.
drawselframe
(
1
)
self
.
drawselframe
(
1
)
import
re
gex
import
re
commentPat
=
re
gex
.
compile
(
"[
\t
]*
\
(#
\
)"
)
commentPat
=
re
.
compile
(
"[
\t
]*
\
(#
\
)"
)
indentPat
=
re
gex
.
compile
(
"
\t
*"
)
indentPat
=
re
.
compile
(
"
\t
*"
)
class
PyEditor
(
TextEditor
):
class
PyEditor
(
TextEditor
):
...
@@ -659,9 +659,9 @@ class PyEditor(TextEditor):
...
@@ -659,9 +659,9 @@ class PyEditor(TextEditor):
snippet
=
self
.
getselectedtext
()
snippet
=
self
.
getselectedtext
()
lines
=
string
.
split
(
snippet
,
'
\r
'
)
lines
=
string
.
split
(
snippet
,
'
\r
'
)
for
i
in
range
(
len
(
lines
)):
for
i
in
range
(
len
(
lines
)):
res
=
commentPat
.
match
(
lines
[
i
])
>=
0
m
=
commentPat
.
match
(
lines
[
i
])
if
res
>
0
:
if
m
:
pos
=
commentPat
.
regs
[
1
][
0
]
pos
=
m
.
start
(
1
)
lines
[
i
]
=
lines
[
i
][:
pos
]
+
lines
[
i
][
pos
+
1
:]
lines
[
i
]
=
lines
[
i
][:
pos
]
+
lines
[
i
][
pos
+
1
:]
snippet
=
string
.
join
(
lines
,
'
\r
'
)
snippet
=
string
.
join
(
lines
,
'
\r
'
)
self
.
insert
(
snippet
)
self
.
insert
(
snippet
)
...
@@ -676,8 +676,9 @@ class PyEditor(TextEditor):
...
@@ -676,8 +676,9 @@ class PyEditor(TextEditor):
indent
=
3000
# arbitrary large number...
indent
=
3000
# arbitrary large number...
for
line
in
lines
:
for
line
in
lines
:
if
string
.
strip
(
line
):
if
string
.
strip
(
line
):
if
indentPat
.
match
(
line
):
m
=
indentPat
.
match
(
line
)
indent
=
min
(
indent
,
indentPat
.
regs
[
0
][
1
])
if
m
:
indent
=
min
(
indent
,
m
.
regs
[
0
][
1
])
else
:
else
:
indent
=
0
indent
=
0
break
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