lexer: add Hint to Error, which is expanded as "%s" instead of "%q"
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -25,6 +25,7 @@ type Error struct {
|
|||||||
Column int
|
Column int
|
||||||
|
|
||||||
Content string
|
Content string
|
||||||
|
Hint string
|
||||||
Err error
|
Err error
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +58,10 @@ func (err Error) Error() string {
|
|||||||
s = append(s, fmt.Sprintf("%q", err.Content))
|
s = append(s, fmt.Sprintf("%q", err.Content))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err.Hint != "" {
|
||||||
|
s = append(s, err.Hint)
|
||||||
|
}
|
||||||
|
|
||||||
return strings.Join(s, ": ")
|
return strings.Join(s, ": ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user