@@ -764,13 +764,20 @@ gridTableFooter = blanklines
766-- | Parse a string with a given parser and state.
766-- | Parse a string with a given parser and state.
767−readWith :: Parser [t] ParserState a -- ^ parser
767+readWith :: Parser [Char] ParserState a -- ^ parser
768− -> ParserState -- ^ initial state
768+ -> ParserState -- ^ initial state
769− -> [t] -- ^ input
769+ -> [Char] -- ^ input
771readWith parser state input =
771readWith parser state input =
772 case runParser parser state "source" input of
772 case runParser parser state "source" input of
774+ let errPos = errorPos err'
775+ errLine = sourceLine errPos
776+ errColumn = sourceColumn errPos
777+ theline = (lines input ++ [""]) !! (errLine - 1)
773− Left err' -> error $ "\nError:\n" ++ show err'
778+ in error $ "\nError at " ++ show err' ++ "\n" ++
779+ theline ++ "\n" ++ replicate (errColumn - 1) ' ' ++
774 Right result -> result
781 Right result -> result
776-- | Parse a string with @parser@ (for testing).
783-- | Parse a string with @parser@ (for testing).