ast

package
v0.0.0-...-4ee3718 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callable

type Callable[T any] interface {
	Arity() int
	Call(ExprVisitor[T], ...T) T
}

type Expr

type Expr[T any] interface {
	Accept(v ExprVisitor[T]) T
}

type ExprAssign

type ExprAssign[T any] struct {
	Name  token.Token
	Value Expr[T]
}

func (*ExprAssign[T]) Accept

func (e *ExprAssign[T]) Accept(v ExprVisitor[T]) T

type ExprBinary

type ExprBinary[T any] struct {
	Left  Expr[T]
	Token token.Token
	Right Expr[T]
}

func (*ExprBinary[T]) Accept

func (e *ExprBinary[T]) Accept(v ExprVisitor[T]) T

type ExprCall

type ExprCall[T any] struct {
	Callee    Expr[T]
	Param     token.Token
	Arguments []Expr[T]
}

func (*ExprCall[T]) Accept

func (e *ExprCall[T]) Accept(v ExprVisitor[T]) T

type ExprGrouping

type ExprGrouping[T any] struct {
	Expression Expr[T]
}

func (*ExprGrouping[T]) Accept

func (e *ExprGrouping[T]) Accept(v ExprVisitor[T]) T

type ExprLiteral

type ExprLiteral[T any] struct {
	Value any
}

func (*ExprLiteral[T]) Accept

func (e *ExprLiteral[T]) Accept(v ExprVisitor[T]) T

type ExprLogical

type ExprLogical[T any] struct {
	Left     Expr[T]
	Operator token.Token
	Right    Expr[T]
}

func (*ExprLogical[T]) Accept

func (e *ExprLogical[T]) Accept(v ExprVisitor[T]) T

type ExprUnary

type ExprUnary[T any] struct {
	Token token.Token
	Right Expr[T]
}

func (*ExprUnary[T]) Accept

func (e *ExprUnary[T]) Accept(v ExprVisitor[T]) T

type ExprVariable

type ExprVariable[T any] struct {
	Name token.Token
}

func (*ExprVariable[T]) Accept

func (e *ExprVariable[T]) Accept(v ExprVisitor[T]) T

type ExprVisitor

type ExprVisitor[T any] interface {
	VisitorExprBinary(*ExprBinary[T]) T
	VisitorExprGrouping(*ExprGrouping[T]) T
	VisitorExprLiteral(*ExprLiteral[T]) T
	VisitorExprUnary(*ExprUnary[T]) T
	VisitorExprVariable(*ExprVariable[T]) T
	VisitorExprAssign(*ExprAssign[T]) T
	VisitorExprLogical(*ExprLogical[T]) T
	VisitorExprCall(*ExprCall[T]) T
}

type Stmt

type Stmt[T any] interface {
	Accept(v StmtVisitor[T]) T
}

type StmtBlock

type StmtBlock[T any] struct {
	Statements []Stmt[T]
}

func (*StmtBlock[T]) Accept

func (e *StmtBlock[T]) Accept(v StmtVisitor[T]) T

type StmtExpr

type StmtExpr[T any] struct {
	Expression Expr[T]
}

func (*StmtExpr[T]) Accept

func (e *StmtExpr[T]) Accept(v StmtVisitor[T]) T

type StmtFunction

type StmtFunction[T any] struct {
	Name   token.Token
	Params []token.Token
	Body   Stmt[T]
}

func (*StmtFunction[T]) Accept

func (e *StmtFunction[T]) Accept(v StmtVisitor[T]) T

type StmtIf

type StmtIf[T any] struct {
	Condition  Expr[T]
	ThenBranch Stmt[T]
	ElseBranch Stmt[T]
}

func (*StmtIf[T]) Accept

func (e *StmtIf[T]) Accept(v StmtVisitor[T]) T

type StmtPrint

type StmtPrint[T any] struct {
	Expression Expr[T]
}

func (*StmtPrint[T]) Accept

func (e *StmtPrint[T]) Accept(v StmtVisitor[T]) T

type StmtReturn

type StmtReturn[T any] struct {
	Keyword token.Token
	Value   Expr[T]
}

func (*StmtReturn[T]) Accept

func (e *StmtReturn[T]) Accept(v StmtVisitor[T]) T

type StmtVar

type StmtVar[T any] struct {
	Name        token.Token
	Initializer Expr[T]
}

func (*StmtVar[T]) Accept

func (e *StmtVar[T]) Accept(v StmtVisitor[T]) T

type StmtVisitor

type StmtVisitor[T any] interface {
	VisitorStmtPrint(*StmtPrint[T]) T
	VisitorStmtExpr(*StmtExpr[T]) T
	VisitorStmtVar(*StmtVar[T]) T
	VisitorStmtBlock(*StmtBlock[T]) T
	VisitorStmtIf(*StmtIf[T]) T
	VisitorStmtWhile(*StmtWhile[T]) T
	VisitorStmtFunction(*StmtFunction[T]) T
	VisitorStmtReturn(*StmtReturn[T]) T
}

type StmtWhile

type StmtWhile[T any] struct {
	Condition Expr[T]
	Body      Stmt[T]
}

func (*StmtWhile[T]) Accept

func (e *StmtWhile[T]) Accept(v StmtVisitor[T]) T

Jump to

Keyboard shortcuts

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