package comby

  1. Overview
  2. Docs
On This Page
  1. Rewrite
Legend:
Library
Module
Module type
Parameter
Class
Class type

Rewrite

Defines rewrite operations.

val all : ?source:string -> ?metasyntax:Matchers.metasyntax -> ?sequential:bool -> rewrite_template:string -> match' list -> replacement option

all source metasyntax sequential rewrite_template matches substitutes rewrite_template with each match in matches to create a rewrite result. If source is specified, each rewrite result is substituted in-place in the source. If source is not specified, rewritten matches are newline-separated. If metasyntax is defined, the rewrite template will respect custom metasyntax definitions.

If the rewrite template contains the syntax :id(), then it is substituted with fresh values. sequential determines whether fresh values are monitonically increasing or a random hash. See substitute for more.

val substitute : ?metasyntax:Matchers.metasyntax -> ?sequential:bool -> string -> Match.environment -> string * string list

substitute metasyntax sequential template environment substitutes template with the variable and value pairs in the environment. It returns the result after substitution, and the list of variables in environment that were substituted for. If metasyntax is defined, the rewrite template will respect custom metasyntax definitions.

The syntax :id() is substituted with fresh values. If sequential is true, it substitutes :id() starting with 1, and subsequent :id() values increment the ID. Otherwise if sequential is false, it substitutes the pattern :id() with a fresh hex string based on the last 48-bit part of a UUID v3 identifier.

OCaml

Innovation. Community. Security.