on master help sign in
Update errors for JSON parsing for new error style
commit3e4065b515e38eda7de71fe4f0112eb86ab38914 authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 30 Apr 2019, 13:32 (8 years ago) parent6369fa3
1 file changed+25−27
compiler/src/Reporting/Error/Json.hs+25−27
compiler/src/Reporting/Error/Json.hs+25−27
@@ -4,8 +4,7 @@ module Reporting.Error.Json
44 ( Error(..)
55 , Problem(..)
66 , DecodeExpectation(..)
7− , ParseExpectation(..)
8− , Context(..)
7+ , ParseError(..)
98 , toReport
109 )
1110 where
@@ -14,7 +13,6 @@ module Reporting.Error.Json
1413import qualified Data.Utf8 as Utf8
1514import Data.Word (Word16)
1615
17−import qualified Parse.Primitives as P
1816import qualified Reporting.Report as Report
1917
2018
@@ -24,7 +22,7 @@ import qualified Reporting.Report as Report
2422
2523data Error e
2624 = DecodeProblem (Problem e)
27− | ParseProblem Word16 Word16 (P.Context Context) ParseExpectation
25+ | ParseProblem ParseError
2826
2927
3028
@@ -50,32 +48,32 @@ data DecodeExpectation
5048
5149
5250
53−-- PARSE EXPECTATION
51+-- PARSE ERROR
5452
5553
56−data ParseExpectation
57− = ObjectStart
58− | ObjectMore
59− | ObjectEnd
60− | ArrayStart
61− | ArrayMore
62− | ArrayEnd
63− | StringStart
64− | StringEnd
65− | IntStart
66− | NoLeadingZeros
67− | NoFloats
68− | Bool
69− | Null
70− | Value
71− | Colon
72− | EndOfFile
54+data ParseError
55+ = PIndex Int ParseError Row Col
56+ | PField Utf8.String ParseError Row Col
57+ | ObjectStart Row Col
58+ | ObjectMore Row Col
59+ | ObjectEnd Row Col
60+ | ArrayStart Row Col
61+ | ArrayMore Row Col
62+ | ArrayEnd Row Col
63+ | StringStart Row Col
64+ | StringEnd Row Col
65+ | IntStart Row Col
66+ | NoLeadingZeros Row Col
67+ | NoFloats Row Col
68+ | Bool Row Col
69+ | Null Row Col
70+ | Value Row Col
71+ | Colon Row Col
72+ | EndOfFile Row Col
7373
7474
75−
76−data Context
77− = CIndex Int
78− | CField Utf8.String
75+type Row = Word16
76+type Col = Word16
7977
8078
8179
@@ -331,4 +329,4 @@ indexToName :: Int -> String
331329indexToName index =
332330 "[" ++ show index ++ "]"
333331
334−-}
332+-}