diff options
| author | aarne <aarne@cs.chalmers.se> | 2007-12-04 11:07:39 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2007-12-04 11:07:39 +0000 |
| commit | 7051331c20d5a9f1eaf5f9f25bca2891f9277370 (patch) | |
| tree | 71e165f6a6e6a12278a7832a1a536d2846347f04 /src/GF/Devel/Grammar/SourceToGF.hs | |
| parent | a7b68870508b90ab1a9e635489ff4e687713d166 (diff) | |
test for new GF source format
Diffstat (limited to 'src/GF/Devel/Grammar/SourceToGF.hs')
| -rw-r--r-- | src/GF/Devel/Grammar/SourceToGF.hs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/GF/Devel/Grammar/SourceToGF.hs b/src/GF/Devel/Grammar/SourceToGF.hs index d40026851..cefc1192c 100644 --- a/src/GF/Devel/Grammar/SourceToGF.hs +++ b/src/GF/Devel/Grammar/SourceToGF.hs @@ -248,13 +248,7 @@ transResDef :: TopDef -> Err (Either [(Ident,Judgement)] [(Ident,String)]) transResDef x = case x of DefPar pardefs -> do pardefs' <- mapM transParDef pardefs - returnl $ [] - ---- [(p, resParam (if null pars - ---- then nope -- abstract param type - ---- else (yes (pars,Nothing)))) - ---- | (p,pars) <- pardefs'] - ---- ++ [(f, G.ResValue (yes (M.mkProd co (G.Con p),Nothing))) | - ---- (p,pars) <- pardefs', (f,co) <- pars] + returnl $ concatMap mkParamDefs pardefs' DefOper defs -> do defs' <- liftM concat $ mapM getDefs defs @@ -267,19 +261,21 @@ transResDef x = case x of DefFlag defs -> liftM (Right . concat) $ mapM transFlagDef defs _ -> Bad $ "illegal definition form in resource" +++ printTree x where - mkOverload (c,j) = case j of -{- ---- - G.ResOper _ (Yes (G.App keyw (G.R fs@(_:_:_)))) | - isOverloading keyw c fs -> - [(c,G.ResOverload [(ty,fu) | (_,(Just ty,fu)) <- fs])] + + mkParamDefs (p,pars) = + if null pars + then [(p,addJType M.meta0 (emptyJudgement JParam))] -- in an interface + else (p,resParam pars) : paramConstructors p pars + + mkOverload (c,j) = case (jtype j, jdef j) of + (_,G.App keyw (G.R fs@(_:_:_))) | isOverloading keyw c fs -> + [(c,resOverload [(ty,fu) | (_,(Just ty,fu)) <- fs])] -- to enable separare type signature --- not type-checked - G.ResOper (Yes (G.App keyw (G.RecType fs@(_:_:_)))) _ | - isOverloading keyw c fs -> [] --} + (G.App keyw (G.RecType fs@(_:_:_)),_) | isOverloading keyw c fs -> [] _ -> [(c,j)] - isOverloading keyw c fs = - printTree keyw == "overload" && -- overload is a "soft keyword" + isOverloading (G.Vr keyw) c fs = + prIdent keyw == "overload" && -- overload is a "soft keyword" False ---- all (== GP.prt c) (map (GP.prt . fst) fs) transParDef :: ParDef -> Err (Ident, [(Ident,G.Context)]) |
