From 3b4c02c19e4af645fd37e8bff774b05d546dc0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Thu, 8 Nov 2018 15:42:00 +0100 Subject: Validate string literals --- crates/ra_syntax/src/validation/mod.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 crates/ra_syntax/src/validation/mod.rs (limited to 'crates/ra_syntax/src/validation/mod.rs') diff --git a/crates/ra_syntax/src/validation/mod.rs b/crates/ra_syntax/src/validation/mod.rs new file mode 100644 index 000000000..2ff0bc26d --- /dev/null +++ b/crates/ra_syntax/src/validation/mod.rs @@ -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 { + let mut errors = Vec::new(); + for node in file.syntax().descendants() { + let _ = visitor_ctx(&mut errors) + .visit::(self::char::validate_char_node) + .visit::(self::string::validate_string_node) + .accept(node); + } + errors +} -- cgit v1.2.3