mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2026-03-12 20:00:31 +00:00
11 lines
9.3 KiB
HTML
11 lines
9.3 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Conversions between `SyntaxNode` and `tt::TokenTree`."><title>syntax_bridge - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-77263533.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="syntax_bridge" data-themes="" data-resource-suffix="" data-rustdoc-version="1.94.0 (4a4ef493e 2026-03-02)" data-channel="1.94.0" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-b897f86f.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-7bab91a1.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-ffcac47a.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate syntax_bridge</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../syntax_bridge/index.html">syntax_<wbr>bridge</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>syntax_<wbr>bridge</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/syntax_bridge/lib.rs.html#1-1037">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Conversions between [<code>SyntaxNode</code>] and [<code>tt::TokenTree</code>].</p>
|
||
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="dummy_test_span_utils/index.html" title="mod syntax_bridge::dummy_test_span_utils">dummy_<wbr>test_<wbr>span_<wbr>utils</a></dt><dd>Dummy things for testing where spans don’t matter.</dd><dt><a class="mod" href="prettify_macro_expansion/index.html" title="mod syntax_bridge::prettify_macro_expansion">prettify_<wbr>macro_<wbr>expansion</a></dt><dd>Utilities for formatting macro expanded nodes until we get a proper formatter.</dd><dt><a class="mod" href="to_parser_input/index.html" title="mod syntax_bridge::to_parser_input">to_<wbr>parser_<wbr>input</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Convert macro-by-example tokens which are specific to macro expansion into a
|
||
format that works for our parser.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Converter.html" title="struct syntax_bridge::Converter">Converter</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="struct" href="struct.RawConverter.html" title="struct syntax_bridge::RawConverter">RawConverter</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>A raw token (straight from lexer) converter</dd><dt><a class="struct" href="struct.StaticRawConverter.html" title="struct syntax_bridge::StaticRawConverter">Static<wbr>RawConverter</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>A raw token (straight from lexer) converter that gives every token the same span.</dd><dt><a class="struct" href="struct.TtTreeSink.html" title="struct syntax_bridge::TtTreeSink">TtTree<wbr>Sink</a><span title="Restricted Visibility"> 🔒</span> </dt></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.DocCommentDesugarMode.html" title="enum syntax_bridge::DocCommentDesugarMode">DocComment<wbr>Desugar<wbr>Mode</a></dt><dd>Doc comment desugaring differs between mbe and proc-macros.</dd><dt><a class="enum" href="enum.SynToken.html" title="enum syntax_bridge::SynToken">SynToken</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="enum" href="enum.TopEntryPoint.html" title="enum syntax_bridge::TopEntryPoint">TopEntry<wbr>Point</a></dt><dd>Parse the whole of the input as a given syntactic construct.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.SpanMapper.html" title="trait syntax_bridge::SpanMapper">Span<wbr>Mapper</a></dt><dt><a class="trait" href="trait.SrcToken.html" title="trait syntax_bridge::SrcToken">SrcToken</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="trait" href="trait.TokenConverter.html" title="trait syntax_bridge::TokenConverter">Token<wbr>Converter</a><span title="Restricted Visibility"> 🔒</span> </dt></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.convert_doc_comment.html" title="fn syntax_bridge::convert_doc_comment">convert_<wbr>doc_<wbr>comment</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.convert_tokens.html" title="fn syntax_bridge::convert_tokens">convert_<wbr>tokens</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.delim_to_str.html" title="fn syntax_bridge::delim_to_str">delim_<wbr>to_<wbr>str</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.desugar_doc_comment_text.html" title="fn syntax_bridge::desugar_doc_comment_text">desugar_<wbr>doc_<wbr>comment_<wbr>text</a></dt><dd>Returns the textual content of a doc comment block as a quoted string
|
||
That is, strips leading <code>///</code> (or <code>/**</code>, etc)
|
||
and strips the ending <code>*/</code>
|
||
And then quote the string, which is needed to convert to <code>tt::Literal</code></dd><dt><a class="fn" href="fn.is_single_token_op.html" title="fn syntax_bridge::is_single_token_op">is_<wbr>single_<wbr>token_<wbr>op</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.parse_to_token_tree.html" title="fn syntax_bridge::parse_to_token_tree">parse_<wbr>to_<wbr>token_<wbr>tree</a></dt><dd>Convert a string to a <code>TokenTree</code>. The spans of the subtree will be anchored to the provided
|
||
anchor with the given context.</dd><dt><a class="fn" href="fn.parse_to_token_tree_static_span.html" title="fn syntax_bridge::parse_to_token_tree_static_span">parse_<wbr>to_<wbr>token_<wbr>tree_<wbr>static_<wbr>span</a></dt><dd>Convert a string to a <code>TokenTree</code>. The passed span will be used for all spans of the produced subtree.</dd><dt><a class="fn" href="fn.syntax_node_to_token_tree.html" title="fn syntax_bridge::syntax_node_to_token_tree">syntax_<wbr>node_<wbr>to_<wbr>token_<wbr>tree</a></dt><dd>Converts a syntax tree to a [<code>tt::Subtree</code>] using the provided span map to populate the
|
||
subtree’s spans.</dd><dt><a class="fn" href="fn.syntax_node_to_token_tree_modified.html" title="fn syntax_bridge::syntax_node_to_token_tree_modified">syntax_<wbr>node_<wbr>to_<wbr>token_<wbr>tree_<wbr>modified</a></dt><dd>Converts a syntax tree to a [<code>tt::Subtree</code>] 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.</dd><dt><a class="fn" href="fn.to_parser_input.html" title="fn syntax_bridge::to_parser_input">to_<wbr>parser_<wbr>input</a></dt><dt><a class="fn" href="fn.token_tree_to_syntax_node.html" title="fn syntax_bridge::token_tree_to_syntax_node">token_<wbr>tree_<wbr>to_<wbr>syntax_<wbr>node</a></dt><dd>Converts a [<code>tt::Subtree</code>] back to a [<code>SyntaxNode</code>].
|
||
The produced <code>SpanMap</code> contains a mapping from the syntax nodes offsets to the subtree’s spans.</dd></dl></section></div></main></body></html> |