Class Type Parameter Parsing, wtf

This commit is contained in:
vegowotenks 2024-11-16 13:11:08 +01:00
commit 49e06c175f
20 changed files with 1158 additions and 0 deletions

33
src/ClassTypeParameter.hs Normal file
View file

@ -0,0 +1,33 @@
module ClassTypeParameter (module ClassTypeParameter) where
import PrimitiveTypes
import Numeric.Natural (Natural)
-- TODO: Annotations
data ClassTypeParameter = ClassTypeParameter { name :: String
, extends :: Maybe TypeBound
, implements :: [ClassType]
}
deriving Show
data TypeBound = SimpleTypeBound String | ClassTypeBound ClassType [ClassType]
deriving Show
data ClassType = RecursiveTypeBound ClassType String [TypeArgument] | NonRecursiveTypeBound String [TypeArgument]
deriving Show
data TypeArgument = ReferenceTypeArgument ReferenceType | WildCardTypeArgument WildCard
deriving Show
data WildCard = WildCard (Maybe WildCardBound)
deriving Show
data WildCardBound = SuperWildCardBound ReferenceType | ExtendsWildCardBound ReferenceType
deriving Show
data ReferenceType = ClassReferenceType ClassType | VariableReferenceType String | ArrayReferenceType ArrayType
deriving Show
data ArrayType = PrimitiveArrayType PrimitiveType Natural | ClassArrayType ClassType Natural | VariableArrayType String Natural
deriving Show