diff --git a/src/Parser.elm b/src/Parser.elm index 2b04394..e7773b6 100644 --- a/src/Parser.elm +++ b/src/Parser.elm @@ -168,7 +168,58 @@ _thinks_ is happening can be really helpful! -} deadEndsToString : List DeadEnd -> String deadEndsToString deadEnds = - "TODO deadEndsToString" + let + deadEndToString : DeadEnd -> String + deadEndToString deadEnd = + let + position : String + position = + "row:" ++ String.fromInt deadEnd.row ++ " col:" ++ String.fromInt deadEnd.col ++ "\n" + in + case deadEnd.problem of + Expecting str -> + "Expecting " ++ str ++ "at " ++ position + + ExpectingInt -> + "ExpectingInt at " ++ position + + ExpectingHex -> + "ExpectingHex at " ++ position + + ExpectingOctal -> + "ExpectingOctal at " ++ position + + ExpectingBinary -> + "ExpectingBinary at " ++ position + + ExpectingFloat -> + "ExpectingFloat at " ++ position + + ExpectingNumber -> + "ExpectingNumber at " ++ position + + ExpectingVariable -> + "ExpectingVariable at " ++ position + + ExpectingSymbol str -> + "ExpectingSymbol " ++ str ++ " at " ++ position + + ExpectingKeyword str -> + "ExpectingKeyword " ++ str ++ "at " ++ position + + ExpectingEnd -> + "ExpectingEnd at " ++ position + + UnexpectedChar -> + "UnexpectedChar at " ++ position + + Problem str -> + "ProblemString " ++ str ++ " at " ++ position + + BadRepeat -> + "BadRepeat at " ++ position + in + List.foldl (++) "" (List.map deadEndToString deadEnds)