From 0fb89ec4b3c1b40ace1bfcec29832303e7c7d0bb Mon Sep 17 00:00:00 2001 From: MunirG05 Date: Tue, 11 Jul 2023 14:54:49 +0530 Subject: [PATCH] the design is very human --- hbasm/src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hbasm/src/main.rs b/hbasm/src/main.rs index 3126ffb4..d59a873b 100644 --- a/hbasm/src/main.rs +++ b/hbasm/src/main.rs @@ -21,14 +21,20 @@ fn main() -> Result<(), Box> { hbasm::text::ErrorKind::UnexpectedEnd => 3, hbasm::text::ErrorKind::InvalidSymbol => 4, }; + let message = match e.kind { + hbasm::text::ErrorKind::UnexpectedToken => "This token is not expected!", + hbasm::text::ErrorKind::InvalidToken => "The token is not valid!", + hbasm::text::ErrorKind::UnexpectedEnd => "The assembler reached the end of input unexpectedly!", + hbasm::text::ErrorKind::InvalidSymbol => "This referenced symbol doesn't have a corresponding label!", + }; let a = colors.next(); - Report::build(ReportKind::Error, "engine_internal", 12) + Report::build(ReportKind::Error, "engine_internal", e.span.clone().start) .with_code(e_code) .with_message(format!("{:?}", e.kind)) .with_label( Label::new(("engine_internal", e.span.clone())) - .with_message(format!("{:?}", e.kind)) + .with_message(message) .with_color(a), ) .finish()