ast

package
v0.0.0-...-a130a8b Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 4 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
	Elements []Expression
}

func (*ArrayLiteral) GetToken

func (self *ArrayLiteral) GetToken() token.Token

func (*ArrayLiteral) String

func (self *ArrayLiteral) String() string

func (*ArrayLiteral) TokenLiteral

func (self *ArrayLiteral) TokenLiteral() string

type BlockStatement

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

func (*BlockStatement) GetToken

func (self *BlockStatement) GetToken() token.Token

func (*BlockStatement) String

func (self *BlockStatement) String() string

func (*BlockStatement) TokenLiteral

func (self *BlockStatement) TokenLiteral() string

type Boolean

type Boolean struct {
	Token token.Token
	Value bool
}

func (*Boolean) GetToken

func (self *Boolean) GetToken() token.Token

func (*Boolean) String

func (self *Boolean) String() string

func (*Boolean) TokenLiteral

func (self *Boolean) TokenLiteral() string

type CallExpression

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

func (*CallExpression) GetToken

func (self *CallExpression) GetToken() token.Token

func (*CallExpression) String

func (self *CallExpression) String() string

func (*CallExpression) TokenLiteral

func (self *CallExpression) TokenLiteral() string

type CommentStatement

type CommentStatement struct {
	Token token.Token
	Text  string
}

func (*CommentStatement) GetToken

func (self *CommentStatement) GetToken() token.Token

func (*CommentStatement) String

func (self *CommentStatement) String() string

func (*CommentStatement) TokenLiteral

func (self *CommentStatement) 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) GetToken

func (self *ExpressionStatement) GetToken() token.Token

func (*ExpressionStatement) String

func (self *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (self *ExpressionStatement) TokenLiteral() string

type FunctionLiteral

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

func (*FunctionLiteral) GetToken

func (self *FunctionLiteral) GetToken() token.Token

func (*FunctionLiteral) String

func (self *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLiteral

func (self *FunctionLiteral) TokenLiteral() string

type HashLiteral

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

func (*HashLiteral) GetToken

func (self *HashLiteral) GetToken() token.Token

func (*HashLiteral) String

func (self *HashLiteral) String() string

func (*HashLiteral) TokenLiteral

func (self *HashLiteral) TokenLiteral() string

type Identifier

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

func (*Identifier) GetToken

func (self *Identifier) GetToken() token.Token

func (*Identifier) String

func (self *Identifier) String() string

func (*Identifier) TokenLiteral

func (self *Identifier) TokenLiteral() string

type IfExpression

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

func (*IfExpression) GetToken

func (self *IfExpression) GetToken() token.Token

func (*IfExpression) String

func (self *IfExpression) String() string

func (*IfExpression) TokenLiteral

func (self *IfExpression) TokenLiteral() string

type IndexExpression

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

func (*IndexExpression) GetToken

func (self *IndexExpression) GetToken() token.Token

func (*IndexExpression) String

func (self *IndexExpression) String() string

func (*IndexExpression) TokenLiteral

func (self *IndexExpression) TokenLiteral() string

type InfixExpression

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

func (*InfixExpression) GetToken

func (self *InfixExpression) GetToken() token.Token

func (*InfixExpression) String

func (self *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (self *InfixExpression) TokenLiteral() string

type IntegerLiteral

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

func (*IntegerLiteral) GetToken

func (self *IntegerLiteral) GetToken() token.Token

func (*IntegerLiteral) String

func (self *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (self *IntegerLiteral) TokenLiteral() string

type LazyExpression

type LazyExpression struct {
	Token token.Token // The prefix token, i.e. 'lazy'
	Right Expression
}

func (*LazyExpression) GetToken

func (self *LazyExpression) GetToken() token.Token

func (*LazyExpression) String

func (self *LazyExpression) String() string

func (*LazyExpression) TokenLiteral

func (self *LazyExpression) TokenLiteral() string

type LetStatement

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

func (*LetStatement) GetToken

func (self *LetStatement) GetToken() token.Token

func (*LetStatement) String

func (self *LetStatement) String() string

func (*LetStatement) TokenLiteral

func (self *LetStatement) TokenLiteral() string

type Node

type Node interface {
	TokenLiteral() string
	GetToken() token.Token
	String() string
}

type NullLiteral

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

func (*NullLiteral) GetToken

func (self *NullLiteral) GetToken() token.Token

func (*NullLiteral) String

func (self *NullLiteral) String() string

func (*NullLiteral) TokenLiteral

func (self *NullLiteral) TokenLiteral() string

type PrefixExpression

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

func (*PrefixExpression) GetToken

func (self *PrefixExpression) GetToken() token.Token

func (*PrefixExpression) String

func (self *PrefixExpression) String() string

func (*PrefixExpression) TokenLiteral

func (self *PrefixExpression) TokenLiteral() string

type Program

type Program struct {
	Statements []Statement
}

func (*Program) GetToken

func (self *Program) GetToken() token.Token

func (*Program) String

func (self *Program) String() string

func (*Program) TokenLiteral

func (self *Program) TokenLiteral() string

type ReturnStatement

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

func (*ReturnStatement) GetToken

func (self *ReturnStatement) GetToken() token.Token

func (*ReturnStatement) String

func (self *ReturnStatement) String() string

func (*ReturnStatement) TokenLiteral

func (self *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) GetToken

func (self *StringLiteral) GetToken() token.Token

func (*StringLiteral) String

func (self *StringLiteral) String() string

func (*StringLiteral) TokenLiteral

func (self *StringLiteral) TokenLiteral() string

type Struct

type Struct struct {
	Token token.Token // The 'struct' token
	Name  string

	// will be empty if no privacy acknowledgement is set
	PrivacyAcknowledgement string

	Fields  []StructField
	Methods map[string]StructMethod
}

func (*Struct) GetToken

func (self *Struct) GetToken() token.Token

func (*Struct) String

func (self *Struct) String() string

func (*Struct) TokenLiteral

func (self *Struct) TokenLiteral() string

type StructField

type StructField struct {
	Name   string
	Public bool
}

type StructInstantiation

type StructInstantiation struct {
	Token      token.Token
	StructName string
	Arguments  []Expression
}

func (*StructInstantiation) GetToken

func (self *StructInstantiation) GetToken() token.Token

func (*StructInstantiation) String

func (self *StructInstantiation) String() string

func (*StructInstantiation) TokenLiteral

func (self *StructInstantiation) TokenLiteral() string

type StructMemberAccessExpression

type StructMemberAccessExpression struct {
	Token      token.Token // The . token
	Left       Expression
	MemberName string
}

func (*StructMemberAccessExpression) GetToken

func (self *StructMemberAccessExpression) GetToken() token.Token

func (*StructMemberAccessExpression) String

func (self *StructMemberAccessExpression) String() string

func (*StructMemberAccessExpression) TokenLiteral

func (self *StructMemberAccessExpression) TokenLiteral() string

type StructMethod

type StructMethod struct {
	FunctionLiteral *FunctionLiteral
	Public          bool
}

type SwitchCase

type SwitchCase struct {
	Value Expression
	Block *BlockStatement
}

type SwitchExpression

type SwitchExpression struct {
	Token   token.Token // The 'switch' token
	Subject Expression
	Cases   []SwitchCase
	Default *BlockStatement
}

func (*SwitchExpression) GetToken

func (self *SwitchExpression) GetToken() token.Token

func (*SwitchExpression) String

func (self *SwitchExpression) String() string

func (*SwitchExpression) TokenLiteral

func (self *SwitchExpression) TokenLiteral() string

Jump to

Keyboard shortcuts

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