Crate ra_ap_syntax_bridge

Source
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§

DocCommentDesugarMode
Doc comment desugaring differs between mbe and proc-macros.
TopEntryPoint
Parse the whole of the input as a given syntactic construct.

Traits§

SpanMapper

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 to tt::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 a SyntaxNode. The produced SpanMap contains a mapping from the syntax nodes offsets to the subtree’s spans.