Documentation ¶
Index ¶
- Variables
- func AddBuiltin(id string, fn func(args ...Object) Object) error
- func BigIntToBinaryString(b *big.Int, unit Unit) string
- func EqualObjectSet(a, b []Object) bool
- func EqualObjects(a, b []Object) bool
- func IsError(v interface{}) bool
- type Binarystring
- type Bool
- type Builtin
- type EnumElements
- type EnumRange
- type EnumType
- type EnumValue
- type Env
- type Error
- type Float
- type Function
- type Int
- type List
- type ListType
- type Map
- type Object
- type ObjectType
- type Record
- type ReturnValue
- type Scope
- type String
- type Unit
- type Verdict
Constants ¶
This section is empty.
Variables ¶
var ( ErrSyntax = errors.New("invalid syntax") Undefined = &singelton{typ: UNDEFINED} Break = &singelton{typ: BREAK} Continue = &singelton{typ: CONTINUE} Any = &singelton{typ: ANY} AnyOrNone = &singelton{typ: ANY_OR_NONE} )
Functions ¶
func AddBuiltin ¶ added in v0.16.2
AddBuiltin adds a builtin function to the runtime environment.
An error is returned if the builtin-name is already registered.
If the given identifier provides formal parameters, the function will be checked for the correct number and type of arguments, automatically. An error is returnes if the input string contrains any syntax-errors.
func BigIntToBinaryString ¶ added in v0.18.0
func EqualObjectSet ¶ added in v0.16.2
EqualObjectSet compares two Object slices for equality ignoring the order of the elements.
Current implementation is O(n^2).
func EqualObjects ¶ added in v0.9.6
EqualObjects compares two Object slices for equality.
Types ¶
type Binarystring ¶ added in v0.18.0
func NewBinarystring ¶ added in v0.18.0
func NewBinarystring(s string) (*Binarystring, error)
func NewBinarystringWithWildcards ¶ added in v0.18.0
func NewBinarystringWithWildcards(s string, unit Unit) (*Binarystring, error)
func (*Binarystring) Equal ¶ added in v0.18.0
func (b *Binarystring) Equal(obj Object) bool
func (*Binarystring) Get ¶ added in v0.18.0
func (b *Binarystring) Get(index int) Object
func (*Binarystring) Inspect ¶ added in v0.18.0
func (b *Binarystring) Inspect() string
func (*Binarystring) Len ¶ added in v0.18.0
func (b *Binarystring) Len() int
func (*Binarystring) Type ¶ added in v0.18.0
func (b *Binarystring) Type() ObjectType
type Builtin ¶ added in v0.9.5
func (*Builtin) Type ¶ added in v0.9.5
func (b *Builtin) Type() ObjectType
type EnumElements ¶ added in v0.18.0
type EnumType ¶ added in v0.18.0
type EnumType struct { Name string Elements EnumElements }
func NewEnumType ¶ added in v0.18.0
func (*EnumType) Type ¶ added in v0.18.0
func (et *EnumType) Type() ObjectType
type EnumValue ¶ added in v0.18.0
type EnumValue struct {
// contains filtered or unexported fields
}
func NewEnumValue ¶ added in v0.18.0
func NewEnumValueByKey ¶ added in v0.18.0
func (*EnumValue) SetValueById ¶ added in v0.18.0
func (*EnumValue) SetValueByKey ¶ added in v0.18.0
func (*EnumValue) Type ¶ added in v0.18.0
func (ev *EnumValue) Type() ObjectType
type Function ¶
type Function struct { Params *syntax.FormalPars Body *syntax.BlockStmt Env Scope }
func (*Function) Type ¶
func (f *Function) Type() ObjectType
type List ¶ added in v0.9.5
func NewComplement ¶ added in v0.16.2
func NewPermutation ¶ added in v0.16.2
func NewRecordOf ¶ added in v0.16.2
func NewSuperset ¶ added in v0.16.2
func (*List) Type ¶ added in v0.9.5
func (l *List) Type() ObjectType
type Map ¶ added in v0.9.6
type Map struct {
// contains filtered or unexported fields
}
Map is a map of objects.
func (*Map) Type ¶ added in v0.9.6
func (m *Map) Type() ObjectType
type Object ¶
type Object interface { // Inspect returns a string-representation of the object for in TTCN-3 syntax. Inspect() string Type() ObjectType Equal(Object) bool }
type ObjectType ¶
type ObjectType string
const ( UNKNOWN ObjectType = "unknown object" UNDEFINED ObjectType = "undefined value" ERROR ObjectType = "runtime error" BREAK ObjectType = "break event" CONTINUE ObjectType = "continue event" RETURN_VALUE ObjectType = "return value" INTEGER ObjectType = "integer" FLOAT ObjectType = "float" BOOL ObjectType = "boolean" // Charstring types CHARSTRING ObjectType = "string" // Binarystring types BITSTRING ObjectType = "bitstring" HEXSTRING ObjectType = "hexstring" OCTETSTRING ObjectType = "octetstring" FUNCTION ObjectType = "function" LIST ObjectType = "list" RECORD ObjectType = "record" MAP ObjectType = "map" BUILTIN_OBJ ObjectType = "builtin function" VERDICT ObjectType = "verdict" ENUM_VALUE ObjectType = "enumerated value" ENUM_TYPE ObjectType = "enumerated type" ANY ObjectType = "?" ANY_OR_NONE ObjectType = "*" )
type Record ¶ added in v0.9.6
TODO(5nord) For simplicity we reuse the Map implementation. We should implement proper record semantics later.
func (*Record) Type ¶ added in v0.9.6
func (r *Record) Type() ObjectType
type ReturnValue ¶
type ReturnValue struct {
Value Object
}
func (*ReturnValue) Equal ¶ added in v0.9.6
func (r *ReturnValue) Equal(obj Object) bool
func (*ReturnValue) Inspect ¶
func (r *ReturnValue) Inspect() string
func (*ReturnValue) Type ¶
func (r *ReturnValue) Type() ObjectType
type String ¶
type String struct { Value []rune // contains filtered or unexported fields }
func NewCharstring ¶ added in v0.18.0
func NewUniversalString ¶ added in v0.18.0
func (*String) IsASCII ¶ added in v0.18.0
IsASCII returns true if the string only contains ASCII characters.
func (*String) Type ¶
func (s *String) Type() ObjectType
Type returns the object type CHARSTRING. This type is used for both charstrings and universal charstrings.