The pseudo code for what I would like to do:
var classObject=Parse(templateFile);
classObject.functions.add(MyGeneratedFunction)
return classObject.toSourceCode()
I really feel like I'm missing something here. I know I can use analysis to parse a file into a tree, but there doesn't seem to be a way to modify it.
I also know I can use code_builder to output source code, but there doesn't seem to be a way to input source code, and I can't walk or modify the tree once built.
I feel like the only path would be to create an intermediate tree from an analysis tree, modify the intermediate tree as needed, and than output a code_builder tree, but that's a LOT of overhead for something that feels like it should be a lot simpler.
Appreciate your help!