summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2008-10-19 14:21:58 +0000
committerkrasimir <krasimir@chalmers.se>2008-10-19 14:21:58 +0000
commit418856d9bfe23944528ba3d41710be0dbfab8d27 (patch)
treefedb48c00b36bacde4c34ece9eda5e2c90db19b9 /src
parent9837fb8fb17be9ecf5d90f3fb5a97ec6389f9eef (diff)
move the literal category names to PGF.Macros
Diffstat (limited to 'src')
-rw-r--r--src/GF/Compile/GeneratePMCFG.hs6
-rw-r--r--src/PGF/Generate.hs5
-rw-r--r--src/PGF/Macros.hs6
3 files changed, 8 insertions, 9 deletions
diff --git a/src/GF/Compile/GeneratePMCFG.hs b/src/GF/Compile/GeneratePMCFG.hs
index 619e5088b..a20496d70 100644
--- a/src/GF/Compile/GeneratePMCFG.hs
+++ b/src/GF/Compile/GeneratePMCFG.hs
@@ -217,16 +217,10 @@ emptyGrammarEnv cnc_defs lincats =
let (last_id,catSet) = Map.mapAccumWithKey computeCatRange 0 lincats
in GrammarEnv last_id (IntMap.singleton 0 catSet) Map.empty Map.empty Map.empty IntMap.empty
where
- cidString = mkCId "String"
- cidInt = mkCId "Int"
- cidFloat = mkCId "Float"
- cidVar = mkCId "_Var"
-
computeCatRange index cat ctype
| cat == cidString = (index, (fcatString,fcatString,[]))
| cat == cidInt = (index, (fcatInt, fcatInt, []))
| cat == cidFloat = (index, (fcatFloat, fcatFloat, []))
- | cat == cidVar = (index, (fcatVar, fcatVar, []))
| otherwise = (index+size,(index,index+size-1,poly))
where
(size,poly) = getMultipliers 1 [] ctype
diff --git a/src/PGF/Generate.hs b/src/PGF/Generate.hs
index 64ca4d5f5..518c2c71b 100644
--- a/src/PGF/Generate.hs
+++ b/src/PGF/Generate.hs
@@ -36,8 +36,9 @@ genRandom gen pgf cat = genTrees (randomRs (0.0, 1.0 :: Double) gen) cat where
(genTrees ds2 cat) -- else (drop k ds)
genTree rs = gett rs where
- gett ds cid | cid == mkCId "String" = (Lit (LStr "foo"), 1)
- gett ds cid | cid == mkCId "Int" = (Lit (LInt 12345), 1)
+ gett ds cid | cid == cidString = (Lit (LStr "foo"), 1)
+ gett ds cid | cid == cidInt = (Lit (LInt 12345), 1)
+ gett ds cid | cid == cidFloat = (Lit (LFlt 12345), 1)
gett [] _ = (Lit (LStr "TIMEOUT"), 1) ----
gett ds cat = case fns cat of
[] -> (Meta 0,1)
diff --git a/src/PGF/Macros.hs b/src/PGF/Macros.hs
index 9b768cd5f..b3847d4a0 100644
--- a/src/PGF/Macros.hs
+++ b/src/PGF/Macros.hs
@@ -140,4 +140,8 @@ combinations t = case t of
aa:uu -> [a:u | a <- aa, u <- combinations uu]
isLiteralCat :: CId -> Bool
-isLiteralCat = (`elem` [mkCId "String", mkCId "Float", mkCId "Int"])
+isLiteralCat = (`elem` [cidString, cidFloat, cidInt])
+
+cidString = mkCId "String"
+cidInt = mkCId "Int"
+cidFloat = mkCId "Float"