Parameter origText
The original text of the file that was parsed to create the origin of tree.
Parameter tree
The concrete syntax tree to unparse.
Return
The unparse of the tree, with layout from origText inserted in unchanged portions of the tree.
Unparse a tree, preserving layout from its parse tree via origin tracking.
The productions in the tree should only consist of nonterminal and terminal symbols;
in a language with seperate concrete and abstract syntax, this may require defining a
translation from abstract back to concrete syntax.
This is intended for use in e.g. refactoring tools, where transformations can be applied
on the tree, but one would like to turn the tree back into a string without affecting
layout in otherwise-unchanged portions of the tree.
Layout preceeding and following the root of the tree is included in the output.
function unparseFragment (Document ::= origText::String tree::a )
Parameter origText
The original text of the file that was parsed to create the origin of tree.
Parameter tree
The concrete syntax tree to unparse.
Return
The unparse of the tree, with layout from origText inserted in unchanged portions of the tree.
Like unparseFile, but intended for unparsing a tree corresponding to a fragment of a file.
Layout preceeding and following the root of the tree is not included.