(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]
    [collection
     ["[0]" list]]]]]
 ["[0]" \\parser]
 [\\library
  ["[0]" /]])

(def \\parser
  (List $.Documentation)
  (list ($.module \\parser._
                  "")

        ($.definition \\parser.empty_input)
        ($.definition \\parser.unexpected_input)
        ($.definition \\parser.wrong_tag)
        ($.definition \\parser.unknown_attribute)
        ($.definition \\parser.unconsumed_inputs)
        ($.definition \\parser.nowhere)

        ($.definition (\\parser.Parser it)
          "A parser of XML-encoded data.")

        ($.definition \\parser.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)])

        ($.definition \\parser.text
          "Yields text from a text node.")

        ($.definition \\parser.tag
          "Yields the tag from the next node.")

        ($.definition \\parser.attribute
          "Yields the value of an attribute in the current node."
          [(attribute name)])

        ($.definition \\parser.node
          "Parses the contents of the next node if the tag matches."
          [(node expected parser)])

        ($.definition \\parser.any
          "Yields the next node.")

        ($.definition \\parser.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 $.Documentation)
  (list.partial ($.module /._
                          "")

                ($.definition /.Tag)
                ($.definition /.Attribute)
                ($.definition /.Attrs)
                ($.definition /.XML)
                ($.definition /.codec)
                ($.definition /.equivalence)

                ($.definition /.attributes
                  "An empty set of XML attributes.")

                ($.definition /.tag
                  "The text format of a XML tag."
                  [(tag name)])

                ($.definition /.attribute
                  "The text format of a XML attribute.")

                ..\\parser
                ))
