Documentation ¶
Index ¶
- type ArrayLiteral
- type BlockStatement
- type BooleanLiteral
- type CallExpression
- type Expression
- type ExpressionStatement
- type FunctionLiteral
- type HashLiteral
- type Identifier
- type IfExpression
- type IndexExpression
- type InfixExpression
- type IntegerLiteral
- type LetStatement
- type Node
- type PrefixExpression
- type ReturnStatement
- type Root
- type Statement
- type StringLiteral
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 containing a list of expressions.
func (*ArrayLiteral) String ¶
func (a *ArrayLiteral) String() string
func (*ArrayLiteral) TokenLiteral ¶
func (a *ArrayLiteral) TokenLiteral() string
type BlockStatement ¶
BlockStatement represents block statement within `{}`.
func (*BlockStatement) String ¶
func (bs *BlockStatement) String() string
func (*BlockStatement) TokenLiteral ¶
func (bs *BlockStatement) TokenLiteral() string
type BooleanLiteral ¶
BooleanLiteral represents string representation of boolean.
func (*BooleanLiteral) String ¶
func (b *BooleanLiteral) String() string
func (*BooleanLiteral) TokenLiteral ¶
func (b *BooleanLiteral) TokenLiteral() string
type CallExpression ¶
type CallExpression struct { Token token.Token Function Expression Arguments []Expression }
CallExpression represents function call.
func (*CallExpression) String ¶
func (ce *CallExpression) String() string
func (*CallExpression) TokenLiteral ¶
func (ce *CallExpression) TokenLiteral() string
type Expression ¶
type Expression interface { Node // contains filtered or unexported methods }
Expression describes AST expression that produces a value.
type ExpressionStatement ¶
type ExpressionStatement struct { Token token.Token Expression Expression }
ExpressionStatement represents expression statement.
func (*ExpressionStatement) String ¶
func (e *ExpressionStatement) String() string
func (*ExpressionStatement) TokenLiteral ¶
func (e *ExpressionStatement) TokenLiteral() string
type FunctionLiteral ¶
type FunctionLiteral struct { Token token.Token Parameters []*Identifier Body *BlockStatement }
FunctionLiteral represents function definition.
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 }
HashLiteral represents hash literal: { <expression>: <expression> }.
func (*HashLiteral) String ¶
func (hl *HashLiteral) String() string
func (*HashLiteral) TokenLiteral ¶
func (hl *HashLiteral) TokenLiteral() string
type Identifier ¶
Identifier represents statement's identifier.
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 }
IfExpression represents `if-else` expression.
func (*IfExpression) String ¶
func (ie *IfExpression) String() string
func (*IfExpression) TokenLiteral ¶
func (ie *IfExpression) TokenLiteral() string
type IndexExpression ¶
type IndexExpression struct { Token token.Token Left Expression Index Expression }
IndexExpression represents index expression: <left-expression>[<index-expression>].
func (*IndexExpression) String ¶
func (ie *IndexExpression) String() string
func (*IndexExpression) TokenLiteral ¶
func (ie *IndexExpression) TokenLiteral() string
type InfixExpression ¶
type InfixExpression struct { Token token.Token // The operator token, e.g. + Left Expression Operator string Right Expression }
InfixExpression represents infix expressions, e.x: 5 + 5.
func (*InfixExpression) String ¶
func (oe *InfixExpression) String() string
func (*InfixExpression) TokenLiteral ¶
func (oe *InfixExpression) TokenLiteral() string
type IntegerLiteral ¶
IntegerLiteral represents string representation of an integer.
func (*IntegerLiteral) String ¶
func (il *IntegerLiteral) String() string
func (*IntegerLiteral) TokenLiteral ¶
func (il *IntegerLiteral) TokenLiteral() string
type LetStatement ¶
type LetStatement struct { Token token.Token Name *Identifier Value Expression }
LetStatement represents `let` statement.
func (*LetStatement) String ¶
func (l *LetStatement) String() string
func (*LetStatement) TokenLiteral ¶
func (l *LetStatement) TokenLiteral() string
type PrefixExpression ¶
type PrefixExpression struct { Token token.Token // !, - Operator string Right Expression }
PrefixExpression represents prefix expression e.x: -5, !IsValid(some) and etc.
func (*PrefixExpression) String ¶
func (pe *PrefixExpression) String() string
func (*PrefixExpression) TokenLiteral ¶
func (pe *PrefixExpression) TokenLiteral() string
type ReturnStatement ¶
type ReturnStatement struct { Token token.Token Value Expression }
ReturnStatement represents `return` statement.
func (*ReturnStatement) String ¶
func (r *ReturnStatement) String() string
func (*ReturnStatement) TokenLiteral ¶
func (r *ReturnStatement) TokenLiteral() string
type Root ¶
type Root struct {
Statements []Statement
}
Root represents a root node of program's AST.
func (*Root) TokenLiteral ¶
type Statement ¶
type Statement interface { Node // contains filtered or unexported methods }
Statement describes AST statement e.x: variable and etc.
type StringLiteral ¶
StringLiteral represents string.
func (*StringLiteral) String ¶
func (sl *StringLiteral) String() string
func (*StringLiteral) TokenLiteral ¶
func (sl *StringLiteral) TokenLiteral() string