REQUEST FOR COMMENT: this is not intended (yet) as a proper revision. It complements the design document for Transformer:
https://docs.google.com/document/d/1ppw0RhjwsrbBcHYhI85pe6ISDbA6r5d00ot3N8cQWeQ/edit?usp=sharing
The key point of this revision is to share the APIs and tests. I include the code as well so that readers can run the unittests and potentially experiment w/ the library as well. Based on the outcome of discussion here, I will break this revision into multiple subsequent revisions for proper review.
This revision introduces three libraries:
- Stencil, which is designed to complement the AST matchers in support of writing source-to-source transformations. A stencil is similar in spirit to a format string: it is composed of a series of raw text strings, references to node ids (bound in a corresponding matcher) and helper code-generation operations. A stencil can be applied to a match result and uses that result to find all nodes referenced in the stencil and then produce a source string.
- Transformer, which provides a concise syntax for specifying code transformations. This library is the main focus of the document mentioned above.
- TransformerTidy, which provides a simple way to create a ClangTidy class from any Transformer rewrite rule.