(.using
  [library
   [lux {"-" nat int rev local}
    ["$" documentation {"+" documentation:}]
    [data
     [text {"+" \n}
      ["%" format {"+" format}]]]
    [macro
     ["[0]" template]]]]
  [\\library
   ["[0]" /]])

(documentation: (/.Parser it)
  "A parser for Lux code analysis nodes.")

(documentation: /.result
  "Executes a parser and makes sure no inputs go unconsumed."
  [(result parser input)])

(documentation: /.any
  "Matches any value, without discrimination.")

(documentation: /.end!
  "Ensures there are no more inputs.")

(documentation: /.end?
  "Checks whether there are no more inputs.")

(template [<query> <assertion>]
  [(`` (as_is (`` (documentation: <query>
                    (format "Queries for a " (~~ (template.text [<query>])) " value.")))
              (`` (documentation: <assertion>
                    (format "Assert a specific " (~~ (template.text [<query>])) " value.")))))]

  [/.bit /.bit!]
  [/.nat /.nat!]
  [/.int /.int!]
  [/.rev /.rev!]
  [/.frac /.frac!]
  [/.text /.text!]
  [/.local /.local!]
  [/.foreign /.foreign!]
  [/.constant /.constant!]
  )

(documentation: /.tuple
  "Parses only within the context of a tuple's contents."
  [(tuple parser)])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..Parser
             ..result
             ..any
             ..end!
             ..end?
             ..bit ..bit!
             ..nat ..nat!
             ..int ..int!
             ..rev ..rev!
             ..frac ..frac!
             ..text ..text!
             ..local ..local!
             ..foreign ..foreign!
             ..constant ..constant!
             ..tuple
             ($.default /.cannot_parse)
             ($.default /.unconsumed_input)]
            []))
