mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Introduce Location and make SyntaxError fields private
This commit is contained in:
parent
3b42ddae60
commit
fda8ddc5fe
10 changed files with 82 additions and 52 deletions
|
@ -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),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue