From 9cb3a059c0623f1e90d34eb3893c0b75261fc024 Mon Sep 17 00:00:00 2001 From: Ayman Nadeem Date: Thu, 19 Jul 2018 16:56:03 -0400 Subject: [PATCH] assert statement modification --- src/Language/Java/Assignment.hs | 4 ++-- src/Language/Java/Syntax.hs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Language/Java/Assignment.hs b/src/Language/Java/Assignment.hs index 1ee21554e..fc93c2f62 100644 --- a/src/Language/Java/Assignment.hs +++ b/src/Language/Java/Assignment.hs @@ -357,7 +357,7 @@ interface = makeTerm <$> symbol InterfaceDeclaration <*> children (normal <|> an interfaceBody = makeTerm <$> symbol InterfaceBody <*> children (manyTerm interfaceMemberDeclaration) normal = symbol NormalInterfaceDeclaration *> children (makeInterface <$> manyTerm modifier <*> identifier <*> (typeParameters <|> pure []) <*> (extends <|> pure []) <*> interfaceBody) makeInterface modifiers identifier typeParams = Declaration.InterfaceDeclaration (modifiers ++ typeParams) identifier - annotationType = symbol AnnotationTypeDeclaration *> children (Declaration.InterfaceDeclaration [] <$> identifier <*> pure [] <*> annotationTypeBody) + annotationType = symbol AnnotationTypeDeclaration *> children (Declaration.InterfaceDeclaration [] <$> AnonAt *> identifier <*> pure [] <*> annotationTypeBody) annotationTypeBody = makeTerm <$> symbol AnnotationTypeBody <*> children (many expression) interfaceMemberDeclaration = symbol InterfaceMemberDeclaration *> children (term expression) extends = symbol ExtendsInterfaces *> children (symbol InterfaceTypeList *> children (manyTerm type')) @@ -476,7 +476,7 @@ enhancedFor = makeTerm <$> symbol EnhancedForStatement <*> children (Statement.F where variable modifiers type' variableDeclaratorId = makeTerm1 (Java.Syntax.Variable modifiers type' variableDeclaratorId) assert :: Assignment Term -assert = makeTerm <$> symbol Grammar.AssertStatement <*> children (Java.Syntax.AssertStatement <$> term expression <*> term expression) +assert = makeTerm <$> symbol Grammar.AssertStatement <*> children (Java.Syntax.AssertStatement <$> term expression <*> optional (term expression)) -- TODO: instanceOf binary :: Assignment Term diff --git a/src/Language/Java/Syntax.hs b/src/Language/Java/Syntax.hs index 87031a608..1d17d0edf 100644 --- a/src/Language/Java/Syntax.hs +++ b/src/Language/Java/Syntax.hs @@ -273,7 +273,7 @@ instance Show1 TryWithResources where liftShowsPrec = genericLiftShowsPrec -- TODO: Implement Eval instance for TryWithResources instance Evaluatable TryWithResources -data AssertStatement a = AssertStatement { assertLHS :: !a, assertRHS :: !a } +data AssertStatement a = AssertStatement { assertLHS :: !a, assertRHS :: !(Maybe a) } deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) instance Eq1 AssertStatement where liftEq = genericLiftEq