Documentation ¶
Index ¶
- type ArrayLiteral
- type AssignmentStatement
- type BlockStatement
- type Boolean
- type Case
- type Conditional
- type Expression
- type FloatLiteral
- type FunctionCallManyArgs
- type FunctionCallNoArgs
- type FunctionCallOneArg
- type Identifier
- type IfStatement
- type IndexExpression
- type InfixExpressionLeftRight
- type InfixExpressionValues
- type IntegerLiteral
- type JSONLiteral
- type NamedArgs
- type NullLiteral
- type PrefixExpression
- type Program
- type ReturnStatement
- type Statement
- type StringLiteral
- type SwitchStatement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayLiteral ¶
type ArrayLiteral struct { Op string `json:"op"` Values []Expression `json:"values"` }
func NewArrayLiteral ¶
func NewArrayLiteral(vals []Expression) *ArrayLiteral
type AssignmentStatement ¶
type AssignmentStatement struct { Op string `json:"op"` Var string `json:"var"` Value Expression `json:"value"` }
func NewAssignmentStatement ¶
func NewAssignmentStatement(varName string, value Expression) *AssignmentStatement
type BlockStatement ¶
func NewBlockStatement ¶
func NewBlockStatement(seq ...Statement) *BlockStatement
type Case ¶
type Case struct { Op string `json:"op"` Condition Expression `json:"condidion"` // This typo is present in the language definition Result Statement `json:"result"` }
type Conditional ¶
type Conditional struct { Condition Expression `json:"if"` Consequence *BlockStatement `json:"then"` }
type Expression ¶
type Expression interface {
// contains filtered or unexported methods
}
Expression denotes an internal node, such as numeric or string literals, infix operator expressions, or identifier expressions
func NewFunctionCall ¶
func NewFunctionCall(fName string, args ...Expression) Expression
func NewFunctionCallNamedArgs ¶
func NewFunctionCallNamedArgs(fName string, args map[string]Expression) Expression
func NewInfixExpression ¶
func NewInfixExpression(tok token.Type, left, right Expression) Expression
func NewPrefixExpression ¶
func NewPrefixExpression(tok token.Type, right Expression) Expression
type FloatLiteral ¶
type FloatLiteral float64
type FunctionCallManyArgs ¶
type FunctionCallManyArgs struct { Values []Expression `json:"values"` Op string `json:"op"` }
type FunctionCallNoArgs ¶
type FunctionCallNoArgs struct {
Op string `json:"op"`
}
type FunctionCallOneArg ¶
type FunctionCallOneArg struct { Value Expression `json:"value"` Op string `json:"op"` }
type Identifier ¶
func NewIdentifierExpression ¶
func NewIdentifierExpression(varName string) *Identifier
type IfStatement ¶
type IfStatement struct { Op string `json:"op"` Cond []Conditional `json:"cond"` }
func NewIfStatement ¶
func NewIfStatement(cond ...Conditional) *IfStatement
type IndexExpression ¶
type IndexExpression struct { Op string `json:"op"` Base Expression `json:"base"` Index Expression `json:"index"` }
func NewIndexExpression ¶
func NewIndexExpression(base, index Expression) *IndexExpression
type InfixExpressionLeftRight ¶
type InfixExpressionLeftRight struct { Op string `json:"op"` Left Expression `json:"left"` Right Expression `json:"right"` }
type InfixExpressionValues ¶
type InfixExpressionValues struct { Op string `json:"op"` Values [2]Expression `json:"values"` }
type IntegerLiteral ¶
type IntegerLiteral int64
type JSONLiteral ¶
type JSONLiteral struct { Op string `json:"op"` Value interface{} `json:"value"` }
JSONLiteral can be a JSON array, map, string, or number
func NewJSONLiteral ¶
func NewJSONLiteral(val interface{}) *JSONLiteral
type NamedArgs ¶
type NamedArgs map[string]Expression
type NullLiteral ¶
type NullLiteral struct{}
func NewNull ¶
func NewNull() *NullLiteral
func (*NullLiteral) MarshalJSON ¶
func (nl *NullLiteral) MarshalJSON() ([]byte, error)
type PrefixExpression ¶
type PrefixExpression struct { Op string `json:"op"` Value Expression `json:"value"` }
type Program ¶
func NewProgram ¶
func NewProgram() *Program
type ReturnStatement ¶
type ReturnStatement struct { Op string `json:"op"` Value Expression `json:"value"` }
func NewReturnStatement ¶
func NewReturnStatement(value Expression) *ReturnStatement
type Statement ¶
type Statement interface {
// contains filtered or unexported methods
}
Statement denotes a top-level node such as an if statement, assignment statement, or return statement
type StringLiteral ¶
type StringLiteral string
type SwitchStatement ¶
func NewSwitchStatement ¶
func NewSwitchStatement(cases ...Case) *SwitchStatement
Click to show internal directories.
Click to hide internal directories.