Skip to main content

Module printer

Module printer 

Source
Expand description

Printer infrastructure: allocators, traits, and the printing pipeline.

This module contains the common plumbing that backends and printers rely on to turn AST values into formatted text:

  • [Allocator]: a thin wrapper around the pretty crate’s allocator, parameterized by the backend, used to produce pretty::Doc nodes.
  • PrettyAst: the trait that printers implement to provide per-type formatting of Hax AST nodes (re-exported from pretty_ast).
  • The resugaring pipeline: a sequence of local AST rewrites that make emitted code idiomatic for the target language before pretty-printing.

Re-exports§

pub use pretty_ast::PrettyAst;

Modules§

pretty_ast
Pretty-printing support for the hax AST.
render_view
Tools for rendering Rust paths into strings.

Structs§

SourceMap
Placeholder type for sourcemaps.

Traits§

HasLinkedItemGraph
Getter and setter for LinkedItemGraph, useful for printers.
Print
Helper trait to print AST fragments.
Printer
A printer defines a list of resugaring phases.
Resugaring
A resugaring is an erased mapper visitor with a name. A resugaring is a local transformation on the AST that produces exclusively ast::resugared nodes. Any involved or non-local transformation should be a phase, not a resugaring.