mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Add interfaces
This commit is contained in:
parent
feb934a678
commit
f3e9c18026
@ -99,6 +99,8 @@ type Syntax = '[
|
||||
, Declaration.Method
|
||||
, Syntax.PropertyModifier
|
||||
, Syntax.PropertyDeclaration
|
||||
, Syntax.InterfaceBaseClause
|
||||
, Syntax.InterfaceDeclaration
|
||||
, [] ]
|
||||
|
||||
type Term = Term.Term (Data.Union.Union Syntax) (Record Location)
|
||||
@ -136,7 +138,7 @@ statement = handleError everything
|
||||
-- , constDeclaration
|
||||
-- , functionDefinition
|
||||
-- , classDeclaration
|
||||
-- , interfaceDeclaration
|
||||
, interfaceDeclaration
|
||||
, traitDeclaration
|
||||
, namespaceDefinition
|
||||
, namespaceUseDeclaration
|
||||
@ -456,6 +458,15 @@ castExpression = makeTerm <$> symbol CastExpression <*> children (flip Expressio
|
||||
castType :: Assignment
|
||||
castType = makeTerm <$> symbol CastType <*> (Syntax.CastType <$> source)
|
||||
|
||||
interfaceDeclaration :: Assignment
|
||||
interfaceDeclaration = makeTerm <$> symbol InterfaceDeclaration <*> children (Syntax.InterfaceDeclaration <$> name <*> (interfaceBaseClause <|> emptyTerm) <*> manyTerm interfaceMemberDeclaration)
|
||||
|
||||
interfaceBaseClause :: Assignment
|
||||
interfaceBaseClause = makeTerm <$> symbol InterfaceBaseClause <*> children (Syntax.InterfaceBaseClause <$> someTerm qualifiedName)
|
||||
|
||||
interfaceMemberDeclaration :: Assignment
|
||||
interfaceMemberDeclaration = classConstDeclaration <|> methodDeclaration
|
||||
|
||||
traitDeclaration :: Assignment
|
||||
traitDeclaration = makeTerm <$> symbol TraitDeclaration <*> children (Syntax.TraitDeclaration <$> name <*> manyTerm traitMemberDeclaration)
|
||||
|
||||
|
@ -347,3 +347,17 @@ data PropertyModifier a = PropertyModifier a a
|
||||
instance Eq1 PropertyModifier where liftEq = genericLiftEq
|
||||
instance Ord1 PropertyModifier where liftCompare = genericLiftCompare
|
||||
instance Show1 PropertyModifier where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data InterfaceDeclaration a = InterfaceDeclaration a a [a]
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 InterfaceDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 InterfaceDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 InterfaceDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype InterfaceBaseClause a = InterfaceBaseClause [a]
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 InterfaceBaseClause where liftEq = genericLiftEq
|
||||
instance Ord1 InterfaceBaseClause where liftCompare = genericLiftCompare
|
||||
instance Show1 InterfaceBaseClause where liftShowsPrec = genericLiftShowsPrec
|
||||
|
Loading…
Reference in New Issue
Block a user