1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 13:51:44 +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
parent 1747860e99
commit ff597b3a9c

View File

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