From cec4f5fb8dc28eee6636fa5f0370c4bef31e644f Mon Sep 17 00:00:00 2001 From: NotAFile Date: Tue, 1 Feb 2022 23:11:59 +0100 Subject: [PATCH] add nom error handling --- src/parser/error.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/parser/error.rs b/src/parser/error.rs index 57c669d..8a9771c 100644 --- a/src/parser/error.rs +++ b/src/parser/error.rs @@ -1,9 +1,5 @@ -use std::fmt::Debug; -use std::ops::Deref; - use super::{IErr, Span}; use ariadne::{Label, Report, ReportKind}; -use nom::error::ErrorKind; use nom_greedyerror::{GreedyErrorKind, Position}; fn span_to_range(input: Span) -> std::ops::Range { @@ -19,7 +15,8 @@ pub fn convert_error(input: Span, e: IErr) -> Report { } GreedyErrorKind::Char(c) => Label::new(err.0.position()..err.0.position()) .with_message(format!("expected {c:?}")), - GreedyErrorKind::Nom(_) => todo!(), + GreedyErrorKind::Nom(kind) => Label::new(err.0.position()..err.0.position()) + .with_message(format!("nom error {kind:?}")), }; labels.push(label); }