diff options
author | Veetaha <[email protected]> | 2020-02-06 00:33:18 +0000 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-02-17 20:24:33 +0000 |
commit | 9fdf984958901a6bf16772c2c88b3163f044b390 (patch) | |
tree | b3f86c533c6a9a86a9183cb117e23efd382c045e /crates/ra_syntax/src/syntax_node.rs | |
parent | 9053003e3b298b38f6029b860efc5baed1996385 (diff) |
ra_syntax: reshape SyntaxError for the sake of removing redundancy
Diffstat (limited to 'crates/ra_syntax/src/syntax_node.rs')
-rw-r--r-- | crates/ra_syntax/src/syntax_node.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs index 7c2b18af3..251668996 100644 --- a/crates/ra_syntax/src/syntax_node.rs +++ b/crates/ra_syntax/src/syntax_node.rs | |||
@@ -6,15 +6,10 @@ | |||
6 | //! The *real* implementation is in the (language-agnostic) `rowan` crate, this | 6 | //! The *real* implementation is in the (language-agnostic) `rowan` crate, this |
7 | //! module just wraps its API. | 7 | //! module just wraps its API. |
8 | 8 | ||
9 | use ra_parser::ParseError; | 9 | pub(crate) use rowan::{GreenNode, GreenToken}; |
10 | use rowan::{GreenNodeBuilder, Language}; | 10 | use rowan::{GreenNodeBuilder, Language}; |
11 | 11 | ||
12 | use crate::{ | 12 | use crate::{Parse, SmolStr, SyntaxError, SyntaxKind, TextUnit}; |
13 | syntax_error::{SyntaxError, SyntaxErrorKind}, | ||
14 | Parse, SmolStr, SyntaxKind, TextUnit, | ||
15 | }; | ||
16 | |||
17 | pub(crate) use rowan::{GreenNode, GreenToken}; | ||
18 | 13 | ||
19 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 14 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
20 | pub enum RustLanguage {} | 15 | pub enum RustLanguage {} |
@@ -73,8 +68,7 @@ impl SyntaxTreeBuilder { | |||
73 | self.inner.finish_node() | 68 | self.inner.finish_node() |
74 | } | 69 | } |
75 | 70 | ||
76 | pub fn error(&mut self, error: ParseError, text_pos: TextUnit) { | 71 | pub fn error(&mut self, error: ra_parser::ParseError, text_pos: TextUnit) { |
77 | let error = SyntaxError::new(SyntaxErrorKind::ParseError(error), text_pos); | 72 | self.errors.push(SyntaxError::new_at_offset(error.0, text_pos)) |
78 | self.errors.push(error) | ||
79 | } | 73 | } |
80 | } | 74 | } |