Documentation
¶
Index ¶
- type ArrayLiteral
- type BlockStatement
- type Boolean
- type CallExpression
- type Expression
- type ExpressionStatement
- type FloatLiteral
- type FunctionLiteral
- type Identifier
- type IfExpression
- type IndexExpression
- type InfixExpression
- type IntegerLiteral
- type Node
- type PrefixExpression
- type Program
- type ReturnStatement
- type Statement
- type VarStatement
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 }
ArrayLiteral represents an array on the AST
func (*ArrayLiteral) String ¶
func (al *ArrayLiteral) String() string
func (*ArrayLiteral) TokenLiteral ¶
func (al *ArrayLiteral) TokenLiteral() string
TokenLiteral returns the array's token literal
type BlockStatement ¶
BlockStatement represents a code block statement on the AST
func (*BlockStatement) String ¶
func (bs *BlockStatement) String() string
func (*BlockStatement) TokenLiteral ¶
func (bs *BlockStatement) TokenLiteral() string
TokenLiteral returns the code block's token literal
type Boolean ¶
Boolean represents a boolean on the AST
func (*Boolean) TokenLiteral ¶
TokenLiteral returns the boolean's token literal
type CallExpression ¶
type CallExpression struct { Token token.Token Function Expression Arguments []Expression }
CallExpression represents a function call on the AST
func (*CallExpression) String ¶
func (ce *CallExpression) String() string
func (*CallExpression) TokenLiteral ¶
func (ce *CallExpression) TokenLiteral() string
TokenLiteral returns the call expression's token literal
type Expression ¶
type Expression interface { Node // contains filtered or unexported methods }
Expression represents an expression on the AST
type ExpressionStatement ¶
type ExpressionStatement struct { Token token.Token Expression Expression }
ExpressionStatement represents an expression on the AST
func (*ExpressionStatement) String ¶
func (es *ExpressionStatement) String() string
func (*ExpressionStatement) TokenLiteral ¶
func (es *ExpressionStatement) TokenLiteral() string
TokenLiteral returns the expression's token
type FloatLiteral ¶
FloatLiteral represents a float literal on the AST
func (*FloatLiteral) String ¶
func (fl *FloatLiteral) String() string
func (*FloatLiteral) TokenLiteral ¶
func (fl *FloatLiteral) TokenLiteral() string
TokenLiteral returns the float literal's token literal
type FunctionLiteral ¶
type FunctionLiteral struct { Token token.Token Parameters []*Identifier Body *BlockStatement }
FunctionLiteral represents a function literal on the AST
func (*FunctionLiteral) String ¶
func (fl *FunctionLiteral) String() string
func (*FunctionLiteral) TokenLiteral ¶
func (fl *FunctionLiteral) TokenLiteral() string
TokenLiteral returns the function literal's token literal
type Identifier ¶
Identifier represents a user-defined identifier on the AST
func (*Identifier) String ¶
func (i *Identifier) String() string
func (*Identifier) TokenLiteral ¶
func (i *Identifier) TokenLiteral() string
TokenLiteral returns the identifier's token
type IfExpression ¶
type IfExpression struct { Token token.Token Condition Expression Consequence *BlockStatement Alternative *BlockStatement }
IfExpression represents an if expression on the AST
func (*IfExpression) String ¶
func (ie *IfExpression) String() string
func (*IfExpression) TokenLiteral ¶
func (ie *IfExpression) TokenLiteral() string
TokenLiteral returns the if expression's token literal
type IndexExpression ¶
type IndexExpression struct { Token token.Token Left Expression Index Expression }
IndexExpression represents an array index expression on the AST
func (*IndexExpression) String ¶
func (ie *IndexExpression) String() string
func (*IndexExpression) TokenLiteral ¶
func (ie *IndexExpression) TokenLiteral() string
TokenLiteral returns the index expression's token literal
type InfixExpression ¶
type InfixExpression struct { Token token.Token Left Expression Operator string Right Expression }
InfixExpression represents an infix expression on the AST
func (*InfixExpression) String ¶
func (ie *InfixExpression) String() string
func (*InfixExpression) TokenLiteral ¶
func (ie *InfixExpression) TokenLiteral() string
TokenLiteral returns the infix expression's token literal
type IntegerLiteral ¶
IntegerLiteral represents an integer literal on the AST
func (*IntegerLiteral) String ¶
func (il *IntegerLiteral) String() string
func (*IntegerLiteral) TokenLiteral ¶
func (il *IntegerLiteral) TokenLiteral() string
TokenLiteral returns the integer literal's token literal
type PrefixExpression ¶
type PrefixExpression struct { Token token.Token Operator string Right Expression }
PrefixExpression represents a prefix expression on the AST
func (*PrefixExpression) String ¶
func (pe *PrefixExpression) String() string
func (*PrefixExpression) TokenLiteral ¶
func (pe *PrefixExpression) TokenLiteral() string
TokenLiteral returns the prefix expression's token literal
type Program ¶
type Program struct {
Statements []Statement
}
Program represents a grouping of statements
func (*Program) TokenLiteral ¶
TokenLiteral returns the statement's token
type ReturnStatement ¶
type ReturnStatement struct { Token token.Token ReturnValue Expression }
ReturnStatement represents a return statement on the AST
func (*ReturnStatement) String ¶
func (rs *ReturnStatement) String() string
func (*ReturnStatement) TokenLiteral ¶
func (rs *ReturnStatement) TokenLiteral() string
TokenLiteral returns the return statement's token
type Statement ¶
type Statement interface { Node // contains filtered or unexported methods }
Statement represents a statement on the AST
type VarStatement ¶
type VarStatement struct { Token token.Token Name *Identifier Value Expression }
VarStatement represents a variable assignment on the AST
func (*VarStatement) String ¶
func (ls *VarStatement) String() string
func (*VarStatement) TokenLiteral ¶
func (ls *VarStatement) TokenLiteral() string
TokenLiteral returns the var statement's token