ast

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsType

func AsType[T Expr](e Expr) (T, bool)

func IsType

func IsType[T Expr](e Expr) bool

func LastAsType

func LastAsType[T Expr](e Expr) (T, bool)

Types

type ArrayExpr

type ArrayExpr struct {
	Exprs Expressions
}

type AssignExpr

type AssignExpr struct {
	Variable VariableExpr
	Value    Expr
}

type BinaryExpr

type BinaryExpr struct {
	Left     Expr
	Operator lexer.Token
	Right    Expr
}

type BoolExpr

type BoolExpr struct {
	Value bool
}

type BranchExpr

type BranchExpr struct {
	Exprs []Expr
}

type CallExpr

type CallExpr struct {
	Function string
	Args     Expressions
}

type ChainedExpr

type ChainedExpr struct {
	Exprs Expressions
}

type ConditionalExpr

type ConditionalExpr struct {
	Cond Expr
	Then Expr
	Else Expr
}

type EachExpr

type EachExpr struct {
	Expr Expr
}

type Expr

type Expr interface {
	// contains filtered or unexported methods
}

func BranchExprs

func BranchExprs(exprs ...Expr) Expr

func ChainExprs

func ChainExprs(exprs ...Expr) Expr

func Last

func Last(e Expr) Expr

func RemoveLast

func RemoveLast(e Expr) Expr

type Expressions

type Expressions []Expr

type FilterExpr

type FilterExpr struct {
	Expr Expr
}

type GroupExpr

type GroupExpr struct {
	Expr Expr
}

type IndexExpr

type IndexExpr struct {
	Index Expr
}

type KeyValue

type KeyValue struct {
	Key   Expr
	Value Expr
}

type MapExpr

type MapExpr struct {
	Expr Expr
}

type NullExpr

type NullExpr struct{}

type NumberFloatExpr

type NumberFloatExpr struct {
	Value float64
}

type NumberIntExpr

type NumberIntExpr struct {
	Value int64
}

type ObjectExpr

type ObjectExpr struct {
	Pairs []KeyValue
}

type Program

type Program struct {
	Statements []Statement
}

type PropertyExpr

type PropertyExpr struct {
	// Property can resolve to a string or number.
	// If it resolves to a number, we expect to be reading from an array.
	// If it resolves to a string, we expect to be reading from a map.
	Property Expr
}

type RangeExpr

type RangeExpr struct {
	Start Expr
	End   Expr
}

type RecursiveDescentExpr

type RecursiveDescentExpr struct {
	IsWildcard bool
	Expr       Expr
}

type RegexExpr

type RegexExpr struct {
	Regex *regexp.Regexp
}

type SearchExpr

type SearchExpr struct {
	Expr Expr
}

type SortByExpr

type SortByExpr struct {
	Expr       Expr
	Descending bool
}

type SpreadExpr

type SpreadExpr struct{}

type Statement

type Statement struct {
	Expressions Expr
}

type StringExpr

type StringExpr struct {
	Value string
}

type UnaryExpr

type UnaryExpr struct {
	Operator lexer.Token
	Right    Expr
}

type VariableExpr

type VariableExpr struct {
	Name string
}

Jump to

Keyboard shortcuts

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