rewrite

package
v0.16.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SameTree TreeIdentity = false
	NewTree  TreeIdentity = true

	VisitChildren VisitRule = true
	SkipChildren  VisitRule = false
)

Variables

This section is empty.

Functions

func BottomUp

func BottomUp(root ops.Operator, f Func) (ops.Operator, error)

BottomUp rewrites an operator tree from the bottom up. BottomUp applies a transformation function to the given operator tree from the bottom up. Each callback [f] returns a TreeIdentity that is aggregated into a final output indicating whether the operator tree was changed.

func TopDown

func TopDown(in ops.Operator, rewriter BreakableFunc) (ops.Operator, error)

TopDown applies a transformation function to the given operator tree from the bottom up. = Each callback [f] returns a TreeIdentity that is aggregated into a final output indicating whether the operator tree was changed. The callback also returns a VisitRule that signals whether the children of this operator should be visited or not

func Visit

func Visit(root ops.Operator, visitor func(ops.Operator) error) error

Visit allows for the walking of the operator tree. If any error is returned, the walk is aborted

Types

type BreakableFunc

type BreakableFunc func(ops.Operator) (ops.Operator, TreeIdentity, VisitRule, error)

type Func

type Func func(ops.Operator) (ops.Operator, TreeIdentity, error)

type TreeIdentity

type TreeIdentity bool

TreeIdentity tracks modifications to node and expression trees. Only return SameTree when it is acceptable to return the original input and discard the returned result as a performance improvement.

type VisitRule

type VisitRule bool

VisitRule signals to the rewriter if the children of this operator should be visited or not

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL