From 624c3db6f493edfb458ee262c4dd691915c46567 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 25 May 2017 17:38:35 +0200 Subject: Add string mode --- rip.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'rip.hs') diff --git a/rip.hs b/rip.hs index 0ad0ed0..34d6647 100644 --- a/rip.hs +++ b/rip.hs @@ -331,6 +331,13 @@ rip' code@(x:xs) fns conns st = do '\'' -> rip' (tail xs) fns conns $ ordI (head xs) : st + '"' -> + let str = takeWhile (/='"') xs + rest = drop (length str + 1) xs + in if length str == length xs + then riperror "No closing quote in \"string\"" + else rip' rest fns conns $ reverse (map (fromIntegral . fromEnum) str) ++ st + '$' -> do putStrLn $ '[' : ((intercalate " " . map show . reverse) st) ++ "]" rip' xs fns conns st -- cgit v1.2.3-70-g09d2