ast

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 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 {
	Token    token.Token
	Elements []Expression
}

array

func (*ArrayLiteral) Column added in v0.1.1

func (al *ArrayLiteral) Column() int

func (*ArrayLiteral) Line added in v0.1.1

func (al *ArrayLiteral) Line() int

func (*ArrayLiteral) String

func (al *ArrayLiteral) String() string

func (*ArrayLiteral) TokenLiteral

func (al *ArrayLiteral) TokenLiteral() string

type BlockStatement

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

func (*BlockStatement) Column added in v0.1.1

func (bs *BlockStatement) Column() int

func (*BlockStatement) Line added in v0.1.1

func (bs *BlockStatement) Line() int

func (*BlockStatement) String

func (bs *BlockStatement) String() string

func (*BlockStatement) TokenLiteral

func (bs *BlockStatement) TokenLiteral() string

type Boolean

type Boolean struct {
	Token token.Token
	Value bool
}

Boolean

func (*Boolean) Column added in v0.1.1

func (b *Boolean) Column() int

func (*Boolean) Line added in v0.1.1

func (b *Boolean) Line() int

func (*Boolean) String

func (b *Boolean) String() string

func (*Boolean) TokenLiteral

func (b *Boolean) TokenLiteral() string

type BreakStatement added in v0.1.10

type BreakStatement struct {
	Token token.Token
}

func (*BreakStatement) Column added in v0.1.10

func (bs *BreakStatement) Column() int

func (*BreakStatement) Line added in v0.1.10

func (bs *BreakStatement) Line() int

func (*BreakStatement) String added in v0.1.10

func (bs *BreakStatement) String() string

func (*BreakStatement) TokenLiteral added in v0.1.10

func (bs *BreakStatement) TokenLiteral() string

type CallExpression

type CallExpression struct {
	Token     token.Token
	Function  Expression
	Arguments []Expression
}

call expression

func (*CallExpression) Column added in v0.1.1

func (ce *CallExpression) Column() int

func (*CallExpression) Line added in v0.1.1

func (ce *CallExpression) Line() int

func (*CallExpression) String

func (ce *CallExpression) String() string

func (*CallExpression) TokenLiteral

func (ce *CallExpression) TokenLiteral() string

type CharLiteral

type CharLiteral struct {
	Token token.Token
	Value rune
}

char

func (*CharLiteral) Column added in v0.1.1

func (sl *CharLiteral) Column() int

func (*CharLiteral) Line added in v0.1.1

func (sl *CharLiteral) Line() int

func (*CharLiteral) String

func (sl *CharLiteral) String() string

func (*CharLiteral) TokenLiteral

func (sl *CharLiteral) TokenLiteral() string

type ConstStatement added in v0.1.10

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

func (*ConstStatement) Column added in v0.1.10

func (cs *ConstStatement) Column() int

func (*ConstStatement) Line added in v0.1.10

func (cs *ConstStatement) Line() int

func (*ConstStatement) String added in v0.1.10

func (cs *ConstStatement) String() string

func (*ConstStatement) TokenLiteral added in v0.1.10

func (cs *ConstStatement) TokenLiteral() string

type ContinueStatement added in v0.1.10

type ContinueStatement struct {
	Token token.Token
}

func (*ContinueStatement) Column added in v0.1.10

func (cs *ContinueStatement) Column() int

func (*ContinueStatement) Line added in v0.1.10

func (cs *ContinueStatement) Line() int

func (*ContinueStatement) String added in v0.1.10

func (cs *ContinueStatement) String() string

func (*ContinueStatement) TokenLiteral added in v0.1.10

func (cs *ContinueStatement) TokenLiteral() string

type ELSE_IF added in v0.1.2

type ELSE_IF struct {
	Condition   Expression
	Consequence *BlockStatement
}

type Expression

type Expression interface {
	Node // TokenLiteral and String()
	// contains filtered or unexported methods
}

type ExpressionStatement

type ExpressionStatement struct {
	Token      token.Token
	Expression Expression
}

func (*ExpressionStatement) Column added in v0.1.1

func (i *ExpressionStatement) Column() int

func (*ExpressionStatement) Line added in v0.1.1

func (i *ExpressionStatement) Line() int

func (*ExpressionStatement) String

func (i *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (i *ExpressionStatement) TokenLiteral() string

type FloatLiteral

type FloatLiteral struct {
	Token token.Token
	Value float64
}

float

func (*FloatLiteral) Column added in v0.1.1

func (sl *FloatLiteral) Column() int

func (*FloatLiteral) Line added in v0.1.1

func (sl *FloatLiteral) Line() int

func (*FloatLiteral) String

func (sl *FloatLiteral) String() string

func (*FloatLiteral) TokenLiteral

func (sl *FloatLiteral) TokenLiteral() string

type ForExpression added in v0.1.2

type ForExpression struct {
	Token     token.Token // The 'for' token
	Init      Statement   // e.g., let i = 0;
	Condition Expression  // e.g., i < 10;
	Post      Statement   // e.g., i = i + 1; (usually as an expression statement)
	Body      *BlockStatement
}

func (*ForExpression) Column added in v0.1.2

func (f *ForExpression) Column() int

func (*ForExpression) Line added in v0.1.2

func (f *ForExpression) Line() int

func (*ForExpression) String added in v0.1.2

func (f *ForExpression) String() string

func (*ForExpression) TokenLiteral added in v0.1.2

func (f *ForExpression) TokenLiteral() string

type FunctionLiteral

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

function

func (*FunctionLiteral) Column added in v0.1.1

func (fl *FunctionLiteral) Column() int

func (*FunctionLiteral) Line added in v0.1.1

func (fl *FunctionLiteral) Line() int

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLiteral

func (fl *FunctionLiteral) TokenLiteral() string

type HashLiteral

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

hash literal

func (*HashLiteral) Column added in v0.1.1

func (hl *HashLiteral) Column() int

func (*HashLiteral) Line added in v0.1.1

func (hl *HashLiteral) Line() int

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) Column added in v0.1.1

func (i *Identifier) Column() int

func (*Identifier) Line added in v0.1.1

func (i *Identifier) Line() int

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

type IfExpression

type IfExpression struct {
	Token       token.Token
	Condition   Expression
	Consequence *BlockStatement
	IfElse      []*ELSE_IF
	Alternative *BlockStatement
}

func (*IfExpression) Column added in v0.1.1

func (i *IfExpression) Column() int

func (*IfExpression) Line added in v0.1.1

func (i *IfExpression) Line() int

func (*IfExpression) String

func (i *IfExpression) String() string

func (*IfExpression) TokenLiteral

func (i *IfExpression) TokenLiteral() string

type ImportStatement added in v0.1.4

type ImportStatement struct {
	Token token.Token
	Path  string
}

func (*ImportStatement) Column added in v0.1.4

func (i *ImportStatement) Column() int

func (*ImportStatement) Line added in v0.1.4

func (i *ImportStatement) Line() int

func (*ImportStatement) String added in v0.1.4

func (i *ImportStatement) String() string

func (*ImportStatement) TokenLiteral added in v0.1.4

func (i *ImportStatement) TokenLiteral() string

type IndexExpression

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

array index expression

func (*IndexExpression) Column added in v0.1.1

func (ie *IndexExpression) Column() int

func (*IndexExpression) Line added in v0.1.1

func (ie *IndexExpression) Line() int

func (*IndexExpression) String

func (ie *IndexExpression) String() string

func (*IndexExpression) TokenLiteral

func (ie *IndexExpression) TokenLiteral() string

type InfixExpression

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

func (*InfixExpression) Column added in v0.1.1

func (i *InfixExpression) Column() int

func (*InfixExpression) Line added in v0.1.1

func (i *InfixExpression) Line() int

func (*InfixExpression) String

func (i *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (i *InfixExpression) TokenLiteral() string

type IntegerLiteral

type IntegerLiteral struct {
	Token token.Token
	Value int64
}

func (*IntegerLiteral) Column added in v0.1.1

func (i *IntegerLiteral) Column() int

func (*IntegerLiteral) Line added in v0.1.1

func (i *IntegerLiteral) Line() int

func (*IntegerLiteral) String

func (i *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (i *IntegerLiteral) TokenLiteral() string

type LetStatement

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

func (*LetStatement) Column added in v0.1.1

func (ls *LetStatement) Column() int

func (*LetStatement) Line added in v0.1.1

func (ls *LetStatement) Line() int

func (*LetStatement) String

func (ls *LetStatement) String() string

func (*LetStatement) TokenLiteral

func (ls *LetStatement) TokenLiteral() string

type MemberExpression added in v0.1.4

type MemberExpression struct {
	Token    token.Token
	Object   Expression
	Property *Identifier
}

func (*MemberExpression) Column added in v0.1.4

func (m *MemberExpression) Column() int

func (*MemberExpression) Line added in v0.1.4

func (m *MemberExpression) Line() int

func (*MemberExpression) String added in v0.1.4

func (m *MemberExpression) String() string

func (*MemberExpression) TokenLiteral added in v0.1.4

func (m *MemberExpression) TokenLiteral() string

type Node

type Node interface {
	TokenLiteral() string
	String() string
	Line() int
	Column() int
}

type PrefixExpression

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

func (*PrefixExpression) Column added in v0.1.1

func (i *PrefixExpression) Column() int

func (*PrefixExpression) Line added in v0.1.1

func (i *PrefixExpression) Line() int

func (*PrefixExpression) String

func (i *PrefixExpression) String() string

func (*PrefixExpression) TokenLiteral

func (i *PrefixExpression) TokenLiteral() string

type Program

type Program struct {
	Statements []Statement
}

func (*Program) Column added in v0.1.1

func (p *Program) Column() int

func (*Program) Line added in v0.1.1

func (p *Program) Line() int

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

type ReturnStatement

type ReturnStatement struct {
	Token       token.Token
	ReturnValue Expression
}

func (*ReturnStatement) Column added in v0.1.1

func (i *ReturnStatement) Column() int

func (*ReturnStatement) Line added in v0.1.1

func (i *ReturnStatement) Line() int

func (*ReturnStatement) String

func (i *ReturnStatement) String() string

func (*ReturnStatement) TokenLiteral

func (i *ReturnStatement) TokenLiteral() string

type Statement

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

type StringLiteral

type StringLiteral struct {
	Token token.Token
	Value string
}

strings

func (*StringLiteral) Column added in v0.1.1

func (sl *StringLiteral) Column() int

func (*StringLiteral) Line added in v0.1.1

func (sl *StringLiteral) Line() int

func (*StringLiteral) String

func (sl *StringLiteral) String() string

func (*StringLiteral) TokenLiteral

func (sl *StringLiteral) TokenLiteral() string

type StructLiteral added in v0.1.9

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

func (*StructLiteral) Column added in v0.1.9

func (ss *StructLiteral) Column() int

func (*StructLiteral) Line added in v0.1.9

func (ss *StructLiteral) Line() int

func (*StructLiteral) String added in v0.1.9

func (sl *StructLiteral) String() string

func (*StructLiteral) TokenLiteral added in v0.1.9

func (sl *StructLiteral) TokenLiteral() string

type StructStatement added in v0.1.9

type StructStatement struct {
	Token  token.Token
	Name   *Identifier
	Fields map[string]Expression
}

struct

func (*StructStatement) Column added in v0.1.9

func (ss *StructStatement) Column() int

func (*StructStatement) Line added in v0.1.9

func (ss *StructStatement) Line() int

func (*StructStatement) String added in v0.1.9

func (ss *StructStatement) String() string

func (*StructStatement) TokenLiteral added in v0.1.9

func (ss *StructStatement) TokenLiteral() string

type WhileExpression added in v0.1.2

type WhileExpression struct {
	Token     token.Token
	Condition Expression
	Body      *BlockStatement
}

func (*WhileExpression) Column added in v0.1.2

func (w *WhileExpression) Column() int

func (*WhileExpression) Line added in v0.1.2

func (w *WhileExpression) Line() int

func (*WhileExpression) String added in v0.1.2

func (w *WhileExpression) String() string

func (*WhileExpression) TokenLiteral added in v0.1.2

func (w *WhileExpression) TokenLiteral() string

Jump to

Keyboard shortcuts

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