diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-10-05 13:15:02 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-10-05 13:15:02 +0200 |
| commit | fd8160f3749135400b3d2c59bf6bfb729c081f16 (patch) | |
| tree | fcd9eee0af33ae71b4b5b5d38453a5af4a974403 /src/parse/parser.rs | |
| parent | ec884ec1d85f6e1d7868db3e82d572579cc5d345 (diff) | |
Remove `SpanPos` in favor of `ErrorPos`
Diffstat (limited to 'src/parse/parser.rs')
| -rw-r--r-- | src/parse/parser.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 4b73c2b9..fe04f29e 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -3,7 +3,8 @@ use std::mem; use std::ops::Range; use super::{TokenMode, Tokens}; -use crate::syntax::{InnerNode, NodeData, NodeKind, SpanPos, SyntaxNode}; +use crate::diag::ErrorPos; +use crate::syntax::{InnerNode, NodeData, NodeKind, SyntaxNode}; use crate::util::EcoString; /// A convenient token-based parser. @@ -398,7 +399,7 @@ impl Parser<'_> { pub fn unexpected(&mut self) { if let Some(found) = self.peek() { let msg = format_eco!("unexpected {}", found.name()); - let error = NodeKind::Error(SpanPos::Full, msg); + let error = NodeKind::Error(ErrorPos::Full, msg); self.perform(error, Self::eat); } } @@ -412,7 +413,7 @@ impl Parser<'_> { /// Insert an error message that `what` was expected at the marker position. pub fn expected_at(&mut self, marker: Marker, what: &str) { let msg = format_eco!("expected {}", what); - let error = NodeKind::Error(SpanPos::Full, msg); + let error = NodeKind::Error(ErrorPos::Full, msg); self.children.insert(marker.0, NodeData::new(error, 0).into()); } @@ -422,7 +423,7 @@ impl Parser<'_> { match self.peek() { Some(found) => { let msg = format_eco!("expected {}, found {}", thing, found.name()); - let error = NodeKind::Error(SpanPos::Full, msg); + let error = NodeKind::Error(ErrorPos::Full, msg); self.perform(error, Self::eat); } None => self.expected(thing), @@ -494,7 +495,7 @@ impl Marker { msg.push_str(", found "); msg.push_str(child.kind().name()); } - let error = NodeKind::Error(SpanPos::Full, msg); + let error = NodeKind::Error(ErrorPos::Full, msg); let inner = mem::take(child); *child = InnerNode::with_child(error, inner).into(); } |
