stdlib

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxTupleLength = 22

Variables

View Source
var (
	AnyType        = anyType{}
	BooleanType    = SimpleType{"Boolean"}
	IntType        = SimpleType{"Int"}
	StringType     = SimpleType{"String"}
	ByteVectorType = SimpleType{"ByteVector"}
	BigIntType     = SimpleType{"BigInt"}
	ThrowType      = throwType{}

	CallableRetV3 = UnionType{Types: []Type{
		SimpleType{Type: "ScriptResult"},
		SimpleType{Type: "TransferSet"},
		SimpleType{Type: "WriteSet"},
	}}
	CallableRetV4 = ListType{Type: UnionType{Types: []Type{
		SimpleType{Type: "BinaryEntry"},
		SimpleType{Type: "BooleanEntry"},
		SimpleType{Type: "Burn"},
		SimpleType{Type: "DeleteEntry"},
		SimpleType{Type: "IntegerEntry"},
		SimpleType{Type: "Issue"},
		SimpleType{Type: "Reissue"},
		SimpleType{Type: "ScriptTransfer"},
		SimpleType{Type: "SponsorFee"},
		SimpleType{Type: "StringEntry"},
	}}}

	CallableRetV5 = UnionType{Types: []Type{
		TupleType{Types: []Type{
			callableRetV5OnlyList,
			AnyType,
		}},
		callableRetV5OnlyList,
	}}
)

Functions

func DefaultTypes

func DefaultTypes() map[ast.LibraryVersion]map[string]Type

func FuncsByVersion

func FuncsByVersion() map[ast.LibraryVersion]FunctionsSignatures

func ObjectsByVersion

func ObjectsByVersion() map[ast.LibraryVersion]ObjectsSignatures

func Pretty

func Pretty(pretty bool) func(*Types) error

func Size

func Size(size int) func(*Types) error

Types

type FunctionParams

type FunctionParams struct {
	ID         ast.Function
	Arguments  []Type
	ReturnType Type
}

type FunctionParamsJson

type FunctionParamsJson struct {
	ID         string   `json:"id"`
	Arguments  []string `json:"arguments"`
	ReturnType string   `json:"return_type"`
}

type FunctionsInVersions

type FunctionsInVersions struct {
	New    map[string][]FunctionParamsJson `json:"new"`
	Remove []string                        `json:"remove"`
}

type FunctionsSignatures

type FunctionsSignatures struct {
	Funcs map[string][]FunctionParams
}

func (*FunctionsSignatures) Check

func (sig *FunctionsSignatures) Check(name string) bool

func (*FunctionsSignatures) Get

func (sig *FunctionsSignatures) Get(name string, args []Type) (FunctionParams, bool)

type FunctionsSignaturesJson

type FunctionsSignaturesJson struct {
	Versions []FunctionsInVersions `json:"versions"`
}

type ListType

type ListType struct {
	Type Type
}

func (*ListType) AppendList

func (t *ListType) AppendList(rideType Type)

func (*ListType) AppendType

func (t *ListType) AppendType(rideType Type)

func (ListType) Equal

func (t ListType) Equal(other Type) bool

func (ListType) EqualWithEntry

func (t ListType) EqualWithEntry(other Type) bool

func (ListType) String

func (t ListType) String() string

type ObjectField

type ObjectField struct {
	Name string
	Type Type
}

type ObjectInfo

type ObjectInfo struct {
	NotConstruct bool
	Fields       []ObjectField
}

type ObjectsSignatures

type ObjectsSignatures struct {
	Obj map[string]ObjectInfo
}

func (*ObjectsSignatures) GetConstruct

func (s *ObjectsSignatures) GetConstruct(name string, args []Type) (FunctionParams, bool)

func (*ObjectsSignatures) GetField

func (s *ObjectsSignatures) GetField(objType Type, fieldName string) (Type, bool)

func (*ObjectsSignatures) IsExist

func (s *ObjectsSignatures) IsExist(name string) bool

type SimpleType

type SimpleType struct {
	Type string
}

func (SimpleType) Equal

func (t SimpleType) Equal(other Type) bool

func (SimpleType) EqualWithEntry

func (t SimpleType) EqualWithEntry(other Type) bool

func (SimpleType) String

func (t SimpleType) String() string

type StdVars

type StdVars struct {
	Vars []VarsInVersion `json:"vars"`
}

func Vars

func Vars() *StdVars

type TupleType

type TupleType struct {
	Types []Type
}

func (TupleType) Equal

func (t TupleType) Equal(other Type) bool

func (TupleType) EqualWithEntry

func (t TupleType) EqualWithEntry(other Type) bool

func (TupleType) String

func (t TupleType) String() string

type Type

type Type interface {
	String() string
	Equal(Type) bool
	EqualWithEntry(Type) bool
}

func JoinTypes

func JoinTypes(types ...Type) Type

func ParseRuntimeType

func ParseRuntimeType(t string) Type

func ParseType

func ParseType(t string) Type

type Types

type Types struct {
	Buffer string

	Pretty bool
	// contains filtered or unexported fields
}

func (*Types) AST

func (t *Types) AST() *node32

func (*Types) Add

func (t *Types) Add(rule pegRule, begin, end, index uint32)

func (*Types) Init

func (p *Types) Init(options ...func(*Types) error) error

func (*Types) Parse

func (p *Types) Parse(rule ...int) error

func (*Types) PrettyPrintSyntaxTree

func (t *Types) PrettyPrintSyntaxTree(buffer string)

func (*Types) Print

func (t *Types) Print()

func (*Types) PrintSyntaxTree

func (p *Types) PrintSyntaxTree()

func (*Types) Reset

func (p *Types) Reset()

func (*Types) SprintSyntaxTree

func (p *Types) SprintSyntaxTree() string

func (*Types) Tokens

func (t *Types) Tokens() []token32

func (*Types) Trim

func (t *Types) Trim(length uint32)

func (*Types) WriteSyntaxTree

func (p *Types) WriteSyntaxTree(w io.Writer)

type UnionType

type UnionType struct {
	Types []Type
}

func (*UnionType) AppendType

func (t *UnionType) AppendType(rideType Type)

func (UnionType) Equal

func (t UnionType) Equal(other Type) bool

func (UnionType) EqualWithEntry

func (t UnionType) EqualWithEntry(other Type) bool

func (UnionType) Simplify

func (t UnionType) Simplify() Type

func (UnionType) String

func (t UnionType) String() string

type Variable

type Variable struct {
	Name string `json:"name"`
	Type Type   `json:"-"`
}

type VarsInVersion

type VarsInVersion struct {
	AppendJson []variableJson `json:"append"`
	Remove     []string       `json:"remove"`
	Append     []Variable     `json:"-"`
}

Jump to

Keyboard shortcuts

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