mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
rename
This commit is contained in:
parent
8cf156d85b
commit
81bca78349
1 changed files with 8 additions and 8 deletions
|
@ -96,10 +96,10 @@ fn convert_tt(
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TtTokenSource {
|
struct TtTokenSource {
|
||||||
tokens: Vec<Tok>,
|
tokens: Vec<TtToken>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Tok {
|
struct TtToken {
|
||||||
kind: SyntaxKind,
|
kind: SyntaxKind,
|
||||||
is_joint_to_next: bool,
|
is_joint_to_next: bool,
|
||||||
text: SmolStr,
|
text: SmolStr,
|
||||||
|
@ -124,7 +124,7 @@ impl TtTokenSource {
|
||||||
}
|
}
|
||||||
fn convert_leaf(&mut self, leaf: &tt::Leaf) {
|
fn convert_leaf(&mut self, leaf: &tt::Leaf) {
|
||||||
let tok = match leaf {
|
let tok = match leaf {
|
||||||
tt::Leaf::Literal(l) => Tok {
|
tt::Leaf::Literal(l) => TtToken {
|
||||||
kind: SyntaxKind::INT_NUMBER, // FIXME
|
kind: SyntaxKind::INT_NUMBER, // FIXME
|
||||||
is_joint_to_next: false,
|
is_joint_to_next: false,
|
||||||
text: l.text.clone(),
|
text: l.text.clone(),
|
||||||
|
@ -144,11 +144,11 @@ impl TtTokenSource {
|
||||||
let s: &str = p.char.encode_utf8(&mut buf);
|
let s: &str = p.char.encode_utf8(&mut buf);
|
||||||
SmolStr::new(s)
|
SmolStr::new(s)
|
||||||
};
|
};
|
||||||
Tok { kind, is_joint_to_next: p.spacing == tt::Spacing::Joint, text }
|
TtToken { kind, is_joint_to_next: p.spacing == tt::Spacing::Joint, text }
|
||||||
}
|
}
|
||||||
tt::Leaf::Ident(ident) => {
|
tt::Leaf::Ident(ident) => {
|
||||||
let kind = SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT);
|
let kind = SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT);
|
||||||
Tok { kind, is_joint_to_next: false, text: ident.text.clone() }
|
TtToken { kind, is_joint_to_next: false, text: ident.text.clone() }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.tokens.push(tok)
|
self.tokens.push(tok)
|
||||||
|
@ -163,7 +163,7 @@ impl TtTokenSource {
|
||||||
let idx = closing as usize;
|
let idx = closing as usize;
|
||||||
let kind = kinds[idx];
|
let kind = kinds[idx];
|
||||||
let text = &texts[idx..texts.len() - (1 - idx)];
|
let text = &texts[idx..texts.len() - (1 - idx)];
|
||||||
let tok = Tok { kind, is_joint_to_next: false, text: SmolStr::new(text) };
|
let tok = TtToken { kind, is_joint_to_next: false, text: SmolStr::new(text) };
|
||||||
self.tokens.push(tok)
|
self.tokens.push(tok)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,14 +187,14 @@ impl TokenSource for TtTokenSource {
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct TtTreeSink<'a> {
|
struct TtTreeSink<'a> {
|
||||||
buf: String,
|
buf: String,
|
||||||
tokens: &'a [Tok],
|
tokens: &'a [TtToken],
|
||||||
text_pos: TextUnit,
|
text_pos: TextUnit,
|
||||||
token_pos: usize,
|
token_pos: usize,
|
||||||
inner: SyntaxTreeBuilder,
|
inner: SyntaxTreeBuilder,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TtTreeSink<'a> {
|
impl<'a> TtTreeSink<'a> {
|
||||||
fn new(tokens: &'a [Tok]) -> TtTreeSink {
|
fn new(tokens: &'a [TtToken]) -> TtTreeSink {
|
||||||
TtTreeSink {
|
TtTreeSink {
|
||||||
buf: String::new(),
|
buf: String::new(),
|
||||||
tokens,
|
tokens,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue