1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

Add class declarations

This commit is contained in:
joshvera 2018-01-10 19:15:51 -05:00
parent f3e9c18026
commit 27d5c6e8a9

View File

@ -137,7 +137,7 @@ statement = handleError everything
-- , echoStatement
-- , constDeclaration
-- , functionDefinition
-- , classDeclaration
, classDeclaration
, interfaceDeclaration
, traitDeclaration
, namespaceDefinition
@ -458,6 +458,11 @@ castExpression = makeTerm <$> symbol CastExpression <*> children (flip Expressio
castType :: Assignment
castType = makeTerm <$> symbol CastType <*> (Syntax.CastType <$> source)
classDeclaration :: Assignment
classDeclaration = makeTerm <$> symbol ClassDeclaration <*> children (makeClass <$> (classModifier <|> emptyTerm) <*> name <*> (classBaseClause <|> emptyTerm) <*> (classInterfaceClause <|> emptyTerm) <*> (makeTerm <$> location <*> manyTerm classMemberDeclaration))
where
makeClass modifier name baseClause interfaceClause declarations = Declaration.Class [modifier] name [baseClause, interfaceClause] declarations
interfaceDeclaration :: Assignment
interfaceDeclaration = makeTerm <$> symbol InterfaceDeclaration <*> children (Syntax.InterfaceDeclaration <$> name <*> (interfaceBaseClause <|> emptyTerm) <*> manyTerm interfaceMemberDeclaration)