Skip to content

implementation deadEndsToString #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion src/Parser.elm
Original file line number Diff line number Diff line change
@@ -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)