Debian Codegraph @

parsing/extend.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 Globnames
12
13 (** Entry keys for constr notations *)
14
15 type production_position =
16 | BorderProd of Constrexpr.side * Gramlib.Gramext.g_assoc option
17 | InternalProd
18
19 type production_level =
20 | NextLevel
21 | NumLevel of int
22 | DefaultLevel (** Interpreted differently at the border or inside a rule *)
23
24 val production_level_eq : production_level -> production_level -> bool
25
26 (** User-level types used to tell how to parse or interpret of the non-terminal *)
27
28 type ('custom,'a) constr_entry_key_gen =
29 | ETIdent
30 | ETName
31 | ETGlobal
32 | ETBigint
33 | ETBinder of bool (* open list of binders if true, closed list of binders otherwise *)
34 | ETConstr of 'custom Constrexpr.notation_entry_gen * Notation_term.notation_binder_kind option * 'a
35 | ETPattern of bool * int option (* true = strict pattern, i.e. not a single variable *)
36
37 (** Entries level (left-hand side of grammar rules) *)
38
39 type constr_entry_key =
40 (CustomName.t, production_level * production_position) constr_entry_key_gen
41
42 val constr_entry_key_eq : constr_entry_key -> constr_entry_key -> bool
43
44 val constr_entry_key_eq_ignore_binder_kind : constr_entry_key -> constr_entry_key -> bool
45
46 (** Entries used in productions, vernac side (e.g. "x bigint" or "x ident") *)
47
48 type 'custom simple_constr_prod_entry_key =
49 ('custom, production_level) constr_entry_key_gen
50
51 (** Entries used in productions (in right-hand-side of grammar rules), to parse non-terminals *)
52
53 type binder_target = ForBinder | ForTerm
54
55 type binder_entry_kind = ETBinderOpen | ETBinderClosed of constr_prod_entry_key option * (bool * string) list
56
57 and constr_prod_entry_key =
58 | ETProdIdent (* Parsed as an ident *)
59 | ETProdName (* Parsed as a name (ident or _) *)
60 | ETProdGlobal (* Parsed as a global reference *)
61 | ETProdBigint (* Parsed as an (unbounded) integer *)
62 | ETProdOneBinder of bool (* Parsed as name, or name:type or 'pattern, possibly in closed form *)
63 | ETProdConstr of Constrexpr.notation_entry * (production_level * production_position) (* Parsed as constr or pattern, or a subentry of those *)
64 | ETProdPattern of int (* Parsed as pattern as a binder (as subpart of a constr) *)
65 | ETProdConstrList of Constrexpr.notation_entry * (production_level * production_position) * (bool * string) list (* Parsed as non-empty list of constr, or subentries of those *)
66 | ETProdBinderList of binder_entry_kind (* Parsed as non-empty list of local binders *)
67
68 (** {5 AST for user-provided entries} *)
69
70 type 'a user_symbol =
71 | Ulist1 of 'a user_symbol
72 | Ulist1sep of 'a user_symbol * string
73 | Ulist0 of 'a user_symbol
74 | Ulist0sep of 'a user_symbol * string
75 | Uopt of 'a user_symbol
76 | Uentry of 'a
77 | Uentryl of 'a * int
78
79 type ('a,'b,'c) ty_user_symbol =
80 | TUlist1 : ('a,'b,'c) ty_user_symbol -> ('a list,'b list,'c list) ty_user_symbol
81 | TUlist1sep : ('a,'b,'c) ty_user_symbol * string -> ('a list,'b list,'c list) ty_user_symbol
82 | TUlist0 : ('a,'b,'c) ty_user_symbol -> ('a list,'b list,'c list) ty_user_symbol
83 | TUlist0sep : ('a,'b,'c) ty_user_symbol * string -> ('a list,'b list,'c list) ty_user_symbol
84 | TUopt : ('a,'b,'c) ty_user_symbol -> ('a option, 'b option, 'c option) ty_user_symbol
85 | TUentry : ('a, 'b, 'c) Genarg.ArgT.tag -> ('a,'b,'c) ty_user_symbol
86 | TUentryl : ('a, 'b, 'c) Genarg.ArgT.tag * int -> ('a,'b,'c) ty_user_symbol