From 2b5dcec64daba9c397de0fd326b977cc55385e99 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Thu, 31 Aug 2023 16:36:33 +0000 Subject: [PATCH] lexer: add Hint to Error, which is expanded as "%s" instead of "%q" Signed-off-by: Alejandro Mery --- lexer/error.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lexer/error.go b/lexer/error.go index 065fc01..d18f3f2 100644 --- a/lexer/error.go +++ b/lexer/error.go @@ -25,6 +25,7 @@ type Error struct { Column int Content string + Hint string Err error } @@ -57,6 +58,10 @@ func (err Error) Error() string { s = append(s, fmt.Sprintf("%q", err.Content)) } + if err.Hint != "" { + s = append(s, err.Hint) + } + return strings.Join(s, ": ") }