aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/parser/xml.lux
blob: fbfa711f44c6dd00cf1eb931e3ea0dd2a6936b6e (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
(.using
 [library
  [lux (.except)
   ["$" documentation (.only documentation:)]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]]
   [macro
    ["[0]" template]]]]
 [\\library
  ["[0]" /]])

(documentation: (/.Parser it)
  "A parser of XML-encoded data.")

(documentation: /.result
  (format "Applies a parser against a stream of XML documents."
          \n "Verifies that all of the inputs are consumed by the parser.")
  [(result parser documents)])

(documentation: /.text
  "Yields text from a text node.")

(documentation: /.tag
  "Yields the tag from the next node.")

(documentation: /.attribute
  "Yields the value of an attribute in the current node."
  [(attribute name)])

(documentation: /.node
  "Parses the contents of the next node if the tag matches."
  [(node expected parser)])

(documentation: /.any
  "Yields the next node.")

(documentation: /.somewhere
  "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs."
  [(somewhere parser)])

(.def .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..Parser
             ..result
             ..text
             ..tag
             ..attribute
             ..node
             ..any
             ..somewhere
             ($.default /.empty_input)
             ($.default /.unexpected_input)
             ($.default /.wrong_tag)
             ($.default /.unknown_attribute)
             ($.default /.unconsumed_inputs)
             ($.default /.nowhere)]
            []))