expressions

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: GPL-3.0 Imports: 4 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 {
	Expr
	interfaces.SourceLocation

	Left     Expr
	Operator tokens.Token
	Right    Expr
}

func (BinaryExpr) Accept

func (b BinaryExpr) Accept(v ExprVisitor) string

func (BinaryExpr) ExprType added in v0.0.8

func (b BinaryExpr) ExprType() ExprType

func (BinaryExpr) ReturnType

func (b BinaryExpr) ReturnType() interfaces.ValueType

type Expr

type Expr interface {
	Accept(v ExprVisitor) string
	ExprType() ExprType
	ReturnType() interfaces.ValueType
}

type ExprType

type ExprType string
const (
	BinaryExprType       ExprType = "Binary"
	GroupingExprType     ExprType = "Grouping"
	LiteralExprType      ExprType = "Literal"
	UnaryExprType        ExprType = "Unary"
	FieldAccessExprType  ExprType = "FieldAccess"
	VariableExprType     ExprType = "Variable"
	FunctionCallExprType ExprType = "FunctionCall"
	LogicalExprType      ExprType = "Logical"
	SliceExprType        ExprType = "SliceString"
	ListExprType         ExprType = "List"
)

type ExprVisitor

type ExprVisitor interface {
	VisitBinary(b BinaryExpr) string
	VisitGrouping(g GroupingExpr) string
	VisitLiteral(l LiteralExpr) string
	VisitUnary(u UnaryExpr) string
	VisitVariable(v VariableExpr) string
	VisitFieldAccess(v FieldAccessExpr) string
	VisitFunctionCall(f FunctionCallExpr) string
	VisitLogical(l LogicalExpr) string
	VisitSlice(s SliceExpr) string
	VisitList(s ListExpr) string
}

type FieldAccessExpr added in v0.0.8

type FieldAccessExpr struct {
	Expr
	interfaces.SourceLocation

	Source Expr
	Field  tokens.Token
	Type   interfaces.ValueType
}

func (FieldAccessExpr) Accept added in v0.0.8

func (v FieldAccessExpr) Accept(visitor ExprVisitor) string

func (FieldAccessExpr) ExprType added in v0.0.8

func (v FieldAccessExpr) ExprType() ExprType

func (FieldAccessExpr) ReturnType added in v0.0.8

func (v FieldAccessExpr) ReturnType() interfaces.ValueType

type FunctionCallExpr

type FunctionCallExpr struct {
	Expr
	interfaces.SourceLocation

	Name      tokens.Token
	Arguments []Expr
	Type      interfaces.ValueType
}

func (FunctionCallExpr) Accept

func (f FunctionCallExpr) Accept(visitor ExprVisitor) string

func (FunctionCallExpr) ExprType added in v0.0.8

func (f FunctionCallExpr) ExprType() ExprType

func (FunctionCallExpr) ReturnType

func (f FunctionCallExpr) ReturnType() interfaces.ValueType

type GroupingExpr

type GroupingExpr struct {
	Expr
	interfaces.SourceLocation

	Expression Expr
}

func (GroupingExpr) Accept

func (g GroupingExpr) Accept(v ExprVisitor) string

func (GroupingExpr) ExprType added in v0.0.8

func (g GroupingExpr) ExprType() ExprType

func (GroupingExpr) ReturnType

func (g GroupingExpr) ReturnType() interfaces.ValueType

type ListExpr added in v0.0.7

type ListExpr struct {
	Expr
	interfaces.SourceLocation

	Elements  []Expr
	ValueType interfaces.ValueType
}

func (ListExpr) Accept added in v0.0.7

func (l ListExpr) Accept(v ExprVisitor) string

func (ListExpr) ExprType added in v0.0.8

func (l ListExpr) ExprType() ExprType

func (ListExpr) ReturnType added in v0.0.7

func (l ListExpr) ReturnType() interfaces.ValueType

type LiteralExpr

type LiteralExpr struct {
	Expr
	interfaces.SourceLocation

	Value     string
	ValueType interfaces.ValueType
}

func (LiteralExpr) Accept

func (l LiteralExpr) Accept(v ExprVisitor) string

func (LiteralExpr) ExprType added in v0.0.8

func (l LiteralExpr) ExprType() ExprType

func (LiteralExpr) ReturnType

func (l LiteralExpr) ReturnType() interfaces.ValueType

type LogicalExpr

type LogicalExpr struct {
	Left     Expr
	Operator tokens.Token
	Right    Expr

	interfaces.SourceLocation
	Expr
}

func (LogicalExpr) Accept

func (l LogicalExpr) Accept(v ExprVisitor) string

func (LogicalExpr) ExprType added in v0.0.8

func (l LogicalExpr) ExprType() ExprType

func (LogicalExpr) ReturnType

func (l LogicalExpr) ReturnType() interfaces.ValueType

type SliceExpr

type SliceExpr struct {
	StartIndex Expr
	EndIndex   Expr
	TargetExpr Expr

	interfaces.SourceLocation
	Expr
}

func (SliceExpr) Accept

func (s SliceExpr) Accept(v ExprVisitor) string

func (SliceExpr) ExprType added in v0.0.8

func (s SliceExpr) ExprType() ExprType

func (SliceExpr) ReturnType

func (s SliceExpr) ReturnType() interfaces.ValueType

type UnaryExpr

type UnaryExpr struct {
	Expr
	interfaces.SourceLocation

	Operator   tokens.Token
	Expression Expr
}

func (UnaryExpr) Accept

func (u UnaryExpr) Accept(v ExprVisitor) string

func (UnaryExpr) ExprType added in v0.0.8

func (u UnaryExpr) ExprType() ExprType

func (UnaryExpr) ReturnType

func (u UnaryExpr) ReturnType() interfaces.ValueType

type VariableExpr

type VariableExpr struct {
	Expr
	interfaces.SourceLocation

	Name tokens.Token
	Type interfaces.ValueType
}

func (VariableExpr) Accept

func (v VariableExpr) Accept(visitor ExprVisitor) string

func (VariableExpr) ExprType added in v0.0.8

func (v VariableExpr) ExprType() ExprType

func (VariableExpr) ReturnType

func (v VariableExpr) ReturnType() interfaces.ValueType

Jump to

Keyboard shortcuts

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