aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index 3fe5abba3..c1472bbe5 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -96,10 +96,10 @@ fn convert_tt(
96} 96}
97 97
98struct TtTokenSource { 98struct TtTokenSource {
99 tokens: Vec<Tok>, 99 tokens: Vec<TtToken>,
100} 100}
101 101
102struct Tok { 102struct TtToken {
103 kind: SyntaxKind, 103 kind: SyntaxKind,
104 is_joint_to_next: bool, 104 is_joint_to_next: bool,
105 text: SmolStr, 105 text: SmolStr,
@@ -124,7 +124,7 @@ impl TtTokenSource {
124 } 124 }
125 fn convert_leaf(&mut self, leaf: &tt::Leaf) { 125 fn convert_leaf(&mut self, leaf: &tt::Leaf) {
126 let tok = match leaf { 126 let tok = match leaf {
127 tt::Leaf::Literal(l) => Tok { 127 tt::Leaf::Literal(l) => TtToken {
128 kind: SyntaxKind::INT_NUMBER, // FIXME 128 kind: SyntaxKind::INT_NUMBER, // FIXME
129 is_joint_to_next: false, 129 is_joint_to_next: false,
130 text: l.text.clone(), 130 text: l.text.clone(),
@@ -144,11 +144,11 @@ impl TtTokenSource {
144 let s: &str = p.char.encode_utf8(&mut buf); 144 let s: &str = p.char.encode_utf8(&mut buf);
145 SmolStr::new(s) 145 SmolStr::new(s)
146 }; 146 };
147 Tok { kind, is_joint_to_next: p.spacing == tt::Spacing::Joint, text } 147 TtToken { kind, is_joint_to_next: p.spacing == tt::Spacing::Joint, text }
148 } 148 }
149 tt::Leaf::Ident(ident) => { 149 tt::Leaf::Ident(ident) => {
150 let kind = SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT); 150 let kind = SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT);
151 Tok { kind, is_joint_to_next: false, text: ident.text.clone() } 151 TtToken { kind, is_joint_to_next: false, text: ident.text.clone() }
152 } 152 }
153 }; 153 };
154 self.tokens.push(tok) 154 self.tokens.push(tok)
@@ -163,7 +163,7 @@ impl TtTokenSource {
163 let idx = closing as usize; 163 let idx = closing as usize;
164 let kind = kinds[idx]; 164 let kind = kinds[idx];
165 let text = &texts[idx..texts.len() - (1 - idx)]; 165 let text = &texts[idx..texts.len() - (1 - idx)];
166 let tok = Tok { kind, is_joint_to_next: false, text: SmolStr::new(text) }; 166 let tok = TtToken { kind, is_joint_to_next: false, text: SmolStr::new(text) };
167 self.tokens.push(tok) 167 self.tokens.push(tok)
168 } 168 }
169} 169}
@@ -187,14 +187,14 @@ impl TokenSource for TtTokenSource {
187#[derive(Default)] 187#[derive(Default)]
188struct TtTreeSink<'a> { 188struct TtTreeSink<'a> {
189 buf: String, 189 buf: String,
190 tokens: &'a [Tok], 190 tokens: &'a [TtToken],
191 text_pos: TextUnit, 191 text_pos: TextUnit,
192 token_pos: usize, 192 token_pos: usize,
193 inner: SyntaxTreeBuilder, 193 inner: SyntaxTreeBuilder,
194} 194}
195 195
196impl<'a> TtTreeSink<'a> { 196impl<'a> TtTreeSink<'a> {
197 fn new(tokens: &'a [Tok]) -> TtTreeSink { 197 fn new(tokens: &'a [TtToken]) -> TtTreeSink {
198 TtTreeSink { 198 TtTreeSink {
199 buf: String::new(), 199 buf: String::new(),
200 tokens, 200 tokens,