diff options
author | Jed Barber <jjbarber@y7mail.com> | 2012-05-14 21:56:43 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2012-05-14 21:56:43 +1000 |
commit | 111e4ab5200ee064b1132ef9e843b786441b5752 (patch) | |
tree | 831a125984b86758dc41f2ef5a563f9993c12ec3 | |
parent | 255ba39c758535589dfd66ffb6efb108919ecc08 (diff) |
Added the removal of escape character backslashes from name processing
-rw-r--r-- | Semantic.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Semantic.hs b/Semantic.hs index 2f54c94..0697179 100644 --- a/Semantic.hs +++ b/Semantic.hs @@ -71,7 +71,8 @@ parse n = Command (number n) name :: String -> ((Stack,Dictionary,Assumptions,Theorems) -> (Stack,Dictionary,Assumptions,Theorems)) name str = \(s,d,a,t) -> let unQuoted = init . tail $ str - wordList = words . (map (\x -> if (x == '.') then ' ' else x)) $ unQuoted + escaped = removeEscChars unQuoted + wordList = words . (map (\x -> if (x == '.') then ' ' else x)) $ escaped name = Name (init wordList) (last wordList) s' = Stack $ ObjName name : (stackList s) in (s',d,a,t) @@ -377,6 +378,14 @@ stripReturn :: String -> String stripReturn s = if (last s == '\r') then init s else s +removeEscChars :: String -> String +removeEscChars [] = [] +removeEscChars (x:[]) = [x] +removeEscChars x = if (head x == '\\') + then (x!!1) : (removeEscChars . (drop 2) $ x) + else (head x) : (removeEscChars . tail $ x) + + main = do args <- getArgs list <- getLines $ head args |