Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Zope
Commits
2caa1258
Commit
2caa1258
authored
Mar 17, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -s option to show the intermediate code, rather than executing it.
parent
70b7ea26
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
lib/python/TAL/driver.py
lib/python/TAL/driver.py
+12
-3
No files found.
lib/python/TAL/driver.py
View file @
2caa1258
...
...
@@ -108,15 +108,17 @@ def main():
versionTest
=
1
macros
=
0
mode
=
None
showcode
=
0
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"h
mnx
"
)
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"h
xmns
"
)
except
getopt
.
error
,
msg
:
sys
.
stderr
.
write
(
"
\
n
%s
\
n
"
%
str
(
msg
))
sys
.
stderr
.
write
(
"usage: driver.py [-h|-x] [-m] [-n] [file]
\
n
"
)
"usage: driver.py [-h|-x] [-m] [-n] [
s] [
file]
\
n
"
)
sys
.
stderr
.
write
(
"-h/-x -- HTML/XML input (default auto)
\
n
"
)
sys
.
stderr
.
write
(
"-m -- macro expansion only
\
n
"
)
sys
.
stderr
.
write
(
"-n -- turn off the Python 1.5.2 test
\
n
"
)
sys
.
stderr
.
write
(
"-s -- print intermediate code
\
n
"
)
sys
.
exit
(
2
)
for
o
,
a
in
opts
:
if
o
==
'-h'
:
...
...
@@ -127,6 +129,8 @@ def main():
versionTest
=
0
if
o
==
'-x'
:
mode
=
"xml"
if
o
==
'-s'
:
showcode
=
1
if
not
versionTest
:
if
sys
.
version
[:
5
]
!=
"1.5.2"
:
sys
.
stderr
.
write
(
...
...
@@ -137,7 +141,8 @@ def main():
else
:
file
=
FILE
it
=
compilefile
(
file
,
mode
)
interpretit
(
it
,
tal
=
(
not
macros
))
if
showcode
:
showit
(
it
)
else
:
interpretit
(
it
,
tal
=
(
not
macros
))
def
interpretit
(
it
,
engine
=
None
,
stream
=
None
,
tal
=
1
):
from
TALInterpreter
import
TALInterpreter
...
...
@@ -163,5 +168,9 @@ def compilefile(file, mode=None):
p
.
parseFile
(
file
)
return
p
.
getCode
()
def
showit
(
it
):
from
pprint
import
pprint
pprint
(
it
)
if
__name__
==
"__main__"
:
main
()
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