blob: 5d82c3ded35d95f132f00a887aa4b2b1748cde5e [file] [log] [blame]
Jeremy Hylton0c3208a2000-03-06 19:13:21 +00001import sys
2import getopt
3
4from compiler import compile, visitor
5
6def main():
7 VERBOSE = 0
8 opts, args = getopt.getopt(sys.argv[1:], 'vq')
9 for k, v in opts:
10 if k == '-v':
11 VERBOSE = 1
12 visitor.ASTVisitor.VERBOSE = visitor.ASTVisitor.VERBOSE + 1
13 if k == '-q':
Jeremy Hylton0a4f1ff2000-05-02 22:29:46 +000014 if sys.platform[:3]=="win":
15 f = open('nul', 'wb') # /dev/null fails on Windows...
16 else:
17 f = open('/dev/null', 'wb')
Jeremy Hylton0c3208a2000-03-06 19:13:21 +000018 sys.stdout = f
19 if not args:
20 print "no files to compile"
21 else:
22 for filename in args:
23 if VERBOSE:
24 print filename
25 compile(filename)
26
27if __name__ == "__main__":
28 main()