aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/parser/tree.lux
blob: 49c5f56d91d3f8b9c9ef7f52cb7015ec29bf3f50 (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
(.module:
  [library
   [lux "*"
    ["$" documentation {"+" [documentation:]}]
    [data
     [text {"+" [\n]}
      ["%" format {"+" [format]}]]]
    [macro
     ["." template]]]]
  [\\library
   ["." /]])

(documentation: (/.Parser it)
  "A parser of arbitrary trees.")

(documentation: /.result'
  "Applies the parser against a tree zipper."
  [(result' parser zipper)])

(documentation: /.result
  "Applies the parser against a tree."
  [(result parser tree)])

(documentation: /.value
  "Yields the value inside the current tree node.")

(template [<name> <doc>]
  [(documentation: <name>
     <doc>)]

  [/.down "Move down."]
  [/.up "Move up."]

  [/.right "Move to the right."]
  [/.rightmost "Move to the rightmost node."]

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

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..Parser
             ..result'
             ..result
             ..value

             ..down
             ..up

             ..right
             ..rightmost

             ..left
             ..leftmost
             
             ..next
             ..end
             
             ..previous
             ..start
             
             ($.default /.cannot_move_further)]
            []))