Debian Codegraph @

vernac/metasyntax.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open Names
12 open Vernacexpr
13 open Notation
14 open Constrexpr
15 open Notation_term
16 open Environ
17
18 type notation_main_data
19 type syntax_rules
20
21 type notation_interpretation_decl
22 (** This data type packages all the necessary information to declare a notation
23 interpretation, once the syntax is declared or recovered from a previous
24 declaration. *)
25
26 val add_notation_syntax :
27 local:bool ->
28 infix:bool ->
29 UserWarn.t option ->
30 notation_declaration ->
31 notation_interpretation_decl
32 (** Add syntax rules for a (constr) notation in the environment *)
33
34 val add_notation_interpretation :
35 local:bool -> env -> notation_interpretation_decl -> unit
36 (** Declare the interpretation of a notation *)
37
38 (** Declaring scopes, delimiter keys and default scopes *)
39
40 val declare_scope : locality_flag -> scope_name -> unit
41 val add_delimiters : locality_flag -> scope_name -> string -> unit
42 val remove_delimiters : locality_flag -> scope_name -> unit
43 val add_class_scope : locality_flag -> scope_name -> add_scope_where option -> scope_class list -> unit
44
45 (** Scope opening *)
46
47 val open_close_scope : locality_flag -> to_open:bool -> scope_name -> unit
48
49 (** Add a notation interpretation associated to a "where" clause (already has pa/pp rules) *)
50
51 val prepare_where_notation :
52 notation_declaration -> notation_interpretation_decl
53 (** Interpret the modifiers of a where-notation *)
54
55 val set_notation_for_interpretation :
56 env -> Constrintern.internalization_env -> notation_interpretation_decl -> unit
57 (** Set the interpretation of the where-notation for interpreting a mutual block *)
58
59 (** Add only the parsing/printing rule of a notation *)
60
61 val add_reserved_notation :
62 local:bool -> infix:bool -> (lstring * syntax_modifier CAst.t list) -> unit
63
64 (** Add a syntactic definition (as in "Notation f := ...") *)
65
66 val add_abbreviation : local:Libobject.locality -> Globnames.extended_global_reference UserWarn.with_qf option -> env ->
67 Id.t -> Id.t list * constr_expr -> syntax_modifier CAst.t list -> unit
68
69 (** Print the Camlp5 state of a grammar *)
70
71 val pr_grammar : string list -> Pp.t
72 val pr_custom_grammar : Libnames.qualid -> Pp.t
73 val pr_keywords : unit -> Pp.t
74
75 (** Register a handler for Print Custom Grammar. The handler should
76 return [None] for unknown entries and [Some] of the associated
77 entries for known entries. *)
78 val register_custom_grammar_for_print : (Libnames.qualid -> Procq.Entry.any_t list option) -> unit
79
80 val with_syntax_protection : ('a -> 'b) -> 'a -> 'b
81
82 val declare_notation_toggle : locality_flag -> on:bool -> all:bool -> Notation.notation_query_pattern -> unit
83
84 val declare_custom_entry : locality_flag -> Id.t -> unit
85 (** Declare given string as a custom grammar entry *)
86
87 val intern_custom_name : Libnames.qualid -> Globnames.CustomName.t
88 (** Intern custom entry name using compat layer if needed. *)
89
90 val intern_notation_entry : Libnames.qualid notation_entry_gen -> notation_entry
91 (** Intern notation entry name using compat layer for custom entries if needed. *)
92
93 val pr_level : notation_entry_level * entry_relative_level list -> Extend.constr_entry_key list -> Pp.t
94 (** Pretty print level information of a notation and all of its arguments *)