aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/collection/tree.lux
blob: 4e063f788ac9d886a73ceefa32bc1a3e307780c9 (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
(.require
 [library
  [lux (.except list)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]]]]
 ["[0]" \\parser]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" finger]
  ["[1][0]" zipper]])

(`` (.def \\parser
      (.List $.Module)
      ($.module \\parser._
                ""
                [($.default \\parser.cannot_move_further)

                 ($.definition (\\parser.Parser it)
                   "A parser of arbitrary trees.")

                 ($.definition \\parser.result'
                   "Applies the parser against a tree zipper."
                   [(result' parser zipper)])

                 ($.definition \\parser.result
                   "Applies the parser against a tree."
                   [(result parser tree)])

                 ($.definition \\parser.value
                   "Yields the value inside the current tree node.")

                 (,, (with_template [<name> <doc>]
                       [($.definition <name>
                          <doc>)]

                       [\\parser.down "Move down."]
                       [\\parser.up "Move up."]

                       [\\parser.right "Move to the right."]
                       [\\parser.rightmost "Move to the rightmost node."]

                       [\\parser.left "Move to the left."]
                       [\\parser.leftmost "Move to the leftmost node."]
                       
                       [\\parser.next "Move to the next node."]
                       [\\parser.end "Move to the last node."]
                       
                       [\\parser.previous "Move to the previous node."]
                       [\\parser.start "Move to the root node."]
                       ))]
                [])))

(.def .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [($.default /.equivalence)
             ($.default /.functor)
             ($.default /.mix)

             ($.definition (/.Tree it)
               "A generic tree data-structure.")

             ($.definition /.flat
               "All the leaf values of the tree, in order."
               [(flat tree)])

             ($.definition /.leaf
               ""
               [(leaf value)])

             ($.definition /.branch
               ""
               [(branch value children)])

             ($.definition /.tree
               "Tree literals."
               [(is (Tree Nat)
                    (tree 12
                          {34 {}
                              56 {}
                              78 {90 {}}}))])]
            [..\\parser
             
             /finger.documentation
             /zipper.documentation]))