summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parser.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/parser.hs b/parser.hs
index f488762..46bd3d0 100644
--- a/parser.hs
+++ b/parser.hs
@@ -206,14 +206,15 @@ pInteger = (read <$> many1 (satisfy isDigit)) << pWhiteComment
pString :: Parser String
pString = do
void $ char '"'
- s <- many (pEscape <|> anyChar)
+ s <- many (pEscape <|> satisfy (/='"'))
symbol "\""
return s
where
pEscape :: Parser Char
- pEscape = char '\\' >> (pEscapeN <|> pEscapeR <|> pEscapeT <|> pEscapeHex)
+ pEscape = char '\\' >> (pEscapeQuote <|> pEscapeN <|> pEscapeR <|> pEscapeT <|> pEscapeHex)
- pEscapeN, pEscapeR, pEscapeT :: Parser Char
+ pEscapeQuote, pEscapeN, pEscapeR, pEscapeT :: Parser Char
+ pEscapeQuote = '"' <$ char '"'
pEscapeN = '\n' <$ char 'n'
pEscapeR = '\r' <$ char 'r'
pEscapeT = '\t' <$ char 't'