diff --git a/src/Parser/JSON.md b/src/Parser/JSON.md index c69ea2c..48ecdbe 100644 --- a/src/Parser/JSON.md +++ b/src/Parser/JSON.md @@ -185,21 +185,25 @@ array = do where emptyArray : Parser (JSONValue TArray) emptyArray = do - _ <- parseExactChar '[' - _ <- many whitespace - _ <- parseExactChar ']' + delimited '[' ']' (nom whitespace) pure $ VArray Nil restValue : Parser (t : JSONType ** JSONValue t) restValue = do _ <- parseExactChar ',' value + values : Parser (List1 (t : JSONType ** JSONValue t)) + values = do + first <- value + rest <- many restValue + pure $ first ::: rest occupiedArray : Parser (JSONValue TArray) occupiedArray = do _ <- parseExactChar '[' - first <- value - rest <- many restValue + xs <- values _ <- parseExactChar ']' - let (types ** xs) = DList.fromList (first :: rest) + -- TODO: Why is this busted? + -- xs <- delimited '[' ']' values + let (types ** xs) = DList.fromList (forget xs) pure $ VArray xs ```