ast

package
v0.0.0-...-5655933 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryExpr

type BinaryExpr struct {
	LHS, RHS Node
	Op       int
	// contains filtered or unexported fields
}

func (*BinaryExpr) Pos

func (n *BinaryExpr) Pos() *position.Position

func (*BinaryExpr) SetType

func (n *BinaryExpr) SetType(t types.Type)

func (*BinaryExpr) Type

func (n *BinaryExpr) Type() types.Type

type BuiltinExpr

type BuiltinExpr struct {
	P    position.Position
	Name string
	Args Node
	// contains filtered or unexported fields
}

func (*BuiltinExpr) Pos

func (n *BuiltinExpr) Pos() *position.Position

func (*BuiltinExpr) SetType

func (n *BuiltinExpr) SetType(t types.Type)

func (*BuiltinExpr) Type

func (n *BuiltinExpr) Type() types.Type

type CaprefTerm

type CaprefTerm struct {
	P       position.Position
	Name    string
	IsNamed bool // true if the capref is a named reference, not positional
	Symbol  *symbol.Symbol
}

func (*CaprefTerm) Pos

func (n *CaprefTerm) Pos() *position.Position

func (*CaprefTerm) Type

func (n *CaprefTerm) Type() types.Type

type CondStmt

type CondStmt struct {
	Cond  Node
	Truth Node
	Else  Node
	Scope *symbol.Scope // a conditional expression can cause new variables to be defined
}

func (*CondStmt) Pos

func (n *CondStmt) Pos() *position.Position

func (*CondStmt) Type

func (n *CondStmt) Type() types.Type

type ConvExpr

type ConvExpr struct {
	N Node
	// contains filtered or unexported fields
}

func (*ConvExpr) Pos

func (n *ConvExpr) Pos() *position.Position

func (*ConvExpr) SetType

func (n *ConvExpr) SetType(t types.Type)

func (*ConvExpr) Type

func (n *ConvExpr) Type() types.Type

type DecoDecl

type DecoDecl struct {
	P      position.Position
	Name   string
	Block  Node
	Symbol *symbol.Symbol
	Scope  *symbol.Scope // The declaration creates its own scope, as a zygote to be instantiated later.
}

func (*DecoDecl) Pos

func (n *DecoDecl) Pos() *position.Position

func (*DecoDecl) Type

func (n *DecoDecl) Type() types.Type

type DecoStmt

type DecoStmt struct {
	P     position.Position
	Name  string
	Block Node
	Decl  *DecoDecl     // Pointer to the declaration of the decorator this statement invokes.
	Scope *symbol.Scope // Instantiated with a copy of the Def's Scope.
}

func (*DecoStmt) Pos

func (n *DecoStmt) Pos() *position.Position

func (*DecoStmt) Type

func (n *DecoStmt) Type() types.Type

type DelStmt

type DelStmt struct {
	P      position.Position
	N      Node
	Expiry time.Duration
}

func (*DelStmt) Pos

func (n *DelStmt) Pos() *position.Position

func (*DelStmt) Type

func (n *DelStmt) Type() types.Type

type Error

type Error struct {
	P        position.Position
	Spelling string
}

func (*Error) Pos

func (n *Error) Pos() *position.Position

func (*Error) Type

func (n *Error) Type() types.Type

type ExprList

type ExprList struct {
	Children []Node
	// contains filtered or unexported fields
}

func (*ExprList) Pos

func (n *ExprList) Pos() *position.Position

func (*ExprList) SetType

func (n *ExprList) SetType(t types.Type)

func (*ExprList) Type

func (n *ExprList) Type() types.Type

type FloatLit

type FloatLit struct {
	P position.Position
	F float64
}

func (*FloatLit) Pos

func (n *FloatLit) Pos() *position.Position

func (*FloatLit) Type

func (n *FloatLit) Type() types.Type

type IDTerm

type IDTerm struct {
	P      position.Position
	Name   string
	Symbol *symbol.Symbol
	Lvalue bool // If set, then this node appears on the left side of an

}

func (*IDTerm) Pos

func (n *IDTerm) Pos() *position.Position

func (*IDTerm) Type

func (n *IDTerm) Type() types.Type

type IndexedExpr

type IndexedExpr struct {
	LHS, Index Node
	// contains filtered or unexported fields
}

func (*IndexedExpr) Pos

func (n *IndexedExpr) Pos() *position.Position

func (*IndexedExpr) SetType

func (n *IndexedExpr) SetType(t types.Type)

func (*IndexedExpr) Type

func (n *IndexedExpr) Type() types.Type

type IntLit

type IntLit struct {
	P position.Position
	I int64
}

func (*IntLit) Pos

func (n *IntLit) Pos() *position.Position

func (*IntLit) Type

func (n *IntLit) Type() types.Type

type NextStmt

type NextStmt struct {
	P position.Position
}

func (*NextStmt) Pos

func (n *NextStmt) Pos() *position.Position

func (*NextStmt) Type

func (n *NextStmt) Type() types.Type

type Node

type Node interface {
	Pos() *position.Position // Returns the position of the node from the original source
	Type() types.Type        // Returns the type of the expression in this node
}

func Walk

func Walk(v Visitor, node Node) Node

Walk traverses (walks) an AST node with the provided Visitor v.

type OtherwiseStmt

type OtherwiseStmt struct {
	P position.Position
}

func (*OtherwiseStmt) Pos

func (n *OtherwiseStmt) Pos() *position.Position

func (*OtherwiseStmt) Type

func (n *OtherwiseStmt) Type() types.Type

type PatternExpr

type PatternExpr struct {
	Expr    Node
	Pattern string // if not empty, the fully defined pattern after typecheck
	Index   int    // reference to the compiled object offset after codegen
}

PatternExpr is the top of a pattern expression.

func (*PatternExpr) Pos

func (n *PatternExpr) Pos() *position.Position

func (*PatternExpr) Type

func (n *PatternExpr) Type() types.Type

type PatternFragment

type PatternFragment struct {
	ID      Node
	Expr    Node
	Symbol  *symbol.Symbol // Optional Symbol for a named pattern
	Pattern string         // If not empty, contains the complete evaluated pattern of the expr
}

PatternFragment holds a named pattern part.

func (*PatternFragment) Pos

func (n *PatternFragment) Pos() *position.Position

func (*PatternFragment) Type

func (n *PatternFragment) Type() types.Type

type PatternLit

type PatternLit struct {
	P       position.Position
	Pattern string
}

PatternLit holds inline constant pattern fragments.

func (*PatternLit) Pos

func (n *PatternLit) Pos() *position.Position

func (*PatternLit) Type

func (n *PatternLit) Type() types.Type

type StmtList

type StmtList struct {
	Scope    *symbol.Scope // Pointer to the local scope for this enclosing block
	Children []Node
}

func (*StmtList) Pos

func (n *StmtList) Pos() *position.Position

func (*StmtList) Type

func (n *StmtList) Type() types.Type

type StopStmt

type StopStmt struct {
	P position.Position
}

func (*StopStmt) Pos

func (n *StopStmt) Pos() *position.Position

func (*StopStmt) Type

func (n *StopStmt) Type() types.Type

type StringLit

type StringLit struct {
	P    position.Position
	Text string
}

func (*StringLit) Pos

func (n *StringLit) Pos() *position.Position

func (*StringLit) Type

func (n *StringLit) Type() types.Type

type UnaryExpr

type UnaryExpr struct {
	P    position.Position // pos is the position of the op
	Expr Node
	Op   int
	// contains filtered or unexported fields
}

func (*UnaryExpr) Pos

func (n *UnaryExpr) Pos() *position.Position

func (*UnaryExpr) SetType

func (n *UnaryExpr) SetType(t types.Type)

func (*UnaryExpr) Type

func (n *UnaryExpr) Type() types.Type

type VarDecl

type VarDecl struct {
	P            position.Position
	Name         string
	Hidden       bool
	Keys         []string
	Limit        int64
	Buckets      []float64
	Kind         metrics.Kind
	ExportedName string
	Symbol       *symbol.Symbol
}

func (*VarDecl) Pos

func (n *VarDecl) Pos() *position.Position

func (*VarDecl) Type

func (n *VarDecl) Type() types.Type

type Visitor

type Visitor interface {
	VisitBefore(n Node) (Visitor, Node)
	VisitAfter(n Node) Node
}

Visitor VisitBefore method is invoked for each node encountered by Walk. If the result Visitor v is not nil, Walk visits each of the children of that node with v. VisitAfter is called on n at the end.

Jump to

Keyboard shortcuts

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