diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-01-28 20:14:24 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-01-28 20:14:24 +0000 |
commit | 94caa9d3a2c645df5c0f2d332bc001831119484d (patch) | |
tree | 8590725d71429399cf43565879e8a444f19f2113 /src/tree | |
parent | ab81e4c7b4383a153145752059be59e17571fad3 (diff) | |
parent | 55e2a478be04bdaba164ea92160e52a6fea5abe5 (diff) |
Merge #31
31: Parse enums r=matklad a=matklad
Diffstat (limited to 'src/tree')
-rw-r--r-- | src/tree/mod.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tree/mod.rs b/src/tree/mod.rs index 795f23f42..9ed0504c7 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs | |||
@@ -106,7 +106,19 @@ impl<'f> Node<'f> { | |||
106 | 106 | ||
107 | impl<'f> fmt::Debug for Node<'f> { | 107 | impl<'f> fmt::Debug for Node<'f> { |
108 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | 108 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
109 | write!(fmt, "{:?}@{:?}", self.kind(), self.range()) | 109 | write!(fmt, "{:?}@{:?}", self.kind(), self.range())?; |
110 | if has_short_text(self.kind()) { | ||
111 | write!(fmt, " \"{}\"", self.text())?; | ||
112 | } | ||
113 | Ok(()) | ||
114 | } | ||
115 | } | ||
116 | |||
117 | fn has_short_text(kind: SyntaxKind) -> bool { | ||
118 | use syntax_kinds::*; | ||
119 | match kind { | ||
120 | IDENT | LIFETIME => true, | ||
121 | _ => false, | ||
110 | } | 122 | } |
111 | } | 123 | } |
112 | 124 | ||