diff options
| author | kr.angelov <kr.angelov@chalmers.se> | 2008-05-21 13:10:54 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@chalmers.se> | 2008-05-21 13:10:54 +0000 |
| commit | c544ef31823c7d2c28c28cae408cca5d71e6978d (patch) | |
| tree | b9693bc684d1737062e45438cedf7536cf5513d5 /src-3.0/GF/Compile | |
| parent | 529374caaa6d451400f57f1ff82106d89d603944 (diff) | |
use ByteString internally in Ident, CId and Label
Diffstat (limited to 'src-3.0/GF/Compile')
| -rw-r--r-- | src-3.0/GF/Compile/API.hs | 2 | ||||
| -rw-r--r-- | src-3.0/GF/Compile/BackOpt.hs | 3 | ||||
| -rw-r--r-- | src-3.0/GF/Compile/Flatten.hs | 2 | ||||
| -rw-r--r-- | src-3.0/GF/Compile/Optimize.hs | 8 | ||||
| -rw-r--r-- | src-3.0/GF/Compile/RemoveLiT.hs | 3 | ||||
| -rw-r--r-- | src-3.0/GF/Compile/Rename.hs | 10 |
6 files changed, 14 insertions, 14 deletions
diff --git a/src-3.0/GF/Compile/API.hs b/src-3.0/GF/Compile/API.hs index 242a9e87a..7e852cf7a 100644 --- a/src-3.0/GF/Compile/API.hs +++ b/src-3.0/GF/Compile/API.hs @@ -10,7 +10,7 @@ import GF.Devel.UseIO -- | Compiles a number of source files and builds a 'GFCC' structure for them. compileToGFCC :: Options -> [FilePath] -> IOE GFCC -compileToGFCC opts fs = +compileToGFCC opts fs = do gr <- batchCompile opts fs let name = justModuleName (last fs) gc1 <- putPointE opts "linking ... " $ diff --git a/src-3.0/GF/Compile/BackOpt.hs b/src-3.0/GF/Compile/BackOpt.hs index 8356f2ba2..0f74bbf92 100644 --- a/src-3.0/GF/Compile/BackOpt.hs +++ b/src-3.0/GF/Compile/BackOpt.hs @@ -24,6 +24,7 @@ import GF.Grammar.PrGrammar (prt) import GF.Data.Operations import Data.List import qualified GF.Infra.Modules as M +import qualified Data.ByteString.Char8 as BS type OptSpec = [Integer] --- @@ -110,7 +111,7 @@ factor c i t = case t of --- we hope this will be fresh and don't check... in GFC would be safe -qqIdent c i = identC ("q_" ++ prt c ++ "__" ++ show i) +qqIdent c i = identC (BS.pack ("q_" ++ prt c ++ "__" ++ show i)) -- we need to replace subterms diff --git a/src-3.0/GF/Compile/Flatten.hs b/src-3.0/GF/Compile/Flatten.hs index 6b25edebb..1168ca6da 100644 --- a/src-3.0/GF/Compile/Flatten.hs +++ b/src-3.0/GF/Compile/Flatten.hs @@ -42,7 +42,7 @@ mkRules conf f t = (fun f ty, lin f (takeWhile (/=':') t)) where args = mkArgs conf ts ty = concat [a ++ " -> " | a <- map snd args] ++ val (ts,val) = let tt = lexTerm t in (init tt,last tt) ---- f = mkIdent t +--- f = identV t fun c a = unwords [" fun", c, ":",a,";"] lin c a = unwords $ [" lin", c] ++ map fst args ++ ["=",a,";"] diff --git a/src-3.0/GF/Compile/Optimize.hs b/src-3.0/GF/Compile/Optimize.hs index a540ee715..8931cb6a2 100644 --- a/src-3.0/GF/Compile/Optimize.hs +++ b/src-3.0/GF/Compile/Optimize.hs @@ -130,9 +130,9 @@ evalCncInfo opts gr cnc abs (c,info) = do CncCat ptyp pde ppr -> do pde' <- case (ptyp,pde) of (Yes typ, Yes de) -> - liftM yes $ pEval ([(strVar, typeStr)], typ) de + liftM yes $ pEval ([(varStr, typeStr)], typ) de (Yes typ, Nope) -> - liftM yes $ mkLinDefault gr typ >>= partEval noOptions gr ([(strVar, typeStr)],typ) + liftM yes $ mkLinDefault gr typ >>= partEval noOptions gr ([(varStr, typeStr)],typ) (May b, Nope) -> return $ May b _ -> return pde -- indirection @@ -248,7 +248,7 @@ recordExpand typ trm = case unComputed typ of mkLinDefault :: SourceGrammar -> Type -> Err Term mkLinDefault gr typ = do case unComputed typ of - RecType lts -> mapPairsM mkDefField lts >>= (return . Abs strVar . R . mkAssign) + RecType lts -> mapPairsM mkDefField lts >>= (return . Abs varStr . R . mkAssign) _ -> prtBad "linearization type must be a record type, not" typ where mkDefField typ = case unComputed typ of @@ -256,7 +256,7 @@ mkLinDefault gr typ = do t' <- mkDefField t let T _ cs = mkWildCases t' return $ T (TWild p) cs - Sort "Str" -> return $ Vr strVar + Sort "Str" -> return $ Vr varStr QC q p -> lookupFirstTag gr q p RecType r -> do let (ls,ts) = unzip r diff --git a/src-3.0/GF/Compile/RemoveLiT.hs b/src-3.0/GF/Compile/RemoveLiT.hs index 28aae9b84..02ff58bc7 100644 --- a/src-3.0/GF/Compile/RemoveLiT.hs +++ b/src-3.0/GF/Compile/RemoveLiT.hs @@ -23,6 +23,7 @@ import GF.Infra.Ident import GF.Infra.Modules import GF.Grammar.Macros import GF.Grammar.Lookup +import GF.Grammar.Predef import GF.Data.Operations @@ -60,4 +61,4 @@ remlTerm gr trm = case trm of look c = err (const $ return defLinType) return $ lookupLincat gr m c m = case [cnc | (cnc,ModMod m) <- modules gr, isModCnc m] of cnc:_ -> cnc -- actually there is always exactly one - _ -> zIdent "CNC" + _ -> cCNC diff --git a/src-3.0/GF/Compile/Rename.hs b/src-3.0/GF/Compile/Rename.hs index c3fef557b..68f4d754f 100644 --- a/src-3.0/GF/Compile/Rename.hs +++ b/src-3.0/GF/Compile/Rename.hs @@ -29,6 +29,7 @@ module GF.Compile.Rename (renameGrammar, import GF.Grammar.Grammar import GF.Grammar.Values +import GF.Grammar.Predef import GF.Infra.Modules import GF.Infra.Ident import GF.Grammar.Macros @@ -90,11 +91,9 @@ renameIdentTerm env@(act,imps) t = [(m, st) | (OSimple _ m, st) <- imps] -- qualif is always possible -- this facility is mainly for BWC with GF1: you need not import PredefAbs - predefAbs c s = case c of - IC "Int" -> return $ Q cPredefAbs cInt - IC "Float" -> return $ Q cPredefAbs cFloat - IC "String" -> return $ Q cPredefAbs cString - _ -> Bad s + predefAbs c s + | isPredefCat c = return $ Q cPredefAbs c + | otherwise = Bad s ident alt c = case lookupTree prt c act of Ok f -> return $ f c @@ -104,7 +103,6 @@ renameIdentTerm env@(act,imps) t = fs -> case nub [f c | f <- fs] of [tr] -> return tr ts@(t:_) -> trace ("WARNING: conflict" +++ unwords (map prt ts)) (return t) ----- ts -> return $ Strs $ (cnIC "#conflict") : reverse ts -- a warning will be generated in CheckGrammar, and the head returned -- in next V: -- Bad $ "conflicting imports:" +++ unwords (map prt ts) |
