analysis

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const FnSetAccountMeta = "set_account_meta"
View Source
const FnSetTxMeta = "set_tx_meta"
View Source
const FnVarOriginBalance = "balance"
View Source
const FnVarOriginMeta = "meta"
View Source
const FnVarOriginOverdraft = "overdraft"
View Source
const TypeAccount = "account"
View Source
const TypeAny = "any"
View Source
const TypeAsset = "asset"
View Source
const TypeMonetary = "monetary"
View Source
const TypeNumber = "number"
View Source
const TypePortion = "portion"
View Source
const TypeString = "string"

Variables

View Source
var Builtins = map[string]FnCallResolution{
	FnSetTxMeta: StatementFnCallResolution{
		Params: []string{TypeString, TypeAny},
		Docs:   "set transaction metadata",
	},
	FnSetAccountMeta: StatementFnCallResolution{
		Params: []string{TypeAccount, TypeString, TypeAny},
		Docs:   "set account metadata",
	},
	FnVarOriginMeta: VarOriginFnCallResolution{
		Params: []string{TypeAccount, TypeString},
		Return: TypeAny,
		Docs:   "fetch account metadata",
	},
	FnVarOriginBalance: VarOriginFnCallResolution{
		Params: []string{TypeAccount, TypeAsset},
		Return: TypeMonetary,
		Docs:   "fetch account balance",
	},
	FnVarOriginOverdraft: VarOriginFnCallResolution{
		Params: []string{TypeAccount, TypeAsset},
		Return: TypeMonetary,
		Docs:   "get absolute amount of the overdraft of an account. Returns zero if balance is not negative",
	},
}

Functions

func SeverityToAnsiString

func SeverityToAnsiString(s Severity) string

Types

type BadAllotmentSum

type BadAllotmentSum struct {
	Sum big.Rat
}

func (*BadAllotmentSum) Message

func (e *BadAllotmentSum) Message() string

func (*BadAllotmentSum) Severity

func (*BadAllotmentSum) Severity() Severity

type BadArity

type BadArity struct {
	Expected int
	Actual   int
}

func (*BadArity) Message

func (e *BadArity) Message() string

func (*BadArity) Severity

func (*BadArity) Severity() Severity

type BuiltinFnHover

type BuiltinFnHover struct {
	Range   parser.Range
	Node    *parser.FnCall
	Context BuiltinFnHoverContext
}

type BuiltinFnHoverContext

type BuiltinFnHoverContext = uint
const (
	OriginContext BuiltinFnHoverContext = iota
	StatementContext
)

type CheckResult

type CheckResult struct {
	Diagnostics []Diagnostic
	Program     parser.Program
	// contains filtered or unexported fields
}

func CheckProgram

func CheckProgram(program parser.Program) CheckResult

func CheckSource

func CheckSource(source string) CheckResult

func (CheckResult) GetErrorsCount

func (r CheckResult) GetErrorsCount() int

func (*CheckResult) GetSymbols

func (r *CheckResult) GetSymbols() []DocumentSymbol

Note: Results are not sorted

func (CheckResult) GetWarningsCount

func (r CheckResult) GetWarningsCount() int

func (CheckResult) ResolveBuiltinFn

func (r CheckResult) ResolveBuiltinFn(v *parser.FnCallIdentifier) FnCallResolution

func (CheckResult) ResolveVar

func (r CheckResult) ResolveVar(v *parser.Variable) *parser.VarDeclaration

type Diagnostic

type Diagnostic struct {
	Range parser.Range
	Kind  DiagnosticKind
}

type DiagnosticKind

type DiagnosticKind interface {
	Message() string
	Severity() Severity
}

type DocumentSymbol

type DocumentSymbol struct {
	Name           string
	Detail         string
	Range          parser.Range
	SelectionRange parser.Range
	Kind           DocumentSymbolKind
}

type DuplicateVariable

type DuplicateVariable struct {
	Name string
}

func (*DuplicateVariable) Message

func (e *DuplicateVariable) Message() string

func (*DuplicateVariable) Severity

func (*DuplicateVariable) Severity() Severity

type EmptiedAccount

type EmptiedAccount struct {
	Name string
}

func (*EmptiedAccount) Message

func (e *EmptiedAccount) Message() string

func (*EmptiedAccount) Severity

func (*EmptiedAccount) Severity() Severity

type FixedPortionVariable

type FixedPortionVariable struct {
	Value big.Rat
}

func (*FixedPortionVariable) Message

func (e *FixedPortionVariable) Message() string

func (*FixedPortionVariable) Severity

func (*FixedPortionVariable) Severity() Severity

type FnCallResolution

type FnCallResolution interface {
	ContextName() string
	GetParams() []string
	// contains filtered or unexported methods
}

type GotoDefinitionResult

type GotoDefinitionResult struct {
	Range parser.Range
}

func GotoDefinition

func GotoDefinition(program parser.Program, position parser.Position, checkResult CheckResult) *GotoDefinitionResult

type Hover

type Hover interface {
	// contains filtered or unexported methods
}

func HoverOn

func HoverOn(program parser.Program, position parser.Position) Hover

type InvalidType

type InvalidType struct {
	Name string
}

func (*InvalidType) Message

func (e *InvalidType) Message() string

TODO evaluate suggestion using Levenshtein distance

func (*InvalidType) Severity

func (*InvalidType) Severity() Severity

type InvalidUnboundedAccount

type InvalidUnboundedAccount struct{}

func (*InvalidUnboundedAccount) Message

func (e *InvalidUnboundedAccount) Message() string

func (*InvalidUnboundedAccount) Severity

func (*InvalidUnboundedAccount) Severity() Severity

type InvalidWorldOverdraft

type InvalidWorldOverdraft struct{}

func (*InvalidWorldOverdraft) Message

func (e *InvalidWorldOverdraft) Message() string

func (*InvalidWorldOverdraft) Severity

func (*InvalidWorldOverdraft) Severity() Severity

type NoAllotmentInSendAll

type NoAllotmentInSendAll struct{}

func (*NoAllotmentInSendAll) Message

func (e *NoAllotmentInSendAll) Message() string

func (*NoAllotmentInSendAll) Severity

func (*NoAllotmentInSendAll) Severity() Severity

type Parsing

type Parsing struct {
	Description string
}

func (*Parsing) Message

func (e *Parsing) Message() string

func (*Parsing) Severity

func (*Parsing) Severity() Severity

type RedundantRemaining

type RedundantRemaining struct{}

func (*RedundantRemaining) Message

func (e *RedundantRemaining) Message() string

func (*RedundantRemaining) Severity

func (*RedundantRemaining) Severity() Severity

type RemainingIsNotLast

type RemainingIsNotLast struct{}

func (*RemainingIsNotLast) Message

func (e *RemainingIsNotLast) Message() string

func (*RemainingIsNotLast) Severity

func (*RemainingIsNotLast) Severity() Severity

type Severity

type Severity = byte
const (
	ErrorSeverity Severity
	WarningSeverity
	Information
	Hint
)

!important! keep in sync with LSP specs https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticSeverity

type StatementFnCallResolution

type StatementFnCallResolution struct {
	Params []string
	Docs   string
}

func (StatementFnCallResolution) ContextName

func (StatementFnCallResolution) ContextName() string

func (StatementFnCallResolution) GetParams

func (r StatementFnCallResolution) GetParams() []string

type TypeMismatch

type TypeMismatch struct {
	Expected string
	Got      string
}

func (*TypeMismatch) Message

func (e *TypeMismatch) Message() string

func (*TypeMismatch) Severity

func (*TypeMismatch) Severity() Severity

type UnboundVariable

type UnboundVariable struct {
	Name string
}

func (*UnboundVariable) Message

func (e *UnboundVariable) Message() string

TODO evaluate suggestion using Levenshtein distance

func (*UnboundVariable) Severity

func (*UnboundVariable) Severity() Severity

type UnboundedAccountIsNotLast

type UnboundedAccountIsNotLast struct{}

func (*UnboundedAccountIsNotLast) Message

func (e *UnboundedAccountIsNotLast) Message() string

func (*UnboundedAccountIsNotLast) Severity

func (*UnboundedAccountIsNotLast) Severity() Severity

type UnknownFunction

type UnknownFunction struct {
	Name string
}

func (*UnknownFunction) Message

func (e *UnknownFunction) Message() string

func (*UnknownFunction) Severity

func (*UnknownFunction) Severity() Severity

type UnusedVar

type UnusedVar struct {
	Name string
}

func (*UnusedVar) Message

func (e *UnusedVar) Message() string

func (*UnusedVar) Severity

func (*UnusedVar) Severity() Severity

type VarOriginFnCallResolution

type VarOriginFnCallResolution struct {
	Params []string
	Docs   string
	Return string
}

func (VarOriginFnCallResolution) ContextName

func (VarOriginFnCallResolution) ContextName() string

func (VarOriginFnCallResolution) GetParams

func (r VarOriginFnCallResolution) GetParams() []string

type VariableHover

type VariableHover struct {
	Range parser.Range
	Node  *parser.Variable
}

Jump to

Keyboard shortcuts

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