mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Assign ChannelTypeDeclarations
This commit is contained in:
parent
f3895a1a68
commit
c0b68de47e
@ -46,6 +46,9 @@ type Syntax =
|
|||||||
, Syntax.Program
|
, Syntax.Program
|
||||||
, Type.Annotation
|
, Type.Annotation
|
||||||
, Type.Array
|
, Type.Array
|
||||||
|
, Type.BiDirectionalChannel
|
||||||
|
, Type.ReceiveChannel
|
||||||
|
, Type.SendChannel
|
||||||
, []
|
, []
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -159,9 +162,12 @@ arrayType = handleError $ makeTerm <$> symbol ArrayType <*> children (Type.Array
|
|||||||
-- Type Declarations
|
-- Type Declarations
|
||||||
|
|
||||||
channelTypeDeclaration :: Assignment
|
channelTypeDeclaration :: Assignment
|
||||||
channelTypeDeclaration = mkChannel <$> symbol TypeSpec <*> children ((,) <$> typeLiteral <*> channelType)
|
channelTypeDeclaration = symbol TypeSpec >>= mkChannelTypeDeclaration
|
||||||
where
|
where
|
||||||
mkChannel loc (name, channel) = makeTerm loc $ Type.Annotation channel name
|
mkChannelTypeDeclaration loc = children (typeIdentifier >>= mkChannelType loc)
|
||||||
|
mkChannelType loc channelName = symbol ChannelType *> children ( (token AnonChan *> token AnonLAngleMinus *> (makeTerm loc <$> (Type.SendChannel channelName <$> typeIdentifier)))
|
||||||
|
<|> (token AnonLAngleMinus *> token AnonChan *> (makeTerm loc <$> (Type.ReceiveChannel channelName <$> typeIdentifier)))
|
||||||
|
<|> (token AnonChan *> (makeTerm loc <$> (Type.BiDirectionalChannel channelName <$> typeIdentifier))))
|
||||||
|
|
||||||
interfaceTypeDeclaration :: Assignment
|
interfaceTypeDeclaration :: Assignment
|
||||||
interfaceTypeDeclaration = mkInterface <$> symbol TypeSpec <*> children ((,) <$> typeLiteral <*> interfaceType)
|
interfaceTypeDeclaration = mkInterface <$> symbol TypeSpec <*> children ((,) <$> typeLiteral <*> interfaceType)
|
||||||
|
Loading…
Reference in New Issue
Block a user