ast

package
v0.0.0-...-cad9b24 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 6 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 {
	Elements []Expression
}

func (*ArrayLiteral) String

func (a *ArrayLiteral) String() string

func (*ArrayLiteral) TokenLiteral

func (a *ArrayLiteral) TokenLiteral() string

type AssignmentExpression

type AssignmentExpression struct {
	Token token.Token
	Left  Expression
	Right Expression
}

func (*AssignmentExpression) String

func (ae *AssignmentExpression) String() string

func (*AssignmentExpression) TokenLiteral

func (ae *AssignmentExpression) TokenLiteral() string

type BinaryExpression

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

func (*BinaryExpression) String

func (be *BinaryExpression) String() string

func (*BinaryExpression) TokenLiteral

func (be *BinaryExpression) TokenLiteral() string

type BlockStatement

type BlockStatement struct {
	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 {
	Token token.Token // the token.Boolean token, either true or false
	Value bool
}

func (*Boolean) String

func (b *Boolean) String() string

func (*Boolean) TokenLiteral

func (b *Boolean) TokenLiteral() string

type BooleanLiteral

type BooleanLiteral struct {
	Token token.Token
	Value bool
}

func (*BooleanLiteral) String

func (bl *BooleanLiteral) String() string

func (*BooleanLiteral) TokenLiteral

func (bl *BooleanLiteral) TokenLiteral() string

type CallExpression

type CallExpression struct {
	Function  *Identifier
	Arguments []Expression
}

func (*CallExpression) String

func (c *CallExpression) String() string

func (*CallExpression) TokenLiteral

func (c *CallExpression) TokenLiteral() string

type DeferStatement

type DeferStatement struct {
	Token     token.Token
	Statement Statement
}

func (*DeferStatement) String

func (ds *DeferStatement) String() string

func (*DeferStatement) TokenLiteral

func (ds *DeferStatement) TokenLiteral() string

type Expression

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

type ExpressionStatement

type ExpressionStatement struct {
	Token      token.Token
	Expression Expression
}

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (es *ExpressionStatement) TokenLiteral() string

type FloatLiteral

type FloatLiteral struct {
	Token token.Token
	Value float64
}

func (*FloatLiteral) String

func (il *FloatLiteral) String() string

func (*FloatLiteral) TokenLiteral

func (il *FloatLiteral) TokenLiteral() string

type FunctionCall

type FunctionCall struct {
	FunctionName string
	Token        token.Token
	Function     Expression
	Arguments    []Expression
}

func (*FunctionCall) String

func (f *FunctionCall) String() string

func (*FunctionCall) TokenLiteral

func (f *FunctionCall) TokenLiteral() string

type FunctionDeclaration

type FunctionDeclaration struct {
	ReturnTypes []*Identifier
	Name        *Identifier
	Parameters  []*Parameter
	Body        *BlockStatement
}

func (*FunctionDeclaration) String

func (fd *FunctionDeclaration) String() string

func (*FunctionDeclaration) TokenLiteral

func (fd *FunctionDeclaration) TokenLiteral() string

type FunctionLiteral

type FunctionLiteral struct {
	Token      token.Token // the 'fn' token
	Parameters []*Identifier
	Body       *BlockStatement
}

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLiteral

func (fl *FunctionLiteral) TokenLiteral() string

type FunctionStatement

type FunctionStatement struct {
	IsExported  bool
	Name        *Identifier
	Parameters  []*Parameter
	Body        *BlockStatement
	ReturnTypes []Expression
}

func (*FunctionStatement) ReturnTypesString

func (f *FunctionStatement) ReturnTypesString() string

func (*FunctionStatement) String

func (f *FunctionStatement) String() string

func (*FunctionStatement) TokenLiteral

func (f *FunctionStatement) TokenLiteral() string

type HashLiteral

type HashLiteral struct {
	Token token.Token
	Pairs map[Expression]Expression
}

func (*HashLiteral) String

func (hl *HashLiteral) String() string

func (*HashLiteral) TokenLiteral

func (hl *HashLiteral) TokenLiteral() string

type Identifier

type Identifier struct {
	Token token.Token
	Value string
}

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

type IfStatement

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

func (*IfStatement) String

func (ie *IfStatement) String() string

func (*IfStatement) TokenLiteral

func (ie *IfStatement) TokenLiteral() string

type IndexExpression

type IndexExpression struct {
	Left  Expression
	Index Expression
}

func (*IndexExpression) String

func (i *IndexExpression) String() string

func (*IndexExpression) TokenLiteral

func (i *IndexExpression) TokenLiteral() string

type InfixExpression

type InfixExpression struct {
	Left     Expression
	Operator token.Token
	Right    Expression
}

func (*InfixExpression) String

func (ie *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (ie *InfixExpression) TokenLiteral() string

type Integer

type Integer struct {
	Token token.Token
	Value int64
}

func (*Integer) String

func (i *Integer) String() string

func (*Integer) TokenLiteral

func (i *Integer) TokenLiteral() string

type IntegerLiteral

type IntegerLiteral struct {
	Token token.Token
	Value int64
}

func (*IntegerLiteral) String

func (il *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (il *IntegerLiteral) TokenLiteral() string

type LetStatement

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

func (*LetStatement) String

func (ls *LetStatement) String() string

func (*LetStatement) TokenLiteral

func (ls *LetStatement) TokenLiteral() string

type Node

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

type NumberType

type NumberType struct {
	Token token.Token
	Type  token.Type
}

func (*NumberType) String

func (nt *NumberType) String() string

func (*NumberType) TokenLiteral

func (nt *NumberType) TokenLiteral() string

type Parameter

type Parameter struct {
	Identifier *Identifier
	Type       token.Type
}

func (*Parameter) String

func (p *Parameter) String() string

type PrefixExpression

type PrefixExpression struct {
	Token    token.Token
	Operator token.Token
	Right    Expression
}

func (*PrefixExpression) String

func (pe *PrefixExpression) String() string

func (*PrefixExpression) TokenLiteral

func (pe *PrefixExpression) TokenLiteral() string

type Program

type Program struct {
	Statements []Statement
}

func (*Program) JSON

func (p *Program) JSON() (string, error)

func (*Program) JSONPretty

func (p *Program) JSONPretty() (string, error)

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

type ReturnStatement

type ReturnStatement struct {
	Token        token.Token
	ReturnValues []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 {
	Token token.Token
	Value string
}

func (*StringLiteral) String

func (sl *StringLiteral) String() string

func (*StringLiteral) TokenLiteral

func (sl *StringLiteral) TokenLiteral() string

type StructDefinition

type StructDefinition struct {
	Token  token.Token
	Name   *Identifier
	Fields []*StructField
}

func (*StructDefinition) String

func (sd *StructDefinition) String() string

func (*StructDefinition) TokenLiteral

func (sd *StructDefinition) TokenLiteral() string

type StructField

type StructField struct {
	Token token.Token
	Name  *Identifier
	Type  token.Type
}

func (*StructField) String

func (sf *StructField) String() string

func (*StructField) TokenLiteral

func (sf *StructField) TokenLiteral() string

type StructLiteral

type StructLiteral struct {
	Token      token.Token
	Fields     map[string]Expression
	StructName *Identifier
}

func (*StructLiteral) String

func (sl *StructLiteral) String() string

func (*StructLiteral) TokenLiteral

func (sl *StructLiteral) TokenLiteral() string

type VariableDeclaration

type VariableDeclaration struct {
	Type  token.Token
	Name  *Identifier
	Value Expression
}

func (*VariableDeclaration) String

func (vd *VariableDeclaration) String() string

func (*VariableDeclaration) TokenLiteral

func (vd *VariableDeclaration) TokenLiteral() string

type WhileExpression

type WhileExpression struct {
	Condition Expression
	Body      Statement
	ID        int
}

func (*WhileExpression) String

func (w *WhileExpression) String() string

func (*WhileExpression) TokenLiteral

func (w *WhileExpression) TokenLiteral() string

Jump to

Keyboard shortcuts

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