So the way I see this could work is:
pr ~tab:8 "\n %s\n" "foo"
would post-process the output to convert spaces to tabs (ie. output
"\n\tfoo\n"). If this was necessary for a whole language you could
do:
let pr = pr ~tab:8 ;;
at the top of the OCaml generator file for that language.
I don't think it's necessary to do anything very complicated here to
implement this. You'd just need to adjust this code to keep track of
how many spaces there had been before the current column and output \t
at the right time. (I mean, it makes the 'pr' function even more
complicated, but ...)
https://gitlab.com/nbdkit/libnbd/-/blob/70329e9585297bc42cf3db3bf50826313...
pr_wrap would also need an optional ?tab parameter, passed straight
through to pr.
But maybe we should just pass the output of the generator through
gofmt, which I believe was the original plan.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v