File tree Expand file tree Collapse file tree 1 file changed +66
-1
lines changed Expand file tree Collapse file tree 1 file changed +66
-1
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,9 @@ type Problem
154154 | BadRepeat
155155
156156
157+
158+
159+
157160{- | Turn all the `DeadEnd` data into a string that is easier for people to
158161read.
159162
@@ -168,7 +171,67 @@ _thinks_ is happening can be really helpful!
168171-}
169172deadEndsToString : List DeadEnd -> String
170173deadEndsToString deadEnds =
171- " TODO deadEndsToString"
174+ String . join " \n " ( List . map deadEndToString deadEnds)
175+
176+
177+ deadEndToString : DeadEnd -> String
178+ deadEndToString deadEnd =
179+ problemToString deadEnd. problem
180+ ++ " at "
181+ ++ deadEndToRowColString deadEnd
182+
183+ problemToString : Problem -> String
184+ problemToString prob =
185+ case prob of
186+ Expecting s ->
187+ " Expecting " ++ s
188+
189+ ExpectingInt ->
190+ " Expecting Int"
191+
192+ ExpectingHex ->
193+ " Expecting Hex"
194+
195+ ExpectingOctal ->
196+ " Expecting Octal"
197+
198+ ExpectingBinary ->
199+ " Expecting Binary"
200+
201+ ExpectingFloat ->
202+ " Expecting Float"
203+
204+ ExpectingNumber ->
205+ " Expecting Number"
206+
207+ ExpectingVariable ->
208+ " Expecting Variable"
209+
210+ ExpectingSymbol s ->
211+ " Expecting Symbol " ++ s
212+
213+ ExpectingKeyword s ->
214+ " Expecting Keyword " ++ s
215+
216+ ExpectingEnd ->
217+ " Expecting End"
218+
219+ UnexpectedChar ->
220+ " Unexpected Char"
221+
222+ Problem s ->
223+ " Problem: " ++ s
224+
225+ BadRepeat ->
226+ " Bad Repeat"
227+
228+
229+
230+
231+ deadEndToRowColString : DeadEnd -> String
232+ deadEndToRowColString deadEnd =
233+ " row " ++ String . fromInt deadEnd. row ++ " , " ++ " col " ++ String . fromInt deadEnd. col
234+
172235
173236
174237
@@ -1256,3 +1319,5 @@ toAdvancedNestable nestable =
12561319 case nestable of
12571320 NotNestable -> A . NotNestable
12581321 Nestable -> A . Nestable
1322+
1323+
You can’t perform that action at this time.
0 commit comments