in_file = args[0]
with open(in_file) as fin:
- _ast = element.deserialize(fin, ast.factory)
+ if in_file[-4:] == '.xml':
+ _ast = element.deserialize(fin, ast.factory)
+ else:
+ import lex_yy
+ import state
+ import y_tab
+ state.infilename = in_file
+ lex_yy.yyin = fin
+ _ast = y_tab.yyparse(ast.AST)
#element.serialize(_ast, 'a.xml', 'utf-8')
#_ast = element.deserialize('a.xml', ast.factory, 'utf-8')
_ast.post_process()