Closed penguinol closed 2 years ago
for example, a lua file like:
local a = 0 if a == 0 then if a == 1 then if a == 2 then if a == 3 then end end end end
I loaded the lua source by ast, and then rewrite the ast to source.
lua_ast = ast.parse(content) tree = ast.parse(content) print(ast.to_lua_source(tree))
the output is like
local a = 0 if a == 0 then if a == 1 then if a == 2 then if a == 3 then else end else end else end else end
for example, a lua file like:
I loaded the lua source by ast, and then rewrite the ast to source.
the output is like