Documentation
¶
Index ¶
- type ArrayExpression
- type AssignExpression
- type BaseNode
- type BlockStatement
- type BooleanExpression
- type BreakStatement
- type CallExpression
- type ClassStatement
- type ConditionalExpression
- type Constant
- type DefStatement
- type Expression
- type ExpressionStatement
- type FloatLiteral
- type GetBlockExpression
- type HashExpression
- type Identifier
- type IfExpression
- type InfixExpression
- type InstanceVariable
- type IntegerLiteral
- type ModuleStatement
- type MultiVariableExpression
- type NextStatement
- type NilExpression
- type PairExpression
- type PrefixExpression
- type Program
- type RangeExpression
- type ReturnStatement
- type SelfExpression
- type Statement
- type StringLiteral
- type Variable
- type WhileStatement
- type YieldExpression
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayExpression ¶
type ArrayExpression struct { *BaseNode Elements []Expression }
ArrayExpression defines the array expression literal which contains the node expression and its value
func (*ArrayExpression) String ¶
func (ae *ArrayExpression) String() string
ArrayExpression.String gets the string format of the Array type token
func (*ArrayExpression) TokenLiteral ¶
func (ae *ArrayExpression) TokenLiteral() string
ArrayExpression gets the literal of the Array type token
type AssignExpression ¶ added in v0.1.0
type AssignExpression struct { *BaseNode Variables []Expression Value Expression // Optioned attribute is only used when infix expression is local assignment in params. // For example: `foo(x = 10)`'s `x = 10` is an optioned assign expression // TODO: Remove this when we can put metadata inside bytecode. Optioned int }
AssignExpression represents variable assignment in Goby.
func (*AssignExpression) String ¶ added in v0.1.0
func (ae *AssignExpression) String() string
func (*AssignExpression) TokenLiteral ¶ added in v0.1.0
func (ae *AssignExpression) TokenLiteral() string
type BaseNode ¶ added in v0.1.0
BaseNode holds the attribute every expression or statement should have
func (*BaseNode) IsExp ¶ added in v0.1.0
IsExp returns if current node should be considered as an expression
func (*BaseNode) IsStmt ¶ added in v0.1.0
IsStmt returns if current node should be considered as a statement
func (*BaseNode) MarkAsExp ¶ added in v0.1.0
func (b *BaseNode) MarkAsExp()
MarkAsExp marks current node to be expression
func (*BaseNode) MarkAsStmt ¶ added in v0.1.0
func (b *BaseNode) MarkAsStmt()
MarkAsStmt marks current node to be statement
type BlockStatement ¶
func (*BlockStatement) IsEmpty ¶ added in v0.1.3
func (bs *BlockStatement) IsEmpty() bool
func (*BlockStatement) KeepLastValue ¶ added in v0.1.0
func (bs *BlockStatement) KeepLastValue()
KeepLastValue prevents block's last expression statement to be popped.
func (*BlockStatement) String ¶
func (bs *BlockStatement) String() string
func (*BlockStatement) TokenLiteral ¶
func (bs *BlockStatement) TokenLiteral() string
type BooleanExpression ¶
BooleanExpression defines the boolean expression literal which contains the node expression and its value
func (*BooleanExpression) String ¶
func (b *BooleanExpression) String() string
BooleanExpression.String gets the string format of the Boolean type token
func (*BooleanExpression) TokenLiteral ¶
func (b *BooleanExpression) TokenLiteral() string
BooleanExpression.TokenLiteral gets the literal of the Boolean type token
type BreakStatement ¶ added in v0.1.0
type BreakStatement struct {
*BaseNode
}
BreakStatement represents "break" keyword
func (*BreakStatement) String ¶ added in v0.1.0
func (bs *BreakStatement) String() string
func (*BreakStatement) TokenLiteral ¶ added in v0.1.0
func (bs *BreakStatement) TokenLiteral() string
TokenLiteral returns token's literal
type CallExpression ¶
type CallExpression struct { *BaseNode Receiver Expression Method string Arguments []Expression Block *BlockStatement BlockArguments []*Identifier }
func (*CallExpression) String ¶
func (ce *CallExpression) String() string
func (*CallExpression) TokenLiteral ¶
func (ce *CallExpression) TokenLiteral() string
type ClassStatement ¶
type ClassStatement struct { *BaseNode Name *Constant Body *BlockStatement SuperClass Expression SuperClassName string }
func (*ClassStatement) String ¶
func (cs *ClassStatement) String() string
func (*ClassStatement) TokenLiteral ¶
func (cs *ClassStatement) TokenLiteral() string
type ConditionalExpression ¶ added in v0.1.0
type ConditionalExpression struct { *BaseNode Condition Expression Consequence *BlockStatement }
ConditionalExpression represents if or elsif expression
func (*ConditionalExpression) String ¶ added in v0.1.0
func (ce *ConditionalExpression) String() string
func (*ConditionalExpression) TokenLiteral ¶ added in v0.1.0
func (ce *ConditionalExpression) TokenLiteral() string
TokenLiteral returns `if` or `elsif`
type DefStatement ¶
type DefStatement struct { *BaseNode Name *Identifier Receiver Expression Parameters []Expression BlockStatement *BlockStatement }
func (*DefStatement) String ¶
func (ds *DefStatement) String() string
func (*DefStatement) TokenLiteral ¶
func (ds *DefStatement) TokenLiteral() string
type Expression ¶
type Expression interface {
// contains filtered or unexported methods
}
type ExpressionStatement ¶
type ExpressionStatement struct { *BaseNode Expression Expression }
func (*ExpressionStatement) String ¶
func (es *ExpressionStatement) String() string
func (*ExpressionStatement) TokenLiteral ¶
func (es *ExpressionStatement) TokenLiteral() string
type FloatLiteral ¶ added in v0.1.6
FloatLiteral contains the node expression and its value
func (*FloatLiteral) String ¶ added in v0.1.6
func (il *FloatLiteral) String() string
FloatLiteral.String gets the string format of the Float type token
func (*FloatLiteral) TokenLiteral ¶ added in v0.1.6
func (il *FloatLiteral) TokenLiteral() string
FloatLiteral.TokenLiteral gets the literal of the Float type token
type GetBlockExpression ¶ added in v0.1.7
type GetBlockExpression struct {
*BaseNode
}
GetBlockExpression represents `get_block` call in the AST
func (*GetBlockExpression) String ¶ added in v0.1.7
func (gbe *GetBlockExpression) String() string
String ...
func (*GetBlockExpression) TokenLiteral ¶ added in v0.1.7
func (gbe *GetBlockExpression) TokenLiteral() string
TokenLiteral ...
type HashExpression ¶
type HashExpression struct { *BaseNode Data map[string]Expression }
HashExpression defines the hash expression literal which contains the node expression and its value
func (*HashExpression) String ¶
func (he *HashExpression) String() string
HashExpression.String gets the string format of the Hash type token
func (*HashExpression) TokenLiteral ¶
func (he *HashExpression) TokenLiteral() string
HashExpression.TokenLiteral gets the literal of the Hash type token
type Identifier ¶
func (*Identifier) ReturnValue ¶
func (i *Identifier) ReturnValue() string
func (*Identifier) String ¶
func (i *Identifier) String() string
func (*Identifier) TokenLiteral ¶
func (i *Identifier) TokenLiteral() string
type IfExpression ¶
type IfExpression struct { *BaseNode Conditionals []*ConditionalExpression Alternative *BlockStatement }
func (*IfExpression) String ¶
func (ie *IfExpression) String() string
func (*IfExpression) TokenLiteral ¶
func (ie *IfExpression) TokenLiteral() string
type InfixExpression ¶
type InfixExpression struct { *BaseNode Left Expression Operator string Right Expression }
func (*InfixExpression) String ¶
func (ie *InfixExpression) String() string
func (*InfixExpression) TokenLiteral ¶
func (ie *InfixExpression) TokenLiteral() string
type InstanceVariable ¶
func (*InstanceVariable) ReturnValue ¶
func (iv *InstanceVariable) ReturnValue() string
func (*InstanceVariable) String ¶
func (iv *InstanceVariable) String() string
func (*InstanceVariable) TokenLiteral ¶
func (iv *InstanceVariable) TokenLiteral() string
type IntegerLiteral ¶
IntegerLiteral contains the node expression and its value
func (*IntegerLiteral) String ¶
func (il *IntegerLiteral) String() string
IntegerLiteral.String gets the string format of the Integer type token
func (*IntegerLiteral) TokenLiteral ¶
func (il *IntegerLiteral) TokenLiteral() string
IntegerLiteral.TokenLiteral gets the Integer type token
type ModuleStatement ¶
type ModuleStatement struct { *BaseNode Name *Constant Body *BlockStatement SuperClass *Constant }
ModuleStatement represents module node in AST
func (*ModuleStatement) String ¶
func (ms *ModuleStatement) String() string
func (*ModuleStatement) TokenLiteral ¶
func (ms *ModuleStatement) TokenLiteral() string
TokenLiteral returns token's literal
type MultiVariableExpression ¶ added in v0.1.0
type MultiVariableExpression struct { *BaseNode Variables []Expression }
MultiVariableExpression is not really an expression, it's just a container that holds multiple Variables
func (*MultiVariableExpression) String ¶ added in v0.1.0
func (m *MultiVariableExpression) String() string
func (*MultiVariableExpression) TokenLiteral ¶ added in v0.1.0
func (m *MultiVariableExpression) TokenLiteral() string
type NextStatement ¶
type NextStatement struct {
*BaseNode
}
NextStatement represents "next" keyword
func (*NextStatement) String ¶
func (ns *NextStatement) String() string
func (*NextStatement) TokenLiteral ¶
func (ns *NextStatement) TokenLiteral() string
TokenLiteral returns token's literal
type NilExpression ¶
type NilExpression struct {
*BaseNode
}
NilExpression represents nil node
func (*NilExpression) TokenLiteral ¶
func (n *NilExpression) TokenLiteral() string
TokenLiteral returns `nil`
type PairExpression ¶ added in v0.1.6
type PairExpression struct { *BaseNode Key Expression Value Expression }
PairExpression represents a key/value pair in method parameters or arguments
func (*PairExpression) String ¶ added in v0.1.6
func (pe *PairExpression) String() string
String .....
func (*PairExpression) TokenLiteral ¶ added in v0.1.6
func (pe *PairExpression) TokenLiteral() string
TokenLiteral .....
type PrefixExpression ¶
type PrefixExpression struct { *BaseNode Operator string Right Expression }
func (*PrefixExpression) String ¶
func (pe *PrefixExpression) String() string
func (*PrefixExpression) TokenLiteral ¶
func (pe *PrefixExpression) TokenLiteral() string
type Program ¶
type Program struct {
Statements []Statement
}
Program is the root node of entire AST
func (*Program) TokenLiteral ¶
type RangeExpression ¶
type RangeExpression struct { *BaseNode Start Expression End Expression }
RangeExpression defines the range expression literal which contains the node expression and its start/end value
func (*RangeExpression) String ¶
func (re *RangeExpression) String() string
RangeExpression.String gets the string format of the Range type token
func (*RangeExpression) TokenLiteral ¶
func (re *RangeExpression) TokenLiteral() string
RangeExpression.TokenLiteral gets the literal of the Range type token
type ReturnStatement ¶
type ReturnStatement struct { *BaseNode ReturnValue Expression }
func (*ReturnStatement) String ¶
func (rs *ReturnStatement) String() string
func (*ReturnStatement) TokenLiteral ¶
func (rs *ReturnStatement) TokenLiteral() string
type SelfExpression ¶
type SelfExpression struct {
*BaseNode
}
func (*SelfExpression) String ¶
func (se *SelfExpression) String() string
func (*SelfExpression) TokenLiteral ¶
func (se *SelfExpression) TokenLiteral() string
type StringLiteral ¶
StringLiteral contains the node expression and its value
func (*StringLiteral) String ¶
func (sl *StringLiteral) String() string
StringLiteral.String gets the string format of the String type token
func (*StringLiteral) TokenLiteral ¶
func (sl *StringLiteral) TokenLiteral() string
StringLiteral.TokenLiteral gets the literal of the String type token
type Variable ¶ added in v0.1.0
type Variable interface { ReturnValue() string Expression // contains filtered or unexported methods }
Variable interface represents assignable nodes in Goby, currently are Identifier, InstanceVariable and Constant
type WhileStatement ¶
type WhileStatement struct { *BaseNode Condition Expression Body *BlockStatement }
func (*WhileStatement) String ¶
func (ws *WhileStatement) String() string
func (*WhileStatement) TokenLiteral ¶
func (ws *WhileStatement) TokenLiteral() string
type YieldExpression ¶
type YieldExpression struct { *BaseNode Arguments []Expression }
func (*YieldExpression) String ¶
func (ye *YieldExpression) String() string
func (*YieldExpression) TokenLiteral ¶
func (ye *YieldExpression) TokenLiteral() string