aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/parser/type.lux
blob: 0d1785b065fa18ee420d05dcedb9db96fad2137d (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
(.module:
  [library
   [lux (#- local function)
    ["$" documentation (#+ documentation:)]
    [data
     [text (#+ \n)
      ["%" format (#+ format)]]]
    [macro
     ["." template]]]]
  [\\library
   ["." /]])

(documentation: /.Env
  "An environment for type parsing.")

(documentation: /.Parser
  "A parser of Lux types.")

(documentation: /.fresh
  "An empty parsing environment.")

(documentation: /.result
  (format "Applies a parser against a type."
          \n "Verifies that the parser fully consumes the type's information.")
  [(result poly type)])

(documentation: /.env
  "Yields the current parsing environment.")

(documentation: /.next
  "Inspect a type in the input stream without consuming it.")

(documentation: /.any
  "Yields a type, without examination.")

(documentation: /.local
  "Apply a parser to the given inputs."
  [(local types poly)])

(documentation: /.with_extension
  ""
  [(with_extension type poly)])

(template [<name>]
  [(`` (documentation: <name>
         (format "Parses the contents of a " (~~ (template.text [<name>])) " type.")
         [(<name> poly)]))]

  [/.variant]
  [/.tuple]
  )

(documentation: /.polymorphic
  ""
  [(polymorphic poly)])

(documentation: /.function
  "Parses a function's inputs and output."
  [(function in_poly out_poly)])

(documentation: /.applied
  "Parses a type application."
  [(applied poly)])

(template [<name> <doc>]
  [(documentation: <name>
     <doc>
     [(<name> expected)])]

  [/.exactly "Parses a type exactly."]
  [/.sub "Parses a sub type."]
  [/.super "Parses a super type."]
  )

(documentation: /.adjusted_idx
  ""
  [(adjusted_idx env idx)])

(documentation: /.parameter!
  ""
  [(parameter! id)])

(documentation: /.existential
  "Yields an existential type.")

(documentation: /.named
  "Yields a named type.")

(documentation: /.recursive
  ""
  [(recursive poly)])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            (format "Parsing of Lux types."
                    \n "Used mostly for polytypic programming.")
            [..Env
             ..Parser
             ..fresh
             ..result
             ..env
             ..next
             ..any
             ..local
             ..with_extension

             ..variant
             ..tuple
             
             ..polymorphic
             ..function
             ..applied

             ..exactly
             ..sub
             ..super
             
             ..adjusted_idx
             ..parameter!
             ..existential
             ..named
             ..recursive

             ($.default /.not_existential)
             ($.default /.not_recursive)
             ($.default /.not_named)
             ($.default /.not_parameter)
             ($.default /.unknown_parameter)
             ($.default /.not_function)
             ($.default /.not_application)
             ($.default /.not_polymorphic)
             ($.default /.not_variant)
             ($.default /.not_tuple)
             ($.default /.types_do_not_match)
             ($.default /.wrong_parameter)
             ($.default /.empty_input)
             ($.default /.unconsumed_input)
             ($.default /.parameter)
             ($.default /.recursive_self)
             ($.default /.recursive_call)]
            []))