Skip to content

Commit 4a96f61

Browse files
bburdetterupertlssmith
authored andcommitted
fixes elm#16
Implementation of deadEndsToString.
1 parent 02839df commit 4a96f61

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

src/Parser.elm

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,31 @@ _thinks_ is happening can be really helpful!
168168
-}
169169
deadEndsToString : List DeadEnd -> String
170170
deadEndsToString deadEnds =
171-
"TODO deadEndsToString"
172-
171+
String.concat (List.intersperse "; " (List.map deadEndToString deadEnds))
172+
173+
174+
deadEndToString : DeadEnd -> String
175+
deadEndToString deadend =
176+
problemToString deadend.problem ++ " at row " ++ String.fromInt deadend.row ++ ", col " ++ String.fromInt deadend.col
177+
178+
179+
problemToString : Problem -> String
180+
problemToString p =
181+
case p of
182+
Expecting s -> "expecting '" ++ s ++ "'"
183+
ExpectingInt -> "expecting int"
184+
ExpectingHex -> "expecting hex"
185+
ExpectingOctal -> "expecting octal"
186+
ExpectingBinary -> "expecting binary"
187+
ExpectingFloat -> "expecting float"
188+
ExpectingNumber -> "expecting number"
189+
ExpectingVariable -> "expecting variable"
190+
ExpectingSymbol s -> "expecting symbol '" ++ s ++ "'"
191+
ExpectingKeyword s -> "expecting keyword '" ++ s ++ "'"
192+
ExpectingEnd -> "expecting end"
193+
UnexpectedChar -> "unexpected char"
194+
Problem s -> "problem " ++ s
195+
BadRepeat -> "bad repeat"
173196

174197

175198
-- PIPELINES

0 commit comments

Comments
 (0)