Documentation
¶
Index ¶
- func Convert(f func(interface{}) interface{}, x interface{}) interface{}
- type AnonymousFunction
- type App
- type Arguments
- type DefFunction
- type Effect
- type Import
- type KeywordArgument
- type LetExpression
- type LetMatch
- type LetVar
- type Match
- type MatchCase
- type MutualRecursion
- type OptionalParameter
- type PositionalArgument
- type Signature
- type Switch
- type SwitchCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnonymousFunction ¶
type AnonymousFunction struct {
// contains filtered or unexported fields
}
AnonymousFunction represents a anonymous function as an expression.
func NewAnonymousFunction ¶
func NewAnonymousFunction(s Signature, ls []interface{}, b interface{}) AnonymousFunction
NewAnonymousFunction creates a anonymous function.
func (AnonymousFunction) Body ¶
func (f AnonymousFunction) Body() interface{}
Body returns a body expression of an anonymous function.
func (AnonymousFunction) Lets ¶
func (f AnonymousFunction) Lets() []interface{}
Lets returns let statements contained in an anonymous function.
func (AnonymousFunction) Signature ¶
func (f AnonymousFunction) Signature() Signature
Signature returns a signature of an anonymous function.
func (AnonymousFunction) String ¶
func (f AnonymousFunction) String() string
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents an application of a function to arguments.
type Arguments ¶
type Arguments struct {
// contains filtered or unexported fields
}
Arguments represents arguments passed to a function.
func NewArguments ¶
func NewArguments(ps []PositionalArgument, ks []KeywordArgument) Arguments
NewArguments creates arguments.
func (Arguments) Keywords ¶
func (a Arguments) Keywords() []KeywordArgument
Keywords returns keyword arguments contained in arguments.
func (Arguments) Positionals ¶
func (a Arguments) Positionals() []PositionalArgument
Positionals returns positional arguments contained in arguments.
type DefFunction ¶
type DefFunction struct {
// contains filtered or unexported fields
}
DefFunction represents a def-function statement node in ASTs.
func NewDefFunction ¶
func NewDefFunction(name string, sig Signature, lets []interface{}, expr interface{}, i *debug.Info) DefFunction
NewDefFunction creates a DefFunction from its function name, signature, internal let statements, and a body expression.
func (DefFunction) Body ¶
func (f DefFunction) Body() interface{}
Body returns a body expression of a function defined by the def-function statement.
func (DefFunction) DebugInfo ¶
func (f DefFunction) DebugInfo() *debug.Info
DebugInfo returns debug information of a function defined by the def-function statement.
func (DefFunction) Lets ¶
func (f DefFunction) Lets() []interface{}
Lets returns let statements contained in the def-function statement. Returned values should be LetVar or DefFunction.
func (DefFunction) Name ¶
func (f DefFunction) Name() string
Name returns a name of a function defined by the def-function statement.
func (DefFunction) Signature ¶
func (f DefFunction) Signature() Signature
Signature returns a signature of a function defined by the def-function statement.
func (DefFunction) String ¶
func (f DefFunction) String() string
type Effect ¶
type Effect struct {
// contains filtered or unexported fields
}
Effect represents effects of programs.
type Import ¶
type Import struct {
// contains filtered or unexported fields
}
Import represents an import of a sub module.
type KeywordArgument ¶
type KeywordArgument struct {
// contains filtered or unexported fields
}
KeywordArgument represents a keyword argument passed to a function.
func NewKeywordArgument ¶
func NewKeywordArgument(name string, value interface{}) KeywordArgument
NewKeywordArgument creates a keyword argument from a bound name and its value.
func (KeywordArgument) Name ¶
func (k KeywordArgument) Name() string
Name returns a bound name of a keyword argument.
func (KeywordArgument) String ¶
func (k KeywordArgument) String() string
func (KeywordArgument) Value ¶
func (k KeywordArgument) Value() interface{}
Value returns a value of a keyword argument.
type LetExpression ¶
type LetExpression struct {
// contains filtered or unexported fields
}
LetExpression represents a let expression node in ASTs.
func NewLetExpression ¶
func NewLetExpression(lets []interface{}, expr interface{}) LetExpression
NewLetExpression creates a let expression.
func (LetExpression) Expr ¶
func (l LetExpression) Expr() interface{}
Expr returns an expression of the let expression.
func (LetExpression) Lets ¶
func (l LetExpression) Lets() []interface{}
Lets returns let-match statements used in the let expression.
func (LetExpression) String ¶
func (l LetExpression) String() string
type LetMatch ¶
type LetMatch struct {
// contains filtered or unexported fields
}
LetMatch represents a let-match statement in ASTs.
func NewLetMatch ¶
func NewLetMatch(pattern interface{}, expr interface{}) LetMatch
NewLetMatch creates a let-match statement from a pattern and an expression.
func (LetMatch) Expr ¶
func (m LetMatch) Expr() interface{}
Expr returns an expression of a variable value""
type LetVar ¶
type LetVar struct {
// contains filtered or unexported fields
}
LetVar represents a let-variable statement node in ASTs.
func (LetVar) Expr ¶
func (v LetVar) Expr() interface{}
Expr returns an expression of a variable value""
type Match ¶
type Match struct {
// contains filtered or unexported fields
}
Match represents a match expression.
type MatchCase ¶
type MatchCase struct {
// contains filtered or unexported fields
}
MatchCase represents a case of a pattern and corrensponding value.
func NewMatchCase ¶
func NewMatchCase(p interface{}, v interface{}) MatchCase
NewMatchCase creates a case in a match expression.
type MutualRecursion ¶
type MutualRecursion struct {
// contains filtered or unexported fields
}
MutualRecursion represents a definition of mutually-recursive functions.
func NewMutualRecursion ¶
func NewMutualRecursion(fs []DefFunction, i *debug.Info) MutualRecursion
NewMutualRecursion creates a mutual recursion node from mutually-recursive functions.
func (MutualRecursion) DebugInfo ¶
func (mr MutualRecursion) DebugInfo() *debug.Info
DebugInfo returns debug information of mutually-recursive function definition.
func (MutualRecursion) DefFunctions ¶
func (mr MutualRecursion) DefFunctions() []DefFunction
DefFunctions returns let-function statements in a mutual recursion definition.
func (MutualRecursion) String ¶
func (mr MutualRecursion) String() string
type OptionalParameter ¶
type OptionalParameter struct {
// contains filtered or unexported fields
}
OptionalParameter represents an optional argument defined in a function.
func NewOptionalParameter ¶
func NewOptionalParameter(n string, v interface{}) OptionalParameter
NewOptionalParameter creates an optional argument.
func (OptionalParameter) DefaultValue ¶
func (o OptionalParameter) DefaultValue() interface{}
DefaultValue returns a default value of an optional argument.
func (OptionalParameter) Name ¶
func (o OptionalParameter) Name() string
Name returns a name of an optional argument.
func (OptionalParameter) String ¶
func (o OptionalParameter) String() string
type PositionalArgument ¶
type PositionalArgument struct {
// contains filtered or unexported fields
}
PositionalArgument represents a positional argument passed to a function.
func NewPositionalArgument ¶
func NewPositionalArgument(value interface{}, expanded bool) PositionalArgument
NewPositionalArgument creates a positional argument.
func (PositionalArgument) Expanded ¶
func (p PositionalArgument) Expanded() bool
Expanded returns true if a positional argument is an expanded list or false otherwise.
func (PositionalArgument) String ¶
func (p PositionalArgument) String() string
func (PositionalArgument) Value ¶
func (p PositionalArgument) Value() interface{}
Value returns a value of a positional argument.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature represents a signature of a function.
func NewSignature ¶
func NewSignature(ps []string, pr string, ks []OptionalParameter, kr string) Signature
NewSignature creates a Signature from {positional, keyword} x {required, optional} arguments and a positional rest argument and a keyword rest argument.
func (Signature) Keywords ¶
func (s Signature) Keywords() []OptionalParameter
Keywords returns keyword optional arguments of a signature.
func (Signature) NameToIndex ¶
NameToIndex converts an argument name into an index in arguments inside a signature.
func (Signature) Positionals ¶
Positionals returns positional required arguments of a signature.
func (Signature) RestKeywords ¶
RestKeywords returns a keyword rest argument of a signature.
func (Signature) RestPositionals ¶
RestPositionals returns a positional rest argument of a signature.
type Switch ¶
type Switch struct {
// contains filtered or unexported fields
}
Switch represents a switch expression.
func NewSwitch ¶
func NewSwitch(v interface{}, cs []SwitchCase, d interface{}) Switch
NewSwitch creates a match expression.
func (Switch) Cases ¶
func (s Switch) Cases() []SwitchCase
Cases returns pairs of a pattern and corrensponding value in a match expression.
func (Switch) DefaultCase ¶
func (s Switch) DefaultCase() interface{}
DefaultCase returns a default case in a switch expression.
type SwitchCase ¶
type SwitchCase struct {
// contains filtered or unexported fields
}
SwitchCase represents a case of a pattern and corrensponding value.
func NewSwitchCase ¶
func NewSwitchCase(p string, v interface{}) SwitchCase
NewSwitchCase creates a case in a switch expression.
func (SwitchCase) Pattern ¶
func (c SwitchCase) Pattern() string
Pattern returns a pattern of a case in a switch expression.
func (SwitchCase) String ¶
func (c SwitchCase) String() string
func (SwitchCase) Value ¶
func (c SwitchCase) Value() interface{}
Value returns a value corrensponding to a pattern in a switch expression.
Source Files
¶
- anonymous_function.go
- app.go
- arguments.go
- def_function.go
- effect.go
- import.go
- keyword_argument.go
- keyword_parameters.go
- let_expression.go
- let_match.go
- let_var.go
- match.go
- match_case.go
- mutual_recursion.go
- optional_parameter.go
- positional_argument.go
- positional_parameters.go
- signature.go
- switch.go
- switch_case.go
- util.go