diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | rip.hs | 7 |
2 files changed, 8 insertions, 0 deletions
@@ -30,6 +30,7 @@ All stack items are signed bigints. - `$`: outputs a stackdump - whitespace: nop - `'c`: pushes the ascii value of c +- `"abcde"`: `'a'b'c'd'e` - `#<file.rip>`: literally includes contents of 'file.rip' in-place @@ -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 |