base

package
v0.0.0-...-1d296a1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VisitorAdapter

type VisitorAdapter struct {
	Visitor           VisitorHider // visitor implements a visitor interface
	ShouldCallVisitor bool
}

VisitorAdapter represents a top level VisitorAdapter that walks the tree but does nothing. Useful for doing analysis on the AST by other visitors For example, if I want to collect all of the function definitions of an arbor file, I would define a struct that is composed of this visitor and implements the VisitFunctionDefinitionNode function.

func New

func New(visitor VisitorHider) *VisitorAdapter

New returns a new Visitor

func (*VisitorAdapter) GetVisitor

func (v *VisitorAdapter) GetVisitor() interface{}

GetVisitor gets the underlying visitor

func (*VisitorAdapter) VisitAnnotatedNode

func (v *VisitorAdapter) VisitAnnotatedNode(node *ast.AnnotatedNode) (ast.Node, error)

func (*VisitorAdapter) VisitAnyNode

func (v *VisitorAdapter) VisitAnyNode(node ast.Node) (ast.Node, error)

func (*VisitorAdapter) VisitAssignmentNode

func (v *VisitorAdapter) VisitAssignmentNode(assignment *ast.AssignmentNode) (ast.Node, error)

VisitAssignment visits an assignment node

func (*VisitorAdapter) VisitBoolOp

func (v *VisitorAdapter) VisitBoolOp(node *ast.BoolOp) (ast.Node, error)

VisitBoolOp visits a boolean node

func (*VisitorAdapter) VisitComparison

func (v *VisitorAdapter) VisitComparison(node *ast.Comparison) (ast.Node, error)

VisitComparison Visits a comparison node

func (*VisitorAdapter) VisitConstant

func (v *VisitorAdapter) VisitConstant(node *ast.Constant) (ast.Node, error)

VisitConstant visits the constant object

func (*VisitorAdapter) VisitContinueNode

func (v *VisitorAdapter) VisitContinueNode(node *ast.ContinueNode) (ast.Node, error)

func (*VisitorAdapter) VisitDeclNode

func (v *VisitorAdapter) VisitDeclNode(node *ast.DeclNode) (ast.Node, error)

VisitDeclNode visits the decl Node

func (*VisitorAdapter) VisitDecoratorNode

func (v *VisitorAdapter) VisitDecoratorNode(node *ast.DecoratorNode) (ast.Node, error)

VisitSliceNode visits a slice node

func (*VisitorAdapter) VisitDotNode

func (v *VisitorAdapter) VisitDotNode(node *ast.DotNode) (ast.Node, error)

func (*VisitorAdapter) VisitExtendsNode

func (v *VisitorAdapter) VisitExtendsNode(extends *ast.ExtendsNode) (ast.Node, error)

func (*VisitorAdapter) VisitFunctionCallNode

func (v *VisitorAdapter) VisitFunctionCallNode(node *ast.FunctionCallNode) (ast.Node, error)

VisitFunctionCallNode visits a function call node

func (*VisitorAdapter) VisitFunctionDefinitionNode

func (v *VisitorAdapter) VisitFunctionDefinitionNode(node *ast.FunctionDefinitionNode) (ast.Node, error)

VisitFunctionDefinitionNode visits a function definition ndde

func (*VisitorAdapter) VisitHandleCaseNode

func (v *VisitorAdapter) VisitHandleCaseNode(node *ast.HandleCaseNode) (ast.Node, error)

func (*VisitorAdapter) VisitIfNode

func (v *VisitorAdapter) VisitIfNode(node *ast.IfNode) (ast.Node, error)

VisitIfNode visits an if node

func (*VisitorAdapter) VisitImplementsNode

func (v *VisitorAdapter) VisitImplementsNode(implementsNode *ast.ImplementsNode) (ast.Node, error)

func (*VisitorAdapter) VisitImportNode

func (v *VisitorAdapter) VisitImportNode(node *ast.ImportNode) (ast.Node, error)

VisitImportNode visits an import node

func (*VisitorAdapter) VisitIndexNode

func (v *VisitorAdapter) VisitIndexNode(node *ast.IndexNode) (ast.Node, error)

VisitIndexNode visits an index node

func (*VisitorAdapter) VisitInstantiateNode

func (v *VisitorAdapter) VisitInstantiateNode(node *ast.InstantiateNode) (ast.Node, error)

func (*VisitorAdapter) VisitInternalNode

func (v *VisitorAdapter) VisitInternalNode(node *ast.InternalNode) (ast.Node, error)

func (*VisitorAdapter) VisitMatchNode

func (v *VisitorAdapter) VisitMatchNode(node *ast.MatchNode) (ast.Node, error)

func (*VisitorAdapter) VisitMathOpNode

func (v *VisitorAdapter) VisitMathOpNode(node *ast.MathOpNode) (ast.Node, error)

VisitMathOpNode Visits a math op node

func (*VisitorAdapter) VisitMethodDefinition

func (v *VisitorAdapter) VisitMethodDefinition(node *ast.MethodDefinition) (ast.Node, error)

func (*VisitorAdapter) VisitPackage

func (v *VisitorAdapter) VisitPackage(node *ast.Package) (ast.Node, error)

func (*VisitorAdapter) VisitPipeNode

func (v *VisitorAdapter) VisitPipeNode(node *ast.PipeNode) (ast.Node, error)

VisitPipeNode visits the pipe node

func (*VisitorAdapter) VisitProgram

func (v *VisitorAdapter) VisitProgram(block *ast.Program) (ast.Node, error)

VisitProgram visits a compiler block

func (*VisitorAdapter) VisitReturnNode

func (v *VisitorAdapter) VisitReturnNode(node *ast.ReturnNode) (ast.Node, error)

VisitReturnNode visits a return node

func (*VisitorAdapter) VisitShapeNode

func (v *VisitorAdapter) VisitShapeNode(node *ast.ShapeNode) (ast.Node, error)

func (*VisitorAdapter) VisitSignalNode

func (v *VisitorAdapter) VisitSignalNode(node *ast.SignalNode) (ast.Node, error)

func (*VisitorAdapter) VisitSliceNode

func (v *VisitorAdapter) VisitSliceNode(node *ast.SliceNode) (ast.Node, error)

VisitSliceNode visits a slice node

func (*VisitorAdapter) VisitTryNode

func (v *VisitorAdapter) VisitTryNode(node *ast.TryNode) (ast.Node, error)

func (*VisitorAdapter) VisitTypeNode

func (v *VisitorAdapter) VisitTypeNode(node *ast.TypeNode) (ast.Node, error)

VisitTypeNode visits a type node

func (*VisitorAdapter) VisitVarName

func (v *VisitorAdapter) VisitVarName(node *ast.VarName) (ast.Node, error)

VisitVarName visits a varname node

func (*VisitorAdapter) VisitWhenNode

func (v *VisitorAdapter) VisitWhenNode(node *ast.WhenNode) (ast.Node, error)

type VisitorHider

type VisitorHider interface {
	SetVisitor(v *VisitorAdapter)
	GetSymbolTable() *scope.SymbolTable
}

VisitorHider is a simple way to set and hide the visitor

Jump to

Keyboard shortcuts

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