From a50bea4c6041f49db06b3ed11fd5265e60d64963 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Wed, 17 Apr 2024 16:15:35 +0200 Subject: [PATCH] =?UTF-8?q?error=20:=20d=C3=A9localisation=20de=20l'erreur?= =?UTF-8?q?=20UnmatchedQuoteError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/error.rs | 10 ++++++++++ src/parser.rs | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index 069b750..020fee5 100644 --- a/src/error.rs +++ b/src/error.rs @@ -41,6 +41,16 @@ impl Display for CommandNotFoundError { } } +pub struct UnmatchedQuoteError { + index: usize, +} + +impl Display for UnmatchedQuoteError { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + write!(f, "unmatched quote at character {}", self.index) + } +} + pub fn print(error: Error) { let name = env::args().next().unwrap_or(String::from("rash")); let name = Path::new(&name).file_name().unwrap().to_str().unwrap(); diff --git a/src/parser.rs b/src/parser.rs index 9d2d299..b1a7c07 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -106,6 +106,3 @@ pub fn parse(line: String, variables: &Variables) -> CommandSequence { command_sequence } - -#[derive(Debug)] -struct UnmatchedQuoteError;