module Language.WebIDL.AST where
import Prelude hiding (Enum)
data Definition a = DefInterface (Interface a)
| DefPartial (Partial a)
| DefDictionary (Dictionary a)
| DefEnum (Enum a)
| DefTypedef (Typedef a)
| DefCallback (Callback a)
| DefImplementsStatement (ImplementsStatement a)
deriving (Show, Eq, Functor)
data ExtendedAttribute a = ExtendedAttributeNoArgs a Ident
| ExtendedAttributeArgList a Ident [Argument a]
| ExtendedAttributeIdent a Ident Ident
| ExtendedAttributeIdentList a Ident [Ident]
| ExtendedAttributeNamedArgList a Ident Ident [Argument a]
deriving (Show, Eq, Functor)
data Interface a = Interface a [ExtendedAttribute a] Ident (Maybe Ident) [InterfaceMember a]
deriving (Show, Eq, Functor)
data Partial a = PartialInterface a Ident [InterfaceMember a]
| PartialDictionary a Ident [DictionaryMember a]
deriving (Show, Eq, Functor)
data Callback a = Callback a Ident ReturnType [Argument a] deriving (Show, Eq, Functor)
data Dictionary a = Dictionary a Ident (Maybe Ident) [DictionaryMember a] deriving (Show, Eq, Functor)
data Exception a = Exception a Ident (Maybe Ident) [ExceptionMember a] deriving (Show, Eq, Functor)
data Enum a = Enum a Ident [EnumValue] deriving (Show, Eq, Functor)
data Typedef a = Typedef a Type Ident deriving (Show, Eq, Functor)
data ImplementsStatement a = ImplementsStatement a Ident Ident deriving (Show, Eq, Functor)
data InterfaceMember a = IMemConst (Const a)
| IMemAttribute (Attribute a)
| IMemOperation (Operation a)
deriving (Show, Eq, Functor)
data DictionaryMember a = DictionaryMember a Type Ident (Maybe Default) deriving (Show, Eq, Functor)
data ExceptionMember a = ExConst a (Const a)
| ExField a Type Ident
deriving (Show, Eq, Functor)
data Attribute a = Attribute a (Maybe Inherit) (Maybe ReadOnly) Type Ident deriving (Show, Eq, Functor)
data Operation a = Operation a [ExtendedAttribute a] (Maybe Qualifier) ReturnType (Maybe Ident) [Argument a]
deriving (Show, Eq, Functor)
data Argument a = ArgOptional [ExtendedAttribute a] Type ArgumentName (Maybe Default)
| ArgNonOpt [ExtendedAttribute a] Type (Maybe Ellipsis) ArgumentName
deriving (Show, Eq, Functor)
newtype EnumValue = EnumValue String deriving (Show, Eq)
data ArgumentName = ArgKey ArgumentNameKeyword
| ArgIdent Ident
deriving (Show, Eq)
data Const a = Const a ConstType Ident ConstValue deriving (Show, Eq, Functor)
data Default = DefaultValue ConstValue
| DefaultString String
deriving (Show, Eq)
data ConstValue = ConstBooleanLiteral Bool
| ConstFloatLiteral Double
| ConstInteger Integer
| ConstNull
deriving (Show, Eq)
data Qualifier = QuaStatic
| QSpecials [Special]
deriving (Show, Eq)
data Special = Getter
| Setter
| Deleter
| LegacyCaller
deriving (Show, Eq)
data ArgumentNameKeyword = ArgAttribute | ArgCallback | ArgConst | ArgCreator
| ArgDeleter | ArgDictionary | ArgEnum | ArgException
| ArgGetter | ArgImplements | ArgInherit | ArgInterface
| ArgLegacyCaller | ArgPartial | ArgSetter | ArgStatic
| ArgStringifier | ArgTypedef | ArgUnrestricted
deriving (Show, Eq)
data Type = TySingleType SingleType | TyUnionType UnionType (Maybe Null) deriving (Show, Eq)
data SingleType = STyNonAny NonAnyType
| STyAny (Maybe Null)
deriving (Show, Eq)
data NonAnyType = TyPrim PrimitiveType (Maybe Null)
| TyDOMString (Maybe Null)
| TyIdent Ident (Maybe Null)
| TySequence Type (Maybe Null)
| TyObject (Maybe Null)
| TyDate (Maybe Null)
deriving (Show, Eq)
data PrimitiveType = PrimIntegerType IntegerType
| PrimFloatType FloatType
| Boolean
| Byte
| Octet
deriving (Show, Eq)
data IntegerType = IntegerType (Maybe Unsigned) IntegerWidth deriving (Show, Eq)
data IntegerWidth = Short | Long Int deriving (Show, Eq)
data Unsigned = Unsigned deriving (Show, Eq)
data FloatType = TyFloat (Maybe Unrestricted)
| TyDouble (Maybe Unrestricted)
deriving (Show, Eq)
type UnionType = [UnionMemberType]
data UnionMemberType = UnionTy UnionType (Maybe Null)
| UnionTyNonAny NonAnyType
deriving (Show, Eq)
data ReturnType = RetType Type
| RetVoid
deriving (Show, Eq)
data ConstType = ConstPrim PrimitiveType (Maybe Null)
| ConstIdent Ident (Maybe Null)
deriving (Show, Eq)
data Null = Null deriving (Show, Eq)
data Ellipsis = Ellipsis deriving (Show, Eq)
data ReadOnly = ReadOnly deriving (Show, Eq)
data Inherit = Inherit deriving (Show, Eq)
data Unrestricted = Unrestricted deriving (Show, Eq)
newtype Ident = Ident String deriving (Show, Eq, Ord)