Add multiple indirection definitions at once using rest parameters. Provides better TypeScript type inference than calling addRule in a loop, but avoid passing too many at once as this can cause TypeScript compilation slowdowns. TypeScript errors if any name conflicts with an existing one.
Add a rule to the grammar. Will raise a typescript error if the rule already exists in the grammar.
Add an indirection function. If the rule already exists, but the implementation differs, an error will be thrown.
Construct an indirection object from the registered definitions.
An object with a method for each registered indirection name.
Retrieve an indirection definition by its name. Useful for inspecting or wrapping existing definitions when extending a pipeline.
The name of the indirection, type-checked against the builder's known names.
Merge this indirection builder with another. If the two builders both have a definition with the same name, no error will be thrown in case they map to the same object (by reference). If they map to a different object, an error will be thrown. To fix this problem, the overridingRules array should contain a definition with the same conflicting name, whose implementation will be used.
Update the type signatures (return types and/or parameter types) of existing indirections without changing their implementations. Use this when a patched indirection changes the types flowing through downstream indirections that don't need new implementations. This is a zero-cost type-level operation.
Narrow the builder's context type parameter to a more specific subtype. This is a zero-cost type-level operation — the builder instance is returned as-is but with updated type parameters.
StaticcreateCreate an IndirBuilder from initial indirection definitions or an existing builder. If a builder is provided, a new copy will be created.
Create an IndirBuilder from initial indirection definitions or an existing builder. If a builder is provided, a new copy will be created.
Builder for composing modular transformation pipelines using indirection definitions. Functions registered through this builder call each other via SUBRULE, enabling the same modularity and extensibility as the parser and generator builders.
Builders mutate internal state and return
this. Always start by copying an existing builder withIndirBuilder.create(existingBuilder).