ast

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 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 ArrayLiteral

type ArrayLiteral struct {
	LineMetadata
	Token    token.Token
	Elements []Expression
}

func (*ArrayLiteral) String

func (al *ArrayLiteral) String() string

func (*ArrayLiteral) TokenLiteral

func (al *ArrayLiteral) TokenLiteral() string

type BlockStatement

type BlockStatement struct {
	LineMetadata
	Token      token.Token
	Statements []Statement
}

func (*BlockStatement) String

func (bs *BlockStatement) String() string

func (*BlockStatement) TokenLiteral

func (bs *BlockStatement) TokenLiteral() string

type Boolean

type Boolean struct {
	LineMetadata
	Token token.Token
	Value bool
}

func (*Boolean) String

func (b *Boolean) String() string

func (*Boolean) TokenLiteral

func (b *Boolean) TokenLiteral() string

type CallExpression

type CallExpression struct {
	LineMetadata
	Token token.Token
	// this can either be an identifier e.g. fun1()
	// or a func literal e.g. fun(a){ a }(12)
	Function  Expression
	Arguments []Expression
}

func (*CallExpression) String

func (ce *CallExpression) String() string

func (*CallExpression) TokenLiteral

func (ce *CallExpression) TokenLiteral() string

type Expression

type Expression interface {
	Node
	// contains filtered or unexported methods
}

type ExpressionStatement

type ExpressionStatement struct {
	LineMetadata
	Token      token.Token
	Expression Expression
}

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (es *ExpressionStatement) TokenLiteral() string

type FunctionLiteral

type FunctionLiteral struct {
	LineMetadata
	Token      token.Token
	Parameters []*Identifier
	Body       *BlockStatement
}

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLiteral

func (fl *FunctionLiteral) TokenLiteral() string

type Identifier

type Identifier struct {
	LineMetadata
	Token token.Token
	Value string
}

func (*Identifier) String

func (id *Identifier) String() string

func (*Identifier) TokenLiteral

func (id *Identifier) TokenLiteral() string

type IfExpression

type IfExpression struct {
	LineMetadata
	Token       token.Token
	Condition   Expression
	Consequence *BlockStatement
	Alternative *BlockStatement
}

func (*IfExpression) String

func (ife *IfExpression) String() string

func (*IfExpression) TokenLiteral

func (ife *IfExpression) TokenLiteral() string

type IndexExpression

type IndexExpression struct {
	LineMetadata
	Token token.Token
	Left  Expression
	Index Expression
}

func (*IndexExpression) String

func (ie *IndexExpression) String() string

func (*IndexExpression) TokenLiteral

func (ie *IndexExpression) TokenLiteral() string

type InfixExpression

type InfixExpression struct {
	LineMetadata
	Token           token.Token
	LeftExpression  Expression
	Operator        string
	RightExpression Expression
}

func (*InfixExpression) String

func (ie *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (ie *InfixExpression) TokenLiteral() string

type IntegerLiteral

type IntegerLiteral struct {
	LineMetadata
	Token token.Token
	Value int64
}

func (*IntegerLiteral) String

func (il *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (il *IntegerLiteral) TokenLiteral() string

type LineMetadata added in v0.4.0

type LineMetadata struct {
	LineNumber int
}

type MapLiteral

type MapLiteral struct {
	LineMetadata
	Token    token.Token
	Mappings map[Expression]Expression
}

func (*MapLiteral) String

func (hl *MapLiteral) String() string

func (*MapLiteral) TokenLiteral

func (hl *MapLiteral) TokenLiteral() string

type MethodCallExpression

type MethodCallExpression struct {
	LineMetadata
	Token  token.Token
	Caller Expression
	Called *CallExpression
}

func (*MethodCallExpression) String

func (ml *MethodCallExpression) String() string

func (*MethodCallExpression) TokenLiteral

func (ml *MethodCallExpression) TokenLiteral() string

type NoOp

type NoOp struct {
	LineMetadata
	Token token.Token
}

func (*NoOp) String

func (no *NoOp) String() string

func (*NoOp) TokenLiteral

func (no *NoOp) TokenLiteral() string

type Node

type Node interface {
	TokenLiteral() string
	String() string
}

type PrefixExpression

type PrefixExpression struct {
	LineMetadata
	Token           token.Token
	Operator        string
	RightExpression Expression
}

func (*PrefixExpression) String

func (pe *PrefixExpression) String() string

func (*PrefixExpression) TokenLiteral

func (pe *PrefixExpression) TokenLiteral() string

type Program

type Program struct {
	LineMetadata
	Statements []Statement
}

func (*Program) String

func (program *Program) String() string

func (*Program) TokenLiteral

func (program *Program) TokenLiteral() string

type ReturnStatement

type ReturnStatement struct {
	LineMetadata
	Token       token.Token
	ReturnValue Expression
}

func (*ReturnStatement) String

func (rs *ReturnStatement) String() string

func (*ReturnStatement) TokenLiteral

func (rs *ReturnStatement) TokenLiteral() string

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

type StringLiteral

type StringLiteral struct {
	LineMetadata
	Token token.Token
	Value string
}

func (*StringLiteral) String

func (sl *StringLiteral) String() string

func (*StringLiteral) TokenLiteral

func (sl *StringLiteral) TokenLiteral() string

type TryExpression

type TryExpression struct {
	LineMetadata
	Token      token.Token
	Expression Expression
}

func (*TryExpression) String

func (te *TryExpression) String() string

func (*TryExpression) TokenLiteral

func (te *TryExpression) TokenLiteral() string

type VarStatement

type VarStatement struct {
	LineMetadata
	Token token.Token
	Name  *Identifier
	Value Expression
}

func (*VarStatement) String

func (vs *VarStatement) String() string

func (*VarStatement) TokenLiteral

func (vs *VarStatement) TokenLiteral() string

Jump to

Keyboard shortcuts

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