expr

package
v0.0.0-...-fa0b8d5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 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 Binary

type Binary struct {
	Left     Expr
	Operator internal.Token
	Right    Expr
}

func (*Binary) Accept

func (b *Binary) Accept(v Visitor) any

type Expr

type Expr interface {
	Accept(Visitor) any
}

func NewBinary

func NewBinary(left Expr, operator internal.Token, right Expr) Expr

func NewGrouping

func NewGrouping(expression Expr) Expr

func NewLiteral

func NewLiteral(value any) Expr

func NewUnary

func NewUnary(operator internal.Token, right Expr) Expr

type ExprVisitor

type ExprVisitor struct{}

func (ExprVisitor) VisitBinaryExpr

func (v ExprVisitor) VisitBinaryExpr(b *Binary) any

func (ExprVisitor) VisitGroupingExpr

func (v ExprVisitor) VisitGroupingExpr(g *Grouping) any

func (ExprVisitor) VisitLiteralExpr

func (v ExprVisitor) VisitLiteralExpr(l *Literal) any

func (ExprVisitor) VisitUnaryExpr

func (v ExprVisitor) VisitUnaryExpr(u *Unary) any

type Grouping

type Grouping struct {
	Expression Expr
}

func (*Grouping) Accept

func (g *Grouping) Accept(v Visitor) any

type Literal

type Literal struct {
	Value any
}

func (*Literal) Accept

func (l *Literal) Accept(v Visitor) any

type PrintifyVisitor

type PrintifyVisitor struct{}

func (PrintifyVisitor) Print

func (v PrintifyVisitor) Print(expression Expr)

func (PrintifyVisitor) String

func (v PrintifyVisitor) String(expression Expr) string

func (PrintifyVisitor) VisitBinaryExpr

func (v PrintifyVisitor) VisitBinaryExpr(b *Binary) any

func (PrintifyVisitor) VisitGroupingExpr

func (v PrintifyVisitor) VisitGroupingExpr(g *Grouping) any

func (PrintifyVisitor) VisitLiteralExpr

func (v PrintifyVisitor) VisitLiteralExpr(l *Literal) any

func (PrintifyVisitor) VisitUnaryExpr

func (v PrintifyVisitor) VisitUnaryExpr(u *Unary) any

type Unary

type Unary struct {
	Operator internal.Token
	Right    Expr
}

func (*Unary) Accept

func (u *Unary) Accept(v Visitor) any

type Visitor

type Visitor interface {
	VisitBinaryExpr(b *Binary) any
	VisitGroupingExpr(g *Grouping) any
	VisitLiteralExpr(l *Literal) any
	VisitUnaryExpr(u *Unary) any
}

Jump to

Keyboard shortcuts

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