From 98d7946709032aae5e1d0d35cff78efc55550900 Mon Sep 17 00:00:00 2001 From: Sophie Forrest Date: Fri, 30 Aug 2024 23:35:45 +1200 Subject: feat(parser): edit diagnostics --- src/parser.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/parser.rs') diff --git a/src/parser.rs b/src/parser.rs index cffa6db..e639516 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -53,7 +53,10 @@ pub enum Instruction { #[derive(Debug, Diagnostic, Error)] pub enum Error { /// Parser encountered a loop with no beginning. - #[diagnostic(help("try closing the loop"))] + #[diagnostic( + code(brainf_rs::parser::loop_with_no_beginning), + help("try closing the loop") + )] #[error("loop closed at {loop_src:?} has no beginning")] LoopWithNoBeginning { /// Source code associated with diagnostic @@ -66,7 +69,10 @@ pub enum Error { }, /// Parser encountered a loop with no ending. - #[diagnostic(help("try closing the loop"))] + #[diagnostic( + code(brainf_rs::parser::loop_with_no_ending), + help("try closing the loop") + )] #[error("loop beginning at {loop_src:?} has no ending")] LoopWithNoEnding { /// Source code associated with diagnostic -- cgit 1.4.1