|
Package EasyExtend ::
Module cst2source
|
|
Module cst2source
Module used to unparse a parse tree and recreate source. For files not
being transformed the Unparser shall unparse the cst into the exact shape
of the parsed source ( however indentation size may vary ). For modified
csts or new cst fragments some autoformatting heuristics are applied [1].
Additional heuristics are necessary for combining exact reconstruction
with autoformatting.
[1] These heuristics is subject to further refinements.
Usage :
>>> from cst2source import Unparser
>>> unparse = Unparser()
>>> import parser
>>> tree = parser.suite("def f():
pass # unparse this fragment").tolist()
>>> print unparse(tree)
def f():
pass # unparse this fragment
|
|
S_INDENT = ' '
|
|
|
NOT_DEFINED = -1
|
|
|
ON_NEWLINE = -1
|
|
|
__DEBUG__ = False
|