Changeset 5393
- Timestamp:
- 07/11/05 07:19:48 (3 years ago)
- svk:copy_cache_prev:
- 7349
- Location:
- src
- Files:
-
- 2 modified
-
Main.hs (modified) (1 diff)
-
Pugs/CodeGen.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Main.hs
r5360 r5393 173 173 glob <- readTVar $ envGlobal env 174 174 newTVar $ userDefined glob 175 translatebackend env{ envGlobal = globRef }175 codeGen backend env{ envGlobal = globRef } 176 176 177 177 doCompileDump :: String -> FilePath -> String -> IO () -
src/Pugs/CodeGen.hs
r5364 r5393 10 10 -} 11 11 12 module Pugs.CodeGen ( translate, backends) where12 module Pugs.CodeGen (codeGen, backends) where 13 13 import Pugs.AST 14 14 import Pugs.Internals … … 34 34 35 35 norm :: String -> String 36 norm s = ucfirst $ map toLower s 37 where ucfirst (x:xs) = toUpper x : xs 38 ucfirst [] = [] 36 norm "" = "" 37 norm (x:xs) = toUpper x : map toLower xs 39 38 40 39 doLookup :: String -> IO Generator 41 40 doLookup s = Map.lookup (norm s) generators 42 41 43 translate:: String -> Env -> IO String44 translates env = do42 codeGen :: String -> Env -> IO String 43 codeGen s env = do 45 44 gen <- catch (doLookup s) $ \_ -> do 46 fail $ "Cannot compile to" ++ s45 fail $ "Cannot generate code for " ++ s 47 46 rv <- runEvalIO env gen 48 47 case rv of
