ast

package
v0.0.0-...-8bbaf59 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 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 {
	Token    token.Token // The token.LBRACKET token
	Elements []Expression
}

func (*ArrayLiteral) String

func (al *ArrayLiteral) String() string

func (*ArrayLiteral) TokenLexeme

func (al *ArrayLiteral) TokenLexeme() string

type Block

type Block struct {
	Token      token.Token // The token.LBRACE token
	Statements []Statement
}

func (*Block) String

func (bs *Block) String() string

func (*Block) TokenLexeme

func (bs *Block) TokenLexeme() string

type Boolean

type Boolean struct {
	Token token.Token // The token.TRUE or token.FALSE token
	Value bool
}

func (*Boolean) String

func (b *Boolean) String() string

func (*Boolean) TokenLexeme

func (b *Boolean) TokenLexeme() string

type CallExpression

type CallExpression struct {
	Token    token.Token // The token.LPAREN token
	Function Expression  // Identifier or FunctionLiteral
	Argument []Expression
}

func (*CallExpression) String

func (ce *CallExpression) String() string

func (*CallExpression) TokenLexeme

func (ce *CallExpression) TokenLexeme() string

type Declaration

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

type Expression

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

type ExpressionStatement

type ExpressionStatement struct {
	Token      token.Token // The first token of the expression
	Expression Expression
}

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLexeme

func (es *ExpressionStatement) TokenLexeme() string

type FunctionLiteral

type FunctionLiteral struct {
	Token      token.Token // The token.FN token
	Parameters []*Identifier
	Body       *Block
}

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLexeme

func (fl *FunctionLiteral) TokenLexeme() string

type GroupedExpression

type GroupedExpression struct {
	Token      token.Token // The token.LPAREN token
	Expression Expression
}

func (*GroupedExpression) String

func (ge *GroupedExpression) String() string

func (*GroupedExpression) TokenLexeme

func (ge *GroupedExpression) TokenLexeme() string

type HashLiteral

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

func (*HashLiteral) String

func (hl *HashLiteral) String() string

func (*HashLiteral) TokenLexeme

func (hl *HashLiteral) TokenLexeme() string

type Identifier

type Identifier struct {
	Token token.Token // The token.IDENT token
	Value string
}

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLexeme

func (i *Identifier) TokenLexeme() string

type IfExpression

type IfExpression struct {
	Token       token.Token // The token.IF token
	Condition   Expression
	Consequence *Block
	Alternative *Block
}

func (*IfExpression) String

func (ie *IfExpression) String() string

func (*IfExpression) TokenLexeme

func (ie *IfExpression) TokenLexeme() string

type IndexExpression

type IndexExpression struct {
	Token token.Token // The token.LBRACKET token
	Left  Expression
	Index Expression
}

func (*IndexExpression) String

func (ie *IndexExpression) String() string

func (*IndexExpression) TokenLexeme

func (ie *IndexExpression) TokenLexeme() string

type InfixExpression

type InfixExpression struct {
	Token    token.Token // The operator token, e.g. +
	Left     Expression
	Operator string
	Right    Expression
}

func (*InfixExpression) String

func (ie *InfixExpression) String() string

func (*InfixExpression) TokenLexeme

func (ie *InfixExpression) TokenLexeme() string

type LetDeclaration

type LetDeclaration struct {
	Token token.Token // The token.LET token
	Name  *Identifier
	Value Expression
}

func (*LetDeclaration) String

func (ld *LetDeclaration) String() string

func (*LetDeclaration) TokenLexeme

func (ld *LetDeclaration) TokenLexeme() string

type MacroLiteral

type MacroLiteral struct {
	Token      token.Token // The token.MACRO token
	Parameters []*Identifier
	Body       *Block
}

func (*MacroLiteral) String

func (ml *MacroLiteral) String() string

func (*MacroLiteral) TokenLexeme

func (ml *MacroLiteral) TokenLexeme() string

type Modifier

type Modifier func(Node) Node

type Node

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

func Modify

func Modify(node Node, modifier Modifier) Node

type NumberLiteral

type NumberLiteral struct {
	Token token.Token // The token.NUMBER token
	Value float64
}

func (*NumberLiteral) String

func (il *NumberLiteral) String() string

func (*NumberLiteral) TokenLexeme

func (il *NumberLiteral) TokenLexeme() string

type PrefixExpression

type PrefixExpression struct {
	Token    token.Token // The operator token, e.g. !
	Operator string
	Right    Expression
}

func (*PrefixExpression) String

func (pe *PrefixExpression) String() string

func (*PrefixExpression) TokenLexeme

func (pe *PrefixExpression) TokenLexeme() string

type Program

type Program struct {
	Statements []Statement
}

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLexeme

func (p *Program) TokenLexeme() string

type ReturnStatement

type ReturnStatement struct {
	Token       token.Token // The token.RETURN token
	ReturnValue Expression
}

func (*ReturnStatement) String

func (rs *ReturnStatement) String() string

func (*ReturnStatement) TokenLexeme

func (rs *ReturnStatement) TokenLexeme() string

type Statement

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

type StringLiteral

type StringLiteral struct {
	Token token.Token // The token.STRING token
	Value string
}

func (*StringLiteral) String

func (sl *StringLiteral) String() string

func (*StringLiteral) TokenLexeme

func (sl *StringLiteral) TokenLexeme() string

Jump to

Keyboard shortcuts

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