aboutsummaryrefslogtreecommitdiff
path: root/src/Fun/Tree.hs
blob: 354677dea01b395a024888b710b1c04f27351e7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module Fun.Tree where

data Tree = Tree [Program]
  deriving Show

data Program = Program [Block]
  deriving Show

data Block = Block FunctionBlock -- | Block DataBlock ...
  deriving Show
data FunctionBlock = FunctionBlock FunctionDeclaration [FunctionDefinition]
  deriving Show

data Visibility = PublicVisibility | PrivateVisibility
  deriving Show

data FunctionDeclaration = FunctionDeclaration String
                                               Visibility
                                               [String]
                                               [FunctionFlag]
  deriving Show
data FunctionFlag = FunctionInline | FunctionDeprecated | FunctionUnknown
  deriving Show
instance Read FunctionFlag where
  readsPrec _ "inline"     = [(FunctionInline, "")]
  readsPrec _ "deprecated" = [(FunctionDeprecated, "")]
  readsPrec _ _            = [(FunctionUnknown, "")]

data FunctionDefinition = FunctionDefinition FunctionPattern FunctionBody
  deriving Show
data FunctionPattern = FunctionPattern [FunctionPatternElement]
  deriving Show
data FunctionPatternElement = FunctionPatternParameter String | FunctionPatternString String | FunctionPatternNumber Integer | FunctionPatternWildcard
  deriving Show
data FunctionBody = FunctionBody [FunctionBodyElement]
  deriving Show
data FunctionBodyElement = Statement String | FunctionBodyIdentifier String | FunctionBodyParameter String | FunctionBodyString String | FunctionBodyNumber Integer
  deriving Show