1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 02:14:20 +03:00

Update Java assignment

This commit is contained in:
Rick Winfrey 2018-12-17 17:52:03 -08:00
parent 3193481ea8
commit 0e34b035c6

View File

@ -42,6 +42,7 @@ import Proto3.Suite (Named (..), Named1 (..))
type Syntax = type Syntax =
'[ Comment.Comment '[ Comment.Comment
, Declaration.Accessibility
, Declaration.Class , Declaration.Class
, Declaration.InterfaceDeclaration , Declaration.InterfaceDeclaration
, Declaration.Method , Declaration.Method
@ -334,12 +335,13 @@ fieldDeclaration :: Assignment Term
fieldDeclaration = makeTerm <$> symbol FieldDeclaration <*> children ((,) <$> manyTerm modifier <*> type' <**> variableDeclaratorList) fieldDeclaration = makeTerm <$> symbol FieldDeclaration <*> children ((,) <$> manyTerm modifier <*> type' <**> variableDeclaratorList)
method :: Assignment Term method :: Assignment Term
method = makeTerm <$> symbol MethodDeclaration <*> children (makeMethod <$> many modifier <*> emptyTerm <*> methodHeader <*> methodBody) method = makeTerm <$> symbol MethodDeclaration <*> children (makeMethod <$> many modifier <*> emptyTerm <*> accessibility <*> methodHeader <*> methodBody)
where where
methodBody = symbol MethodBody *> children (term expression <|> emptyTerm) methodBody = symbol MethodBody *> children (term expression <|> emptyTerm)
methodDeclarator = symbol MethodDeclarator *> children ( (,) <$> identifier <*> formalParameters) methodDeclarator = symbol MethodDeclarator *> children ( (,) <$> identifier <*> formalParameters)
accessibility = makeTerm <$> location <*> pure Declaration.Unknown
methodHeader = symbol MethodHeader *> children ((,,,,) <$> (typeParameters <|> pure []) <*> manyTerm annotation <*> type' <*> methodDeclarator <*> (throws <|> pure [])) methodHeader = symbol MethodHeader *> children ((,,,,) <$> (typeParameters <|> pure []) <*> manyTerm annotation <*> type' <*> methodDeclarator <*> (throws <|> pure []))
makeMethod modifiers receiver (typeParams, annotations, returnType, (name, params), throws) = Declaration.Method (returnType : modifiers <> typeParams <> annotations <> throws) receiver name params makeMethod modifiers receiver accessibility (typeParams, annotations, returnType, (name, params), throws) = Declaration.Method (returnType : modifiers <> typeParams <> annotations <> throws) receiver accessibility name params
generic :: Assignment Term generic :: Assignment Term
generic = makeTerm <$> symbol Grammar.GenericType <*> children(Java.Syntax.GenericType <$> term type' <*> manyTerm type') generic = makeTerm <$> symbol Grammar.GenericType <*> children(Java.Syntax.GenericType <$> term type' <*> manyTerm type')