eclaType

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTypeOfList

func CheckTypeOfList(l *List, t string) bool

func GetTypeOfKeyAndValue

func GetTypeOfKeyAndValue(v string) (string, string)

func IsList

func IsList(t string) bool

func IsMap

func IsMap(typ string) bool

func IsStruct

func IsStruct(typ string) bool

func StringAreEscapedChar

func StringAreEscapedChar(value string) bool

Types

type Any

type Any struct {
	Value Type
	Type  string
}

func NewAny

func NewAny(value Type) *Any

NewAny creates a new variable

func (*Any) Add

func (a *Any) Add(other Type) (Type, error)

Add adds two Type objects

func (*Any) And

func (a *Any) And(other Type) (Type, error)

And returns true if the two Type objects are true

func (*Any) Append

func (a *Any) Append(other Type) (Type, error)

func (*Any) Decrement

func (a *Any) Decrement()

func (*Any) Div

func (a *Any) Div(other Type) (Type, error)

Div divides two Type objects

func (*Any) DivEc

func (a *Any) DivEc(other Type) (Type, error)

DivEc divides two Type objects

func (*Any) Eq

func (a *Any) Eq(other Type) (Type, error)

Eq returns true if the two Type objects are equal

func (*Any) GetFunction

func (a *Any) GetFunction() *Function

func (*Any) GetIndex

func (a *Any) GetIndex(i Type) (*Type, error)

func (*Any) GetSize

func (a *Any) GetSize() int

func (*Any) GetString

func (a *Any) GetString() String

func (*Any) GetType

func (a *Any) GetType() string

func (*Any) GetValue

func (a *Any) GetValue() any

func (*Any) Gt

func (a *Any) Gt(other Type) (Type, error)

Gt returns true if the first Type object is greater than the second

func (*Any) GtEq

func (a *Any) GtEq(other Type) (Type, error)

GtEq returns true if the first Type object is greater than or equal to the second

func (*Any) Increment

func (a *Any) Increment()

func (*Any) IsNull

func (a *Any) IsNull() bool

func (*Any) Len

func (a *Any) Len() (int, error)

func (*Any) Lw

func (a *Any) Lw(other Type) (Type, error)

Lw returns true if the first Type object is lower than the second

func (*Any) LwEq

func (a *Any) LwEq(other Type) (Type, error)

LwEq returns true if the first Type object is lower than or equal to the second

func (*Any) Mod

func (a *Any) Mod(other Type) (Type, error)

Mod modulos two Type objects

func (*Any) Mul

func (a *Any) Mul(other Type) (Type, error)

Mul multiplies two Type objects

func (*Any) Not

func (a *Any) Not() (Type, error)

Not returns the opposite of the Type object

func (*Any) NotEq

func (a *Any) NotEq(other Type) (Type, error)

NotEq returns true if the two Type objects are not equal

func (*Any) Or

func (a *Any) Or(other Type) (Type, error)

Or returns true if either Type objects is true

func (*Any) SetAny

func (a *Any) SetAny(value Type) error

SetAny sets the value of the variable

func (*Any) SetValue

func (a *Any) SetValue(value any) error

func (*Any) String

func (a *Any) String() string

func (*Any) Sub

func (a *Any) Sub(other Type) (Type, error)

Sub subtracts two Type objects

func (*Any) Xor

func (a *Any) Xor(other Type) (Type, error)

Xor returns true if either Type objects is true, but not both

type Bool

type Bool bool

func NewBool

func NewBool(value string) (Bool, error)

NewBool creates a new Bool

func (Bool) Add

func (b Bool) Add(other Type) (Type, error)

returns error

func (Bool) And

func (b Bool) And(other Type) (Type, error)

And returns true if both Types are true

func (Bool) Append

func (b Bool) Append(other Type) (Type, error)

Append returns errors

func (Bool) Div

func (b Bool) Div(other Type) (Type, error)

returns error

func (Bool) DivEc

func (b Bool) DivEc(other Type) (Type, error)

returns error

func (Bool) Eq

func (b Bool) Eq(other Type) (Type, error)

Eq returns true if two Type objects are equal

func (Bool) GetIndex

func (b Bool) GetIndex(other Type) (*Type, error)

returns error

func (Bool) GetSize

func (b Bool) GetSize() int

func (Bool) GetString

func (b Bool) GetString() String

GetString returns the string representation of the bool

func (Bool) GetType

func (b Bool) GetType() string

GetType returns the type Bool

func (Bool) GetValue

func (b Bool) GetValue() any

GetValue returns the value of the bool

func (Bool) Gt

func (b Bool) Gt(other Type) (Type, error)

returns error

func (Bool) GtEq

func (b Bool) GtEq(other Type) (Type, error)

returns error

func (Bool) IsNull

func (b Bool) IsNull() bool

func (Bool) Len

func (b Bool) Len() (int, error)

func (Bool) Lw

func (b Bool) Lw(other Type) (Type, error)

returns error

func (Bool) LwEq

func (b Bool) LwEq(other Type) (Type, error)

returns error

func (Bool) Mod

func (b Bool) Mod(other Type) (Type, error)

returns error

func (Bool) Mul

func (b Bool) Mul(other Type) (Type, error)

returns error"cannot add " + b.String() + " and " + other.String()

func (Bool) Not

func (b Bool) Not() (Type, error)

Not returns the opposite of the bool

func (Bool) NotEq

func (b Bool) NotEq(other Type) (Type, error)

NotEq returns true if two Type objects are not equal

func (Bool) Or

func (b Bool) Or(other Type) (Type, error)

Or returns true if either Type is true

func (Bool) SetValue

func (b Bool) SetValue(value any) error

SetValue

func (Bool) String

func (b Bool) String() string

func (Bool) Sub

func (b Bool) Sub(other Type) (Type, error)

returns error

func (Bool) Xor

func (b Bool) Xor(other Type) (Type, error)

Xor returns true if only one of the Types is true

type Char

type Char rune

func NewChar

func NewChar(value string) (Char, error)

NewChar creates a new Char

func (Char) Add

func (c Char) Add(other Type) (Type, error)

Add adds two Type objects compatible with Char

func (Char) And

func (c Char) And(other Type) (Type, error)

And returns an error

func (Char) Append

func (c Char) Append(other Type) (Type, error)

func (Char) Div

func (c Char) Div(other Type) (Type, error)

Div divides two Type objects compatible with Char

func (Char) DivEc

func (c Char) DivEc(other Type) (Type, error)

DivEc divides two Type objects compatible with Char

func (Char) Eq

func (c Char) Eq(other Type) (Type, error)

Eq returns true if two Type objects are equal

func (Char) GetIndex

func (Char) GetIndex(index Type) (*Type, error)

GetIndex returns an error

func (Char) GetSize

func (c Char) GetSize() int

func (Char) GetString

func (c Char) GetString() String

GetString returns the string representation of the char

func (Char) GetType

func (Char) GetType() string

GetType returns the type Char

func (Char) GetValue

func (c Char) GetValue() any

GetValue returns the value of the char

func (Char) GetValueAsInt

func (c Char) GetValueAsInt() Int

func (Char) Gt

func (c Char) Gt(other Type) (Type, error)

Gt returns true if the first Type object is greater than the second

func (Char) GtEq

func (c Char) GtEq(other Type) (Type, error)

GtEq returns true if the first Type object is greater than or equal to the second

func (Char) IsNull

func (Char) IsNull() bool

func (Char) Len

func (c Char) Len() (int, error)

func (Char) Lw

func (c Char) Lw(other Type) (Type, error)

Lw returns true if the first Type object is lower than the second

func (Char) LwEq

func (c Char) LwEq(other Type) (Type, error)

LwEq returns true if the first Type object is lower than or equal to the second

func (Char) Mod

func (c Char) Mod(other Type) (Type, error)

Mod returns the remainder of the division of two Type objects compatible with Char

func (Char) Mul

func (c Char) Mul(other Type) (Type, error)

Mul multiplies two Type objects compatible with Char

func (Char) Not

func (c Char) Not() (Type, error)

Not returns an error

func (Char) NotEq

func (c Char) NotEq(other Type) (Type, error)

NotEq returns true if two Type objects are not equal

func (Char) Or

func (c Char) Or(other Type) (Type, error)

Or returns an error

func (Char) SetValue

func (c Char) SetValue(value any) error

SetValue returns an error

func (Char) String

func (c Char) String() string

func (Char) Sub

func (c Char) Sub(other Type) (Type, error)

Sub subtracts two Type objects compatible with Char

func (Char) Xor

func (c Char) Xor(other Type) (Type, error)

type Float

type Float float32

func NewFloat

func NewFloat(value string) Float

NewFloat creates a new Float

func (Float) Add

func (f Float) Add(other Type) (Type, error)

Add adds two Type objects compatible with Float

func (Float) And

func (f Float) And(other Type) (Type, error)

And returns errors

func (Float) Append

func (f Float) Append(other Type) (Type, error)

Append returns errors

func (Float) Div

func (f Float) Div(other Type) (Type, error)

Div divides two Type objects compatible with Float

func (Float) DivEc

func (f Float) DivEc(other Type) (Type, error)

DivEc returns error because you cannot div ec float

func (Float) Eq

func (f Float) Eq(other Type) (Type, error)

Eq returns true if two Type objects are equal

func (Float) GetIndex

func (f Float) GetIndex(other Type) (*Type, error)

returns error

func (Float) GetSize

func (f Float) GetSize() int

func (Float) GetString

func (f Float) GetString() String

GetString returns the string representation of the float

func (Float) GetType

func (f Float) GetType() string

GetType returns the type Float

func (Float) GetValue

func (f Float) GetValue() any

GetValue returns the value of the float

func (Float) Gt

func (f Float) Gt(other Type) (Type, error)

Gt returns true if the float is greater than the other

func (Float) GtEq

func (f Float) GtEq(other Type) (Type, error)

GtEq returns true if the float is greater than or equal to the other

func (Float) IsNull

func (f Float) IsNull() bool

func (Float) Len

func (f Float) Len() (int, error)

func (Float) Lw

func (f Float) Lw(other Type) (Type, error)

Lw returns true if the float is lower than the other

func (Float) LwEq

func (f Float) LwEq(other Type) (Type, error)

LwEq returns true if the float is lower than or equal to the other

func (Float) Mod

func (f Float) Mod(other Type) (Type, error)

Mod returns error

func (Float) Mul

func (f Float) Mul(other Type) (Type, error)

Mul multiplies two Type objects compatible with Float

func (Float) Not

func (f Float) Not() (Type, error)

Not returns errors

func (Float) NotEq

func (f Float) NotEq(other Type) (Type, error)

NotEq returns true if two Type objects are not equal

func (Float) Or

func (f Float) Or(other Type) (Type, error)

Or returns errors

func (Float) SetValue

func (f Float) SetValue(value any) error

SetValue

func (Float) String

func (f Float) String() string

func (Float) Sub

func (f Float) Sub(other Type) (Type, error)

Sub subtracts two Type objects compatible with Float

func (Float) Xor

func (f Float) Xor(other Type) (Type, error)

Xor

type Function

type Function struct {
	Name   string
	Args   [][]parser.FunctionParams
	Body   map[string][]parser.Node
	Return map[string][]string
	// contains filtered or unexported fields
}

func NewAnonymousFunction

func NewAnonymousFunction(args []parser.FunctionParams, body []parser.Node, ret []string) *Function

func NewFunction

func NewFunction(Name string, args []parser.FunctionParams, body []parser.Node, ret []string) *Function

func (*Function) Add

func (f *Function) Add(other Type) (Type, error)

func (*Function) AddOverload

func (f *Function) AddOverload(args []parser.FunctionParams, body []parser.Node, ret []string)

func (*Function) And

func (f *Function) And(other Type) (Type, error)

func (*Function) Append

func (f *Function) Append(other Type) (Type, error)

func (*Function) CheckReturn

func (f *Function) CheckReturn(ret []Type, StructDecl []eclaDecl.TypeDecl) bool

func (*Function) Div

func (f *Function) Div(other Type) (Type, error)

func (*Function) DivEc

func (f *Function) DivEc(other Type) (Type, error)

func (*Function) Eq

func (f *Function) Eq(other Type) (Type, error)

func (*Function) GetBody

func (f *Function) GetBody() []parser.Node

func (*Function) GetIndex

func (f *Function) GetIndex(number Type) (*Type, error)

func (*Function) GetIndexOfArgs

func (f *Function) GetIndexOfArgs(args []Type) int

func (*Function) GetReturn

func (f *Function) GetReturn() []string

func (*Function) GetSize

func (f *Function) GetSize() int

func (*Function) GetString

func (f *Function) GetString() String

func (*Function) GetType

func (f *Function) GetType() string

func (*Function) GetTypes

func (f *Function) GetTypes() []string

func (*Function) GetValue

func (f *Function) GetValue() any

func (*Function) Gt

func (f *Function) Gt(other Type) (Type, error)

func (*Function) GtEq

func (f *Function) GtEq(other Type) (Type, error)

func (*Function) IsNull

func (f *Function) IsNull() bool

func (*Function) Len

func (f *Function) Len() (int, error)

func (*Function) Lw

func (f *Function) Lw(other Type) (Type, error)

func (*Function) LwEq

func (f *Function) LwEq(other Type) (Type, error)

func (*Function) Mod

func (f *Function) Mod(other Type) (Type, error)

func (*Function) Mul

func (f *Function) Mul(other Type) (Type, error)

func (*Function) Not

func (f *Function) Not() (Type, error)

func (*Function) NotEq

func (f *Function) NotEq(other Type) (Type, error)

func (*Function) Or

func (f *Function) Or(other Type) (Type, error)

func (*Function) Override

func (f *Function) Override(args []parser.FunctionParams, body []parser.Node, ret []string) error

func (*Function) SetValue

func (f *Function) SetValue(value any) error

func (*Function) String

func (f *Function) String() string

func (*Function) Sub

func (f *Function) Sub(other Type) (Type, error)

func (*Function) TypeAndNumberOfArgsIsCorrect

func (f *Function) TypeAndNumberOfArgsIsCorrect(args []Type, StructDecl []eclaDecl.TypeDecl) (bool, map[string]*Var)

func (*Function) Xor

func (f *Function) Xor(other Type) (Type, error)

type FunctionBuiltIn

type FunctionBuiltIn struct {
	Name string
	// contains filtered or unexported fields
}

func NewAppend

func NewAppend() *FunctionBuiltIn

func NewLen

func NewLen() *FunctionBuiltIn

func NewSizeOf

func NewSizeOf() *FunctionBuiltIn

func NewTypeOf

func NewTypeOf() *FunctionBuiltIn

func (*FunctionBuiltIn) Add

func (f *FunctionBuiltIn) Add(other Type) (Type, error)

func (*FunctionBuiltIn) And

func (f *FunctionBuiltIn) And(other Type) (Type, error)

func (*FunctionBuiltIn) Append

func (f *FunctionBuiltIn) Append(other Type) (Type, error)

func (*FunctionBuiltIn) Call

func (f *FunctionBuiltIn) Call(args []Type) ([]Type, error)

func (*FunctionBuiltIn) Div

func (f *FunctionBuiltIn) Div(other Type) (Type, error)

func (*FunctionBuiltIn) DivEc

func (f *FunctionBuiltIn) DivEc(other Type) (Type, error)

func (*FunctionBuiltIn) Eq

func (f *FunctionBuiltIn) Eq(other Type) (Type, error)

func (*FunctionBuiltIn) GetIndex

func (f *FunctionBuiltIn) GetIndex(number Type) (*Type, error)

func (*FunctionBuiltIn) GetSize

func (f *FunctionBuiltIn) GetSize() int

func (*FunctionBuiltIn) GetString

func (f *FunctionBuiltIn) GetString() String

func (*FunctionBuiltIn) GetType

func (f *FunctionBuiltIn) GetType() string

func (*FunctionBuiltIn) GetValue

func (f *FunctionBuiltIn) GetValue() any

func (*FunctionBuiltIn) Gt

func (f *FunctionBuiltIn) Gt(other Type) (Type, error)

func (*FunctionBuiltIn) GtEq

func (f *FunctionBuiltIn) GtEq(other Type) (Type, error)

func (*FunctionBuiltIn) IsNull

func (f *FunctionBuiltIn) IsNull() bool

func (*FunctionBuiltIn) Len

func (f *FunctionBuiltIn) Len() (int, error)

func (*FunctionBuiltIn) Lw

func (f *FunctionBuiltIn) Lw(other Type) (Type, error)

func (*FunctionBuiltIn) LwEq

func (f *FunctionBuiltIn) LwEq(other Type) (Type, error)

func (*FunctionBuiltIn) Mod

func (f *FunctionBuiltIn) Mod(other Type) (Type, error)

func (*FunctionBuiltIn) Mul

func (f *FunctionBuiltIn) Mul(other Type) (Type, error)

func (*FunctionBuiltIn) Not

func (f *FunctionBuiltIn) Not() (Type, error)

func (*FunctionBuiltIn) NotEq

func (f *FunctionBuiltIn) NotEq(other Type) (Type, error)

func (*FunctionBuiltIn) Or

func (f *FunctionBuiltIn) Or(other Type) (Type, error)

func (*FunctionBuiltIn) SetValue

func (f *FunctionBuiltIn) SetValue(value any) error

func (*FunctionBuiltIn) String

func (f *FunctionBuiltIn) String() string

func (*FunctionBuiltIn) Sub

func (f *FunctionBuiltIn) Sub(other Type) (Type, error)

func (*FunctionBuiltIn) Xor

func (f *FunctionBuiltIn) Xor(other Type) (Type, error)

type Int

type Int int

func NewInt

func NewInt(value string) Int

NewInt creates a new Int

func (Int) Add

func (i Int) Add(other Type) (Type, error)

Add adds two Type objects compatible with Int

func (Int) And

func (i Int) And(other Type) (Type, error)

And returns errors

func (Int) Append

func (i Int) Append(other Type) (Type, error)

Append returns errors

func (Int) Div

func (i Int) Div(other Type) (Type, error)

Div divides two Type objects compatible with Int

func (Int) DivEc

func (i Int) DivEc(other Type) (Type, error)

DivEc divides two Type objects compatible with Int

func (Int) Eq

func (i Int) Eq(other Type) (Type, error)

Eq returns true if two Type objects are equal

func (Int) GetIndex

func (i Int) GetIndex(other Type) (*Type, error)

returns error

func (Int) GetSize

func (i Int) GetSize() int

func (Int) GetString

func (i Int) GetString() String

GetString returns the string representation of the int

func (Int) GetType

func (i Int) GetType() string

GetType returns the type Int

func (Int) GetValue

func (i Int) GetValue() any

GetValue returns the value of the int

func (Int) Gt

func (i Int) Gt(other Type) (Type, error)

Gt returns true if the first Type object is greater than the second

func (Int) GtEq

func (i Int) GtEq(other Type) (Type, error)

GtEq returns true if the first Type object is greater than or equal to the second

func (Int) IsNull

func (i Int) IsNull() bool

func (Int) Len

func (i Int) Len() (int, error)

func (Int) Lw

func (i Int) Lw(other Type) (Type, error)

Lw returns true if the first Type object is lower than the second

func (Int) LwEq

func (i Int) LwEq(other Type) (Type, error)

LwEq returns true if the first Type object is lower than or equal to the second

func (Int) Mod

func (i Int) Mod(other Type) (Type, error)

Mod returns the remainder of the division of two Type objects compatible with Int

func (Int) Mul

func (i Int) Mul(other Type) (Type, error)

Mul multiplies two Type objects compatible with Int

func (Int) Not

func (i Int) Not() (Type, error)

Not returns an error

func (Int) NotEq

func (i Int) NotEq(other Type) (Type, error)

NotEq returns true if two Type objects are not equal

func (Int) Or

func (i Int) Or(other Type) (Type, error)

Or returns an error

func (Int) SetValue

func (i Int) SetValue(value any) error

SetValue

func (Int) String

func (i Int) String() string

func (Int) Sub

func (i Int) Sub(other Type) (Type, error)

Sub subtracts two Type objects compatible with Int

func (Int) Xor

func (i Int) Xor(other Type) (Type, error)

Xor returns 1 if only one of the Type objects is true

type Lib

type Lib struct {
	Name string
}

func NewLib

func NewLib(name string) *Lib

func (*Lib) Add

func (l *Lib) Add(other Type) (Type, error)

func (*Lib) And

func (l *Lib) And(other Type) (Type, error)

func (*Lib) Append

func (l *Lib) Append(other Type) (Type, error)

func (*Lib) Div

func (l *Lib) Div(other Type) (Type, error)

func (*Lib) DivEc

func (l *Lib) DivEc(other Type) (Type, error)

func (*Lib) Eq

func (l *Lib) Eq(other Type) (Type, error)

func (*Lib) GetIndex

func (l *Lib) GetIndex(number Type) (*Type, error)

func (*Lib) GetSize

func (l *Lib) GetSize() int

func (*Lib) GetString

func (l *Lib) GetString() String

func (*Lib) GetType

func (l *Lib) GetType() string

func (*Lib) GetValue

func (l *Lib) GetValue() any

func (*Lib) Gt

func (l *Lib) Gt(other Type) (Type, error)

func (*Lib) GtEq

func (l *Lib) GtEq(other Type) (Type, error)

func (*Lib) IsNull

func (l *Lib) IsNull() bool

func (*Lib) Len

func (l *Lib) Len() (int, error)

func (*Lib) Lw

func (l *Lib) Lw(other Type) (Type, error)

func (*Lib) LwEq

func (l *Lib) LwEq(other Type) (Type, error)

func (*Lib) Mod

func (l *Lib) Mod(other Type) (Type, error)

func (*Lib) Mul

func (l *Lib) Mul(other Type) (Type, error)

func (*Lib) Not

func (l *Lib) Not() (Type, error)

func (*Lib) NotEq

func (l *Lib) NotEq(other Type) (Type, error)

func (*Lib) Or

func (l *Lib) Or(other Type) (Type, error)

func (*Lib) SetValue

func (l *Lib) SetValue(value any) error

func (*Lib) String

func (l *Lib) String() string

func (*Lib) Sub

func (l *Lib) Sub(other Type) (Type, error)

func (*Lib) Xor

func (l *Lib) Xor(other Type) (Type, error)

type List

type List struct {
	Value []Type
	Typ   string
}

func (*List) Add

func (l *List) Add(other Type) (Type, error)

Add adds two Type objects compatible with List

func (*List) And

func (l *List) And(other Type) (Type, error)

And returns errors

func (*List) Append

func (l *List) Append(other Type) (Type, error)

Append to list

func (*List) Div

func (l *List) Div(other Type) (Type, error)

Div returns errors because you cannot divide lists

func (*List) DivEc

func (l *List) DivEc(other Type) (Type, error)

DivEc returns error because you cannot div ec lists

func (*List) Eq

func (l *List) Eq(other Type) (Type, error)

Eq returns true if two Type objects are equal

func (*List) GetIndex

func (l *List) GetIndex(index Type) (*Type, error)

func (*List) GetSize

func (l *List) GetSize() int

func (*List) GetString

func (l *List) GetString() String

GetString returns the string of list

func (*List) GetType

func (l *List) GetType() string

GetType returns the type List

func (*List) GetValue

func (l *List) GetValue() any

GetValue returns the value of the list

func (*List) GetValueType

func (l *List) GetValueType() string

func (*List) Gt

func (l *List) Gt(other Type) (Type, error)

Gt returns true if the first Type object is greater than the second

func (*List) GtEq

func (l *List) GtEq(other Type) (Type, error)

GtEq returns true if the first Type object is greater than or equal the second

func (*List) IsNull

func (l *List) IsNull() bool

func (*List) Len

func (l *List) Len() (int, error)

func (*List) Lw

func (l *List) Lw(other Type) (Type, error)

Lw returns true if the first Type object is lower than the second

func (*List) LwEq

func (l *List) LwEq(other Type) (Type, error)

LwEq returns true if the first Type object is lower than or equal the second

func (*List) Mod

func (l *List) Mod(other Type) (Type, error)

Mod returns errors because you cannot mod lists

func (*List) Mul

func (l *List) Mul(other Type) (Type, error)

Mul if other is Int , return n * List

func (*List) Not

func (l *List) Not() (Type, error)

Not returns errors

func (*List) NotEq

func (l *List) NotEq(other Type) (Type, error)

NotEq returns true if two Type objects are not equal

func (*List) Or

func (l *List) Or(other Type) (Type, error)

Or returns errors

func (*List) SetType

func (l *List) SetType(other string)

func (*List) SetValue

func (l *List) SetValue(v any) error

SetValue

func (*List) String

func (l *List) String() string

func (*List) Sub

func (l *List) Sub(other Type) (Type, error)

Sub returns errors because you cannot subtract lists

func (*List) Xor

func (l *List) Xor(other Type) (Type, error)

Xor returns errors

type Map

type Map struct {
	Keys   []Type
	Values []Type
	Typ    string
	TypKey string
	TypVal string
}

func NewMap

func NewMap() *Map

func (*Map) Add

func (m *Map) Add(value Type) (Type, error)

func (*Map) AddKey

func (m *Map) AddKey(key Type) error

func (*Map) And

func (m *Map) And(other Type) (Type, error)

func (*Map) Append

func (m *Map) Append(other Type) (Type, error)

func (*Map) Delete

func (m *Map) Delete(key Type)

func (*Map) Div

func (m *Map) Div(value Type) (Type, error)

func (*Map) DivEc

func (m *Map) DivEc(value Type) (Type, error)

func (*Map) Eq

func (m *Map) Eq(value Type) (Type, error)

TODO add case var ?

func (*Map) Get

func (m *Map) Get(key Type) (Type, bool)

func (*Map) GetIndex

func (m *Map) GetIndex(index Type) (*Type, error)

func (*Map) GetKey

func (m *Map) GetKey(value Type) (Type, bool)

func (*Map) GetKeyTypes

func (m *Map) GetKeyTypes() string

func (*Map) GetSize

func (m *Map) GetSize() int

func (*Map) GetString

func (m *Map) GetString() String

GetString returns the string of map

func (*Map) GetType

func (m *Map) GetType() string

GetType returns the type Struct

func (*Map) GetValue

func (m *Map) GetValue() any

func (*Map) GetValueTypes

func (m *Map) GetValueTypes() string

func (*Map) Gt

func (m *Map) Gt(other Type) (Type, error)

func (*Map) GtEq

func (m *Map) GtEq(other Type) (Type, error)

func (*Map) IsNull

func (m *Map) IsNull() bool

func (*Map) Len

func (m *Map) Len() (int, error)

func (*Map) Lw

func (m *Map) Lw(other Type) (Type, error)

func (*Map) LwEq

func (m *Map) LwEq(other Type) (Type, error)

func (*Map) Mod

func (m *Map) Mod(value Type) (Type, error)

func (*Map) Mul

func (m *Map) Mul(value Type) (Type, error)

func (*Map) Not

func (m *Map) Not() (Type, error)

func (*Map) NotEq

func (m *Map) NotEq(value Type) (Type, error)

func (*Map) Or

func (m *Map) Or(other Type) (Type, error)

func (*Map) Set

func (m *Map) Set(key Type, value Type)

func (*Map) SetAutoType

func (m *Map) SetAutoType() error

func (*Map) SetType

func (m *Map) SetType(t string)

func (*Map) SetValue

func (m *Map) SetValue(v any) error

func (*Map) String

func (m *Map) String() string

func (*Map) Sub

func (m *Map) Sub(value Type) (Type, error)

func (*Map) Xor

func (m *Map) Xor(other Type) (Type, error)

type Null

type Null struct {
	// contains filtered or unexported fields
}

func NewNull

func NewNull() Null

func NewNullType

func NewNullType(typ string) Null

func (Null) Add

func (n Null) Add(other Type) (Type, error)

func (Null) And

func (n Null) And(other Type) (Type, error)

func (Null) Append

func (n Null) Append(other Type) (Type, error)

func (Null) Div

func (n Null) Div(other Type) (Type, error)

func (Null) DivEc

func (n Null) DivEc(other Type) (Type, error)

func (Null) Eq

func (n Null) Eq(other Type) (Type, error)

func (Null) GetIndex

func (n Null) GetIndex(number Type) (*Type, error)

func (Null) GetSize

func (n Null) GetSize() int

func (Null) GetString

func (n Null) GetString() String

func (Null) GetType

func (n Null) GetType() string

func (Null) GetValue

func (n Null) GetValue() any

func (Null) Gt

func (n Null) Gt(other Type) (Type, error)

func (Null) GtEq

func (n Null) GtEq(other Type) (Type, error)

func (Null) IsNull

func (n Null) IsNull() bool

func (Null) Len

func (n Null) Len() (int, error)

func (Null) Lw

func (n Null) Lw(other Type) (Type, error)

func (Null) LwEq

func (n Null) LwEq(other Type) (Type, error)

func (Null) Mod

func (n Null) Mod(other Type) (Type, error)

func (Null) Mul

func (n Null) Mul(other Type) (Type, error)

func (Null) Not

func (n Null) Not() (Type, error)

func (Null) NotEq

func (n Null) NotEq(other Type) (Type, error)

func (Null) Or

func (n Null) Or(other Type) (Type, error)

func (Null) SetValue

func (n Null) SetValue(value any) error

func (Null) String

func (n Null) String() string

func (Null) Sub

func (n Null) Sub(other Type) (Type, error)

func (Null) Xor

func (n Null) Xor(other Type) (Type, error)

type String

type String string

func NewString

func NewString(value string) (String, error)

NewString creates a new String

func (String) Add

func (s String) Add(other Type) (Type, error)

Add adds two Type objects

func (String) And

func (s String) And(other Type) (Type, error)

And returns errors

func (String) Append

func (s String) Append(other Type) (Type, error)

func (String) Div

func (s String) Div(other Type) (Type, error)

Div returns errors because you cannot divide strings

func (String) DivEc

func (s String) DivEc(other Type) (Type, error)

DivEc returns error because you cannot div ec strings

func (String) Eq

func (s String) Eq(other Type) (Type, error)

Eq returns true if two Type objects are equal

func (String) GetIndex

func (s String) GetIndex(other Type) (*Type, error)

TODO refactor with switch ? GetIndex returns a single character

func (String) GetSize

func (s String) GetSize() int

func (String) GetString

func (s String) GetString() String

GetString returns the string

func (String) GetType

func (s String) GetType() string

GetType returns the type String

func (String) GetValue

func (s String) GetValue() any

GetValue returns the value of the string

func (String) Gt

func (s String) Gt(other Type) (Type, error)

Gt returns true if s is greater than other

func (String) GtEq

func (s String) GtEq(other Type) (Type, error)

GtEq returns true if s is greater than or equal to other

func (String) IsNull

func (s String) IsNull() bool

func (String) Len

func (s String) Len() (int, error)

func (String) Lw

func (s String) Lw(other Type) (Type, error)

Lw returns true if s is lower than other

func (String) LwEq

func (s String) LwEq(other Type) (Type, error)

LwEq returns true if s is lower than or equal to other

func (String) Mod

func (s String) Mod(other Type) (Type, error)

Mod returns errors because you cannot mod strings

func (String) Mul

func (s String) Mul(other Type) (Type, error)

Mul if other is Int , return n * String

func (String) Not

func (s String) Not() (Type, error)

Not returns errors

func (String) NotEq

func (s String) NotEq(other Type) (Type, error)

NotEq returns true if two Type objects are not equal

func (String) Or

func (s String) Or(other Type) (Type, error)

Or returns errors

func (String) SetValue

func (s String) SetValue(value any) error

SetValue

func (String) String

func (s String) String() string

func (String) Sub

func (s String) Sub(other Type) (Type, error)

Sub returns errors because you cannot subtract strings

func (String) Xor

func (s String) Xor(other Type) (Type, error)

Xor returns errors

type Struct

type Struct struct {
	Fields     map[string]*Type
	Typ        string
	Definition *eclaDecl.StructDecl
}

func NewStruct

func NewStruct(def *eclaDecl.StructDecl) *Struct

func (*Struct) Add

func (s *Struct) Add(other Type) (Type, error)

func (*Struct) AddField

func (s *Struct) AddField(index int, val Type)

func (*Struct) And

func (s *Struct) And(other Type) (Type, error)

func (*Struct) Append

func (s *Struct) Append(other Type) (Type, error)

func (*Struct) Div

func (s *Struct) Div(value Type) (Type, error)

func (*Struct) DivEc

func (s *Struct) DivEc(value Type) (Type, error)

func (*Struct) Eq

func (s *Struct) Eq(value Type) (Type, error)

TODO add case var ?

func (*Struct) Get

func (s *Struct) Get(fieldName string) (Type, error)

func (*Struct) GetField

func (s *Struct) GetField(value string) *Type

func (*Struct) GetIndex

func (s *Struct) GetIndex(index Type) (*Type, error)

func (*Struct) GetSize

func (s *Struct) GetSize() int

func (*Struct) GetString

func (s *Struct) GetString() String

GetString returns the string of map

func (*Struct) GetType

func (s *Struct) GetType() string

GetType returns the type Struct

func (*Struct) GetValue

func (s *Struct) GetValue() any

func (*Struct) Gt

func (s *Struct) Gt(other Type) (Type, error)

func (*Struct) GtEq

func (s *Struct) GtEq(other Type) (Type, error)

func (*Struct) IsNull

func (s *Struct) IsNull() bool

func (*Struct) Len

func (s *Struct) Len() (int, error)

func (*Struct) Lw

func (s *Struct) Lw(other Type) (Type, error)

func (*Struct) LwEq

func (s *Struct) LwEq(other Type) (Type, error)

func (*Struct) Mod

func (s *Struct) Mod(value Type) (Type, error)

func (*Struct) Mul

func (s *Struct) Mul(value Type) (Type, error)

func (*Struct) Not

func (s *Struct) Not() (Type, error)

func (*Struct) NotEq

func (s *Struct) NotEq(value Type) (Type, error)

func (*Struct) Or

func (s *Struct) Or(other Type) (Type, error)

func (*Struct) Set

func (s *Struct) Set(fieldName string, FieldValue Type) error

func (*Struct) SetType

func (s *Struct) SetType(t string)

func (*Struct) SetValue

func (s *Struct) SetValue(v any) error

func (*Struct) String

func (s *Struct) String() string

func (*Struct) Sub

func (s *Struct) Sub(value Type) (Type, error)

func (*Struct) Verify

func (s *Struct) Verify() error

func (*Struct) Xor

func (s *Struct) Xor(other Type) (Type, error)

type Type

type Type interface {
	GetValue() any
	SetValue(value any) error
	String() string
	GetString() String
	GetType() string
	GetIndex(index Type) (*Type, error)
	//Add : +
	Add(other Type) (Type, error)
	//Sub : -
	Sub(other Type) (Type, error)
	//Mul : *
	Mul(other Type) (Type, error)
	//Div : /
	Div(other Type) (Type, error)
	//Mod : %
	Mod(other Type) (Type, error)
	//DivEc : //
	DivEc(other Type) (Type, error)
	//Eq : ==
	Eq(other Type) (Type, error)
	//NotEq : !=
	NotEq(other Type) (Type, error)
	//Gt : >
	Gt(other Type) (Type, error)
	//GtEq : >=
	GtEq(other Type) (Type, error)
	//Lw : <
	Lw(other Type) (Type, error)
	//LwEq : <=
	LwEq(other Type) (Type, error)
	//And : &&
	And(other Type) (Type, error)
	//Or : ||
	Or(other Type) (Type, error)
	//Not : !
	Not() (Type, error)
	//Xor : ^
	Xor(other Type) (Type, error)
	// IsNull : returns true if the value is null
	IsNull() bool
	// append : temporary
	Append(other Type) (Type, error)
	GetSize() int
	Len() (int, error)
}

func NewList

func NewList(t string) (Type, error)

type Var

type Var struct {
	Name  string
	Value Type
}

func NewVar

func NewVar(name string, Type string, value Type) (*Var, error)

NewVar creates a new variable

func NewVarEmpty

func NewVarEmpty(name string, Type string) (*Var, error)

func (*Var) Add

func (v *Var) Add(other Type) (Type, error)

Add adds two Type objects

func (*Var) And

func (v *Var) And(other Type) (Type, error)

And returns true if the two Type objects are true

func (*Var) Append

func (v *Var) Append(other Type) (Type, error)

func (*Var) Decrement

func (v *Var) Decrement()

func (*Var) Div

func (v *Var) Div(other Type) (Type, error)

Div divides two Type objects

func (*Var) DivEc

func (v *Var) DivEc(other Type) (Type, error)

DivEc divides two Type objects

func (*Var) Eq

func (v *Var) Eq(other Type) (Type, error)

Eq returns true if the two Type objects are equal

func (*Var) GetFunction

func (v *Var) GetFunction() *Function

func (*Var) GetIndex

func (v *Var) GetIndex(i Type) (*Type, error)

func (*Var) GetSize

func (v *Var) GetSize() int

func (*Var) GetString

func (v *Var) GetString() String

func (*Var) GetType

func (v *Var) GetType() string

func (*Var) GetValue

func (v *Var) GetValue() any

func (*Var) Gt

func (v *Var) Gt(other Type) (Type, error)

Gt returns true if the first Type object is greater than the second

func (*Var) GtEq

func (v *Var) GtEq(other Type) (Type, error)

GtEq returns true if the first Type object is greater than or equal to the second

func (*Var) Increment

func (v *Var) Increment()

func (*Var) IsAny

func (v *Var) IsAny() bool

func (*Var) IsFunction

func (v *Var) IsFunction() bool

func (*Var) IsNull

func (v *Var) IsNull() bool

func (*Var) Len

func (v *Var) Len() (int, error)

func (*Var) Lw

func (v *Var) Lw(other Type) (Type, error)

Lw returns true if the first Type object is lower than the second

func (*Var) LwEq

func (v *Var) LwEq(other Type) (Type, error)

LwEq returns true if the first Type object is lower than or equal to the second

func (*Var) Mod

func (v *Var) Mod(other Type) (Type, error)

Mod modulos two Type objects

func (*Var) Mul

func (v *Var) Mul(other Type) (Type, error)

Mul multiplies two Type objects

func (*Var) Not

func (v *Var) Not() (Type, error)

Not returns the opposite of the Type object

func (*Var) NotEq

func (v *Var) NotEq(other Type) (Type, error)

NotEq returns true if the two Type objects are not equal

func (*Var) Or

func (v *Var) Or(other Type) (Type, error)

Or returns true if either Type objects is true

func (*Var) SetValue

func (v *Var) SetValue(value any) error

SetValue TODO: Refactor this method

func (*Var) SetVar

func (v *Var) SetVar(value Type) error

SetVar sets the value of the variable

func (*Var) String

func (v *Var) String() string

func (*Var) Sub

func (v *Var) Sub(other Type) (Type, error)

Sub subtracts two Type objects

func (*Var) Xor

func (v *Var) Xor(other Type) (Type, error)

Xor returns true if only one of the Type objects is true

Jump to

Keyboard shortcuts

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