mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
rename Decl in GF.Grammar.Grammar to Hypo to match the convention in PGF
This commit is contained in:
@@ -30,7 +30,7 @@ module GF.Grammar.Grammar (SourceGrammar,
|
|||||||
TInfo(..),
|
TInfo(..),
|
||||||
Label(..),
|
Label(..),
|
||||||
MetaSymb(..),
|
MetaSymb(..),
|
||||||
Decl,
|
Hypo,
|
||||||
Context,
|
Context,
|
||||||
Equation,
|
Equation,
|
||||||
Labelling,
|
Labelling,
|
||||||
@@ -200,8 +200,8 @@ data Label =
|
|||||||
|
|
||||||
newtype MetaSymb = MetaSymb Int deriving (Read, Show, Eq, Ord)
|
newtype MetaSymb = MetaSymb Int deriving (Read, Show, Eq, Ord)
|
||||||
|
|
||||||
type Decl = (Ident,Term) -- (x:A) (_:A) A
|
type Hypo = (Ident,Term) -- (x:A) (_:A) A
|
||||||
type Context = [Decl] -- (x:A)(y:B) (x,y:A) (_,_:A)
|
type Context = [Hypo] -- (x:A)(y:B) (x,y:A) (_,_:A)
|
||||||
type Equation = ([Patt],Term)
|
type Equation = ([Patt],Term)
|
||||||
|
|
||||||
type Labelling = (Label, Term)
|
type Labelling = (Label, Term)
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ mkCTable :: [Ident] -> Term -> Term
|
|||||||
mkCTable ids v = foldr ccase v ids where
|
mkCTable ids v = foldr ccase v ids where
|
||||||
ccase x t = T TRaw [(PV x,t)]
|
ccase x t = T TRaw [(PV x,t)]
|
||||||
|
|
||||||
mkDecl :: Term -> Decl
|
mkHypo :: Term -> Hypo
|
||||||
mkDecl typ = (identW, typ)
|
mkHypo typ = (identW, typ)
|
||||||
|
|
||||||
eqStrIdent :: Ident -> Ident -> Bool
|
eqStrIdent :: Ident -> Ident -> Bool
|
||||||
eqStrIdent = (==)
|
eqStrIdent = (==)
|
||||||
|
|||||||
@@ -540,10 +540,10 @@ ListBind
|
|||||||
: Bind { [$1] }
|
: Bind { [$1] }
|
||||||
| Bind ',' ListBind { $1 : $3 }
|
| Bind ',' ListBind { $1 : $3 }
|
||||||
|
|
||||||
Decl :: { [Decl] }
|
Decl :: { [Hypo] }
|
||||||
Decl
|
Decl
|
||||||
: '(' ListBind ':' Exp ')' { [(x,$4) | x <- $2] }
|
: '(' ListBind ':' Exp ')' { [(x,$4) | x <- $2] }
|
||||||
| Exp4 { [mkDecl $1] }
|
| Exp4 { [mkHypo $1] }
|
||||||
|
|
||||||
ListTupleComp :: { [Term] }
|
ListTupleComp :: { [Term] }
|
||||||
ListTupleComp
|
ListTupleComp
|
||||||
@@ -575,12 +575,12 @@ ListAltern
|
|||||||
: Altern { [$1] }
|
: Altern { [$1] }
|
||||||
| Altern ';' ListAltern { $1 : $3 }
|
| Altern ';' ListAltern { $1 : $3 }
|
||||||
|
|
||||||
DDecl :: { [Decl] }
|
DDecl :: { [Hypo] }
|
||||||
DDecl
|
DDecl
|
||||||
: '(' ListBind ':' Exp ')' { [(x,$4) | x <- $2] }
|
: '(' ListBind ':' Exp ')' { [(x,$4) | x <- $2] }
|
||||||
| Exp6 { [mkDecl $1] }
|
| Exp6 { [mkHypo $1] }
|
||||||
|
|
||||||
ListDDecl :: { [Decl] }
|
ListDDecl :: { [Hypo] }
|
||||||
ListDDecl
|
ListDDecl
|
||||||
: {- empty -} { [] }
|
: {- empty -} { [] }
|
||||||
| DDecl ListDDecl { $1 ++ $2 }
|
| DDecl ListDDecl { $1 ++ $2 }
|
||||||
@@ -615,11 +615,11 @@ listCatDef id pos cont size = [catd,nilfund,consfund]
|
|||||||
|
|
||||||
cont' = [(mkId x i,ty) | (i,(x,ty)) <- zip [0..] cont]
|
cont' = [(mkId x i,ty) | (i,(x,ty)) <- zip [0..] cont]
|
||||||
xs = map (Vr . fst) cont'
|
xs = map (Vr . fst) cont'
|
||||||
cd = mkDecl (mkApp (Vr id) xs)
|
cd = mkHypo (mkApp (Vr id) xs)
|
||||||
lc = mkApp (Vr listId) xs
|
lc = mkApp (Vr listId) xs
|
||||||
|
|
||||||
niltyp = mkProdSimple (cont' ++ replicate size cd) lc
|
niltyp = mkProdSimple (cont' ++ replicate size cd) lc
|
||||||
constyp = mkProdSimple (cont' ++ [cd, mkDecl lc]) lc
|
constyp = mkProdSimple (cont' ++ [cd, mkHypo lc]) lc
|
||||||
|
|
||||||
mkId x i = if isWildIdent x then (varX i) else x
|
mkId x i = if isWildIdent x then (varX i) else x
|
||||||
|
|
||||||
|
|||||||
@@ -55,17 +55,17 @@ checkCond s b = if b then return () else checkError s
|
|||||||
checkWarn :: Message -> Check ()
|
checkWarn :: Message -> Check ()
|
||||||
checkWarn msg = Check (\ctxt msgs -> Success () ctxt ((text "Warning:" <+> msg) : msgs))
|
checkWarn msg = Check (\ctxt msgs -> Success () ctxt ((text "Warning:" <+> msg) : msgs))
|
||||||
|
|
||||||
checkUpdate :: Decl -> Check ()
|
checkUpdate :: Hypo -> Check ()
|
||||||
checkUpdate d = Check (\ctxt msgs -> Success () (d:ctxt) msgs)
|
checkUpdate d = Check (\ctxt msgs -> Success () (d:ctxt) msgs)
|
||||||
|
|
||||||
checkInContext :: [Decl] -> Check r -> Check r
|
checkInContext :: [Hypo] -> Check r -> Check r
|
||||||
checkInContext g ch = do
|
checkInContext g ch = do
|
||||||
i <- checkUpdates g
|
i <- checkUpdates g
|
||||||
r <- ch
|
r <- ch
|
||||||
checkResets i
|
checkResets i
|
||||||
return r
|
return r
|
||||||
|
|
||||||
checkUpdates :: [Decl] -> Check Int
|
checkUpdates :: [Hypo] -> Check Int
|
||||||
checkUpdates ds = mapM checkUpdate ds >> return (length ds)
|
checkUpdates ds = mapM checkUpdate ds >> return (length ds)
|
||||||
|
|
||||||
checkReset :: Check ()
|
checkReset :: Check ()
|
||||||
|
|||||||
Reference in New Issue
Block a user