From 580efad636b1c73a0cd64c80435c75edac4bd179 Mon Sep 17 00:00:00 2001 From: Ayman Nadeem Date: Fri, 20 Jul 2018 12:45:36 -0400 Subject: [PATCH] stubbing in annotationType stuff --- src/Language/Java/Assignment.hs | 2 +- src/Language/Java/Syntax.hs | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Language/Java/Assignment.hs b/src/Language/Java/Assignment.hs index fbe2537ea..43d166bd0 100644 --- a/src/Language/Java/Assignment.hs +++ b/src/Language/Java/Assignment.hs @@ -285,7 +285,7 @@ char = makeTerm <$> symbol CharacterLiteral <*> (Literal.TextElement <$> source) -- Identifiers identifier :: Assignment Term -identifier = makeTerm <$> (symbol Identifier <|> symbol TypeIdentifier) <*> (Syntax.Identifier . name <$> source) +identifier = makeTerm <$> (symbol Identifier) <*> (Syntax.Identifier . name <$> source) typeIdentifier :: Assignment Term typeIdentifier = makeTerm <$> (symbol Identifier) <*> (Syntax.Identifier . name <$> source) diff --git a/src/Language/Java/Syntax.hs b/src/Language/Java/Syntax.hs index e6d2c35d6..90291a02b 100644 --- a/src/Language/Java/Syntax.hs +++ b/src/Language/Java/Syntax.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveAnyClass, DuplicateRecordFields #-} {-# OPTIONS_GHC -Wno-missing-export-lists #-} module Language.Java.Syntax where @@ -283,3 +283,22 @@ instance Show1 AssertStatement where liftShowsPrec = genericLiftShowsPrec -- TODO: Implement Eval instance for AssertStatement instance Evaluatable AssertStatement + +newtype DefaultValue a = DefaultValue { defaultValueElement :: a } + deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) + +instance Eq1 DefaultValue where liftEq = genericLiftEq +instance Ord1 DefaultValue where liftCompare = genericLiftCompare +instance Show1 DefaultValue where liftShowsPrec = genericLiftShowsPrec + +instance Evaluatable DefaultValue + +data AnnotationTypeElement a = AnnotationTypeElement { modifiers :: ![a], identifier :: !a, dims :: ![a], defaultValue :: !a } + deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) + +instance Eq1 AnnotationTypeElement where liftEq = genericLiftEq +instance Ord1 AnnotationTypeElement where liftCompare = genericLiftCompare +instance Show1 AnnotationTypeElement where liftShowsPrec = genericLiftShowsPrec + +-- TODO: Implement Eval instance for AnnotationTypeElement +instance Evaluatable AnnotationTypeElement