Documentation
¶
Index ¶
- Variables
- func Compile(source string) (VarsEncoder, CompiledProgram, error)
- func CompileWithFeatureFlags(source string, featureFlags map[string]struct{}) (VarsEncoder, CompiledProgram, error)
- type AccountBalance
- type AccountDependency
- type AccountMetadataRow
- type AccountsMetadata
- type BadArityErr
- type BadPortionParsingErr
- type BalanceQuery
- type BalanceQueryItem
- type BalanceRow
- type Balances
- type BytecodeVersion
- type CannotCastScopedAccountToString
- type CannotCastToString
- type CannotStoreScopedAccountInMeta
- type CompiledProgram
- type CompilerCannotCastToString
- type CompilerCannotStoreScopedAccountInMeta
- type CompilerDuplicateRemaining
- type CompilerError
- type CompilerExperimentalFeature
- type CompilerFeatureNotImplemented
- type CompilerInvalidFeature
- type CompilerInvalidMetaPosition
- type CompilerInvalidScopedAccountPosition
- type CompilerInvalidUncappedSource
- type CompilerInvalidVariableValue
- type CompilerMissingVariable
- type CompilerTypeError
- type CompilerUnboundVar
- type CompilerUnsupportedNode
- type DivideByZero
- type ExecutionResult
- type ExperimentalFeature
- type InternalError
- type InterpreterError
- type InvalidAccountName
- type InvalidAllotmentInSendAll
- type InvalidAllotmentSum
- type InvalidAsset
- type InvalidColor
- type InvalidFeature
- type InvalidMonetaryLiteral
- type InvalidNestedMeta
- type InvalidNumberLiteral
- type InvalidRemainingAllotment
- type InvalidScope
- type InvalidTypeErr
- type InvalidUnboundedAddressInScalingAddress
- type InvalidUnboundedInSendAll
- type MetaDependency
- type Metadata
- type MetadataNotFound
- type MetadataQuery
- type MismatchedCurrencyError
- type MissingFundsErr
- type MissingVariableErr
- type NegativeAmountErr
- type NegativeBalanceError
- type NegativePortion
- type ParseResult
- func (p ParseResult) Compile() (VarsEncoder, CompiledProgram, error)
- func (p ParseResult) CompileWithFeatureFlags(featureFlags map[string]struct{}) (VarsEncoder, CompiledProgram, error)
- func (p ParseResult) GetNeededVariables() map[string]string
- func (p ParseResult) GetParsingErrors() []ParserError
- func (p ParseResult) GetSource() string
- func (p ParseResult) ResolveDependencies(ctx context.Context, vars VariablesMap, store Store) (ResolvedDependencies, error)
- func (p ParseResult) Run(ctx context.Context, vars VariablesMap, store Store) (ExecutionResult, InterpreterError)
- func (p ParseResult) RunWithFeatureFlags(ctx context.Context, vars VariablesMap, store Store, ...) (ExecutionResult, InterpreterError)
- type ParserError
- type Posting
- type QueryBalanceError
- type QueryMetadataError
- type ResolvedDependencies
- type SetAccountMetadataRow
- type SetAccountsMetadata
- type StaticStore
- type Store
- type TypeError
- type TypecheckBadArity
- type TypecheckDuplicateVariable
- type TypecheckErrorKind
- type TypecheckInvalidType
- type TypecheckTypeMismatch
- type TypecheckUnboundVariable
- type TypecheckUnknownFunction
- type UnboundFunctionErr
- type UnboundVariableErr
- type UnhandledError
- type UnsupportedBytecodeVersionError
- type VMStore
- type Value
- type VariablesMap
- type Vars
- type VarsEncoder
- type VerifiedVarsInfo
- type Vm
- type VmAssetMismatchError
- type VmBadMetaValueError
- type VmCannotCastScopedAccountToString
- type VmDivideByZeroError
- type VmInternalError
- type VmInvalidAccountName
- type VmInvalidAllotmentSum
- type VmInvalidColor
- type VmInvalidPostingError
- type VmInvalidScope
- type VmInvalidUncappedSource
- type VmMetadataNotFoundError
- type VmMissingFundsError
- type VmNegativeAmountError
- type VmNegativeBalanceError
- type VmNegativePortionError
- type VmStoreError
Constants ¶
This section is empty.
Variables ¶
var ( CurrentBytecodeVersion = vm.CurrentBytecodeVersion PeekCompiledProgramVersion = vm.PeekProgramVersion PeekVarsVersion = vm.PeekVarsVersion )
var ( VerifyCompiledProgram = vm.Verify VerifyCompiledProgramWithVars = vm.VerifyWithVars )
var DecodeCompiledProgram = vm.DecodeProgram
var DecodeVars = vm.DecodeVars
var ErrScalingNotSupported = interpreter.ErrScalingNotSupported
var NewVm = vm.NewVm
var ParseErrorsToString = parser.ParseErrorsToString
Functions ¶
func Compile ¶ added in v0.1.1
func Compile(source string) (VarsEncoder, CompiledProgram, error)
func CompileWithFeatureFlags ¶ added in v0.1.1
func CompileWithFeatureFlags(source string, featureFlags map[string]struct{}) (VarsEncoder, CompiledProgram, error)
Types ¶
type AccountBalance ¶
type AccountBalance = interpreter.AccountBalance
type AccountDependency ¶ added in v0.0.25
type AccountDependency = interpreter.AccountDependency
type AccountMetadataRow ¶ added in v0.0.25
type AccountMetadataRow = interpreter.AccountMetadataRow
Input account metadata (opaque, string-valued) read via meta()
type AccountsMetadata ¶
type AccountsMetadata = interpreter.AccountsMetadata
type BadArityErr ¶ added in v0.1.2
type BadArityErr = interpreter.BadArityErr
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type BadPortionParsingErr ¶ added in v0.1.2
type BadPortionParsingErr = interpreter.BadPortionParsingErr
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type BalanceQuery ¶
type BalanceQuery = interpreter.BalanceQuery
For each account, list of the needed assets
type BalanceQueryItem ¶ added in v0.0.25
type BalanceQueryItem = interpreter.BalanceQueryItem
type BalanceRow ¶ added in v0.0.25
type BalanceRow = interpreter.BalanceRow
type Balances ¶
type Balances = interpreter.Balances
type BytecodeVersion ¶ added in v0.1.1
type BytecodeVersion = vm.BytecodeVersion
BytecodeVersion is the version of the bytecode wire format a compiled program or an encoded Vars was written with — major.minor, versioned independently of the library itself: a new library release does not imply a new bytecode version. A reader accepts a blob of its own major with a minor no newer than its own (BytecodeVersion.CanRead); anything else the decoders reject with UnsupportedBytecodeVersionError. Major 0 is unstable: a 0.x build reads only its exact version, so a host holding a 0.x blob this build rejects should recompile the script from source.
CurrentBytecodeVersion is what this build's Compile and Encode write and the newest it can execute. A host that stores bytecode compiled by one build and executes it with another can compare it against the stored blob's version before trusting the bytecode to run; PeekCompiledProgramVersion and PeekVarsVersion read that version from the raw bytes without decoding the rest, and without checking that this build can read it.
type CannotCastScopedAccountToString ¶ added in v0.1.2
type CannotCastScopedAccountToString = interpreter.CannotCastScopedAccountToString
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type CannotCastToString ¶ added in v0.1.2
type CannotCastToString = interpreter.CannotCastToString
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type CannotStoreScopedAccountInMeta ¶ added in v0.1.2
type CannotStoreScopedAccountInMeta = interpreter.CannotStoreScopedAccountInMeta
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type CompiledProgram ¶ added in v0.1.1
type CompilerCannotCastToString ¶ added in v0.1.2
type CompilerCannotCastToString = compiler.CannotCastToString
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerCannotStoreScopedAccountInMeta ¶ added in v0.1.2
type CompilerCannotStoreScopedAccountInMeta = compiler.CannotStoreScopedAccountInMeta
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerDuplicateRemaining ¶ added in v0.1.2
type CompilerDuplicateRemaining = compiler.DuplicateRemaining
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerError ¶ added in v0.1.2
type CompilerError = compiler.CompilerError
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerExperimentalFeature ¶ added in v0.1.2
type CompilerExperimentalFeature = compiler.ExperimentalFeature
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerFeatureNotImplemented ¶ added in v0.1.2
type CompilerFeatureNotImplemented = compiler.FeatureNotImplemented
CompilerFeatureNotImplemented reports a valid construct the compiler does not support yet; the interpreter may still run the script.
type CompilerInvalidFeature ¶ added in v0.1.2
type CompilerInvalidFeature = compiler.InvalidFeature
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerInvalidMetaPosition ¶ added in v0.1.2
type CompilerInvalidMetaPosition = compiler.InvalidMetaPosition
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerInvalidScopedAccountPosition ¶ added in v0.1.2
type CompilerInvalidScopedAccountPosition = compiler.InvalidScopedAccountPosition
Compiler errors reporting defects in numscript itself, never caused by the script. Their fields are diagnostic only and not part of the contract.
type CompilerInvalidUncappedSource ¶ added in v0.1.2
type CompilerInvalidUncappedSource = compiler.InvalidUncappedSource
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerInvalidVariableValue ¶ added in v0.1.2
type CompilerInvalidVariableValue = compiler.InvalidVariableValue
Errors returned by VarsEncoder.Encode, caused by the vars. Cause is the parser's error, diagnostic only.
type CompilerMissingVariable ¶ added in v0.1.2
type CompilerMissingVariable = compiler.MissingVariable
Errors returned by VarsEncoder.Encode, caused by the vars. Cause is the parser's error, diagnostic only.
type CompilerTypeError ¶ added in v0.1.2
Compiler error types, aliased so callers of Compile and VarsEncoder.Encode can classify failures with errors.As without reaching into internal packages. All are returned by value. As with the interpreter's error types, their exported fields, other than the embedded source range, are part of the public contract: only ever added to, never renamed or removed. The Compiler prefix keeps them apart from the interpreter's error types of the same name.
CompilerError is implemented by every error Compile reports about the script itself; the others in this block are caused by the script.
type CompilerUnboundVar ¶ added in v0.1.2
type CompilerUnboundVar = compiler.UnboundVar
Compiler errors reporting defects in numscript itself, never caused by the script. Their fields are diagnostic only and not part of the contract.
type CompilerUnsupportedNode ¶ added in v0.1.2
type CompilerUnsupportedNode = compiler.UnsupportedNode
Compiler errors reporting defects in numscript itself, never caused by the script. Their fields are diagnostic only and not part of the contract.
type DivideByZero ¶ added in v0.1.2
type DivideByZero = interpreter.DivideByZero
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type ExecutionResult ¶
type ExecutionResult = interpreter.ExecutionResult
type ExperimentalFeature ¶ added in v0.1.2
type ExperimentalFeature = interpreter.ExperimentalFeature
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InternalError ¶ added in v0.1.2
type InternalError = interpreter.InternalError
Interpreter errors reporting defects in numscript itself, never caused by the script or its inputs. Their fields are diagnostic only and not part of the contract.
type InterpreterError ¶
type InterpreterError = interpreter.InterpreterError
type InvalidAccountName ¶ added in v0.1.2
type InvalidAccountName = interpreter.InvalidAccountName
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidAllotmentInSendAll ¶ added in v0.1.2
type InvalidAllotmentInSendAll = interpreter.InvalidAllotmentInSendAll
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidAllotmentSum ¶ added in v0.1.2
type InvalidAllotmentSum = interpreter.InvalidAllotmentSum
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidAsset ¶ added in v0.1.2
type InvalidAsset = interpreter.InvalidAsset
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidColor ¶ added in v0.1.2
type InvalidColor = interpreter.InvalidColor
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidFeature ¶ added in v0.1.2
type InvalidFeature = interpreter.InvalidFeature
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidMonetaryLiteral ¶ added in v0.1.2
type InvalidMonetaryLiteral = interpreter.InvalidMonetaryLiteral
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidNestedMeta ¶ added in v0.1.2
type InvalidNestedMeta = interpreter.InvalidNestedMeta
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidNumberLiteral ¶ added in v0.1.2
type InvalidNumberLiteral = interpreter.InvalidNumberLiteral
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidRemainingAllotment ¶ added in v0.1.2
type InvalidRemainingAllotment = interpreter.InvalidRemainingAllotment
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidScope ¶ added in v0.1.2
type InvalidScope = interpreter.InvalidScope
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidTypeErr ¶ added in v0.1.2
type InvalidTypeErr = interpreter.InvalidTypeErr
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidUnboundedAddressInScalingAddress ¶ added in v0.1.2
type InvalidUnboundedAddressInScalingAddress = interpreter.InvalidUnboundedAddressInScalingAddress
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type InvalidUnboundedInSendAll ¶ added in v0.1.2
type InvalidUnboundedInSendAll = interpreter.InvalidUnboundedInSendAll
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type MetaDependency ¶ added in v0.0.25
type MetaDependency = interpreter.MetaDependency
type MetadataNotFound ¶ added in v0.1.2
type MetadataNotFound = interpreter.MetadataNotFound
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type MetadataQuery ¶
type MetadataQuery = interpreter.MetadataQuery
type MismatchedCurrencyError ¶ added in v0.1.2
type MismatchedCurrencyError = interpreter.MismatchedCurrencyError
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type MissingFundsErr ¶ added in v0.0.21
type MissingFundsErr = interpreter.MissingFundsErr
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type MissingVariableErr ¶ added in v0.1.2
type MissingVariableErr = interpreter.MissingVariableErr
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type NegativeAmountErr ¶ added in v0.0.26
type NegativeAmountErr = interpreter.NegativeAmountErr
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type NegativeBalanceError ¶ added in v0.1.2
type NegativeBalanceError = interpreter.NegativeBalanceError
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type NegativePortion ¶ added in v0.1.2
type NegativePortion = interpreter.NegativePortion
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type ParseResult ¶
type ParseResult struct {
// contains filtered or unexported fields
}
This struct represents a parsed numscript source code
func Parse ¶
func Parse(code string) ParseResult
func (ParseResult) Compile ¶ added in v0.1.1
func (p ParseResult) Compile() (VarsEncoder, CompiledProgram, error)
func (ParseResult) CompileWithFeatureFlags ¶ added in v0.1.1
func (p ParseResult) CompileWithFeatureFlags(featureFlags map[string]struct{}) (VarsEncoder, CompiledProgram, error)
CompileWithFeatureFlags compiles the program, rejecting any construct gated behind an experimental feature flag that isn't in featureFlags.
func (ParseResult) GetNeededVariables ¶ added in v0.0.12
func (p ParseResult) GetNeededVariables() map[string]string
Returns a map from a variable's name to its type.
doesn't include variables whose value is already defined within the script
func (ParseResult) GetParsingErrors ¶
func (p ParseResult) GetParsingErrors() []ParserError
func (ParseResult) GetSource ¶
func (p ParseResult) GetSource() string
func (ParseResult) ResolveDependencies ¶ added in v0.0.25
func (p ParseResult) ResolveDependencies(ctx context.Context, vars VariablesMap, store Store) (ResolvedDependencies, error)
ResolveDependencies statically determines which accounts and metadata the script reads and writes, resolving account/asset/key expressions against the given vars and store.
func (ParseResult) Run ¶
func (p ParseResult) Run(ctx context.Context, vars VariablesMap, store Store) (ExecutionResult, InterpreterError)
func (ParseResult) RunWithFeatureFlags ¶ added in v0.0.10
func (p ParseResult) RunWithFeatureFlags( ctx context.Context, vars VariablesMap, store Store, featureFlags map[string]struct{}, ) (ExecutionResult, InterpreterError)
type ParserError ¶
type ParserError = parser.ParserError
type Posting ¶
type Posting = interpreter.Posting
type QueryBalanceError ¶ added in v0.1.2
type QueryBalanceError = interpreter.QueryBalanceError
Interpreter errors reporting that a Store call failed; Unwrap yields the store's own error.
type QueryMetadataError ¶ added in v0.1.2
type QueryMetadataError = interpreter.QueryMetadataError
Interpreter errors reporting that a Store call failed; Unwrap yields the store's own error.
type ResolvedDependencies ¶ added in v0.0.25
type ResolvedDependencies = interpreter.ResolvedDependencies
type SetAccountMetadataRow ¶ added in v0.0.25
type SetAccountMetadataRow = interpreter.SetAccountMetadataRow
The account metadata set during the execution (tagged, typed values)
type SetAccountsMetadata ¶ added in v0.0.25
type SetAccountsMetadata = interpreter.SetAccountsMetadata
type StaticStore ¶
type StaticStore = interpreter.StaticStore
type Store ¶
type Store = interpreter.Store
type TypeError ¶ added in v0.1.2
type TypeError = interpreter.TypeError
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type TypecheckBadArity ¶ added in v0.1.2
The type checker's findings, carried by CompilerTypeError.Kind. Each kind is a value type whose exported fields follow the same contract as above.
type TypecheckDuplicateVariable ¶ added in v0.1.2
type TypecheckDuplicateVariable = typecheck.DuplicateVariable
The type checker's findings, carried by CompilerTypeError.Kind. Each kind is a value type whose exported fields follow the same contract as above.
type TypecheckErrorKind ¶ added in v0.1.2
The type checker's findings, carried by CompilerTypeError.Kind. Each kind is a value type whose exported fields follow the same contract as above.
type TypecheckInvalidType ¶ added in v0.1.2
type TypecheckInvalidType = typecheck.InvalidType
The type checker's findings, carried by CompilerTypeError.Kind. Each kind is a value type whose exported fields follow the same contract as above.
type TypecheckTypeMismatch ¶ added in v0.1.2
type TypecheckTypeMismatch = typecheck.TypeMismatch
The type checker's findings, carried by CompilerTypeError.Kind. Each kind is a value type whose exported fields follow the same contract as above.
type TypecheckUnboundVariable ¶ added in v0.1.2
type TypecheckUnboundVariable = typecheck.UnboundVariable
The type checker's findings, carried by CompilerTypeError.Kind. Each kind is a value type whose exported fields follow the same contract as above.
type TypecheckUnknownFunction ¶ added in v0.1.2
type TypecheckUnknownFunction = typecheck.UnknownFunction
The type checker's findings, carried by CompilerTypeError.Kind. Each kind is a value type whose exported fields follow the same contract as above.
type UnboundFunctionErr ¶ added in v0.1.2
type UnboundFunctionErr = interpreter.UnboundFunctionErr
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type UnboundVariableErr ¶ added in v0.1.2
type UnboundVariableErr = interpreter.UnboundVariableErr
Interpreter error types, aliased so callers of Run and ResolveDependencies can classify failures with errors.As without reaching into internal packages. All are returned by value. Their exported fields, other than the embedded source range, are part of the public contract: hosts may persist them as structured facts, so they are only ever added to, never renamed or removed.
These are caused by the script, its vars, or the state it runs against.
type UnhandledError ¶ added in v0.1.2
type UnhandledError = interpreter.UnhandledError
Interpreter errors reporting defects in numscript itself, never caused by the script or its inputs. Their fields are diagnostic only and not part of the contract.
type UnsupportedBytecodeVersionError ¶ added in v0.1.1
type UnsupportedBytecodeVersionError = vm.UnsupportedBytecodeVersionError
BytecodeVersion is the version of the bytecode wire format a compiled program or an encoded Vars was written with — major.minor, versioned independently of the library itself: a new library release does not imply a new bytecode version. A reader accepts a blob of its own major with a minor no newer than its own (BytecodeVersion.CanRead); anything else the decoders reject with UnsupportedBytecodeVersionError. Major 0 is unstable: a 0.x build reads only its exact version, so a host holding a 0.x blob this build rejects should recompile the script from source.
CurrentBytecodeVersion is what this build's Compile and Encode write and the newest it can execute. A host that stores bytecode compiled by one build and executes it with another can compare it against the stored blob's version before trusting the bytecode to run; PeekCompiledProgramVersion and PeekVarsVersion read that version from the raw bytes without decoding the rest, and without checking that this build can read it.
type Value ¶
type Value = interpreter.Value
type VariablesMap ¶
type VariablesMap = interpreter.VariablesMap
type VarsEncoder ¶ added in v0.1.1
type VarsEncoder = compiler.VarsEncoder
type VerifiedVarsInfo ¶ added in v0.1.1
type VerifiedVarsInfo = vm.VerifiedVarsInfo
VerifyCompiledProgram statically checks that a program is safe to execute: ExecVm assumes well-formed bytecode and will panic rather than error on a program that is not. Compile's output always is, so this is for programs that came from somewhere else — DecodeCompiledProgram, most obviously.
VerifyCompiledProgramWithVars additionally checks the program against the vars it will be given; prefer it whenever vars are in play, since a program that loads a variable is only safe against a pool that actually has it. On success it also returns a VerifiedVarsInfo: a caller that reuses the same compiled Program across many calls (e.g. an LRU cache keyed on the compiled bytes) can keep this and use its CheckVars method to skip re-running verification — a whole-program static pass — when it sees a Vars shape it already knows is compatible.
type VmAssetMismatchError ¶ added in v0.1.1
type VmAssetMismatchError = vm.AssetMismatchError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmBadMetaValueError ¶ added in v0.1.1
type VmBadMetaValueError = vm.BadMetaValueError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmCannotCastScopedAccountToString ¶ added in v0.1.1
type VmCannotCastScopedAccountToString = vm.CannotCastScopedAccountToString
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmDivideByZeroError ¶ added in v0.1.1
type VmDivideByZeroError = vm.DivideByZeroError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmInternalError ¶ added in v0.1.1
type VmInternalError = vm.InternalError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmInvalidAccountName ¶ added in v0.1.1
type VmInvalidAccountName = vm.InvalidAccountName
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmInvalidAllotmentSum ¶ added in v0.1.1
type VmInvalidAllotmentSum = vm.InvalidAllotmentSum
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmInvalidColor ¶ added in v0.1.1
type VmInvalidColor = vm.InvalidColor
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmInvalidPostingError ¶ added in v0.1.1
type VmInvalidPostingError = vm.InvalidPostingError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmInvalidScope ¶ added in v0.1.1
type VmInvalidScope = vm.InvalidScope
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmInvalidUncappedSource ¶ added in v0.1.1
type VmInvalidUncappedSource = vm.InvalidUncappedSource
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmMetadataNotFoundError ¶ added in v0.1.1
type VmMetadataNotFoundError = vm.MetadataNotFoundError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmMissingFundsError ¶ added in v0.1.1
type VmMissingFundsError = vm.MissingFundsError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmNegativeAmountError ¶ added in v0.1.1
type VmNegativeAmountError = vm.NegativeAmountError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmNegativeBalanceError ¶ added in v0.1.1
type VmNegativeBalanceError = vm.NegativeBalanceError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmNegativePortionError ¶ added in v0.1.1
type VmNegativePortionError = vm.NegativePortionError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
type VmStoreError ¶ added in v0.1.1
type VmStoreError = vm.StoreError
VM execution error types, aliased so ExecVm callers can classify failures with errors.As without reaching into internal packages — the same pattern as the interpreter's error types above. The Vm prefix keeps them apart from the interpreter's error types of the same name, which are different types with different fields.
Directories
¶
| Path | Synopsis |
|---|---|
|
Builder to format numscript document
|
Builder to format numscript document |
|
cmd
|
|
|
numscript
command
|
|
|
internal
|
|
|
funds
Package funds is the funds engine shared by the VM and the tree-walking interpreter: per-(account, scope, asset, color) balances, a FIFO queue of funding sources fed by Pull/PullUncapped, and the postings produced by Send/SendUncapped.
|
Package funds is the funds engine shared by the VM and the tree-walking interpreter: per-(account, scope, asset, color) balances, a FIFO queue of funding sources fed by Pull/PullUncapped, and the postings produced by Send/SendUncapped. |
|
gen
Package gen produces random numscript programs for differential testing.
|
Package gen produces random numscript programs for differential testing. |
|
ir
Package ir is the compiler's intermediate representation, and everything that operates on it: Parse and Dump convert to and from the textual format (see ir-textual-format.md), Typecheck checks register types, Assemble lowers to a vm.Program.
|
Package ir is the compiler's intermediate representation, and everything that operates on it: Parse and Dump convert to and from the textual format (see ir-textual-format.md), Typecheck checks register types, Assemble lowers to a vm.Program. |
|
typecheck
Package typecheck is the shared, side-effect-free type checker for numscript.
|
Package typecheck is the shared, side-effect-free type checker for numscript. |
|
oracle
module
|