0 | module Protocol.IDE.Highlight
4 | import Protocol.IDE.FileContext
5 | import Protocol.IDE.Decoration
10 | record Highlight where
11 | constructor MkHighlight
12 | location : FileContext
17 | docOverview : String
22 | record LwHighlight where
23 | constructor MkLwHighlight
24 | location : FileContext
28 | SExpable Highlight where
29 | toSExp (MkHighlight fc nam impl k dec doc t ns)
30 | = SExpList [ toSExp fc
31 | , SExpList [ SExpList [ SymbolAtom "name", StringAtom nam ]
32 | , SExpList [ SymbolAtom "namespace", StringAtom ns ]
34 | , SExpList [ SymbolAtom "implicit", toSExp impl ]
35 | , SExpList [ SymbolAtom "key", StringAtom k ]
36 | , SExpList [ SymbolAtom "doc-overview", StringAtom doc ]
37 | , SExpList [ SymbolAtom "type", StringAtom t ]
42 | FromSExpable Highlight where
43 | fromSExp (SExpList [ fc
44 | , SExpList [ SExpList [ SymbolAtom "name", StringAtom nam ]
45 | , SExpList [ SymbolAtom "namespace", StringAtom ns ]
47 | , SExpList [ SymbolAtom "implicit", impl ]
48 | , SExpList [ SymbolAtom "key", StringAtom key ]
49 | , SExpList [ SymbolAtom "doc-overview", StringAtom doc ]
50 | , SExpList [ SymbolAtom "type", StringAtom typ ]
54 | { location = !(fromSExp fc)
57 | , isImplicit = !(fromSExp impl)
58 | , decor = !(fromSExp dec)
61 | fromSExp _ = Nothing
64 | SExpable LwHighlight where
65 | toSExp lwhl = SExpList
66 | [ toSExp lwhl.location
67 | , SExpList [ toSExp lwhl.decor]
71 | FromSExpable LwHighlight where
74 | , SExpList [ decor ]
75 | ]) = do pure $
MkLwHighlight
76 | { location = !(fromSExp location)
77 | , decor = !(fromSExp decor)}
78 | fromSExp _ = Nothing
81 | data SourceHighlight =
86 | SExpable SourceHighlight where
87 | toSExp (Full hl) = toSExp hl
88 | toSExp (Lw hl) = toSExp hl
91 | FromSExpable SourceHighlight where
93 | let Nothing = fromSExp shl
94 | | Just hl => Just (Full hl)