diff options
| author | Emilio Jesus Gallego Arias | 2019-08-19 02:35:56 +0200 |
|---|---|---|
| committer | Emilio Jesus Gallego Arias | 2020-03-25 23:45:00 -0400 |
| commit | 13929f39f8560cfcb3aacf20c84c6dcb5295cec5 (patch) | |
| tree | a4204cd4bced576d6d846ebac908aab5092c66a5 /gramlib | |
| parent | 4a88beff476d2c27eae381bc8a61f777015c0617 (diff) | |
[parsing] Make grammar extension type private.
After the gramlib merge and the type-safe interface added to it, the
grammar extension type is redundant; we thus make it private as a
first step on consolidating it with the one in gramlib's.
Diffstat (limited to 'gramlib')
| -rw-r--r-- | gramlib/grammar.ml | 11 | ||||
| -rw-r--r-- | gramlib/grammar.mli | 8 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gramlib/grammar.ml b/gramlib/grammar.ml index 0024d70466..818608674e 100644 --- a/gramlib/grammar.ml +++ b/gramlib/grammar.ml @@ -77,8 +77,7 @@ module type S = sig val make : ('a, _, 'f, Loc.t -> 'a) Rule.t -> 'f -> 'a t end - module Unsafe : - sig + module Unsafe : sig val clear_entry : 'a Entry.t -> unit end val safe_extend : warning:(string -> unit) option -> @@ -87,6 +86,10 @@ module type S = sig list -> unit val safe_delete_rule : 'a Entry.t -> ('a, _, 'f, 'r) Rule.t -> unit + + (* Used in custom entries, should tweak? *) + val level_of_nonterm : ('a, norec, 'c) Symbol.t -> string option + end (* Implementation *) @@ -1666,4 +1669,8 @@ let safe_delete_rule e r = let AnyS (symbols, _) = get_symbols r in delete_rule e symbols +let level_of_nonterm sym = match sym with + | Snterml (_,l) -> Some l + | _ -> None + end diff --git a/gramlib/grammar.mli b/gramlib/grammar.mli index f0423a92af..4ac85bd358 100644 --- a/gramlib/grammar.mli +++ b/gramlib/grammar.mli @@ -86,16 +86,20 @@ module type S = sig val make : ('a, _, 'f, Loc.t -> 'a) Rule.t -> 'f -> 'a t end - module Unsafe : - sig + module Unsafe : sig val clear_entry : 'a Entry.t -> unit end + val safe_extend : warning:(string -> unit) option -> 'a Entry.t -> Gramext.position option -> (string option * Gramext.g_assoc option * 'a Production.t list) list -> unit val safe_delete_rule : 'a Entry.t -> ('a, _, 'f, 'r) Rule.t -> unit + + (* Used in custom entries, should tweak? *) + val level_of_nonterm : ('a, norec, 'c) Symbol.t -> string option + end (** Signature type of the functor [Grammar.GMake]. The types and functions are almost the same than in generic interface, but: |
