From: Samir Benmendil Date: Sat, 20 Jan 2018 22:32:20 +0000 (+0000) Subject: Support escaped quotes X-Git-Url: https://git.rmz.io/my-scheme.git/commitdiff_plain/3144d06ee882e88a81a02c532061a48997506cf6?ds=sidebyside Support escaped quotes `innerChar` matches a char that is not a backslash or a quote. If it is either, it will match a backslash, capture a following quote and lift a quote char into the `innerChar` monad. This will not support anything other than quote after the backslash char. --- diff --git a/app/Main.hs b/app/Main.hs index cea4c9b..0c0d29c 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -22,7 +22,10 @@ parseString = do char '"' x <- many innerChar char '"' return $ String x - where innerChar = noneOf "\"" + where innerChar = noneOf ['\\', '\"'] <|> escapeChar + escapeChar = do char '\\' + c <- oneOf "\"" + return $ '\"' parseAtom :: Parser LispVal parseAtom = do