From fda8ddc5fe8a764c0dc91fecb92af1bdf3078485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Mon, 5 Nov 2018 18:38:34 +0100 Subject: Introduce Location and make SyntaxError fields private --- crates/ra_syntax/src/parser_impl/event.rs | 4 ++-- crates/ra_syntax/src/parser_impl/mod.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_syntax/src/parser_impl') diff --git a/crates/ra_syntax/src/parser_impl/event.rs b/crates/ra_syntax/src/parser_impl/event.rs index ced09bcff..1445401bc 100644 --- a/crates/ra_syntax/src/parser_impl/event.rs +++ b/crates/ra_syntax/src/parser_impl/event.rs @@ -15,6 +15,7 @@ use crate::{ TextRange, TextUnit, yellow::syntax_error::{ ParseError, + SyntaxError, SyntaxErrorKind, }, }; @@ -162,8 +163,7 @@ impl<'a, S: Sink> EventProcessor<'a, S> { self.leaf(kind, len, n_raw_tokens); } Event::Error { msg } => self.sink.error( - SyntaxErrorKind::ParseError(msg), - TextRange::offset_len(self.text_pos, 1.into()), + SyntaxError::new(SyntaxErrorKind::ParseError(msg), self.text_pos), ), } } diff --git a/crates/ra_syntax/src/parser_impl/mod.rs b/crates/ra_syntax/src/parser_impl/mod.rs index ade25770b..cb6e370ac 100644 --- a/crates/ra_syntax/src/parser_impl/mod.rs +++ b/crates/ra_syntax/src/parser_impl/mod.rs @@ -10,10 +10,10 @@ use crate::{ event::{Event, EventProcessor}, input::{InputPosition, ParserInput}, }, - SmolStr, TextRange, + SmolStr, yellow::syntax_error::{ ParseError, - SyntaxErrorKind, + SyntaxError, }, }; @@ -25,7 +25,7 @@ pub(crate) trait Sink { fn leaf(&mut self, kind: SyntaxKind, text: SmolStr); fn start_internal(&mut self, kind: SyntaxKind); fn finish_internal(&mut self); - fn error(&mut self, kind: SyntaxErrorKind, offset: TextRange); + fn error(&mut self, error: SyntaxError); fn finish(self) -> Self::Tree; } -- cgit v1.2.3