numscript

package module
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 3 Imported by: 0

README

Numscript CLI

GitHub Release Go Reference Go codecov

Numscript is the DSL used to express financial transaction within the Formance ledger. You can try it in its online playground

The CLI in this repo allows you to play with numscript locally, check if there are parsing or logic errors in your numscript files, and run the numscript language server

The language server features include:

  • Diagnostics
  • Hover on values
  • Detect document symbols
  • Go to definition
Build locally

If you have the golang toolchain installed locally, you can run go install ./internal/numscript/numscript.go to build the cli from source, which you'll be able to run by executing the numscript command Otherwise, you can download it from this repo's releases

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ParseErrorsToString = parser.ParseErrorsToString

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance = interpreter.AccountBalance

type AccountMetadata

type AccountMetadata = interpreter.AccountMetadata

type AccountsMetadata

type AccountsMetadata = interpreter.AccountsMetadata

The newly defined account metadata after the execution

type BalanceQuery

type BalanceQuery = interpreter.BalanceQuery

For each account, list of the needed assets

type Balances

type Balances = interpreter.Balances

type ExecutionResult

type ExecutionResult = interpreter.ExecutionResult

type InterpreterError

type InterpreterError = interpreter.InterpreterError

type Metadata

type Metadata = interpreter.Metadata

The transaction metadata, set by set_tx_meta()

type MetadataQuery

type MetadataQuery = interpreter.MetadataQuery

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) 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) Run

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 StaticStore

type StaticStore = interpreter.StaticStore

type Store

type Store = interpreter.Store

type Value

type Value = interpreter.Value

type VariablesMap

type VariablesMap = interpreter.VariablesMap

Directories

Path Synopsis
internal
cmd
lsp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL