On Tuesday, 10 May 2016 at 15:42:00 UTC, Jesse Phillips wrote:
I wish to announce version 1.0.0 of CodeBuilder. As the code
originally came from ProtocolBuffer I've now eat some dog food by
utilizing the library within ProtocolBuffer. I've also put in
unittests and a readme.
The Dub package provides two configurations, one for mixins and
one as a file writer. When using the file writer it is of no
interest to modify the line numbers as you'll actually have a D
source file to look at.
* Reduced complexity. Originally I was trying to store generated
code in to many different places, There was the current state,
the stack that held items which would later be popped into the
current state, a build so code could be structured before putting
it on the stack, and the current state could be returned by
asking for it's memory. All that goes away and instead another
CodeBuilder can be put or pushed into another.
* The string used for indentation can be specified (but is global
for all code builders.
* The code string isn't created while putting the string into the
builder. Instead it is stored as an operation that is used to
generate the string when calling finalize(). This makes
indentation consistent when putting one CodeBuilder into another.
I'd also like to note that Google's Protocol Buffer source has a
similar need, but I like my API better :)