summaryrefslogtreecommitdiff
path: root/src/GF/Source/SourceToGrammar.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-11-18 16:54:23 +0000
committeraarne <aarne@cs.chalmers.se>2006-11-18 16:54:23 +0000
commit8e07d61ccfe67fb72253d3ce622f8eff7342a427 (patch)
tree6f43e607cf865d59df3e3744c6e1455f5cebcbab /src/GF/Source/SourceToGrammar.hs
parent6cee6f0591004e6b4fd1156a71976d820a6875c7 (diff)
overload syntax; type printing in CheckGrammar
Diffstat (limited to 'src/GF/Source/SourceToGrammar.hs')
-rw-r--r--src/GF/Source/SourceToGrammar.hs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/GF/Source/SourceToGrammar.hs b/src/GF/Source/SourceToGrammar.hs
index 49023bf09..7e525a4b9 100644
--- a/src/GF/Source/SourceToGrammar.hs
+++ b/src/GF/Source/SourceToGrammar.hs
@@ -299,7 +299,7 @@ transResDef x = case x of
(p,pars) <- pardefs', (f,co) <- pars]
DefOper defs -> do
defs' <- liftM concat $ mapM getDefs defs
- returnl [mkOverload (f, G.ResOper pt pe) | (f,(pt,pe)) <- defs']
+ returnl $ concatMap mkOverload [(f, G.ResOper pt pe) | (f,(pt,pe)) <- defs']
DefLintype defs -> do
defs' <- liftM concat $ mapM getDefs defs
@@ -309,10 +309,17 @@ transResDef x = case x of
_ -> Bad $ "illegal definition form in resource" +++ printTree x
where
mkOverload (c,j) = case j of
- G.ResOper Nope (Yes (G.R fs@(_:_:_))) | isOverloading c fs ->
- (c,G.ResOverload [(ty,fu) | (_,(Just ty,fu)) <- fs])
- _ -> (c,j)
- isOverloading c fs = all (== GP.prt c) (map (GP.prt . fst) fs)
+ G.ResOper _ (Yes (G.App keyw (G.R fs@(_:_:_)))) |
+ isOverloading keyw c fs ->
+ [(c,G.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 -> []
+ _ -> [(c,j)]
+ isOverloading keyw c fs =
+ GP.prt keyw == "overload" && -- overload is a "soft keyword"
+ all (== GP.prt c) (map (GP.prt . fst) fs)
transParDef :: ParDef -> Err (Ident, [G.Param])
transParDef x = case x of