diff options
author | Jed Barber <jjbarber@y7mail.com> | 2012-05-14 22:13:30 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2012-05-14 22:13:30 +1000 |
commit | 8e9f71bbec90d74390cae13db6f091bc5609f79e (patch) | |
tree | 838cf32c9742151d095c0903cfe2e34f9bdea52e /Semantic.hs | |
parent | ca22154af94bb260c812af4e11441b5a79790575 (diff) |
Moved a number of article format parsing functions to a separate file
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 |