From 111e4ab5200ee064b1132ef9e843b786441b5752 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Mon, 14 May 2012 21:56:43 +1000 Subject: Added the removal of escape character backslashes from name processing --- Semantic.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- cgit