tools/PascalPreprocessor.hs
changeset 7067 f98ec3aecf4e
parent 7059 800dcaf979bf
child 7315 59b5b19e6604
equal deleted inserted replaced
7066:12cc2bd84b0b 7067:f98ec3aecf4e
   119         try $ string "DEFINE"
   119         try $ string "DEFINE"
   120         spaces
   120         spaces
   121         i <- identifier        
   121         i <- identifier        
   122         d <- ((string ":=" >> return ())<|> spaces) >> many (noneOf "}")
   122         d <- ((string ":=" >> return ())<|> spaces) >> many (noneOf "}")
   123         char '}'
   123         char '}'
   124         updateState $ \(m, b) -> (if and b then Map.insert i d m else m, b)
   124         updateState $ \(m, b) -> (if (and b) && (head i /= '_') then Map.insert i d m else m, b)
   125         return ""
   125         return ""
   126     replace s = do
   126     replace s = do
   127         (m, _) <- getState
   127         (m, _) <- getState
   128         return $ Map.findWithDefault s s m
   128         return $ Map.findWithDefault s s m
   129         
   129