ast

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(node Node) string

func Patch

func Patch(node *Node, newNode Node)

func Walk

func Walk(node *Node, visitor Visitor)

Types

type ArrayNode

type ArrayNode struct {
	Nodes []Node
	// contains filtered or unexported fields
}

func (*ArrayNode) Location

func (n *ArrayNode) Location() file.Location

func (*ArrayNode) SetLocation

func (n *ArrayNode) SetLocation(loc file.Location)

func (*ArrayNode) SetType

func (n *ArrayNode) SetType(t reflect.Type)

func (*ArrayNode) Type

func (n *ArrayNode) Type() reflect.Type

type BinaryNode

type BinaryNode struct {
	Operator string
	Left     Node
	Right    Node
	// contains filtered or unexported fields
}

func (*BinaryNode) Location

func (n *BinaryNode) Location() file.Location

func (*BinaryNode) SetLocation

func (n *BinaryNode) SetLocation(loc file.Location)

func (*BinaryNode) SetType

func (n *BinaryNode) SetType(t reflect.Type)

func (*BinaryNode) Type

func (n *BinaryNode) Type() reflect.Type

type BoolNode

type BoolNode struct {
	Value bool
	// contains filtered or unexported fields
}

func (*BoolNode) Location

func (n *BoolNode) Location() file.Location

func (*BoolNode) SetLocation

func (n *BoolNode) SetLocation(loc file.Location)

func (*BoolNode) SetType

func (n *BoolNode) SetType(t reflect.Type)

func (*BoolNode) Type

func (n *BoolNode) Type() reflect.Type

type BuiltinNode

type BuiltinNode struct {
	Name      string
	Arguments []Node
	// contains filtered or unexported fields
}

func (*BuiltinNode) Location

func (n *BuiltinNode) Location() file.Location

func (*BuiltinNode) SetLocation

func (n *BuiltinNode) SetLocation(loc file.Location)

func (*BuiltinNode) SetType

func (n *BuiltinNode) SetType(t reflect.Type)

func (*BuiltinNode) Type

func (n *BuiltinNode) Type() reflect.Type

type ClosureNode

type ClosureNode struct {
	Node Node
	// contains filtered or unexported fields
}

func (*ClosureNode) Location

func (n *ClosureNode) Location() file.Location

func (*ClosureNode) SetLocation

func (n *ClosureNode) SetLocation(loc file.Location)

func (*ClosureNode) SetType

func (n *ClosureNode) SetType(t reflect.Type)

func (*ClosureNode) Type

func (n *ClosureNode) Type() reflect.Type

type ConditionalNode

type ConditionalNode struct {
	Cond Node
	Exp1 Node
	Exp2 Node
	// contains filtered or unexported fields
}

func (*ConditionalNode) Location

func (n *ConditionalNode) Location() file.Location

func (*ConditionalNode) SetLocation

func (n *ConditionalNode) SetLocation(loc file.Location)

func (*ConditionalNode) SetType

func (n *ConditionalNode) SetType(t reflect.Type)

func (*ConditionalNode) Type

func (n *ConditionalNode) Type() reflect.Type

type ConstantNode

type ConstantNode struct {
	Value interface{}
	// contains filtered or unexported fields
}

func (*ConstantNode) Location

func (n *ConstantNode) Location() file.Location

func (*ConstantNode) SetLocation

func (n *ConstantNode) SetLocation(loc file.Location)

func (*ConstantNode) SetType

func (n *ConstantNode) SetType(t reflect.Type)

func (*ConstantNode) Type

func (n *ConstantNode) Type() reflect.Type

type FloatNode

type FloatNode struct {
	Value float64
	// contains filtered or unexported fields
}

func (*FloatNode) Location

func (n *FloatNode) Location() file.Location

func (*FloatNode) SetLocation

func (n *FloatNode) SetLocation(loc file.Location)

func (*FloatNode) SetType

func (n *FloatNode) SetType(t reflect.Type)

func (*FloatNode) Type

func (n *FloatNode) Type() reflect.Type

type FunctionNode

type FunctionNode struct {
	Name      string
	Arguments []Node
	Fast      bool
	// contains filtered or unexported fields
}

func (*FunctionNode) Location

func (n *FunctionNode) Location() file.Location

func (*FunctionNode) SetLocation

func (n *FunctionNode) SetLocation(loc file.Location)

func (*FunctionNode) SetType

func (n *FunctionNode) SetType(t reflect.Type)

func (*FunctionNode) Type

func (n *FunctionNode) Type() reflect.Type

type IdentifierNode

type IdentifierNode struct {
	Value string
	// contains filtered or unexported fields
}

func (*IdentifierNode) Location

func (n *IdentifierNode) Location() file.Location

func (*IdentifierNode) SetLocation

func (n *IdentifierNode) SetLocation(loc file.Location)

func (*IdentifierNode) SetType

func (n *IdentifierNode) SetType(t reflect.Type)

func (*IdentifierNode) Type

func (n *IdentifierNode) Type() reflect.Type

type IndexNode

type IndexNode struct {
	Node  Node
	Index Node
	// contains filtered or unexported fields
}

func (*IndexNode) Location

func (n *IndexNode) Location() file.Location

func (*IndexNode) SetLocation

func (n *IndexNode) SetLocation(loc file.Location)

func (*IndexNode) SetType

func (n *IndexNode) SetType(t reflect.Type)

func (*IndexNode) Type

func (n *IndexNode) Type() reflect.Type

type IntegerNode

type IntegerNode struct {
	Value int
	// contains filtered or unexported fields
}

func (*IntegerNode) Location

func (n *IntegerNode) Location() file.Location

func (*IntegerNode) SetLocation

func (n *IntegerNode) SetLocation(loc file.Location)

func (*IntegerNode) SetType

func (n *IntegerNode) SetType(t reflect.Type)

func (*IntegerNode) Type

func (n *IntegerNode) Type() reflect.Type

type MapNode

type MapNode struct {
	Pairs []Node
	// contains filtered or unexported fields
}

func (*MapNode) Location

func (n *MapNode) Location() file.Location

func (*MapNode) SetLocation

func (n *MapNode) SetLocation(loc file.Location)

func (*MapNode) SetType

func (n *MapNode) SetType(t reflect.Type)

func (*MapNode) Type

func (n *MapNode) Type() reflect.Type

type MatchesNode

type MatchesNode struct {
	Regexp *regexp.Regexp
	Left   Node
	Right  Node
	// contains filtered or unexported fields
}

func (*MatchesNode) Location

func (n *MatchesNode) Location() file.Location

func (*MatchesNode) SetLocation

func (n *MatchesNode) SetLocation(loc file.Location)

func (*MatchesNode) SetType

func (n *MatchesNode) SetType(t reflect.Type)

func (*MatchesNode) Type

func (n *MatchesNode) Type() reflect.Type

type MethodNode

type MethodNode struct {
	Node      Node
	Method    string
	Arguments []Node
	// contains filtered or unexported fields
}

func (*MethodNode) Location

func (n *MethodNode) Location() file.Location

func (*MethodNode) SetLocation

func (n *MethodNode) SetLocation(loc file.Location)

func (*MethodNode) SetType

func (n *MethodNode) SetType(t reflect.Type)

func (*MethodNode) Type

func (n *MethodNode) Type() reflect.Type

type NilNode

type NilNode struct {
	// contains filtered or unexported fields
}

func (*NilNode) Location

func (n *NilNode) Location() file.Location

func (*NilNode) SetLocation

func (n *NilNode) SetLocation(loc file.Location)

func (*NilNode) SetType

func (n *NilNode) SetType(t reflect.Type)

func (*NilNode) Type

func (n *NilNode) Type() reflect.Type

type Node

type Node interface {
	Location() file.Location
	SetLocation(file.Location)
	Type() reflect.Type
	SetType(reflect.Type)
}

Node represents items of abstract syntax tree.

type PairNode

type PairNode struct {
	Key   Node
	Value Node
	// contains filtered or unexported fields
}

func (*PairNode) Location

func (n *PairNode) Location() file.Location

func (*PairNode) SetLocation

func (n *PairNode) SetLocation(loc file.Location)

func (*PairNode) SetType

func (n *PairNode) SetType(t reflect.Type)

func (*PairNode) Type

func (n *PairNode) Type() reflect.Type

type PointerNode

type PointerNode struct {
	// contains filtered or unexported fields
}

func (*PointerNode) Location

func (n *PointerNode) Location() file.Location

func (*PointerNode) SetLocation

func (n *PointerNode) SetLocation(loc file.Location)

func (*PointerNode) SetType

func (n *PointerNode) SetType(t reflect.Type)

func (*PointerNode) Type

func (n *PointerNode) Type() reflect.Type

type PropertyNode

type PropertyNode struct {
	Node     Node
	Property string
	// contains filtered or unexported fields
}

func (*PropertyNode) Location

func (n *PropertyNode) Location() file.Location

func (*PropertyNode) SetLocation

func (n *PropertyNode) SetLocation(loc file.Location)

func (*PropertyNode) SetType

func (n *PropertyNode) SetType(t reflect.Type)

func (*PropertyNode) Type

func (n *PropertyNode) Type() reflect.Type

type SliceNode

type SliceNode struct {
	Node Node
	From Node
	To   Node
	// contains filtered or unexported fields
}

func (*SliceNode) Location

func (n *SliceNode) Location() file.Location

func (*SliceNode) SetLocation

func (n *SliceNode) SetLocation(loc file.Location)

func (*SliceNode) SetType

func (n *SliceNode) SetType(t reflect.Type)

func (*SliceNode) Type

func (n *SliceNode) Type() reflect.Type

type StringNode

type StringNode struct {
	Value string
	// contains filtered or unexported fields
}

func (*StringNode) Location

func (n *StringNode) Location() file.Location

func (*StringNode) SetLocation

func (n *StringNode) SetLocation(loc file.Location)

func (*StringNode) SetType

func (n *StringNode) SetType(t reflect.Type)

func (*StringNode) Type

func (n *StringNode) Type() reflect.Type

type UnaryNode

type UnaryNode struct {
	Operator string
	Node     Node
	// contains filtered or unexported fields
}

func (*UnaryNode) Location

func (n *UnaryNode) Location() file.Location

func (*UnaryNode) SetLocation

func (n *UnaryNode) SetLocation(loc file.Location)

func (*UnaryNode) SetType

func (n *UnaryNode) SetType(t reflect.Type)

func (*UnaryNode) Type

func (n *UnaryNode) Type() reflect.Type

type Visitor

type Visitor interface {
	Enter(node *Node)
	Exit(node *Node)
}

Jump to

Keyboard shortcuts

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