(.using
  [library
   [lux "*"
    ["$" documentation {"+" documentation:}]
    [data
     [text {"+" \n}
      ["%" format {"+" 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)]
            []))
