Expand description
Conversions between SyntaxNode
and tt::TokenTree
.
Modules§
- dummy_
test_ span_ utils - Dummy things for testing where spans don’t matter.
- prettify_
macro_ expansion - Utilities for formatting macro expanded nodes until we get a proper formatter.
Enums§
- DocComment
Desugar Mode - Doc comment desugaring differs between mbe and proc-macros.
- TopEntry
Point - Parse the whole of the input as a given syntactic construct.
Traits§
Functions§
- desugar_
doc_ comment_ text - 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 tott::Literal
- parse_
to_ token_ tree - Convert a string to a
TokenTree
. The spans of the subtree will be anchored to the provided anchor with the given context. - parse_
to_ token_ tree_ static_ span - Convert a string to a
TokenTree
. The passed span will be used for all spans of the produced subtree. - syntax_
node_ to_ token_ tree - Converts a syntax tree to a
tt::Subtree
using the provided span map to populate the subtree’s spans. - syntax_
node_ to_ token_ tree_ modified - 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. - to_
parser_ input - token_
tree_ to_ syntax_ node - Converts a
tt::Subtree
back to aSyntaxNode
. The producedSpanMap
contains a mapping from the syntax nodes offsets to the subtree’s spans.