diff options
Diffstat (limited to 'Semantic.hs')
-rw-r--r-- | Semantic.hs | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/Semantic.hs b/Semantic.hs index 0697179..e40f4bc 100644 --- a/Semantic.hs +++ b/Semantic.hs @@ -1,4 +1,3 @@ -import Control.Monad( liftM ) import System( getArgs ) import Data.List import qualified Data.Set as Set @@ -7,6 +6,7 @@ import TypeVar import Term import Theorem import Object +import Parse @@ -70,9 +70,7 @@ 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 - escaped = removeEscChars unQuoted - wordList = words . (map (\x -> if (x == '.') then ' ' else x)) $ escaped + let wordList = (separateBy '.') . removeEscChars . removeQuotes $ str name = Name (init wordList) (last wordList) s' = Stack $ ObjName name : (stackList s) in (s',d,a,t) @@ -370,22 +368,6 @@ doSemanticCheck = -- important to use foldl here so commands get applied in the correct order -getLines :: FilePath -> IO [String] -getLines = liftM lines . readFile - - -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 |