summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Semantic.hs11
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