From d013ece76a7053828d325a592e6a7ee8ff2218b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Tue, 8 Oct 2024 22:48:10 -0700 Subject: [PATCH] fix(deps): remove nom --- Cargo.toml | 1 - src/error.rs | 67 +--------------------------------------------------- 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 88d27c6..eb51001 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ span = [] [dependencies] miette = "7.2.0" -nom = "7.1.1" thiserror = "1.0.40" winnow = { version = "0.6.20", features = ["alloc", "unstable-recover"] } diff --git a/src/error.rs b/src/error.rs index a70f22f..b6a097e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,7 +4,6 @@ use std::{ }; use miette::{Diagnostic, SourceSpan}; -use nom::error::{ContextError, ErrorKind, FromExternalError, ParseError}; use thiserror::Error; #[cfg(doc)] @@ -103,68 +102,4 @@ pub enum KdlErrorKind { #[error("An unspecified parse error occurred.")] #[diagnostic(code(kdl::other))] Other, -} - -#[derive(Debug, Clone, Eq, PartialEq)] -pub(crate) struct KdlParseError { - pub(crate) input: I, - pub(crate) context: Option<&'static str>, - pub(crate) len: usize, - pub(crate) label: Option<&'static str>, - pub(crate) help: Option<&'static str>, - pub(crate) kind: Option, - pub(crate) touched: bool, -} - -impl ParseError for KdlParseError { - fn from_error_kind(input: I, _kind: nom::error::ErrorKind) -> Self { - Self { - input, - len: 0, - label: None, - help: None, - context: None, - kind: None, - touched: false, - } - } - - fn append(_input: I, _kind: nom::error::ErrorKind, other: Self) -> Self { - other - } -} - -impl ContextError for KdlParseError { - fn add_context(_input: I, ctx: &'static str, mut other: Self) -> Self { - other.context = other.context.or(Some(ctx)); - other - } -} - -impl<'a> FromExternalError<&'a str, ParseIntError> for KdlParseError<&'a str> { - fn from_external_error(input: &'a str, _kind: ErrorKind, e: ParseIntError) -> Self { - KdlParseError { - input, - len: 0, - label: None, - help: None, - context: None, - kind: Some(KdlErrorKind::ParseIntError(e)), - touched: false, - } - } -} - -impl<'a> FromExternalError<&'a str, ParseFloatError> for KdlParseError<&'a str> { - fn from_external_error(input: &'a str, _kind: ErrorKind, e: ParseFloatError) -> Self { - KdlParseError { - input, - len: 0, - label: None, - help: None, - context: None, - kind: Some(KdlErrorKind::ParseFloatError(e)), - touched: false, - } - } -} +} \ No newline at end of file