aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/format/binary.lux
blob: 0ed4363849f85baad06a28f38b0b6f3e3909d705 (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
(.module:
  [library
   [lux {"-" nat int rev list type or and}
    ["$" documentation {"+" documentation:}]
    [data
     [text {"+" \n}
      ["%" format {"+" 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 /.name)
             ($.default /.type)
             ($.default /.location)
             ($.default /.code)]
            []))