summaryrefslogtreecommitdiff
path: root/src/GF/Grammar/Macros.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2005-12-02 13:13:14 +0000
committeraarne <aarne@cs.chalmers.se>2005-12-02 13:13:14 +0000
commitdea5158cbf1c11d45f2ed91d9975fbc77245e652 (patch)
tree751ef7bcaccf58c43354d5b1767d3b3d3d1ac34d /src/GF/Grammar/Macros.hs
parent50ddb387f4495beb8bd8da2b9726a087a489df68 (diff)
floats in GF and GFC (parsing user input still doesn't work)
Diffstat (limited to 'src/GF/Grammar/Macros.hs')
-rw-r--r--src/GF/Grammar/Macros.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs
index 440a54562..dc4f790fd 100644
--- a/src/GF/Grammar/Macros.hs
+++ b/src/GF/Grammar/Macros.hs
@@ -287,11 +287,12 @@ typeStr = srt "Str"
typeTok = srt "Tok"
typeStrs = srt "Strs"
-typeString, typeInt :: Term
-typeInts :: Int -> Term
+typeString, typeFloat, typeInt :: Term
+typeInts :: Integer -> Term
typeString = constPredefRes "String"
typeInt = constPredefRes "Int"
+typeFloat = constPredefRes "Float"
typeInts i = App (constPredefRes "Ints") (EInt i)
isTypeInts :: Term -> Bool
@@ -501,6 +502,7 @@ term2patt trm = case termForm trm of
aa' <- mapM term2patt aa
return (PR (zip ll aa'))
Ok ([],EInt i,[]) -> return $ PInt i
+ Ok ([],EFloat i,[]) -> return $ PFloat i
Ok ([],K s, []) -> return $ PString s
_ -> prtBad "no pattern corresponds to term" trm
@@ -513,6 +515,7 @@ patt2term pt = case pt of
PR r -> R [assign l (patt2term p) | (l,p) <- r]
PT _ p -> patt2term p
PInt i -> EInt i
+ PFloat i -> EFloat i
PString s -> K s
redirectTerm :: Ident -> Term -> Term