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 HashExpression
- type Identifier
- type IfExpression
- type InfixExpression
- type InstanceVariable
- type IntegerLiteral
- type ModuleStatement
- type MultiVariableExpression
- type NextStatement
- type NilExpression
- 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 }
func (*ArrayExpression) String ¶
func (ae *ArrayExpression) String() string
func (*ArrayExpression) TokenLiteral ¶
func (ae *ArrayExpression) TokenLiteral() string
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 ¶
func (*BooleanExpression) String ¶
func (b *BooleanExpression) String() string
func (*BooleanExpression) TokenLiteral ¶
func (b *BooleanExpression) TokenLiteral() string
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 HashExpression ¶
type HashExpression struct { *BaseNode Data map[string]Expression }
func (*HashExpression) String ¶
func (he *HashExpression) String() string
func (*HashExpression) TokenLiteral ¶
func (he *HashExpression) TokenLiteral() string
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 ¶
func (*IntegerLiteral) String ¶
func (il *IntegerLiteral) String() string
func (*IntegerLiteral) TokenLiteral ¶
func (il *IntegerLiteral) TokenLiteral() string
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 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 }
func (*RangeExpression) String ¶
func (re *RangeExpression) String() string
func (*RangeExpression) TokenLiteral ¶
func (re *RangeExpression) TokenLiteral() string
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 ¶
func (*StringLiteral) String ¶
func (sl *StringLiteral) String() string
func (*StringLiteral) TokenLiteral ¶
func (sl *StringLiteral) TokenLiteral() string
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