ast

package
v0.0.0-...-95ae90b Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Token    token.Token // the '[' token
	Elements []Expression
}

func (*Array) String

func (a *Array) String() string

func (*Array) TokenLiteral

func (a *Array) TokenLiteral() string

type AssignStatement

type AssignStatement struct {
	Token token.Token // the token.DEF token
	Left  Expression
	Value Expression
}

func (*AssignStatement) String

func (a *AssignStatement) String() string

func (*AssignStatement) TokenLiteral

func (a *AssignStatement) TokenLiteral() string

type AttributeExpression

type AttributeExpression struct {
	Token token.Token
	Left  Expression
	Index *StringLiteral
}

func (*AttributeExpression) String

func (i *AttributeExpression) String() string

func (*AttributeExpression) TokenLiteral

func (i *AttributeExpression) TokenLiteral() string

type BlockStatement

type BlockStatement struct {
	Token      token.Token // the { 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
	Value bool
}

func (*Boolean) String

func (b *Boolean) String() string

func (*Boolean) TokenLiteral

func (b *Boolean) TokenLiteral() string

type BreakStatement

type BreakStatement struct {
	Token token.Token
}

func (*BreakStatement) String

func (b *BreakStatement) String() string

func (*BreakStatement) TokenLiteral

func (b *BreakStatement) TokenLiteral() string

type CallExpression

type CallExpression struct {
	Token     token.Token // The '(' token
	Function  Expression  // Identifier or FunctionLiteral
	Arguments []Expression
}

func (*CallExpression) String

func (ce *CallExpression) String() string

func (*CallExpression) TokenLiteral

func (ce *CallExpression) TokenLiteral() string

type ClassLiteral

type ClassLiteral struct {
	Token   token.Token
	Name    string
	Parent  string
	Fields  []*DefStatement
	Methods map[string]*FunctionLiteral
}

func (*ClassLiteral) String

func (c *ClassLiteral) String() string

func (*ClassLiteral) TokenLiteral

func (c *ClassLiteral) TokenLiteral() string

type CompareExpression

type CompareExpression struct {
	Token token.Token // and, or
	Left  Expression
	Right Expression
}

func (*CompareExpression) String

func (i *CompareExpression) String() string

func (*CompareExpression) TokenLiteral

func (i *CompareExpression) TokenLiteral() string

type ContinueStatement

type ContinueStatement struct {
	Token token.Token
}

func (*ContinueStatement) String

func (c *ContinueStatement) String() string

func (*ContinueStatement) TokenLiteral

func (c *ContinueStatement) TokenLiteral() string

type DefStatement

type DefStatement struct {
	Token token.Token // the token.DEF token
	Const bool
	Name  *Identifier
	Value Expression
}

func (*DefStatement) String

func (d *DefStatement) String() string

func (*DefStatement) TokenLiteral

func (d *DefStatement) TokenLiteral() string

type DeleteStatement

type DeleteStatement struct {
	Token token.Token
	Name  string
}

func (*DeleteStatement) String

func (d *DeleteStatement) String() string

func (*DeleteStatement) TokenLiteral

func (d *DeleteStatement) TokenLiteral() string

type DoExpression

type DoExpression struct {
	Token      token.Token
	Statements *BlockStatement
}

func (*DoExpression) String

func (d *DoExpression) String() string

func (*DoExpression) TokenLiteral

func (d *DoExpression) TokenLiteral() string

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) TokenLiteral

func (es *ExpressionStatement) TokenLiteral() string

type FloatLiteral

type FloatLiteral struct {
	Token token.Token // the token.FLOAT token
	Value float64
}

func (*FloatLiteral) String

func (f *FloatLiteral) String() string

func (*FloatLiteral) TokenLiteral

func (f *FloatLiteral) TokenLiteral() string

type FunctionLiteral

type FunctionLiteral struct {
	Token      token.Token // The 'func' token
	Name       string
	FQName     string
	Native     bool
	Parameters []*Identifier
	Body       *BlockStatement
}

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLiteral

func (fl *FunctionLiteral) TokenLiteral() string

type HashLiteral

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

func (*HashLiteral) String

func (h *HashLiteral) String() string

func (*HashLiteral) TokenLiteral

func (h *HashLiteral) TokenLiteral() 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) TokenLiteral

func (i *Identifier) TokenLiteral() string

type IfExpression

type IfExpression struct {
	Token       token.Token // The 'if' token
	Condition   Expression
	Consequence *BlockStatement
	Alternative *BlockStatement
}

func (*IfExpression) String

func (ie *IfExpression) String() string

func (*IfExpression) TokenLiteral

func (ie *IfExpression) TokenLiteral() string

type IfaceMethodDef

type IfaceMethodDef struct {
	Name   string
	Params []string
}

type ImportStatement

type ImportStatement struct {
	Token token.Token // the token.Import token
	Path  *StringLiteral
	Name  *Identifier
}

func (*ImportStatement) String

func (i *ImportStatement) String() string

func (*ImportStatement) TokenLiteral

func (i *ImportStatement) TokenLiteral() string

type IndexExpression

type IndexExpression struct {
	Token token.Token // The '[' token
	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 {
	Token    token.Token // the infix token, e.g. +, <
	Left     Expression
	Operator string
	Right    Expression
}

func (*InfixExpression) String

func (i *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (i *InfixExpression) TokenLiteral() string

type IntegerLiteral

type IntegerLiteral struct {
	Token token.Token // the token.INT token
	Value int64
}

func (*IntegerLiteral) String

func (i *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (i *IntegerLiteral) TokenLiteral() string

type InterfaceLiteral

type InterfaceLiteral struct {
	Token   token.Token
	Name    string
	Methods map[string]*IfaceMethodDef
}

func (*InterfaceLiteral) String

func (c *InterfaceLiteral) String() string

func (*InterfaceLiteral) TokenLiteral

func (c *InterfaceLiteral) TokenLiteral() string

type IterLoopStatement

type IterLoopStatement struct {
	Token token.Token
	Key   *Identifier
	Value *Identifier
	Iter  Expression
	Body  *BlockStatement
}

func (*IterLoopStatement) String

func (fl *IterLoopStatement) String() string

func (*IterLoopStatement) TokenLiteral

func (fl *IterLoopStatement) TokenLiteral() string

type LoopStatement

type LoopStatement struct {
	Token     token.Token
	Init      *DefStatement
	Condition Expression
	Iter      Node
	Body      *BlockStatement
}

func (*LoopStatement) String

func (fl *LoopStatement) String() string

func (*LoopStatement) TokenLiteral

func (fl *LoopStatement) TokenLiteral() string

type NewInstance

type NewInstance struct {
	Token     token.Token
	Class     Expression
	Arguments []Expression
}

func (*NewInstance) String

func (m *NewInstance) String() string

func (*NewInstance) TokenLiteral

func (m *NewInstance) TokenLiteral() string

type Node

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

type NullLiteral

type NullLiteral struct {
	Token token.Token // the token.NULL token
}

func (*NullLiteral) String

func (n *NullLiteral) String() string

func (*NullLiteral) TokenLiteral

func (n *NullLiteral) TokenLiteral() string

type PassStatement

type PassStatement struct {
	Token token.Token
}

func (*PassStatement) String

func (b *PassStatement) String() string

func (*PassStatement) TokenLiteral

func (b *PassStatement) TokenLiteral() string

type PrefixExpression

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

func (*PrefixExpression) String

func (p *PrefixExpression) String() string

func (*PrefixExpression) TokenLiteral

func (p *PrefixExpression) TokenLiteral() string

type Program

type Program struct {
	Filename   string
	Statements []Statement
}

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

type ReturnStatement

type ReturnStatement struct {
	Token token.Token // the 'return' token
	Value Expression
}

func (*ReturnStatement) String

func (r *ReturnStatement) String() string

func (*ReturnStatement) TokenLiteral

func (r *ReturnStatement) TokenLiteral() string

type Statement

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

type StringLiteral

type StringLiteral struct {
	Token token.Token
	Value []rune
}

func (*StringLiteral) String

func (s *StringLiteral) String() string

func (*StringLiteral) TokenLiteral

func (s *StringLiteral) TokenLiteral() string

type ThrowStatement

type ThrowStatement struct {
	Token      token.Token
	Expression Expression
}

func (*ThrowStatement) String

func (t *ThrowStatement) String() string

func (*ThrowStatement) TokenLiteral

func (t *ThrowStatement) TokenLiteral() string

type TryCatchExpression

type TryCatchExpression struct {
	Try    *BlockStatement
	Catch  *BlockStatement
	Symbol *Identifier
}

func (*TryCatchExpression) String

func (t *TryCatchExpression) String() string

func (*TryCatchExpression) TokenLiteral

func (t *TryCatchExpression) TokenLiteral() string

Jump to

Keyboard shortcuts

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