Documentation ¶
Index ¶
- type Array
- type AssignExpression
- type BlockStatement
- type Boolean
- type BreakStatement
- type CallFunction
- type ConstStatement
- type DuringExpression
- type Expression
- type ExpressionStatement
- type Float
- type ForStatement
- type Function
- type Hash
- type Identifier
- type IfExpression
- type IndexExpression
- type InfixExpression
- type Integer
- type LetStatement
- type Node
- type PrefixExpression
- type Program
- type ReturnStatement
- type SkipStatement
- type Statement
- type StringLiteral
- type VariableStatement
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) TokenLiteral ¶
type AssignExpression ¶
type AssignExpression struct { Token token.Token // The token.ASSIGN token Ident *Identifier Value Expression }
func (*AssignExpression) String ¶
func (assignExpression *AssignExpression) String() string
func (*AssignExpression) TokenLiteral ¶
func (assignExpression *AssignExpression) TokenLiteral() string
type BlockStatement ¶
type BlockStatement struct { Token token.Token // token.LEFTBRAC and token.RIGHTBRAC Statements []Statement }
func (*BlockStatement) String ¶
func (blockStatement *BlockStatement) String() string
func (*BlockStatement) TokenLiteral ¶
func (blockStatement *BlockStatement) TokenLiteral() string
type Boolean ¶
func (*Boolean) TokenLiteral ¶
type BreakStatement ¶ added in v0.0.3
func (*BreakStatement) String ¶ added in v0.0.3
func (breakStatement *BreakStatement) String() string
func (*BreakStatement) TokenLiteral ¶ added in v0.0.3
func (breakStatement *BreakStatement) TokenLiteral() string
type CallFunction ¶
type CallFunction struct { Token token.Token Function Expression Arguments []Expression }
func (*CallFunction) String ¶
func (callFunction *CallFunction) String() string
func (*CallFunction) TokenLiteral ¶
func (callFunction *CallFunction) TokenLiteral() string
type ConstStatement ¶
type ConstStatement struct { Token token.Token // token.CONST Name *Identifier Value Expression }
func (*ConstStatement) String ¶
func (constStatement *ConstStatement) String() string
func (*ConstStatement) TokenLiteral ¶
func (cs *ConstStatement) TokenLiteral() string
type DuringExpression ¶ added in v0.0.3
type DuringExpression struct { Token token.Token // token.DURING Condition Expression Body *BlockStatement // during body }
func (*DuringExpression) String ¶ added in v0.0.3
func (duringExpression *DuringExpression) String() string
func (*DuringExpression) TokenLiteral ¶ added in v0.0.3
func (duringExpression *DuringExpression) TokenLiteral() string
type Expression ¶
type Expression interface { Node // contains filtered or unexported methods }
type ExpressionStatement ¶
type ExpressionStatement struct { // We need this because sometimes we have an expression act like a statement // e.g let x = 5; // x + 10; // this is an expression but it acts like a statement Token token.Token // the first token of the expression Expression Expression }
func (*ExpressionStatement) String ¶
func (expressionStatement *ExpressionStatement) String() string
func (*ExpressionStatement) TokenLiteral ¶
func (es *ExpressionStatement) TokenLiteral() string
type Float ¶ added in v0.0.5
func (*Float) TokenLiteral ¶ added in v0.0.5
type ForStatement ¶ added in v0.0.4
type ForStatement struct { Token token.Token // The token.FOR IdxIdent *Identifier // The index identifier of the loop VarIdent *Identifier // The variable identifier of the loop Expression Expression // The expression to iterate over Body *BlockStatement // The body of the loop }
func (*ForStatement) String ¶ added in v0.0.4
func (fs *ForStatement) String() string
func (*ForStatement) TokenLiteral ¶ added in v0.0.4
func (fs *ForStatement) TokenLiteral() string
type Function ¶
type Function struct { Token token.Token // the 'fun' token Parameters []*Identifier Body *BlockStatement }
func (*Function) TokenLiteral ¶
type Hash ¶
type Hash struct { Token token.Token // The '{' token Pairs map[Expression]Expression }
func (*Hash) TokenLiteral ¶
type Identifier ¶
func (*Identifier) String ¶
func (identifier *Identifier) String() string
func (*Identifier) TokenLiteral ¶
func (i *Identifier) TokenLiteral() string
type IfExpression ¶
type IfExpression struct { token.Token // token.IF Condition Expression Consequence *BlockStatement // If block Alternative *BlockStatement // Else block }
func (*IfExpression) String ¶
func (ifExpression *IfExpression) String() string
func (*IfExpression) TokenLiteral ¶
func (ifExpression *IfExpression) TokenLiteral() string
type IndexExpression ¶
type IndexExpression struct { Token token.Token // The [ token Ident Expression Index Expression Value Expression }
func (*IndexExpression) String ¶
func (idx *IndexExpression) String() string
func (*IndexExpression) TokenLiteral ¶
func (idx *IndexExpression) TokenLiteral() string
type InfixExpression ¶
type InfixExpression struct { Token token.Token // The operator token, e.g. + Left Expression Operator string Right Expression }
func (*InfixExpression) String ¶
func (infixExpression *InfixExpression) String() string
func (*InfixExpression) TokenLiteral ¶
func (infixExpression *InfixExpression) TokenLiteral() string
type Integer ¶ added in v0.0.5
func (*Integer) TokenLiteral ¶ added in v0.0.5
type LetStatement ¶
type LetStatement struct { Token token.Token // token.LET Name *Identifier Value Expression }
func (*LetStatement) String ¶
func (letStatement *LetStatement) String() string
func (*LetStatement) TokenLiteral ¶
func (ls *LetStatement) TokenLiteral() string
type PrefixExpression ¶
type PrefixExpression struct { Token token.Token // The prefix token, e.g. ! Operator string Right Expression }
func (*PrefixExpression) String ¶
func (prefixExpression *PrefixExpression) String() string
func (*PrefixExpression) TokenLiteral ¶
func (pe *PrefixExpression) TokenLiteral() string
type Program ¶
type Program struct {
Statements []Statement
}
func (*Program) String ¶
This will allow us to print AST nodes for debugging and to compare them with other AST nodes.
func (*Program) TokenLiteral ¶
type ReturnStatement ¶
type ReturnStatement struct { Token token.Token // token.RETURN ReturnValue Expression }
func (*ReturnStatement) String ¶
func (returnStatement *ReturnStatement) String() string
func (*ReturnStatement) TokenLiteral ¶
func (rs *ReturnStatement) TokenLiteral() string
type SkipStatement ¶ added in v0.0.3
func (*SkipStatement) String ¶ added in v0.0.3
func (ls *SkipStatement) String() string
func (*SkipStatement) TokenLiteral ¶ added in v0.0.3
func (ls *SkipStatement) TokenLiteral() string
type StringLiteral ¶
func (*StringLiteral) String ¶
func (stringLiteral *StringLiteral) String() string
func (*StringLiteral) TokenLiteral ¶
func (stringLiteral *StringLiteral) TokenLiteral() string
type VariableStatement ¶
type VariableStatement struct { Token token.Token // token.LET or token.CONST Type string // "let" or "const" Name *Identifier Value Expression }
Click to show internal directories.
Click to hide internal directories.