diff options
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r-- | crates/syntax/src/ast/make.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index c2c938ad1..33f1ad7b3 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs | |||
@@ -339,7 +339,7 @@ pub mod tokens { | |||
339 | use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken}; | 339 | use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken}; |
340 | 340 | ||
341 | pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> = | 341 | pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> = |
342 | Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;")); | 342 | Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;\n\n")); |
343 | 343 | ||
344 | pub fn single_space() -> SyntaxToken { | 344 | pub fn single_space() -> SyntaxToken { |
345 | SOURCE_FILE | 345 | SOURCE_FILE |
@@ -379,6 +379,16 @@ pub mod tokens { | |||
379 | .unwrap() | 379 | .unwrap() |
380 | } | 380 | } |
381 | 381 | ||
382 | pub fn blank_line() -> SyntaxToken { | ||
383 | SOURCE_FILE | ||
384 | .tree() | ||
385 | .syntax() | ||
386 | .descendants_with_tokens() | ||
387 | .filter_map(|it| it.into_token()) | ||
388 | .find(|it| it.kind() == WHITESPACE && it.text().as_str() == "\n\n") | ||
389 | .unwrap() | ||
390 | } | ||
391 | |||
382 | pub struct WsBuilder(SourceFile); | 392 | pub struct WsBuilder(SourceFile); |
383 | 393 | ||
384 | impl WsBuilder { | 394 | impl WsBuilder { |