about summary refs log tree commit diff
path: root/users/sterni/nix/char
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-10-13T12·23+0300
committertazjin <tazjin@tvl.su>2022-10-16T12·26+0000
commit0abc66ad91b8bcc25aeb7f3d086fcc52529ec8e8 (patch)
tree5c8a224b7ad033bfa6e4e2c9391248f391e0d3ac /users/sterni/nix/char
parentd9c497520ca0b89f49aed7c9507504b55eff49ce (diff)
feat(tvix/eval): add an AST pretty-printing module r/5143
This implements serde::Serialize for the rnix AST through a wrapper
type, and exposes a function for serialising the AST into
a (pretty-printed JSON) string representation.

This can be used to debug issues with the AST, and to display an AST
reprsentation in tools like tvixbolt.

Serialize is implemented manually because we don't own any of the
structs and the way to traverse them is not easily derived
automatically, and this is quite verbose. We might be able to condense
it a little bit, but at the same time it's also fairly straightforward.

Change-Id: I922df43cfc25636f3c8baee7944c75ade516055c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6943
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: Adam Joseph <adam@westernsemico.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'users/sterni/nix/char')
0 files changed, 0 insertions, 0 deletions