aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tt/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_tt/src/lib.rs')
-rw-r--r--crates/ra_tt/src/lib.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs
index 209ca4048..73d8395a8 100644
--- a/crates/ra_tt/src/lib.rs
+++ b/crates/ra_tt/src/lib.rs
@@ -55,7 +55,13 @@ pub struct Subtree {
55} 55}
56 56
57#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] 57#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
58pub enum Delimiter { 58pub struct Delimiter {
59 pub id: TokenId,
60 pub kind: DelimiterKind,
61}
62
63#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
64pub enum DelimiterKind {
59 Parenthesis, 65 Parenthesis,
60 Brace, 66 Brace,
61 Bracket, 67 Bracket,
@@ -97,10 +103,10 @@ impl fmt::Display for TokenTree {
97 103
98impl fmt::Display for Subtree { 104impl fmt::Display for Subtree {
99 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 105 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
100 let (l, r) = match self.delimiter { 106 let (l, r) = match self.delimiter.map(|it| it.kind) {
101 Some(Delimiter::Parenthesis) => ("(", ")"), 107 Some(DelimiterKind::Parenthesis) => ("(", ")"),
102 Some(Delimiter::Brace) => ("{", "}"), 108 Some(DelimiterKind::Brace) => ("{", "}"),
103 Some(Delimiter::Bracket) => ("[", "]"), 109 Some(DelimiterKind::Bracket) => ("[", "]"),
104 None => ("", ""), 110 None => ("", ""),
105 }; 111 };
106 f.write_str(l)?; 112 f.write_str(l)?;