builtin

package
v1.2.2-sp7 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TyBool = tyBool(0)

TyBool represents the `bool` type.

View Source
var TyByte = TyUint8

TyByte represents the `byte` type.

View Source
var TyFloat = TyFloat64

TyFloat represents the `float` type.

View Source
var TyFloat32 = tyFloat32(0)

TyFloat32 represents the `float32` type.

View Source
var TyFloat64 = tyFloat64(0)

TyFloat64 represents the `float64` type.

View Source
var TyInt = tyInt(0)

TyInt represents the `int` type.

View Source
var TyInt16 = tyInt16(0)

TyInt16 represents the `int16` type.

View Source
var TyInt32 = tyInt32(0)

TyInt32 represents the `int32` type.

View Source
var TyInt64 = tyInt64(0)

TyInt64 represents the `int64` type.

View Source
var TyInt8 = tyInt8(0)

TyInt8 represents the `int8` type.

View Source
var TyString = tyString(0)

TyString represents the `string` type.

View Source
var TyUint = tyUint(0)

TyUint represents the `uint` type.

View Source
var TyUint16 = tyUint16(0)

TyUint16 represents the `uint16` type.

View Source
var TyUint32 = tyUint32(0)

TyUint32 represents the `uint32` type.

View Source
var TyUint64 = tyUint64(0)

TyUint64 represents the `uint64` type.

View Source
var TyUint8 = tyUint8(0)

TyUint8 represents the `uint8` type.

View Source
var TyVar = tyVar(0)

TyVar represents the `var` type.

View Source
var YaklangBaseLib = map[string]interface{}{
	"append":    Append,
	"copy":      Copy,
	"delete":    Delete,
	"get":       Get,
	"len":       Len,
	"cap":       Cap,
	"mkmap":     Mkmap,
	"mapFrom":   MapFrom,
	"mapOf":     MapOf,
	"panic":     Panic,
	"panicf":    Panicf,
	"print":     fmt.Print,
	"printf":    fmt.Printf,
	"println":   fmt.Println,
	"sprint":    fmt.Sprint,
	"sprintf":   fmt.Sprintf,
	"sprintln":  fmt.Sprintln,
	"fprintln":  fmt.Fprintln,
	"set":       Set,
	"mkslice":   Mkslice,
	"slice":     Mkslice,
	"sliceFrom": sliceFrom,
	"sliceOf":   SliceOf,
	"sub":       SubSlice,
	"make":      Make,
	"close":     CloseChan,

	"float":   TyFloat64,
	"float64": TyFloat64,
	"float32": TyFloat32,
	"int8":    TyInt8,
	"int16":   TyInt16,
	"int32":   TyInt32,
	"int64":   TyInt64,
	"int":     TyInt,
	"uint":    TyUint,
	"byte":    TyUint8,
	"uint8":   TyUint8,
	"uint16":  TyUint16,
	"uint32":  TyUint32,
	"uint64":  TyUint64,
	"string":  TyString,
	"bool":    TyBool,
	"var":     TyVar,
	"type":    typeOf,

	"max": Max,
	"min": Min,

	"undefined": yaklangspec.Undefined,
	"nil":       nil,
	"true":      true,
	"false":     false,

	"$elem":    Elem,
	"$neg":     Neg,
	"$mul":     Mul,
	"$quo":     Quo,
	"$mod":     Mod,
	"$add":     Add,
	"$sub":     Sub,
	"$ternary": Ternary,
	"$in":      In,

	"$xor":    Xor,
	"$lshr":   Lshr,
	"$rshr":   Rshr,
	"$bitand": BitAnd,
	"$bitor":  BitOr,
	"$bitnot": BitNot,
	"$andnot": AndNot,

	"$lt":  LT,
	"$gt":  GT,
	"$le":  LE,
	"$ge":  GE,
	"$eq":  EQ,
	"$ne":  NE,
	"$not": Not,
}

Functions

func Add

func Add(a, b interface{}) interface{}

Add returns a+b

func AndNot

func AndNot(a, b interface{}) interface{}

AndNot returns a &^ b

func Append

func Append(a interface{}, vals ...interface{}) (ret interface{})

Append does append(a, vals...)

func BitAnd

func BitAnd(a, b interface{}) interface{}

BitAnd returns a & b

func BitNot

func BitNot(a interface{}) interface{}

BitNot returns ^a

func BitOr

func BitOr(a, b interface{}) interface{}

BitOr returns a | b

func Bool

func Bool(a interface{}) bool

Bool returns bool(a)

func Cap

func Cap(a interface{}) int

Cap returns capacity of a collection object. object can be a slice, an array or a chan.

func CloseChan

func CloseChan(v interface{})

close channel

func Copy

func Copy(a, b interface{}) int

Copy does copy(a, b).

func Dec

func Dec(a interface{}) interface{}

Dec returns a-1

func Delete

func Delete(m interface{}, key interface{})

Delete deletes a key from map object.

func EQ

func EQ(a, b interface{}) interface{}

func Elem

func Elem(a interface{}) interface{}

Elem returns *a

func Float32

func Float32(a interface{}) float32

Float32 returns float32(a)

func Float64

func Float64(a interface{}) float64

Float64 returns float64(a)

func GE

func GE(a, b interface{}) interface{}

GE returns a >= b

func GT

func GT(a, b interface{}) interface{}

GT returns a > b

func Get

func Get(m interface{}, key interface{}, defaultValues ...interface{}) (result interface{})

Get gets a value from an object. object can be a slice, an array, a map or a user-defined class.

func GetVar

func GetVar(m interface{}, key interface{}) interface{}

GetVar returns a member variable of an object. object can be a slice, an array, a map or a user-defined class.

func In

func In(a, b interface{}) interface{}

In

func Inc

func Inc(a interface{}) interface{}

Inc returns a+1

func Int

func Int(a interface{}) int

Int returns int(a)

func Int16

func Int16(a interface{}) int16

Int16 returns int16(a)

func Int32

func Int32(a interface{}) int32

Int32 returns int32(a)

func Int64

func Int64(a interface{}) int64

Int64 returns int64(a)

func Int8

func Int8(a interface{}) int8

Int8 returns int8(a)

func LE

func LE(a, b interface{}) interface{}

LE returns a <= b

func LT

func LT(a, b interface{}) interface{}

LT returns a < b

func Len

func Len(a interface{}) int

Len returns length of a collection object. object can be a slice, an array, a map, a string or a chan.

func Lshr

func Lshr(a, b interface{}) interface{}

Lshr returns a << b

func Make

func Make(typ yaksepc.GoTyper, args ...int) interface{}

Make creates a instance of yaksepc builtin type (slice, map and chan)

func Map

func Map(key, elem interface{}) interface{}

Map returns map[key]elem

func MapFrom

func MapFrom(args ...interface{}) interface{}

MapFrom creates a map from args.

func MapInit

func MapInit(args ...interface{}) interface{}

MapInit creates a map object from `mapInit(mapType, member1, val1, ...)`.

func MapOf

func MapOf(key, val interface{}) interface{}

MapOf makes a map type.

func Max

func Max(args ...interface{}) (max interface{})

Max returns max(a1, a2, ...)

func Min

func Min(args ...interface{}) (min interface{})

Min returns min(a1, a2, ...)

func Mkmap

func Mkmap(typ interface{}, n ...int) interface{}

Mkmap makes a new map object.

func Mkslice

func Mkslice(typ interface{}, args ...interface{}) interface{}

Mkslice returns a new slice.

func Mod

func Mod(a, b interface{}) interface{}

Mod returns a%b or return fmt.Sprintf(a,b...)

func Mul

func Mul(a, b interface{}) interface{}

Mul returns a*b

func NE

func NE(a, b interface{}) interface{}

NE returns a != b

func Neg

func Neg(a interface{}) interface{}

Neg returns -a

func Not

func Not(a interface{}) interface{}

Not returns !a

func Panic

func Panic(v interface{})

Panic panics with v.

func Panicf

func Panicf(format string, args ...interface{})

Panicf panics with sprintf(format, args...).

func Quo

func Quo(a, b interface{}) interface{}

Quo returns a/b

func Rshr

func Rshr(a, b interface{}) interface{}

Rshr returns a >> b

func Set

func Set(m interface{}, args ...interface{})

Set sets (index, value) pairs to an object. object can be a slice, an array, a map or a user-defined class.

func SetIndex

func SetIndex(m, key, v interface{})

SetIndex sets a (index, value) pair to an object. object can be a slice, an array, a map or a user-defined class.

func Slice

func Slice(elem interface{}) interface{}

Slice returns []T

func SliceFrom

func SliceFrom(args ...interface{}) interface{}

SliceFrom creates a slice from [a1, a2, ...].

func SliceFromTy

func SliceFromTy(args ...interface{}) interface{}

SliceFromTy creates a slice from `[]T{a1, a2, ...}`.

func SliceOf

func SliceOf(typ interface{}) interface{}

SliceOf makes a slice type.

func String

func String(a interface{}) string

String returns string(a)

func StringEx

func StringEx(a interface{}, verbose string) string

func StructInit

func StructInit(args ...interface{}) interface{}

StructInit creates a struct object from `structInit(structType, member1, val1, ...)`.

func Sub

func Sub(a, b interface{}) interface{}

Sub returns a-b

func SubSlice

func SubSlice(a, i, j interface{}) interface{}

SubSlice returns a[i:j]. if i == nil it returns a[:j]. if j == nil it returns a[i:].

func Ternary

func Ternary(condation, a, b interface{}) interface{}

Ternary

func Uint

func Uint(a interface{}) uint

Uint returns uint(a)

func Uint16

func Uint16(a interface{}) uint16

Uint16 returns uint16(a)

func Uint32

func Uint32(a interface{}) uint32

Uint32 returns uint32(a)

func Uint64

func Uint64(a interface{}) uint64

Uint64 returns uint64(a)

func Uint8

func Uint8(a interface{}) byte

Uint8 returns uint8(a)

func Xor

func Xor(a, b interface{}) interface{}

Xor returns a ^ b

Types

This section is empty.

Jump to

Keyboard shortcuts

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