diff options
Diffstat (limited to 'crates/syntax/src')
-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 dac4174cd..25e8a359d 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs | |||
@@ -354,7 +354,7 @@ pub mod tokens { | |||
354 | use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken}; | 354 | use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken}; |
355 | 355 | ||
356 | pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> = | 356 | pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> = |
357 | Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;")); | 357 | Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;\n\n")); |
358 | 358 | ||
359 | pub fn single_space() -> SyntaxToken { | 359 | pub fn single_space() -> SyntaxToken { |
360 | SOURCE_FILE | 360 | SOURCE_FILE |
@@ -394,6 +394,16 @@ pub mod tokens { | |||
394 | .unwrap() | 394 | .unwrap() |
395 | } | 395 | } |
396 | 396 | ||
397 | pub fn blank_line() -> SyntaxToken { | ||
398 | SOURCE_FILE | ||
399 | .tree() | ||
400 | .syntax() | ||
401 | .descendants_with_tokens() | ||
402 | .filter_map(|it| it.into_token()) | ||
403 | .find(|it| it.kind() == WHITESPACE && it.text().as_str() == "\n\n") | ||
404 | .unwrap() | ||
405 | } | ||
406 | |||
397 | pub struct WsBuilder(SourceFile); | 407 | pub struct WsBuilder(SourceFile); |
398 | 408 | ||
399 | impl WsBuilder { | 409 | impl WsBuilder { |