From dea5158cbf1c11d45f2ed91d9975fbc77245e652 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 2 Dec 2005 13:13:14 +0000 Subject: floats in GF and GFC (parsing user input still doesn't work) --- src/GF/Grammar/Macros.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/GF/Grammar/Macros.hs') 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 -- cgit v1.2.3