From 3ad023ef6a688d5b6ded1437476379a584f0afc7 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sat, 25 Jan 2025 04:39:25 -0500 Subject: [PATCH] json: Janky string --- src/Parser/JSON.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Parser/JSON.md b/src/Parser/JSON.md index faca235..453177a 100644 --- a/src/Parser/JSON.md +++ b/src/Parser/JSON.md @@ -198,3 +198,14 @@ array = do let (types ** xs) = DList.fromList (first :: rest) pure $ VArray xs ``` + +```idris +string = do + _ <- parseExactChar '"' + -- TODO: Handle control characters properly + e1 <- parseError "Expected non-quote, got quote" + e2 <- parseError "End of input" + contents <- parseString . many $ parseCharE (not . (== '"')) (\_ => e1) e2 + _ <- parseExactChar '"' + pure $ VString contents +```