1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00

Reorder error message to add callstack after the error syntax node

This commit is contained in:
Rick Winfrey 2017-05-18 09:47:14 -07:00 committed by Rob Rix
parent 1a98dba03b
commit 9519e557be

View File

@ -167,9 +167,9 @@ data ErrorCause symbol
showError :: Show symbol => Source.Source -> Error symbol -> ShowS
showError source Error{..}
= showSourcePos errorPos . showString ": error: " . showExpectation . showChar '\n'
. showString (prettyCallStack callStack) . showChar '\n'
. showString context -- actualLines results include line endings, so no newline here
. showString (replicate (succ (Info.column errorPos + lineNumberDigits)) ' ') . showChar '^' . showChar '\n'
. showString (prettyCallStack callStack) . showChar '\n'
where showExpectation = case errorCause of
UnexpectedEndOfInput [] -> showString "no rule to match at end of input nodes"
UnexpectedEndOfInput symbols -> showString "expected " . showSymbols symbols . showString " at end of input nodes"