diff options
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 6982b9815..dc4b779e8 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -27,8 +27,6 @@ mod ptr; | |||
27 | 27 | ||
28 | pub mod algo; | 28 | pub mod algo; |
29 | pub mod ast; | 29 | pub mod ast; |
30 | /// Utilities for simple uses of the parser. | ||
31 | pub mod utils; | ||
32 | 30 | ||
33 | pub use rowan::{SmolStr, TextRange, TextUnit}; | 31 | pub use rowan::{SmolStr, TextRange, TextUnit}; |
34 | pub use ra_parser::SyntaxKind; | 32 | pub use ra_parser::SyntaxKind; |
@@ -51,7 +49,7 @@ impl SourceFile { | |||
51 | fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SourceFile> { | 49 | fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SourceFile> { |
52 | let root = SyntaxNode::new(green, errors); | 50 | let root = SyntaxNode::new(green, errors); |
53 | if cfg!(debug_assertions) { | 51 | if cfg!(debug_assertions) { |
54 | utils::validate_block_structure(&root); | 52 | validation::validate_block_structure(&root); |
55 | } | 53 | } |
56 | assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE); | 54 | assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE); |
57 | TreeArc::cast(root) | 55 | TreeArc::cast(root) |
@@ -82,3 +80,10 @@ impl SourceFile { | |||
82 | errors | 80 | errors |
83 | } | 81 | } |
84 | } | 82 | } |
83 | |||
84 | pub fn check_fuzz_invariants(text: &str) { | ||
85 | let file = SourceFile::parse(text); | ||
86 | let root = file.syntax(); | ||
87 | validation::validate_block_structure(root); | ||
88 | let _ = file.errors(); | ||
89 | } | ||