package yuujinchou

  1. Overview
  2. Docs

A handler that reperforms the internal modifier effects. See Modifier.S.Perform.

val not_found : Param.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 S.modify. Modifiers such as Language.any, Language.only, Language.none, and a few other modifiers expect at least one matching binding. For example, the modifier 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".

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 S.modify. Modifiers such as Language.renaming and 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.

hook prefix id input is called when processing the modifiers created by Language.hook, where ctx is the context passed to S.modify. When the engine encounters the modifier 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.

OCaml

Innovation. Community. Security.