rust/crates/ra_syntax/src/validation/mod.rs

23 lines
589 B
Rust
Raw Normal View History

2018-11-08 08:42:00 -06:00
use crate::{
algo::visit::{visitor_ctx, VisitorCtx},
ast,
SourceFileNode,
yellow::SyntaxError,
};
2018-11-11 13:27:00 -06:00
mod byte;
2018-11-08 08:42:00 -06:00
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)
2018-11-11 13:27:00 -06:00
.visit::<ast::Byte, _>(self::byte::validate_byte_node)
2018-11-08 08:42:00 -06:00
.visit::<ast::Char, _>(self::char::validate_char_node)
.visit::<ast::String, _>(self::string::validate_string_node)
.accept(node);
}
errors
}