Documentation
¶
Index ¶
- Constants
- func EvalFunctions(ctx core.Context) map[string]Function
- func ImportProgram(ctx core.Context, filename string) error
- func IsAssignment(entry string) (varname string, expression string, ok bool)
- func IsCompatibleSyntax(s string) bool
- func ListVariables(storage core.VariableStorage, args []string) notify.Message
- func StopAllPlayables(context core.Context)
- type Evaluator
- type Function
- type VariableStore
Constants ¶
const SyntaxVersion = "0.37" // major,minor
SyntaxVersion tells what language version this package is supporting.
Variables ¶
This section is empty.
Functions ¶
func ImportProgram ¶ added in v0.9.2
ImportProgram runs a script from a file
func IsAssignment ¶
[ ]a[]=[]note('c')
func IsCompatibleSyntax ¶ added in v0.7.0
func ListVariables ¶ added in v0.9.2
func ListVariables(storage core.VariableStorage, args []string) notify.Message
ListVariables prints a list of sorted key=value pairs.
func StopAllPlayables ¶ added in v0.9.2
Types ¶
type Evaluator ¶ added in v0.9.2
type Evaluator struct {
// contains filtered or unexported fields
}
func NewEvaluator ¶ added in v0.9.2
func (*Evaluator) EvaluateExpression ¶ added in v0.9.2
EvaluateExpression returns the result of an expression (entry) using a given store of variables. The result is either FunctionResult or a "raw" Go object.
func (*Evaluator) EvaluateProgram ¶ added in v0.9.2
Statements are separated by newlines and semicolons. If a line is prefixed by one or more TABs then that line is appended to the previous. If a line is prefixed by 4 SPACES then that line is appended to the previous. Return the result of the last expression or statement.
func (*Evaluator) LookupFunction ¶ added in v0.9.2
type Function ¶
type Function struct {
Keyword string
Title string
Description string
Prefix string // for autocomplete
Alias string // short notation
Template string // for autocomplete in VSC
Samples string // for doc generation
ControlsAudio bool
Tags string // space separated
IsCore bool // creates a core musical object
IsComposer bool // can decorate a musical object or other decorations
Func any
}
func (Function) Declaration ¶ added in v0.50.0
func (Function) HumanizedTemplate ¶ added in v0.9.2
type VariableStore ¶
type VariableStore struct {
// contains filtered or unexported fields
}
VariableStore is an in-memory storage of values by name. Access to this store is go-routine safe.
func (*VariableStore) Delete ¶
func (v *VariableStore) Delete(key string)
Delete removes a stored value by the key. Ignores if the key is not found.
func (*VariableStore) Get ¶
func (v *VariableStore) Get(key string) (any, bool)
Get returns a value found by the key. Inspect the second return value of presence.
func (*VariableStore) NameFor ¶
func (v *VariableStore) NameFor(value any) string
NameFor finds the entry for a value and returns its (first) associated name
func (*VariableStore) Put ¶
func (v *VariableStore) Put(key string, value any)
Put stores a value by the key. Overwrites any existing value.
func (*VariableStore) Variables ¶
func (v *VariableStore) Variables() map[string]any
Variables returns a copy of all stores variables.