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
500c3ca1
Commit
500c3ca1
authored
Feb 05, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -m option to perform precompilation (i.e. macro expansion) only.
parent
de880a7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
lib/python/TAL/driver.py
lib/python/TAL/driver.py
+18
-6
No files found.
lib/python/TAL/driver.py
View file @
500c3ca1
...
...
@@ -105,17 +105,22 @@ FILE = "test/test1.xml"
def
main
():
noVersionTest
=
0
macros
=
0
compile
=
0
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"cn"
)
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"c
m
n"
)
except
getopt
.
error
,
msg
:
sys
.
stderr
.
write
(
"%s
\
n
"
%
str
(
msg
))
sys
.
stderr
.
write
(
"usage: driver.py [-n] [file]
\
n
"
)
sys
.
stderr
.
write
(
"-n turns of the Python 1.5.2 test
\
n
"
)
sys
.
stderr
.
write
(
"usage: driver.py [-c] [-m] [-n] [file]
\
n
"
)
sys
.
stderr
.
write
(
"-c -- compiled mode (faster)
\
n
"
)
sys
.
stderr
.
write
(
"-m -- macro expansion only
\
n
"
)
sys
.
stderr
.
write
(
"-n -- turn of the Python 1.5.2 test
\
n
"
)
sys
.
exit
(
2
)
for
o
,
a
in
opts
:
if
o
==
'-c'
:
compile
=
not
compile
compile
=
1
if
o
==
'-m'
:
macros
=
1
if
o
==
'-n'
:
noVersionTest
=
1
if
not
noVersionTest
:
...
...
@@ -128,8 +133,11 @@ def main():
else
:
file
=
FILE
doc
=
parsefile
(
file
)
if
compile
:
it
=
compiletree
(
doc
)
if
macros
or
compile
:
if
macros
:
it
=
precompiletree
(
doc
)
else
:
it
=
compiletree
(
doc
)
interpretit
(
it
)
else
:
doc
=
talizetree
(
doc
)
...
...
@@ -156,6 +164,10 @@ def talizetree(root, dom=None, engine=None):
engine
=
DummyEngine
()
return
TALVisitor
(
root
,
dom
,
engine
)()
def
precompiletree
(
root
):
from
TALCompiler
import
METALCompiler
return
METALCompiler
(
root
)()
def
compiletree
(
root
):
from
TALCompiler
import
TALCompiler
return
TALCompiler
(
root
)()
...
...
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