diff --git a/src/Parser.elm b/src/Parser.elm index 5a8b03a..fd797f7 100644 --- a/src/Parser.elm +++ b/src/Parser.elm @@ -168,8 +168,31 @@ _thinks_ is happening can be really helpful! -} deadEndsToString : List DeadEnd -> String deadEndsToString deadEnds = - "TODO deadEndsToString" - + String.concat (List.intersperse "; " (List.map deadEndToString deadEnds)) + + +deadEndToString : DeadEnd -> String +deadEndToString deadend = + problemToString deadend.problem ++ " at row " ++ String.fromInt deadend.row ++ ", col " ++ String.fromInt deadend.col + + +problemToString : Problem -> String +problemToString p = + case p of + Expecting s -> "expecting '" ++ s ++ "'" + ExpectingInt -> "expecting int" + ExpectingHex -> "expecting hex" + ExpectingOctal -> "expecting octal" + ExpectingBinary -> "expecting binary" + ExpectingFloat -> "expecting float" + ExpectingNumber -> "expecting number" + ExpectingVariable -> "expecting variable" + ExpectingSymbol s -> "expecting symbol '" ++ s ++ "'" + ExpectingKeyword s -> "expecting keyword '" ++ s ++ "'" + ExpectingEnd -> "expecting end" + UnexpectedChar -> "unexpected char" + Problem s -> "problem " ++ s + BadRepeat -> "bad repeat" -- PIPELINES