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

(def .public documentation
  (List $.Documentation)
  (list ($.module /._
                  "")

        ($.definition /.incorrect_quantification)

        ($.definition /.regex
          "Create lexers using regular-expression syntax."
          ["Literals"
           (regex "a")]
          ["Wildcards"
           (regex ".")]
          ["Escaping"
           (regex "\.")]
          ["Character classes"
           (regex "\d")
           (regex "\p{Lower}")
           (regex "[abc]")
           (regex "[a-z]")
           (regex "[a-zA-Z]")
           (regex "[a-z&&[def]]")]
          ["Negation"
           (regex "[^abc]")
           (regex "[^a-z]")
           (regex "[^a-zA-Z]")
           (regex "[a-z&&[^bc]]")
           (regex "[a-z&&[^m-p]]")]
          ["Combinations"
           (regex "aa")
           (regex "a?")
           (regex "a*")
           (regex "a+")]
          ["Specific amounts"
           (regex "a{2}")]
          ["At least"
           (regex "a{1,}")]
          ["At most"
           (regex "a{,1}")]
          ["Between"
           (regex "a{1,2}")]
          ["Groups"
           (regex "a(.)c")
           (regex "a(b+)c")
           (regex "(\d{3})-(\d{3})-(\d{4})")
           (regex "(\d{3})-(?:\d{3})-(\d{4})")
           (regex "(?<code>\d{3})-\k<code>-(\d{4})")
           (regex "(?<code>\d{3})-\k<code>-(\d{4})-\0")
           (regex "(\d{3})-((\d{3})-(\d{4}))")]
          ["Alternation"
           (regex "a|b")
           (regex "a(.)(.)|b(.)(.)")])

        ($.definition /.pattern
          "Allows you to test text against regular expressions."
          [(when some_text
             (pattern "(\d{3})-(\d{3})-(\d{4})"
                      [_ country_code area_code place_code])
             do_some_thing_when_number

             (pattern "\w+")
             do_some_thing_when_word

             _
             do_something_else)])
        ))
