()
| 45 | |
| 46 | |
| 47 | def main(): |
| 48 | import optparse |
| 49 | parser = optparse.OptionParser(__doc__.strip()) |
| 50 | opts, args = parser.parse_args() |
| 51 | |
| 52 | if not args: |
| 53 | parser.error("You need to specify the name of Python files to print out.") |
| 54 | |
| 55 | import compiler, traceback |
| 56 | for fn in args: |
| 57 | print '\n\n%s:\n' % fn |
| 58 | try: |
| 59 | printAst(compiler.parseFile(fn), initlevel=1) |
| 60 | except SyntaxError, e: |
| 61 | traceback.print_exc() |
| 62 | |
| 63 | if __name__ == '__main__': |
| 64 | main() |
no test coverage detected