1
0
forked from GitHub/gf-core

the construct lin C t now replaces lock fields (in source code; still tempor used internally); lock fields removed from english resource as an example

This commit is contained in:
aarne
2009-06-20 13:50:34 +00:00
parent ddd6902e7d
commit c8027c8a4c
10 changed files with 318 additions and 314 deletions

View File

@@ -148,6 +148,8 @@ instance Binary Term where
put (FV x) = putWord8 35 >> put x
put (Alts x) = putWord8 36 >> put x
put (Strs x) = putWord8 37 >> put x
put (ELin x y) = putWord8 38 >> put (x,y)
get = do tag <- getWord8
case tag of
0 -> get >>= \x -> return (Vr x)
@@ -186,6 +188,7 @@ instance Binary Term where
35 -> get >>= \x -> return (FV x)
36 -> get >>= \x -> return (Alts x)
37 -> get >>= \x -> return (Strs x)
38 -> get >>= \(x,y) -> return (ELin x y)
_ -> decodingError
instance Binary Patt where

View File

@@ -147,6 +147,9 @@ data Term =
| EPatt Patt -- ^ pattern (in macro definition): # p
| EPattType Term -- ^ pattern type: pattern T
| ELincat Ident Term -- ^ boxed linearization type of Ident
| ELin Ident Term -- ^ boxed linearization of type Ident
| FV [Term] -- ^ alternatives in free variation: @variants { s ; ... }@
| Alts (Term, [(Term, Term)]) -- ^ alternatives by prefix: @pre {t ; s\/c ; ...}@

View File

@@ -36,8 +36,10 @@ lockRecType c t = plusRecType t $ RecType [(lockLabel c, RecType [])]
unlockRecord :: Ident -> Term -> Err Term
unlockRecord c ft = do
let (xs,t) = termFormCnc ft
t' <- plusRecord t $ R [(lockLabel c, (Just (RecType []),R []))]
return $ mkAbs xs t'
let lock = R [(lockLabel c, (Just (RecType []),R []))]
case plusRecord t lock of
Ok t' -> return $ mkAbs xs t'
_ -> return $ mkAbs xs (ExtR t lock)
lockLabel :: Ident -> Label
lockLabel c = LIdent $! BS.append lockPrefix (ident2bs c)

View File

@@ -634,6 +634,14 @@ composOp co trm =
do ty' <- co ty
return (EPattType ty')
ELincat c ty ->
do ty' <- co ty
return (ELincat c ty')
ELin c ty ->
do ty' <- co ty
return (ELin c ty')
_ -> return trm -- covers K, Vr, Cn, Sort, EPatt
getTableType :: TInfo -> Err Type

File diff suppressed because one or more lines are too long

View File

@@ -423,6 +423,8 @@ Exp4
| 'strs' '{' ListExp '}' { Strs $3 }
| '#' Patt2 { EPatt $2 }
| 'pattern' Exp5 { EPattType $2 }
| 'lincat' Ident Exp5 { ELincat $2 $3 }
| 'lin' Ident Exp5 { ELin $2 $3 }
| Exp5 { $1 }
Exp5 :: { Term }