File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44from compiler import compile , visitor
55
6- ## import profile
6+ import profile
77
88def main ():
99 VERBOSE = 0
1010 DISPLAY = 0
11+ PROFILE = 0
1112 CONTINUE = 0
12- opts , args = getopt .getopt (sys .argv [1 :], 'vqdc ' )
13+ opts , args = getopt .getopt (sys .argv [1 :], 'vqdcp ' )
1314 for k , v in opts :
1415 if k == '-v' :
1516 VERBOSE = 1
@@ -24,16 +25,21 @@ def main():
2425 DISPLAY = 1
2526 if k == '-c' :
2627 CONTINUE = 1
28+ if k == '-p' :
29+ PROFILE = 1
2730 if not args :
2831 print "no files to compile"
2932 else :
3033 for filename in args :
3134 if VERBOSE :
3235 print filename
3336 try :
34- compile (filename , DISPLAY )
35- ## profile.run('compile(%s, %s)' % (`filename`, `DISPLAY`),
36- ## filename + ".prof")
37+ if PROFILE :
38+ profile .run ('compile(%s, %s)' % (`filename` , `DISPLAY` ),
39+ filename + ".prof" )
40+ else :
41+ compile (filename , DISPLAY )
42+
3743 except SyntaxError , err :
3844 print err
3945 print err .lineno
You can’t perform that action at this time.
0 commit comments