Adds a library for unparsing concrete syntax trees using reflection, origin tracking and the pp library to preserve layout. Most of the complexity here is to do with robustly handling indentation for trees that have undergone transformations. I don't expect anyone reviewing this to fully understand the details.
Also adds a mechanism to the Silver driver for refactoring Silver code. Two example refactorings are supported - replacing regular functions with the new concise syntax, and inserting calls to new wherever a tree is implicitly undecorated.
Documentation
Added doc comments for the API of the unparse library. I'm not sure if it is worthwhile trying to make the implementation intelligible.
Added help messages for command line flags related to refactoring.
Testing
Tested by running the refactoring tool on Silver.
This could maybe use some unit tests for the unparsing mechanism, but I don't really have time right now and would like to get this merged.
Fixes #800.
Changes
Adds a library for unparsing concrete syntax trees using reflection, origin tracking and the pp library to preserve layout. Most of the complexity here is to do with robustly handling indentation for trees that have undergone transformations. I don't expect anyone reviewing this to fully understand the details.
Also adds a mechanism to the Silver driver for refactoring Silver code. Two example refactorings are supported - replacing regular functions with the new concise syntax, and inserting calls to
new
wherever a tree is implicitly undecorated.Documentation
Added doc comments for the API of the unparse library. I'm not sure if it is worthwhile trying to make the implementation intelligible.
Added help messages for command line flags related to refactoring.
Testing
Tested by running the refactoring tool on Silver.
This could maybe use some unit tests for the unparsing mechanism, but I don't really have time right now and would like to get this merged.