diff options
author | Adolfo OchagavĂa <[email protected]> | 2018-11-05 17:38:34 +0000 |
---|---|---|
committer | Adolfo OchagavĂa <[email protected]> | 2018-11-05 17:38:34 +0000 |
commit | fda8ddc5fe8a764c0dc91fecb92af1bdf3078485 (patch) | |
tree | 1de03cfa42f40bb5ca19956534f53d0b92d271d5 /crates/ra_syntax/src/parser_impl | |
parent | 3b42ddae601fbd73f672e82028e04c3abdf1252d (diff) |
Introduce Location and make SyntaxError fields private
Diffstat (limited to 'crates/ra_syntax/src/parser_impl')
-rw-r--r-- | crates/ra_syntax/src/parser_impl/event.rs | 4 | ||||
-rw-r--r-- | crates/ra_syntax/src/parser_impl/mod.rs | 6 |
2 files changed, 5 insertions, 5 deletions
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::{ | |||
15 | TextRange, TextUnit, | 15 | TextRange, TextUnit, |
16 | yellow::syntax_error::{ | 16 | yellow::syntax_error::{ |
17 | ParseError, | 17 | ParseError, |
18 | SyntaxError, | ||
18 | SyntaxErrorKind, | 19 | SyntaxErrorKind, |
19 | }, | 20 | }, |
20 | }; | 21 | }; |
@@ -162,8 +163,7 @@ impl<'a, S: Sink> EventProcessor<'a, S> { | |||
162 | self.leaf(kind, len, n_raw_tokens); | 163 | self.leaf(kind, len, n_raw_tokens); |
163 | } | 164 | } |
164 | Event::Error { msg } => self.sink.error( | 165 | Event::Error { msg } => self.sink.error( |
165 | SyntaxErrorKind::ParseError(msg), | 166 | SyntaxError::new(SyntaxErrorKind::ParseError(msg), self.text_pos), |
166 | TextRange::offset_len(self.text_pos, 1.into()), | ||
167 | ), | 167 | ), |
168 | } | 168 | } |
169 | } | 169 | } |
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::{ | |||
10 | event::{Event, EventProcessor}, | 10 | event::{Event, EventProcessor}, |
11 | input::{InputPosition, ParserInput}, | 11 | input::{InputPosition, ParserInput}, |
12 | }, | 12 | }, |
13 | SmolStr, TextRange, | 13 | SmolStr, |
14 | yellow::syntax_error::{ | 14 | yellow::syntax_error::{ |
15 | ParseError, | 15 | ParseError, |
16 | SyntaxErrorKind, | 16 | SyntaxError, |
17 | }, | 17 | }, |
18 | }; | 18 | }; |
19 | 19 | ||
@@ -25,7 +25,7 @@ pub(crate) trait Sink { | |||
25 | fn leaf(&mut self, kind: SyntaxKind, text: SmolStr); | 25 | fn leaf(&mut self, kind: SyntaxKind, text: SmolStr); |
26 | fn start_internal(&mut self, kind: SyntaxKind); | 26 | fn start_internal(&mut self, kind: SyntaxKind); |
27 | fn finish_internal(&mut self); | 27 | fn finish_internal(&mut self); |
28 | fn error(&mut self, kind: SyntaxErrorKind, offset: TextRange); | 28 | fn error(&mut self, error: SyntaxError); |
29 | fn finish(self) -> Self::Tree; | 29 | fn finish(self) -> Self::Tree; |
30 | } | 30 | } |
31 | 31 | ||