aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/parser/analysis.lux
blob: 3e718fbb665b036b4b6b30e541e8831d99dc7eaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
(.using
 [library
  [lux (.except nat int rev local)
   ["$" documentation (.only documentation:)]
   [data
    [text (.only \n)
     ["%" \\format (.only 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.")

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

  [/.bit /.this_bit]
  [/.nat /.this_nat]
  [/.int /.this_int]
  [/.rev /.this_rev]
  [/.frac /.this_frac]
  [/.text /.this_text]
  [/.local /.this_local]
  [/.foreign /.this_foreign]
  [/.constant /.this_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 ..this_bit
             ..nat ..this_nat
             ..int ..this_int
             ..rev ..this_rev
             ..frac ..this_frac
             ..text ..this_text
             ..local ..this_local
             ..foreign ..this_foreign
             ..constant ..this_constant
             ..tuple
             ($.default /.cannot_parse)
             ($.default /.unconsumed_input)]
            []))