From 51976c9f2157953f794ed1efcd68403a8545d346 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Wed, 9 Aug 2017 13:58:59 +0200 Subject: A bit of miscellaneous code documentation around notations. --- interp/notation.mli | 8 ++++---- interp/notation_ops.ml | 1 + intf/notation_term.ml | 2 +- vernac/metasyntax.ml | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/interp/notation.mli b/interp/notation.mli index 7d055571c..d10012212 100644 --- a/interp/notation.mli +++ b/interp/notation.mli @@ -176,10 +176,10 @@ val scope_class_of_class : Classops.cl_typ -> scope_class (** Building notation key *) type symbol = - | Terminal of string - | NonTerminal of Id.t - | SProdList of Id.t * symbol list - | Break of int + | Terminal of string (* an expression including symbols or a simply-quoted ident, e.g. "'U'" or "!" *) + | NonTerminal of Id.t (* an identifier "x" *) + | SProdList of Id.t * symbol list (* an expression "x sep .. sep y", remembering x (or y) and sep *) + | Break of int (* a sequence of blanks > 1, e.g. " " *) val symbol_eq : symbol -> symbol -> bool diff --git a/interp/notation_ops.ml b/interp/notation_ops.ml index 301ec6984..c414ba67a 100644 --- a/interp/notation_ops.ml +++ b/interp/notation_ops.ml @@ -338,6 +338,7 @@ let compare_recursive_parts found f f' (iterator,subc) = let notation_constr_and_vars_of_glob_constr a = let found = ref { vars = []; recursive_term_vars = []; recursive_binders_vars = [] } in let has_ltac = ref false in + (* Turn a glob_constr into a notation_constr by first trying to find a recursive pattern *) let rec aux c = let keepfound = !found in (* n^2 complexity but small and done only once per notation *) diff --git a/intf/notation_term.ml b/intf/notation_term.ml index d1cbb6a33..028d14ccf 100644 --- a/intf/notation_term.ml +++ b/intf/notation_term.ml @@ -63,7 +63,7 @@ type subscopes = tmp_scope_name option * scope_name list type notation_var_instance_type = | NtnTypeConstr | NtnTypeOnlyBinder | NtnTypeConstrList | NtnTypeBinderList -(** Type of variables when interpreting a constr_expr as an notation_constr: +(** Type of variables when interpreting a constr_expr as a notation_constr: in a recursive pattern x..y, both x and y carry the individual type of each element of the list x..y *) type notation_var_internalization_type = diff --git a/vernac/metasyntax.ml b/vernac/metasyntax.ml index 09eb0503d..462f6215a 100644 --- a/vernac/metasyntax.ml +++ b/vernac/metasyntax.ml @@ -956,7 +956,7 @@ let make_interpretation_type isrec isonlybinding = function | NtnInternTypeConstr | NtnInternTypeIdent -> if isonlybinding then NtnTypeOnlyBinder else NtnTypeConstr | NtnInternTypeBinder when isrec -> NtnTypeBinderList - | NtnInternTypeBinder -> user_err Pp.(str "Type binder is only for use in recursive notations for binders.") + | NtnInternTypeBinder -> user_err Pp.(str "Type binder is only for use in recursive notations for binders.") let make_interpretation_vars recvars allvars = let eq_subscope (sc1, l1) (sc2, l2) = -- cgit v1.2.3