Validate string literals
This commit is contained in:
committed by
Adolfo Ochagavía
parent
5a9150df9b
commit
3b4c02c19e
20
crates/ra_syntax/src/validation/mod.rs
Normal file
20
crates/ra_syntax/src/validation/mod.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use crate::{
|
||||
algo::visit::{visitor_ctx, VisitorCtx},
|
||||
ast,
|
||||
SourceFileNode,
|
||||
yellow::SyntaxError,
|
||||
};
|
||||
|
||||
mod char;
|
||||
mod string;
|
||||
|
||||
pub(crate) fn validate(file: &SourceFileNode) -> Vec<SyntaxError> {
|
||||
let mut errors = Vec::new();
|
||||
for node in file.syntax().descendants() {
|
||||
let _ = visitor_ctx(&mut errors)
|
||||
.visit::<ast::Char, _>(self::char::validate_char_node)
|
||||
.visit::<ast::String, _>(self::string::validate_string_node)
|
||||
.accept(node);
|
||||
}
|
||||
errors
|
||||
}
|
||||
Reference in New Issue
Block a user