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

(documentation: (/.Parser it)
  "A command-line interface parser.")

(documentation: /.result
  "Executes the parser and verifies that all inputs are processed."
  [(result parser inputs)])

(documentation: /.any
  "Just returns the next input without applying any logic.")

(documentation: /.parse
  "Parses the next input with a parsing function."
  [(parse parser)])

(documentation: /.this
  "Checks that a token is in the inputs."
  [(this reference)])

(documentation: /.somewhere
  "Given a parser, tries to parse it somewhere in the inputs (i.e. not necessarily parsing the immediate inputs)."
  [(somewhere cli)])

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

(documentation: /.named
  "Parses a named parameter and yields its value."
  [(named name value)])

(documentation: /.parameter
  "Parses a parameter that can have either a short or a long name."
  [(parameter [short long] value)])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..Parser
             ..result
             ..any
             ..parse
             ..this
             ..somewhere
             ..end
             ..named
             ..parameter]
            []))
