Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement the "pretty printing feature", issue #20 #22
This implements a
It also implements several new
Thanks in advance for the review!
Some nodes are extracted as plain string values, but I need to discriminate them to properly write back their textual form.
Also, augment some of the existing classes with the symbolic constants to represent the enums used for particular scalar attributes.
Lot's of things are still missing (right now, only the SELECT statement is covered), but the basic infrastructure is there and seems to work reasonably well. Obviously the "pretty is in the eye of the beholder", and the formatting style is currently very biased on my own taste, but the idea is that it could be driven by a set of options, once the dust settles.
I initially assumed that complex printers would require some context to be carried around, so I started by implementing them as classes. That turned out to be untrue, and plain functions are up to the task.
Ideally a list of items could be written on a single line, when its length does not exceed some threshold. This was just an attempt to implement that behaviour, but I didn't like the result.