Skip to content

Commit

Permalink
fix: missing documentation that I accidentally deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsterling committed Jul 8, 2022
1 parent cbaf336 commit a853891
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Modifier.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module type S = ModifierSigs.S with module Language := Language

module Make (P : Param) : S with module P = P =
struct
module Language = Language
module Language = Language
module P = P
include P

Expand Down
8 changes: 8 additions & 0 deletions src/ModifierSigs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ end
module type Handler =
sig
module P : Param

val not_found : P.context option -> Trie.bwd_path -> unit
(** [not_found ctx prefix] is called when the engine expects at least one binding within the subtree at [prefix] but could not find any, where [ctx] is the context passed to {!val:S.modify}. Modifiers such as {!val:Language.any}, {!val:Language.only}, {!val:Language.none}, and a few other modifiers expect at least one matching binding. For example, the modifier {!val:Language.except}[ ["x"; "y"]] expects that there was already something under the subtree at [x.y]. If there were actually no names with the prefix [x.y], then the modifier will trigger this effect with [prefix] being [Emp #< "x" #< "y"]. *)

val shadow : P.context option -> Trie.bwd_path -> P.data * P.tag -> P.data * P.tag -> P.data * P.tag
(** [shadow ctx path x y] is called when item [y] is being assigned to [path] but [x] is already bound at [path], where [ctx] is the context passed to {!val:S.modify}. Modifiers such as {!val:Language.renaming} and {!val:Language.union} could lead to bindings having the same name, and when that happens, this function is called to resolve the conflicting bindings. To implement silent shadowing, one can simply return item [y]. One can also employ a more sophisticated strategy to implement type-directed disambiguation. *)


val hook : P.context option -> Trie.bwd_path -> P.hook -> (P.data, P.tag) Trie.t -> (P.data, P.tag) Trie.t
(** [hook prefix id input] is called when processing the modifiers created by {!val:Language.hook}, where [ctx] is the context passed to {!val:S.modify}. When the engine encounters the modifier {!val:Language.hook}[ id] while handling the subtree [input] at [prefix], it will call [hook prefix id input] and replace the existing subtree [input] with the return value. *)

end

module type S =
Expand Down

0 comments on commit a853891

Please sign in to comment.