aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/format/binary.lux
blob: e0d2bc7fe432b22d35dd459bb953d90b9fa3f61e (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
(.using
 [library
  [lux {"-" nat int rev list type or and symbol}
   ["$" documentation (.only documentation:)]
   [data
    [text (.only \n)
     ["%" format (.only format)]]]
   [macro
    ["[0]" template]]]]
 [\\library
  ["[0]" /]])

(documentation: /.Mutation
  "A mutation of binary data, tracking where in the data to transform.")

(documentation: /.Specification
  "A description of how to transform binary data.")

(documentation: /.no_op
  "A specification for empty binary data.")

(documentation: /.instance
  "Given a specification of how to construct binary data, yields a binary blob that matches it.")

(documentation: (/.Writer it)
  "An operation that knows how to write information into a binary blob.")

(documentation: /.result
  "Yields a binary blob with all the information written to it."
  [(result writer value)])

(documentation: /.or
  ""
  [(or left right)])

(documentation: /.and
  ""
  [(and pre post)])

(documentation: /.rec
  "A combinator for recursive writers."
  [(rec body)])

(documentation: /.segment
  "Writes at most 'size' bytes of an input binary blob."
  [(segment size)])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..Mutation
             ..Specification
             ..no_op
             ..instance
             ..Writer
             ..result
             ..or
             ..and
             ..rec
             ..segment
             ($.default /.monoid)
             ($.default /.bits_8)
             ($.default /.bits_16)
             ($.default /.bits_32)
             ($.default /.bits_64)
             ($.default /.any)
             ($.default /.bit)
             ($.default /.nat)
             ($.default /.int)
             ($.default /.rev)
             ($.default /.frac)
             ($.default /.binary_8)
             ($.default /.binary_16)
             ($.default /.binary_32)
             ($.default /.binary_64)
             ($.default /.utf8_8)
             ($.default /.utf8_16)
             ($.default /.utf8_32)
             ($.default /.utf8_64)
             ($.default /.text)
             ($.default /.sequence_8)
             ($.default /.sequence_16)
             ($.default /.sequence_32)
             ($.default /.sequence_64)
             ($.default /.maybe)
             ($.default /.list)
             ($.default /.set)
             ($.default /.symbol)
             ($.default /.type)
             ($.default /.location)
             ($.default /.code)]
            []))