json: Refactor string parser

This commit is contained in:
Nathan McCarty 2025-01-26 15:40:15 -05:00
parent 91e1d2c9b1
commit 4fb5707b25

View file

@ -209,13 +209,15 @@ array = do
```idris ```idris
string = do string = do
_ <- parseExactChar '"' str <- parseString $ delimited '"' '"' (many stringCharacter)
-- TODO: Handle control characters properly pure $ VString str
e1 <- parseError "Expected non-quote, got quote" where
e2 <- parseError "End of input" -- TODO: Handle control characters properly
contents <- parseString . many $ parseCharE (not . (== '"')) (\_ => e1) e2 stringCharacter : Parser Char
_ <- parseExactChar '"' stringCharacter = do
pure $ VString contents e1 <- parseError "Expected non-quote, got quote"
e2 <- parseError "End of input"
parseCharE (not . (== '"')) (\_ => e1) e2
``` ```
```idris ```idris