Traqula
    Preparing search index...

    Class IndirBuilder<Context, Names, RuleDefs>

    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 with IndirBuilder.create(existingBuilder).

    Type Parameters

    Index

    Methods

    • Delete multiple indirection definitions by name in a single call.

      Type Parameters

      • U extends string

      Parameters

      • ...ruleNames: U[]

        Names of the indirections to delete.

      Returns IndirBuilder<
          Context,
          Exclude<Names, U>,
          {
              [K in string]: RuleDefs[K] extends IndirDef<Context, K>
                  ? any[any]
                  : never
          },
      >

    • Retrieve an indirection definition by its name. Useful for inspecting or wrapping existing definitions when extending a pipeline.

      Type Parameters

      • U extends string

      Parameters

      • ruleName: U

        The name of the indirection, type-checked against the builder's known names.

      Returns RuleDefs[U] extends IndirDef<any, U, RT, PT>
          ? IndirDef<Context, U, RT, PT>
          : never

    • 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.

      Type Parameters

      • Patch extends { [Key in string]?: [any] | [any, any[]] }

      Returns IndirBuilder<
          Context,
          Names,
          {
              [Key in string]: Key extends keyof Patch
                  ? Patch[Key] extends [any, any[]]
                      ? IndirDef<Context, Key, any[any][0], any[any][1]>
                      : Patch[Key] extends [any]
                          ? RuleDefs[Key] extends IndirDef<any, any, any, Par>
                              ? IndirDef<Context, Key, any[any][0], Par>
                              : never
                          : never
                  : RuleDefs[Key] extends IndirDef<Context, Key> ? any[any] : never
          },
      >

    • 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.

      Type Parameters

      • NewContext

      Returns IndirBuilder<
          NewContext,
          Names,
          {
              [Key in string
              | number
              | symbol]: Key extends Names
                  ? RuleDefs[Key] extends IndirDef<any, any, RT, PT>
                      ? IndirDef<NewContext, Key, RT, PT>
                      : never
                  : never
          },
      >