package rocq-runtime

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file g_number_string.ml

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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
let _ = Mltop.add_known_module "rocq-runtime.plugins.number_string_notation"

# 13 "plugins/syntax/g_number_string.mlg"
 

open Notation
open Number_string
open Pp
open Stdarg
open Procq.Prim

let pr_number_after = function
  | Nop -> mt ()
  | Warning n -> str "warning after " ++ NumTok.UnsignedNat.print n
  | Abstract n -> str "abstract after " ++ NumTok.UnsignedNat.print n

let pr_number_string_mapping (b, n, n') =
  if b then
    str "[" ++ Libnames.pr_qualid n ++ str "]" ++ spc () ++ str "=>" ++ spc ()
    ++ Libnames.pr_qualid n'
  else
    Libnames.pr_qualid n ++ spc () ++ str "=>" ++ spc ()
    ++ Libnames.pr_qualid n'

let pr_number_string_via (n, l) =
  str "via " ++ Libnames.pr_qualid n ++ str " mapping ["
  ++ prlist_with_sep pr_comma pr_number_string_mapping l ++ str "]"

let pr_number_modifier = function
  | After a -> pr_number_after a
  | Via nl -> pr_number_string_via nl

let pr_number_options l =
  str "(" ++ prlist_with_sep pr_comma pr_number_modifier l ++ str ")"

let pr_string_option l =
  str "(" ++ pr_number_string_via l ++ str ")"



let (wit_number_string_mapping, number_string_mapping) =
  Vernacextend.vernac_argument_extend ~plugin:"rocq-runtime.plugins.number_string_notation" ~name:"number_string_mapping" 
  {
    Vernacextend.arg_parsing =
    Vernacextend.Arg_rules
    ([(Procq.Production.make
       (Procq.Rule.next
        (Procq.Rule.next
         (Procq.Rule.next
          (Procq.Rule.next
           (Procq.Rule.next (Procq.Rule.stop)
            ((Procq.Symbol.token (Procq.terminal "["))))
           ((Procq.Symbol.nterm reference)))
          ((Procq.Symbol.token (Procq.terminal "]"))))
         ((Procq.Symbol.token (Procq.terminal "=>"))))
        ((Procq.Symbol.nterm reference)))
       (fun n' _ _ n _ loc -> 
# 53 "plugins/syntax/g_number_string.mlg"
                                                   true, n, n' 
                              ));
     (Procq.Production.make
      (Procq.Rule.next
       (Procq.Rule.next
        (Procq.Rule.next (Procq.Rule.stop) ((Procq.Symbol.nterm reference)))
        ((Procq.Symbol.token (Procq.terminal "=>"))))
       ((Procq.Symbol.nterm reference)))
      (fun n' _ n loc -> 
# 52 "plugins/syntax/g_number_string.mlg"
                                           false, n, n' 
                         ))]);
    Vernacextend.arg_printer = fun env sigma -> 
# 51 "plugins/syntax/g_number_string.mlg"
               pr_number_string_mapping 
    ;
    }
let _ = (wit_number_string_mapping, number_string_mapping)

let (wit_number_string_via, number_string_via) =
  Vernacextend.vernac_argument_extend ~plugin:"rocq-runtime.plugins.number_string_notation" ~name:"number_string_via" 
  {
    Vernacextend.arg_parsing =
    Vernacextend.Arg_rules
    ([(Procq.Production.make
       (Procq.Rule.next
        (Procq.Rule.next
         (Procq.Rule.next
          (Procq.Rule.next
           (Procq.Rule.next
            (Procq.Rule.next (Procq.Rule.stop)
             ((Procq.Symbol.token (Procq.terminal "via"))))
            ((Procq.Symbol.nterm reference)))
           ((Procq.Symbol.token (Procq.terminal "mapping"))))
          ((Procq.Symbol.token (Procq.terminal "["))))
         ((Procq.Symbol.list1sep ((Procq.Symbol.nterm number_string_mapping)) ((Procq.Symbol.rules 
         [Procq.Rules.make (Procq.Rule.next_norec (Procq.Rule.stop)
                            ((Procq.Symbol.token (Procq.terminal ","))))
                           (fun _ loc -> ())])) false)))
        ((Procq.Symbol.token (Procq.terminal "]"))))
       (fun _ l _ _ n _ loc -> 
# 58 "plugins/syntax/g_number_string.mlg"
                                                                                          n, l 
                               ))]);
    Vernacextend.arg_printer = fun env sigma -> 
# 57 "plugins/syntax/g_number_string.mlg"
               pr_number_string_via 
    ;
    }
let _ = (wit_number_string_via, number_string_via)

let (wit_number_modifier, number_modifier) =
  Vernacextend.vernac_argument_extend ~plugin:"rocq-runtime.plugins.number_string_notation" ~name:"number_modifier" 
  {
    Vernacextend.arg_parsing =
    Vernacextend.Arg_rules
    ([(Procq.Production.make
       (Procq.Rule.next (Procq.Rule.stop)
        ((Procq.Symbol.nterm number_string_via)))
       (fun v loc -> 
# 65 "plugins/syntax/g_number_string.mlg"
                                Via v 
                     ));
     (Procq.Production.make
      (Procq.Rule.next
       (Procq.Rule.next
        (Procq.Rule.next (Procq.Rule.stop)
         ((Procq.Symbol.token (Procq.terminal "abstract"))))
        ((Procq.Symbol.token (Procq.terminal "after"))))
       ((Procq.Symbol.nterm bignat)))
      (fun n _ _ loc -> 
# 64 "plugins/syntax/g_number_string.mlg"
                                        After (Abstract (NumTok.UnsignedNat.of_string n)) 
                        ));
     (Procq.Production.make
      (Procq.Rule.next
       (Procq.Rule.next
        (Procq.Rule.next (Procq.Rule.stop)
         ((Procq.Symbol.token (Procq.terminal "warning"))))
        ((Procq.Symbol.token (Procq.terminal "after"))))
       ((Procq.Symbol.nterm bignat)))
      (fun waft _ _ loc -> 
# 63 "plugins/syntax/g_number_string.mlg"
                                          After (Warning (NumTok.UnsignedNat.of_string waft)) 
                           ))]);
    Vernacextend.arg_printer = fun env sigma -> 
# 62 "plugins/syntax/g_number_string.mlg"
               pr_number_modifier 
    ;
    }
let _ = (wit_number_modifier, number_modifier)

let (wit_number_options, number_options) =
  Vernacextend.vernac_argument_extend ~plugin:"rocq-runtime.plugins.number_string_notation" ~name:"number_options" 
  {
    Vernacextend.arg_parsing =
    Vernacextend.Arg_rules
    ([(Procq.Production.make
       (Procq.Rule.next
        (Procq.Rule.next
         (Procq.Rule.next (Procq.Rule.stop)
          ((Procq.Symbol.token (Procq.terminal "("))))
         ((Procq.Symbol.list1sep ((Procq.Symbol.nterm number_modifier)) ((Procq.Symbol.rules 
         [Procq.Rules.make (Procq.Rule.next_norec (Procq.Rule.stop)
                            ((Procq.Symbol.token (Procq.terminal ","))))
                           (fun _ loc -> ())])) false)))
        ((Procq.Symbol.token (Procq.terminal ")"))))
       (fun _ l _ loc -> 
# 70 "plugins/syntax/g_number_string.mlg"
                                                       l 
                         ))]);
    Vernacextend.arg_printer = fun env sigma -> 
# 69 "plugins/syntax/g_number_string.mlg"
               pr_number_options 
    ;
    }
let _ = (wit_number_options, number_options)

let (wit_string_option, string_option) =
  Vernacextend.vernac_argument_extend ~plugin:"rocq-runtime.plugins.number_string_notation" ~name:"string_option" 
  {
    Vernacextend.arg_parsing =
    Vernacextend.Arg_rules
    ([(Procq.Production.make
       (Procq.Rule.next
        (Procq.Rule.next
         (Procq.Rule.next (Procq.Rule.stop)
          ((Procq.Symbol.token (Procq.terminal "("))))
         ((Procq.Symbol.nterm number_string_via)))
        ((Procq.Symbol.token (Procq.terminal ")"))))
       (fun _ v _ loc -> 
# 75 "plugins/syntax/g_number_string.mlg"
                                        v 
                         ))]);
    Vernacextend.arg_printer = fun env sigma -> 
# 74 "plugins/syntax/g_number_string.mlg"
               pr_string_option 
    ;
    }
let _ = (wit_string_option, string_option)

let () = Vernacextend.static_vernac_extend ~plugin:(Some "rocq-runtime.plugins.number_string_notation") ~command:"NumberNotation" ~classifier:(fun _ -> Vernacextend.classify_as_sideeff) ?entry:None 
         [(Vernacextend.TyML
         (false,
          Vernacextend.TyTerminal
          ("Number",
           Vernacextend.TyTerminal
           ("Notation",
            Vernacextend.TyNonTerminal (Extend.TUentry (Genarg.get_arg_tag wit_reference),
            Vernacextend.TyNonTerminal (Extend.TUentry (Genarg.get_arg_tag wit_reference),
            Vernacextend.TyNonTerminal (Extend.TUentry (Genarg.get_arg_tag wit_reference),
            Vernacextend.TyNonTerminal (Extend.TUopt (Extend.TUentry (Genarg.get_arg_tag wit_number_options)),
            Vernacextend.TyTerminal
            (":",
             Vernacextend.TyNonTerminal (Extend.TUentry (Genarg.get_arg_tag wit_preident),
             Vernacextend.TyNil)))))))),
          (let coqpp_body ty f g nl sc locality =
            Vernactypes.vtdefault (fun () -> 
# 82 "plugins/syntax/g_number_string.mlg"
      vernac_number_notation (Locality.make_module_locality locality) ty f g (Option.default [] nl) sc 
            ) in fun ty f g nl sc ?loc ~atts () ->
            coqpp_body ty f g nl sc (Attributes.parse 
# 79 "plugins/syntax/g_number_string.mlg"
                   Attributes.locality
               atts)),
          None))]

let () = Vernacextend.static_vernac_extend ~plugin:(Some "rocq-runtime.plugins.number_string_notation") ~command:"StringNotation" ~classifier:(fun _ -> Vernacextend.classify_as_sideeff) ?entry:None 
         [(Vernacextend.TyML
         (false,
          Vernacextend.TyTerminal
          ("String",
           Vernacextend.TyTerminal
           ("Notation",
            Vernacextend.TyNonTerminal (Extend.TUentry (Genarg.get_arg_tag wit_reference),
            Vernacextend.TyNonTerminal (Extend.TUentry (Genarg.get_arg_tag wit_reference),
            Vernacextend.TyNonTerminal (Extend.TUentry (Genarg.get_arg_tag wit_reference),
            Vernacextend.TyNonTerminal (Extend.TUopt (Extend.TUentry (Genarg.get_arg_tag wit_string_option)),
            Vernacextend.TyTerminal
            (":",
             Vernacextend.TyNonTerminal (Extend.TUentry (Genarg.get_arg_tag wit_preident),
             Vernacextend.TyNil)))))))),
          (let coqpp_body ty f g o sc locality =
            Vernactypes.vtdefault (fun () -> 
# 88 "plugins/syntax/g_number_string.mlg"
      vernac_string_notation (Locality.make_module_locality locality) ty f g o sc 
            ) in fun ty f g o sc ?loc ~atts () ->
            coqpp_body ty f g o sc (Attributes.parse 
# 86 "plugins/syntax/g_number_string.mlg"
                   Attributes.locality
               atts)),
          None))]

OCaml

Innovation. Community. Security.