diff options
-rw-r--r-- | parser.hs | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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' |