mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-08-17 01:00:24 +03:00
[ contrib ] Implement Show ParsingError
(#2407)
This commit is contained in:
parent
e0f5f541e2
commit
36e38860b7
@ -134,6 +134,7 @@
|
||||
to 32 bits but now that is codified. JavaScript backends are now supported.
|
||||
* Removes `contrib`'s deprecated `Data.Num.Implementations` module. See
|
||||
`Prelude.Interfaces` instead.
|
||||
* Implements `Show tok => Show (ParsingError tok)` for `Text.Parser.Core`.
|
||||
|
||||
### Other changes
|
||||
|
||||
|
@ -271,6 +271,14 @@ position = Position
|
||||
public export
|
||||
data ParsingError tok = Error String (Maybe Bounds)
|
||||
|
||||
export
|
||||
Show tok => Show (ParsingError tok) where
|
||||
show (Error s Nothing) = "PARSING ERROR: " ++ s
|
||||
show (Error s (Just (MkBounds startLine startCol endLine endCol))) =
|
||||
"PARSING ERROR: "
|
||||
++ s
|
||||
++ " @ L\{show startLine}:\{show startCol}-L\{show endLine}:\{show endCol}"
|
||||
|
||||
data ParseResult : Type -> Type -> Type -> Type where
|
||||
Failure : (committed : Bool) -> (fatal : Bool) ->
|
||||
List1 (ParsingError tok) -> ParseResult state tok ty
|
||||
|
Loading…
Reference in New Issue
Block a user