diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-11 16:43:34 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-11 16:43:34 +0100 |
commit | 77e9bf9b5fdcd4262e2d9badb42b912f5728d90b (patch) | |
tree | 3f318ed358723e229dc6101404d7b607bbeabd51 /crates/ra_syntax/src/ast/generated.rs | |
parent | 9b155c89764b8413df6b32edfde94fce1d9c15ec (diff) | |
parent | 6fe77db41307da8ead8a0b0355488221b61c0349 (diff) |
Merge #116
116: Collapse comments upon join r=matklad a=aochagavia
Todo:
- [x] Write tests
- [x] Resolve fixmes
- [x] Implement `comment_start_length` using the parser
I left a bunch of questions as fixmes. Can someone take a look at them? Also, I would love to use the parser to calculate the length of the leading characters in a comment (`//`, `///`, `//!`, `/*`), so any hints are greatly appreciated.
Co-authored-by: Adolfo OchagavĂa <[email protected]>
Co-authored-by: Adolfo OchagavĂa <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index f27093291..ef7b5b1a1 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -231,6 +231,24 @@ impl<'a> AstNode<'a> for CastExpr<'a> { | |||
231 | 231 | ||
232 | impl<'a> CastExpr<'a> {} | 232 | impl<'a> CastExpr<'a> {} |
233 | 233 | ||
234 | // Comment | ||
235 | #[derive(Debug, Clone, Copy)] | ||
236 | pub struct Comment<'a> { | ||
237 | syntax: SyntaxNodeRef<'a>, | ||
238 | } | ||
239 | |||
240 | impl<'a> AstNode<'a> for Comment<'a> { | ||
241 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
242 | match syntax.kind() { | ||
243 | COMMENT => Some(Comment { syntax }), | ||
244 | _ => None, | ||
245 | } | ||
246 | } | ||
247 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
248 | } | ||
249 | |||
250 | impl<'a> Comment<'a> {} | ||
251 | |||
234 | // Condition | 252 | // Condition |
235 | #[derive(Debug, Clone, Copy)] | 253 | #[derive(Debug, Clone, Copy)] |
236 | pub struct Condition<'a> { | 254 | pub struct Condition<'a> { |