-
Notifications
You must be signed in to change notification settings - Fork 691
/
WASHData.hs
74 lines (60 loc) · 1.32 KB
/
WASHData.hs
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
module WASHData -- derived from HSPData
( File (..)
, Mode (..)
, Element (..)
, Text (..)
, Content (..)
, CodeFrag (..)
, Attribute (..)
, AttrValue (..)
)
where {
-- Data type.
data File = File {
fcode :: [CodeFrag],
topElem :: Element
} deriving Show;
data Mode = V | S | F
deriving (Eq,Show);
data Element = Element
{ elemMode :: Mode
, elemName :: String
, elemAttrs :: [Attribute]
, elemContent :: [Content]
, elemEmptyTag :: Bool }
deriving Show;
data Text = Text
{ textMode :: Mode
, textString :: String
}
deriving Show;
data Content
= CElement { celem :: Element }
| CText { ctext :: Text }
| CReference { creference :: Text }
| CPI { cpi :: String }
| CComment { ccomment :: String }
| CCode { ccode :: [CodeFrag] }
deriving Show;
data CodeFrag
= HFrag String
| EFrag Element
| HSFrag String
| CFrag [Content]
| AFrag [Attribute]
| VFrag String
deriving Show;
data Attribute
= Attribute
{ attrMode :: Mode
, attrName :: String
, attrValue :: AttrValue }
| AttrPattern
{ attrPattern :: String }
deriving Show;
data AttrValue
= AText String
| ACode String
deriving Show;
data Reference = Reference String deriving Show;
}