diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2006-06-06 21:30:14 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2006-06-06 21:30:14 +0000 |
| commit | f09e929dd1e46c066a566a5e0c6437ecaf3002a1 (patch) | |
| tree | e703f7835de306a59ca495526bfc78edc7372026 /src/GF/Conversion | |
| parent | 283379b57fc650719f519368cb75cfdc3829598e (diff) | |
initial support for literal categories e.g. String,Int and Float
Diffstat (limited to 'src/GF/Conversion')
| -rw-r--r-- | src/GF/Conversion/SimpleToFCFG.hs | 9 | ||||
| -rw-r--r-- | src/GF/Conversion/Types.hs | 9 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/GF/Conversion/SimpleToFCFG.hs b/src/GF/Conversion/SimpleToFCFG.hs index 7570f2d65..b1093e9f2 100644 --- a/src/GF/Conversion/SimpleToFCFG.hs +++ b/src/GF/Conversion/SimpleToFCFG.hs @@ -244,7 +244,14 @@ type SRulesMap = Map.Map SCat [SRule] type FCatSet = Map.Map SCat (Map.Map [SPath] (Map.Map [(SPath,STerm)] (Either FCat FCat))) -emptyFRulesEnv = FRulesEnv 0 Map.empty [] +emptyFRulesEnv = FRulesEnv 0 (ins fcatString (ins fcatInt (ins fcatFloat Map.empty))) [] + where + ins fcat@(FCat _ cat rcs tcs) fcatSet = + Map.insertWith (\_ -> Map.insertWith (\_ -> Map.insert tcs x_fcat) rcs tmap_s) cat rmap_s fcatSet + where + x_fcat = Right fcat + tmap_s = Map.singleton tcs x_fcat + rmap_s = Map.singleton rcs tmap_s genFCatHead :: FRulesEnv -> FCat -> (FRulesEnv, FCat) genFCatHead env@(FRulesEnv last_id fcatSet rules) m1@(FCat _ cat rcs tcs) = diff --git a/src/GF/Conversion/Types.hs b/src/GF/Conversion/Types.hs index ef2097acf..ab0b6a6e8 100644 --- a/src/GF/Conversion/Types.hs +++ b/src/GF/Conversion/Types.hs @@ -14,9 +14,10 @@ module GF.Conversion.Types where -import qualified GF.Infra.Ident as Ident (Ident, wildIdent, isWildIdent) -import qualified GF.Canon.AbsGFC as AbsGFC (CIdent(..)) +import qualified GF.Infra.Ident as Ident (Ident(..), wildIdent, isWildIdent) +import qualified GF.Canon.AbsGFC as AbsGFC (CIdent(..), Label(..)) import qualified GF.Grammar.Grammar as Grammar (Term) +import qualified GF.Grammar.Values as Values (cString, cInt, cFloat) import GF.Formalism.GCFG import GF.Formalism.SimpleGFC @@ -116,6 +117,10 @@ data FCat = FCat {-# UNPACK #-} !Int SCat [SPath] [(SPath,STerm)] initialFCat :: SCat -> FCat initialFCat cat = FCat 0 cat [] [] +fcatString = FCat (-1) Values.cString [Path [Left (AbsGFC.L (Ident.IC "s"))]] [] +fcatInt = FCat (-2) Values.cInt [Path [Left (AbsGFC.L (Ident.IC "s"))]] [] +fcatFloat = FCat (-3) Values.cFloat [Path [Left (AbsGFC.L (Ident.IC "s"))]] [] + fcat2scat :: FCat -> SCat fcat2scat (FCat _ c _ _) = c |
