Documentation
¶
Index ¶
- Variables
- type Arithmetic
- type ArithmeticImpl
- func (a *ArithmeticImpl) Add(Object) (Object, error)
- func (a *ArithmeticImpl) Div(Object) (Object, error)
- func (a *ArithmeticImpl) Equal(Object) (Object, error)
- func (a *ArithmeticImpl) Gt(Object) (Object, error)
- func (a *ArithmeticImpl) GtEq(Object) (Object, error)
- func (a *ArithmeticImpl) LogicalAnd(Object) (Object, error)
- func (a *ArithmeticImpl) LogicalNot() (Object, error)
- func (a *ArithmeticImpl) LogicalOr(Object) (Object, error)
- func (a *ArithmeticImpl) Lt(Object) (Object, error)
- func (a *ArithmeticImpl) LtEq(Object) (Object, error)
- func (a *ArithmeticImpl) Mod(Object) (Object, error)
- func (a *ArithmeticImpl) Mul(Object) (Object, error)
- func (a *ArithmeticImpl) Negative() (Object, error)
- func (a *ArithmeticImpl) NotEqual(Object) (Object, error)
- func (a *ArithmeticImpl) Pow(Object) (Object, error)
- func (a *ArithmeticImpl) Sub(Object) (Object, error)
- func (a *ArithmeticImpl) Xor(Object) (Object, error)
- type Bool
- func (o *Bool) Add(rs Object) (Object, error)
- func (o *Bool) BinaryOp(op int, rhs Object) (Object, error)
- func (o *Bool) Div(rs Object) (Object, error)
- func (o *Bool) Equal(rs Object) (Object, error)
- func (o *Bool) GetValue() any
- func (o *Bool) Gt(rs Object) (Object, error)
- func (o *Bool) GtEq(rs Object) (Object, error)
- func (o *Bool) LogicalAnd(rs Object) (Object, error)
- func (o *Bool) LogicalNot() (Object, error)
- func (o *Bool) LogicalOr(rs Object) (Object, error)
- func (o *Bool) Lt(rs Object) (Object, error)
- func (o *Bool) LtEq(rs Object) (Object, error)
- func (o *Bool) Mod(rs Object) (Object, error)
- func (o *Bool) Mul(rs Object) (Object, error)
- func (o *Bool) Negative() (Object, error)
- func (o *Bool) NotEqual(rs Object) (Object, error)
- func (o *Bool) Pow(rs Object) (Object, error)
- func (o *Bool) String() string
- func (o *Bool) Sub(rs Object) (Object, error)
- func (o *Bool) TypeName() string
- func (o *Bool) UnaryOp(op int) (Object, error)
- func (o *Bool) Xor(rs Object) (Object, error)
- type BuiltinFunc
- type Dict
- func (o *Dict) BinaryOp(op int, rhs Object) (Object, error)
- func (o *Dict) CanIterate() bool
- func (o *Dict) Equal(rs Object) (Object, error)
- func (o *Dict) GetValue() any
- func (o *Dict) IndexGet(rs Object) (Object, error)
- func (o *Dict) IndexSet(idx Object, rs Object) error
- func (o *Dict) Iterate() Iterator
- func (o *Dict) LogicalAnd(rs Object) (Object, error)
- func (o *Dict) LogicalNot() (Object, error)
- func (o *Dict) LogicalOr(rs Object) (Object, error)
- func (o *Dict) MethodCall(name string, args ...Object) (Object, error)
- func (o *Dict) MethodLen(args ...Object) (Object, error)
- func (o *Dict) MethodPop(args ...Object) (Object, error)
- func (o *Dict) NotEqual(rs Object) (Object, error)
- func (o *Dict) String() string
- func (o *Dict) TypeName() string
- func (o *Dict) UnaryOp(op int) (Object, error)
- type Float
- func (o *Float) Add(rs Object) (Object, error)
- func (o *Float) BinaryOp(op int, rhs Object) (Object, error)
- func (o *Float) Div(rs Object) (Object, error)
- func (o *Float) Equal(rs Object) (Object, error)
- func (o *Float) GetValue() any
- func (o *Float) Gt(rs Object) (Object, error)
- func (o *Float) GtEq(rs Object) (Object, error)
- func (o *Float) LogicalAnd(rs Object) (Object, error)
- func (o *Float) LogicalNot() (Object, error)
- func (o *Float) LogicalOr(rs Object) (Object, error)
- func (o *Float) Lt(rs Object) (Object, error)
- func (o *Float) LtEq(rs Object) (Object, error)
- func (o *Float) Mod(rs Object) (Object, error)
- func (o *Float) Mul(rs Object) (Object, error)
- func (o *Float) Negative() (Object, error)
- func (o *Float) NotEqual(rs Object) (Object, error)
- func (o *Float) Pow(rs Object) (Object, error)
- func (o *Float) String() string
- func (o *Float) Sub(rs Object) (Object, error)
- func (o *Float) TypeName() string
- func (o *Float) UnaryOp(op int) (Object, error)
- type Impl
- func (a *Impl) Add(Object) (Object, error)
- func (o *Impl) BinaryOp(_ int, _ Object) (Object, error)
- func (o *Impl) Call(_ ...Object) (Object, error)
- func (o *Impl) CanCall() bool
- func (o *Impl) CanIterate() bool
- func (a *Impl) Div(Object) (Object, error)
- func (a *Impl) Equal(Object) (Object, error)
- func (o *Impl) GetValue() any
- func (a *Impl) Gt(Object) (Object, error)
- func (a *Impl) GtEq(Object) (Object, error)
- func (o *Impl) IndexGet(Object) (Object, error)
- func (o *Impl) IndexSet(Object, Object) error
- func (o *Impl) Iterate() Iterator
- func (a *Impl) LogicalAnd(Object) (Object, error)
- func (a *Impl) LogicalNot() (Object, error)
- func (a *Impl) LogicalOr(Object) (Object, error)
- func (a *Impl) Lt(Object) (Object, error)
- func (a *Impl) LtEq(Object) (Object, error)
- func (o *Impl) MethodCall(string, ...Object) (Object, error)
- func (a *Impl) Mod(Object) (Object, error)
- func (a *Impl) Mul(Object) (Object, error)
- func (a *Impl) Negative() (Object, error)
- func (a *Impl) NotEqual(Object) (Object, error)
- func (a *Impl) Pow(Object) (Object, error)
- func (o *Impl) String() string
- func (a *Impl) Sub(Object) (Object, error)
- func (o *Impl) TypeName() string
- func (o *Impl) UnaryOp(_ int) (Object, error)
- func (a *Impl) Xor(Object) (Object, error)
- type Int
- func (o *Int) Add(rs Object) (Object, error)
- func (o *Int) BinaryOp(op int, rhs Object) (Object, error)
- func (o *Int) Div(rs Object) (Object, error)
- func (o *Int) Equal(rs Object) (Object, error)
- func (o *Int) GetValue() any
- func (o *Int) Gt(rs Object) (Object, error)
- func (o *Int) GtEq(rs Object) (Object, error)
- func (o *Int) LogicalAnd(rs Object) (Object, error)
- func (o *Int) LogicalNot() (Object, error)
- func (o *Int) LogicalOr(rs Object) (Object, error)
- func (o *Int) Lt(rs Object) (Object, error)
- func (o *Int) LtEq(rs Object) (Object, error)
- func (o *Int) Mod(rs Object) (Object, error)
- func (o *Int) Mul(rs Object) (Object, error)
- func (o *Int) Negative() (Object, error)
- func (o *Int) NotEqual(rs Object) (Object, error)
- func (o *Int) Pow(rs Object) (Object, error)
- func (o *Int) String() string
- func (o *Int) Sub(rs Object) (Object, error)
- func (o *Int) TypeName() string
- func (o *Int) UnaryOp(op int) (Object, error)
- func (o *Int) Xor(rs Object) (Object, error)
- type Iterator
- type List
- func (o *List) Add(rs Object) (Object, error)
- func (o *List) BinaryOp(op int, rhs Object) (Object, error)
- func (o *List) CanIterate() bool
- func (o *List) Equal(rs Object) (Object, error)
- func (o *List) GetValue() any
- func (o *List) IndexGet(rs Object) (Object, error)
- func (o *List) IndexSet(idx Object, rs Object) error
- func (o *List) Iterate() Iterator
- func (o *List) LogicalAnd(rs Object) (Object, error)
- func (o *List) LogicalNot() (Object, error)
- func (o *List) LogicalOr(rs Object) (Object, error)
- func (o *List) MethodCall(name string, args ...Object) (Object, error)
- func (o *List) MethodLen(args ...Object) (Object, error)
- func (o *List) MethodPop(args ...Object) (Object, error)
- func (o *List) MethodReverse(args ...Object) (Object, error)
- func (o *List) Mul(rs Object) (Object, error)
- func (o *List) NotEqual(rs Object) (Object, error)
- func (o *List) String() string
- func (o *List) TypeName() string
- func (o *List) UnaryOp(op int) (Object, error)
- type ListIterator
- type MapIterator
- type NativeFunc
- type Null
- func (o *Null) BinaryOp(op int, rhs Object) (Object, error)
- func (o *Null) Equal(rs Object) (Object, error)
- func (o *Null) LogicalAnd(rs Object) (Object, error)
- func (o *Null) LogicalNot() (Object, error)
- func (o *Null) LogicalOr(rs Object) (Object, error)
- func (o *Null) NotEqual(rs Object) (Object, error)
- func (o *Null) String() string
- func (o *Null) TypeName() string
- func (o *Null) UnaryOp(op int) (Object, error)
- type Object
- type Str
- func (o *Str) Add(rs Object) (Object, error)
- func (o *Str) BinaryOp(op int, rhs Object) (Object, error)
- func (o *Str) Equal(rs Object) (Object, error)
- func (o *Str) GetValue() any
- func (o *Str) Gt(rs Object) (Object, error)
- func (o *Str) GtEq(rs Object) (Object, error)
- func (o *Str) IndexGet(rs Object) (Object, error)
- func (o *Str) IndexSet(idx Object, rs Object) error
- func (o *Str) LogicalAnd(rs Object) (Object, error)
- func (o *Str) LogicalNot() (Object, error)
- func (o *Str) LogicalOr(rs Object) (Object, error)
- func (o *Str) Lt(rs Object) (Object, error)
- func (o *Str) LtEq(rs Object) (Object, error)
- func (o *Str) MethodCall(name string, args ...Object) (Object, error)
- func (o *Str) MethodLen(args ...Object) (Object, error)
- func (o *Str) MethodReverse(args ...Object) (Object, error)
- func (o *Str) MethodSplit(args ...Object) (Object, error)
- func (o *Str) Mul(rs Object) (Object, error)
- func (o *Str) NotEqual(rs Object) (Object, error)
- func (o *Str) String() string
- func (o *Str) TypeName() string
- func (o *Str) UnaryOp(op int) (Object, error)
- type UserFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidOp = errors.New("invalid operator") ErrNotImplemented = errors.New("not implemented") ErrDivByZero = errors.New("division by zero") ErrModByZero = errors.New("modulo by zero") ErrInvalidIndexType = errors.New("invalid index type") ErrIndexOutOfRange = errors.New("index out of range") ErrUnknownMethod = errors.New("unknown method") )
Functions ¶
This section is empty.
Types ¶
type Arithmetic ¶
type Arithmetic interface {
// LogicalNot реализация логического унарного НЕ
LogicalNot() (Object, error)
// LogicalOr реализация логического ИЛИ
LogicalOr() (Object, error)
// LogicalAnd реализация логического И для объекта
LogicalAnd(Object) (Object, error)
// Equal реализация сравнения между объектами
Equal(Object) (Object, error)
// NotEqual реализация отрицательного сравнения между объектами
NotEqual(Object) (Object, error)
// Negative реализация унарного отрицания
Negative() (Object, error)
// GtEq реализация сравнения больше либо равно
GtEq(Object) (Object, error)
// Gt реализация сравнения строго больше
Gt(Object) (Object, error)
// LtEq реализация сравнения меньше либо равно
LtEq(Object) (Object, error)
// Lt реализация сравнения строго меньше
Lt(Object) (Object, error)
// Add сложение двух объектов
Add(Object) (Object, error)
// Sub вычитание двух объектов
Sub(Object) (Object, error)
// Pow возведение в степень
Pow(Object) (Object, error)
// Mul умножение объектов
Mul(Object) (Object, error)
// Div деление объектов
Div(Object) (Object, error)
// Mod получение целочисленного остатка
Mod(Object) (Object, error)
// Xor ксоринг объектов
Xor(Object) (Object, error)
}
type ArithmeticImpl ¶
type ArithmeticImpl struct{}
func (*ArithmeticImpl) LogicalAnd ¶
func (a *ArithmeticImpl) LogicalAnd(Object) (Object, error)
func (*ArithmeticImpl) LogicalNot ¶
func (a *ArithmeticImpl) LogicalNot() (Object, error)
func (*ArithmeticImpl) Negative ¶
func (a *ArithmeticImpl) Negative() (Object, error)
type Bool ¶
type Bool struct {
Impl
// contains filtered or unexported fields
}
Bool булевый тип
func (*Bool) LogicalNot ¶
type BuiltinFunc ¶
type BuiltinFunc struct {
Impl
// contains filtered or unexported fields
}
BuiltinFunc функция
func NewBuiltinFunc ¶
func NewBuiltinFunc( n string, c func(args ...Object) (Object, error), ) *BuiltinFunc
NewBuiltinFunc новая встроенная функция
func (*BuiltinFunc) CanCall ¶
func (o *BuiltinFunc) CanCall() bool
func (*BuiltinFunc) String ¶
func (o *BuiltinFunc) String() string
func (*BuiltinFunc) TypeName ¶
func (o *BuiltinFunc) TypeName() string
type Dict ¶
type Dict struct {
Impl
// contains filtered or unexported fields
}
Dict мапа
func (*Dict) CanIterate ¶
func (*Dict) LogicalNot ¶
type Float ¶
type Float struct {
Impl
// contains filtered or unexported fields
}
Float тип с плавающей точкой
func (*Float) LogicalNot ¶
type Impl ¶
type Impl struct{}
Impl базовая реализация объекта
func (*Impl) CanIterate ¶
func (*Impl) LogicalNot ¶
type Int ¶
type Int struct {
Impl
// contains filtered or unexported fields
}
Int целочисленный тип
func (*Int) LogicalNot ¶
type List ¶
type List struct {
Impl
// contains filtered or unexported fields
}
список, содержащий другие объекты
func (*List) CanIterate ¶
func (*List) LogicalNot ¶
type ListIterator ¶
type ListIterator struct {
Impl
// contains filtered or unexported fields
}
ListIterator используется для итерирования по списку
func (*ListIterator) Key ¶
func (i *ListIterator) Key() Object
func (*ListIterator) Next ¶
func (i *ListIterator) Next() bool
func (*ListIterator) String ¶
func (i *ListIterator) String() string
func (*ListIterator) TypeName ¶
func (i *ListIterator) TypeName() string
func (*ListIterator) Value ¶
func (i *ListIterator) Value() Object
type MapIterator ¶
type MapIterator struct {
Impl
// contains filtered or unexported fields
}
func (*MapIterator) Key ¶
func (m *MapIterator) Key() Object
func (*MapIterator) Next ¶
func (m *MapIterator) Next() bool
func (*MapIterator) String ¶
func (m *MapIterator) String() string
func (*MapIterator) TypeName ¶
func (m *MapIterator) TypeName() string
func (*MapIterator) Value ¶
func (m *MapIterator) Value() Object
type NativeFunc ¶
type NativeFunc struct {
Impl
// contains filtered or unexported fields
}
NativeFunc функция
func NewNativeFunc ¶
func NewNativeFunc( args []string, argsLen int, code []parser.IStmtContext, ) *NativeFunc
func (*NativeFunc) CanCall ¶
func (o *NativeFunc) CanCall() bool
func (*NativeFunc) GetArgs ¶
func (o *NativeFunc) GetArgs() []string
func (*NativeFunc) GetArgsLen ¶
func (o *NativeFunc) GetArgsLen() int
func (*NativeFunc) GetCode ¶
func (o *NativeFunc) GetCode() []parser.IStmtContext
func (*NativeFunc) SetName ¶
func (o *NativeFunc) SetName(name string)
func (*NativeFunc) String ¶
func (o *NativeFunc) String() string
func (*NativeFunc) TypeName ¶
func (o *NativeFunc) TypeName() string
type Object ¶
type Object interface {
// возращение имени типа в виде строки
TypeName() string
// возвращение строковое представление типа
String() string
// выполнение бинарной операции
BinaryOp(int, Object) (Object, error)
// выполнение унарной операции
UnaryOp(int) (Object, error)
// может ли данный объект быть вызван как функция
CanCall() bool
// вызов объекта как функции с аргументами
Call(...Object) (Object, error)
// call method of object
MethodCall(string, ...Object) (Object, error)
// может ли данный объект итерироваться
CanIterate() bool
// возвращает итератор для объекта
Iterate() Iterator
// получение значения из объекта
GetValue() any
// получение значения объекта по его индексу внутри
IndexGet(Object) (Object, error)
// установка значения объекта по индексу
IndexSet(Object, Object) error
// LogicalNot реализация логического унарного НЕ
LogicalNot() (Object, error)
// LogicalOr реализация логического ИЛИ
LogicalOr(Object) (Object, error)
// LogicalAnd реализация логического И для объекта
LogicalAnd(Object) (Object, error)
// Equal реализация сравнения между объектами
Equal(Object) (Object, error)
// NotEqual реализация отрицательного сравнения между объектами
NotEqual(Object) (Object, error)
// Negative реализация унарного отрицания
Negative() (Object, error)
// GtEq реализация сравнения больше либо равно
GtEq(Object) (Object, error)
// Gt реализация сравнения строго больше
Gt(Object) (Object, error)
// LtEq реализация сравнения меньше либо равно
LtEq(Object) (Object, error)
// Lt реализация сравнения строго меньше
Lt(Object) (Object, error)
// Add сложение двух объектов
Add(Object) (Object, error)
// Sub вычитание двух объектов
Sub(Object) (Object, error)
// Pow возведение в степень
Pow(Object) (Object, error)
// Mul умножение объектов
Mul(Object) (Object, error)
// Div деление объектов
Div(Object) (Object, error)
// Mod получение целочисленного остатка
Mod(Object) (Object, error)
// Xor ксоринг объектов
Xor(Object) (Object, error)
}
представляет собой элементарный объект для обработки
type Str ¶
type Str struct {
Impl
// contains filtered or unexported fields
}
Str тип с плавающей точкой
func (*Str) LogicalNot ¶
type UserFunc ¶
type UserFunc struct {
Impl
// contains filtered or unexported fields
}
UserFunc функция, созданная пользователем
func NewUserFunc ¶
NewUserFunc новая пользовательская функция
Click to show internal directories.
Click to hide internal directories.