Created
February 15, 2014 21:54
-
-
Save pedrofurla/9025691 to your computer and use it in GitHub Desktop.
A little model for a subset of WebIdl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE ExistentialQuantification #-} | |
| module WebIdl.Ast where | |
| import WebIdl.Lex | |
| type Ident = String | |
| type ExtAttributes = String | |
| type Default = Maybe Literal | |
| type ReadOnly = Bool | |
| type Inherit = Bool | |
| type Nullable = Bool | |
| type Array = Bool | |
| -- | | |
| data Type = Type Ident Nullable Array deriving (Show, Eq) | |
| data Callback = Callback Ident ExtAttributes CbDef deriving (Show, Eq) | |
| data CbDef = CbDef Type [FormalArg] deriving (Show, Eq) | |
| data FormalArg = FormalArg Type Ident Default deriving (Show, Eq) | |
| data TypeDef = TypeDef Ident Type deriving (Show, Eq) | |
| data Const = Const Ident Type Literal deriving (Show, Eq) | |
| data Interface = Interface Ident ExtAttributes (Maybe Type) [IMember] deriving (Show, Eq) | |
| data IMember = | |
| Attribute Ident Type ReadOnly Inherit | | |
| Operation Ident Type [FormalArg] deriving (Show, Eq) | |
| -- data Definition = | |
| data WebIdl = WebIdl [Either Interface Callback] deriving (Show,Eq) | |
| data Box = forall a. Show a => Box a | |
| instance Show Box where | |
| show (Box a) = "Box " ++ show a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment