Crate syntax_bridge

Source
Expand description

Conversions between [SyntaxNode] and [tt::TokenTree].

Modules§

Enums§

Traits§

Functions§

  • Returns the textual content of a doc comment block as a quoted string That is, strips leading /// (or /**, etc) and strips the ending */ And then quote the string, which is needed to convert to tt::Literal
  • Convert a string to a TokenTree. The spans of the subtree will be anchored to the provided anchor with the given context.
  • Convert a string to a TokenTree. The passed span will be used for all spans of the produced subtree.
  • Converts a syntax tree to a [tt::Subtree] using the provided span map to populate the subtree’s spans.
  • Converts a syntax tree to a [tt::Subtree] using the provided span map to populate the subtree’s spans. Additionally using the append and remove parameters, the additional tokens can be injected or hidden from the output.
  • Converts a [tt::Subtree] back to a [SyntaxNode]. The produced SpanMap contains a mapping from the syntax nodes offsets to the subtree’s spans.