Debian Codegraph @

src/rocq_elpi_name_quotation.ml

raw symbols SCIP
1 (* coq-elpi: Coq terms as the object language of elpi *)
2 (* license: GNU Lesser General Public License Version 2.1 or later *)
3 (* ------------------------------------------------------------------------- *)
4
5 module API = Elpi.API
6 open Rocq_elpi_utils
7 open Rocq_elpi_HOAS
8 open Names
9
10 let to_name ~loc src =
11 if src = "_" then in_elpiast_name ~loc (EConstr.anonR)
12 else in_elpiast_name ~loc (EConstr.nameR (Id.of_string src))
13
14 (* Install the quotation *)
15 let () =
16 let f ~language state loc src = to_name ~loc src in
17 let _ = API.Quotation.register_named_quotation ~descriptor:interp_quotations ~name:"name" f in
18 let _ = API.Quotation.register_named_quotation ~descriptor:synterp_quotations ~name:"name" f in
19 ()
20
21 let () =
22 let f ~language state loc s =
23 let src = String.sub s 1 (String.length s - 2) in
24 to_name ~loc src in
25 let _ = API.Quotation.declare_backtick ~descriptor:interp_quotations ~name:"Name.t" f in
26 let _ = API.Quotation.declare_backtick ~descriptor:synterp_quotations ~name:"Name.t" f in
27 ()