From bc8e1ff1ec1d6279f04c86609178a3365b1cf3b8 Mon Sep 17 00:00:00 2001 From: joshvera Date: Fri, 20 Jul 2018 15:46:33 -0400 Subject: [PATCH] Add annotatedType and add back catchType to catchFormalParameter Co-Authored-By: Ayman Nadeem --- src/Language/Java/Assignment.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Language/Java/Assignment.hs b/src/Language/Java/Assignment.hs index 4977afff2..d07742553 100644 --- a/src/Language/Java/Assignment.hs +++ b/src/Language/Java/Assignment.hs @@ -66,12 +66,14 @@ type Syntax = , Expression.Member , Expression.Super , Expression.This + , Java.Syntax.AnnotatedType , Java.Syntax.Annotation , Java.Syntax.AnnotationField , Java.Syntax.AnnotationTypeElement , Java.Syntax.ArrayCreationExpression , Java.Syntax.AssertStatement , Java.Syntax.Asterisk + , Java.Syntax.CatchType , Java.Syntax.Constructor , Java.Syntax.ClassBody , Java.Syntax.ClassLiteral @@ -408,9 +410,13 @@ type' = choice [ , typeIdentifier , generic , typeArgument + , annotatedType ] where array = foldl (\into each -> makeTerm1 (Type.Array (Just each) into)) +annotatedType :: Assignment Term +annotatedType = makeTerm <$> symbol AnnotatedType <*> children (Java.Syntax.AnnotatedType <$> many annotation <*> type') + typeArgument :: Assignment Term typeArgument = symbol TypeArgument *> children (term type') @@ -454,7 +460,10 @@ catches :: Assignment [Term] catches = symbol Catches *> children (manyTerm catch) where catch = makeTerm <$> symbol CatchClause <*> children (Statement.Catch <$> catchFormalParameter <*> term expression) - catchFormalParameter = makeTerm <$> symbol CatchFormalParameter <*> children (flip Type.Annotation <$> type' <* symbol VariableDeclaratorId <*> children identifier) + catchFormalParameter = makeTerm <$> symbol CatchFormalParameter <*> children (flip Type.Annotation <$> catchType <* symbol VariableDeclaratorId <*> children identifier) + +catchType :: Assignment Term +catchType = makeTerm <$> symbol CatchType <*> (Java.Syntax.CatchType <$> many type') finally :: Assignment Term finally = makeTerm <$> symbol Finally <*> children (Statement.Finally <$> term expression)