diff --git a/lib/Quox/Parser/Lexer.idr b/lib/Quox/Parser/Lexer.idr index 8702aa2..7ef791f 100644 --- a/lib/Quox/Parser/Lexer.idr +++ b/lib/Quox/Parser/Lexer.idr @@ -71,15 +71,17 @@ tmatch : Lexer -> (String -> Token) -> Tokenizer ExtToken tmatch t f = match t (T . f) -||| [todo] escapes other than `\"` and (accidentally) `\\` export fromStringLit : String -> String fromStringLit = pack . go . unpack . drop 1 . dropLast 1 where go : List Char -> List Char - go [] = [] - go ['\\'] = ['\\'] -- i guess??? - go ('\\' :: c :: cs) = c :: go cs - go (c :: cs) = c :: go cs + go [] = [] + go ['\\'] = ['\\'] -- i guess??? + go ('\\' :: 'n' :: cs) = '\n' :: go cs + go ('\\' :: 't' :: cs) = '\t' :: go cs + -- [todo] others + go ('\\' :: c :: cs) = c :: go cs + go (c :: cs) = c :: go cs private string : Tokenizer ExtToken