ast

package
v0.0.0-...-e9dc133 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NOT_METHOD = iota
	NORMAL_METHOD
	STATIC_METHOD
	GETTER_METHOD
	SETTER_METHOD
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayExpression

type ArrayExpression struct {
	Items []Expression
}

func (*ArrayExpression) Accept

func (e *ArrayExpression) Accept(v ExpressionVisitor) any

type AssignmentExpression

type AssignmentExpression struct {
	Name  *token.Token
	Value Expression
}

func (*AssignmentExpression) Accept

type BinaryExpression

type BinaryExpression struct {
	Left, Right Expression
	Operator    *token.Token
}

func (*BinaryExpression) Accept

func (b *BinaryExpression) Accept(v ExpressionVisitor) any

type BlockStatement

type BlockStatement struct {
	Statements []Statement
}

func (*BlockStatement) Accept

func (s *BlockStatement) Accept(v StatementVisitor)

type BreakStatement

type BreakStatement struct {
	Keyword *token.Token
}

func (*BreakStatement) Accept

func (s *BreakStatement) Accept(v StatementVisitor)

type CallExpression

type CallExpression struct {
	Callee       Expression
	Arguments    []Expression
	ClosingParen *token.Token
}

func (*CallExpression) Accept

func (e *CallExpression) Accept(v ExpressionVisitor) any

type ClassStatement

type ClassStatement struct {
	Name       *token.Token
	Methods    []*FunctionStatement
	Superclass *VariableExpression
}

func (*ClassStatement) Accept

func (s *ClassStatement) Accept(v StatementVisitor)

type ContinueStatement

type ContinueStatement struct {
	Keyword *token.Token
}

func (*ContinueStatement) Accept

func (s *ContinueStatement) Accept(v StatementVisitor)

type Expression

type Expression interface {
	Accept(ExpressionVisitor) any
}

type ExpressionStatement

type ExpressionStatement struct {
	Expr Expression
}

func (*ExpressionStatement) Accept

type ExpressionVisitor

type ExpressionVisitor interface {
	VisitBinaryExpression(*BinaryExpression) any
	VisitTernaryExpression(*TernaryExpression) any
	VisitLogicalExpression(*LogicalExpression) any
	VisitGroupedExpression(*GroupingExpression) any
	VisitUnaryExpression(*UnaryExpression) any
	VisitLiteralExpression(*LiteralExpression) any
	VisitVariableExpression(*VariableExpression) any
	VisitAssignmentExpression(*AssignmentExpression) any
	VisitCallExpression(*CallExpression) any
	VisitLambdaExpression(*LambdaExpression) any
	VisitSequenceExpression(*SequenceExpression) any
	VisitArrayExpression(*ArrayExpression) any
	VisitMapExpression(*MapExpression) any
	VisitIndexExpression(*IndexExpression) any
	VisitIndexedAssignmentExpression(*IndexedAssignmentExpression) any
	VisitGetExpression(*GetExpression) any
	VisitSetExpression(*SetExpression) any
	VisitThisExpression(*ThisExpression) any
	VisitSuperGetExpression(*SuperGetExpression) any
	VisitSuperSetExpression(*SuperSetExpression) any
}

type ForEachStatement

type ForEachStatement struct {
	VariableName *token.Token
	Array        Expression
	Body         Statement
}

func (*ForEachStatement) Accept

func (s *ForEachStatement) Accept(v StatementVisitor)

type FunctionStatement

type FunctionStatement struct {
	Name   *token.Token
	Params []*token.Token
	Body   []Statement
	Kind   MethodType
}

func (*FunctionStatement) Accept

func (s *FunctionStatement) Accept(v StatementVisitor)

type GetExpression

type GetExpression struct {
	Object Expression
	Name   *token.Token
}

func (*GetExpression) Accept

func (e *GetExpression) Accept(v ExpressionVisitor) any

type GroupingExpression

type GroupingExpression struct {
	Expr Expression
}

func (*GroupingExpression) Accept

type IfStatement

type IfStatement struct {
	Condition                Expression
	Consequence, Alternative Statement
}

func (*IfStatement) Accept

func (s *IfStatement) Accept(v StatementVisitor)

type IndexExpression

type IndexExpression struct {
	Object         Expression
	LeftIndex      Expression
	RightIndex     Expression
	ClosingBracket *token.Token
}

func (*IndexExpression) Accept

func (e *IndexExpression) Accept(v ExpressionVisitor) any

type IndexedAssignmentExpression

type IndexedAssignmentExpression struct {
	Left  *IndexExpression
	Value Expression
}

func (*IndexedAssignmentExpression) Accept

type LambdaExpression

type LambdaExpression struct {
	Operator *token.Token
	Function *FunctionStatement
}

func (*LambdaExpression) Accept

func (e *LambdaExpression) Accept(v ExpressionVisitor) any

type LiteralExpression

type LiteralExpression struct {
	Value any
}

func (*LiteralExpression) Accept

type LogicalExpression

type LogicalExpression struct {
	Left, Right Expression
	Operator    *token.Token
}

func (*LogicalExpression) Accept

type LoopStatement

type LoopStatement struct {
	Condition Expression
	Body      Statement
	Increment Expression
}

func (*LoopStatement) Accept

func (s *LoopStatement) Accept(v StatementVisitor)

type MapExpression

type MapExpression struct {
	OpeningBrace *token.Token
	Keys         []Expression
	Values       []Expression
}

func (*MapExpression) Accept

func (e *MapExpression) Accept(v ExpressionVisitor) any

type MethodType

type MethodType int

type ReturnStatement

type ReturnStatement struct {
	Keyword *token.Token
	Value   Expression
}

func (*ReturnStatement) Accept

func (s *ReturnStatement) Accept(v StatementVisitor)

type SequenceExpression

type SequenceExpression struct {
	Items []Expression
}

func (*SequenceExpression) Accept

type SetExpression

type SetExpression struct {
	Object, Value Expression
	Name          *token.Token
}

func (*SetExpression) Accept

func (e *SetExpression) Accept(v ExpressionVisitor) any

type Statement

type Statement interface {
	Accept(StatementVisitor)
}

type StatementVisitor

type StatementVisitor interface {
	VisitExpressionStatement(*ExpressionStatement)
	VisitVarStatement(*VarStatement)
	VisitBlockStatement(*BlockStatement)
	VisitIfStatement(*IfStatement)
	VisitLoopStatement(*LoopStatement)
	VisitForEachStatement(*ForEachStatement)
	VisitFunctionStatement(*FunctionStatement)
	VisitReturnStatement(*ReturnStatement)
	VisitBreakStatement(*BreakStatement)
	VisitContinueStatement(*ContinueStatement)
	VisitClassStatement(*ClassStatement)
}

type SuperGetExpression

type SuperGetExpression struct {
	Keyword, Method *token.Token
}

func (*SuperGetExpression) Accept

type SuperSetExpression

type SuperSetExpression struct {
	Keyword, Method *token.Token
	Value           Expression
}

func (*SuperSetExpression) Accept

type TernaryExpression

type TernaryExpression struct {
	Condition, Consequence, Alternative Expression
	Operator                            *token.Token
}

func (*TernaryExpression) Accept

type ThisExpression

type ThisExpression struct {
	Keyword *token.Token
}

func (*ThisExpression) Accept

func (e *ThisExpression) Accept(v ExpressionVisitor) any

type UnaryExpression

type UnaryExpression struct {
	Expr     Expression
	Operator *token.Token
}

func (*UnaryExpression) Accept

func (u *UnaryExpression) Accept(v ExpressionVisitor) any

type VarStatement

type VarStatement struct {
	Name        *token.Token
	Initializer Expression
}

func (*VarStatement) Accept

func (s *VarStatement) Accept(v StatementVisitor)

type VariableExpression

type VariableExpression struct {
	Name *token.Token
}

func (*VariableExpression) Accept

Jump to

Keyboard shortcuts

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