Documentation ¶
Index ¶
- Constants
- Variables
- func SeverityToAnsiString(s Severity) string
- type BadAllotmentSum
- type BadArity
- type BuiltinFnHover
- type BuiltinFnHoverContext
- type CheckResult
- type Diagnostic
- type DiagnosticKind
- type DocumentSymbol
- type DocumentSymbolKind
- type DuplicateVariable
- type EmptiedAccount
- type FixedPortionVariable
- type FnCallResolution
- type GotoDefinitionResult
- type Hover
- type InvalidType
- type InvalidUnboundedAccount
- type InvalidWorldOverdraft
- type NoAllotmentInSendAll
- type Parsing
- type RedundantRemaining
- type RemainingIsNotLast
- type Severity
- type StatementFnCallResolution
- type TypeMismatch
- type UnboundVariable
- type UnboundedAccountIsNotLast
- type UnknownFunction
- type UnusedVar
- type VarOriginFnCallResolution
- type VariableHover
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 AllowedTypes = []string{ TypeMonetary, TypeAccount, TypePortion, TypeAsset, TypeNumber, TypeString, }
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 ¶
Types ¶
type BadAllotmentSum ¶
func (*BadAllotmentSum) Message ¶
func (e *BadAllotmentSum) Message() string
func (*BadAllotmentSum) Severity ¶
func (*BadAllotmentSum) 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 DocumentSymbol ¶
type DocumentSymbolKind ¶
type DocumentSymbolKind = float64
const (
DocumentSymbolVariable DocumentSymbolKind = 13
)
!important! keep in sync with https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol
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 ¶
func (*FixedPortionVariable) Message ¶
func (e *FixedPortionVariable) Message() string
func (*FixedPortionVariable) Severity ¶
func (*FixedPortionVariable) Severity() Severity
type FnCallResolution ¶
type GotoDefinitionResult ¶
func GotoDefinition ¶
func GotoDefinition(program parser.Program, position parser.Position, checkResult CheckResult) *GotoDefinitionResult
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 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 ¶
func (StatementFnCallResolution) ContextName ¶
func (StatementFnCallResolution) ContextName() string
func (StatementFnCallResolution) GetParams ¶
func (r StatementFnCallResolution) GetParams() []string
type TypeMismatch ¶
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 VarOriginFnCallResolution ¶
func (VarOriginFnCallResolution) ContextName ¶
func (VarOriginFnCallResolution) ContextName() string
func (VarOriginFnCallResolution) GetParams ¶
func (r VarOriginFnCallResolution) GetParams() []string
Click to show internal directories.
Click to hide internal directories.