Documentation ¶
Overview ¶
Package types provides type inference and checking for TTCN-3.
Index ¶
- Variables
- func Equal(a, b Object) bool
- type Basic
- type Component
- func (c *Component) Begin() loc.Position
- func (c *Component) CompatibleTo(other Type) bool
- func (c *Component) EnclosingScope() Scope
- func (c *Component) End() loc.Position
- func (c *Component) Insert(name string, obj Object) Object
- func (c *Component) Kind() Kind
- func (c *Component) Lookup(name string) Object
- func (c *Component) Names() []string
- type Info
- type Kind
- type List
- type Module
- type NamedType
- type NodeNotImplementedError
- type Object
- type Range
- type RedefinitionError
- type Ref
- type Scope
- type Struct
- func (s *Struct) Begin() loc.Position
- func (s *Struct) CompatibleTo(other Type) bool
- func (s *Struct) EnclosingScope() Scope
- func (s *Struct) End() loc.Position
- func (s *Struct) Insert(name string, obj Object) Object
- func (s *Struct) Kind() Kind
- func (s *Struct) Lookup(name string) Object
- func (s *Struct) Names() []string
- type Type
- type Var
Constants ¶
This section is empty.
Variables ¶
var ( Integer = &Basic{kind: IntegerType} Boolean = &Basic{kind: BooleanType} )
Functions ¶
Types ¶
type Basic ¶
type Basic struct {
// contains filtered or unexported fields
}
Basic represents a basic TTCN-3 type, such as integer, boolean, ...
func (*Basic) CompatibleTo ¶
func (*Basic) EnclosingScope ¶
type Component ¶ added in v0.11.0
type Component struct { Scope Scope Extends []*Component // contains filtered or unexported fields }
Component represents a component type.
func (*Component) CompatibleTo ¶ added in v0.11.0
func (*Component) EnclosingScope ¶ added in v0.11.0
type Info ¶
type Info struct { Types map[ast.Node]Type Scopes map[ast.Node]Scope // contains filtered or unexported fields }
func (*Info) InsertTree ¶
InsertTree inserts the given syntax tree n into the given parent scope scp.
type Kind ¶
type Kind string
Kind returns the kind of the object.
const ( UnknownType Kind = "unknown type" IntegerType Kind = "integer" UnionType Kind = "union" EnumeratedType Kind = "enumerated" SetType Kind = "set" RecordType Kind = "record" BooleanType Kind = "boolean" RecordOfType Kind = "record of" SetOfType Kind = "set of" ArrayType Kind = "array of" ComponentType Kind = "component" TypeReference Kind = "type reference" )
type List ¶ added in v0.11.0
func (*List) CompatibleTo ¶ added in v0.11.0
func (*List) EnclosingScope ¶ added in v0.11.0
type Module ¶ added in v0.11.0
Module represents a TTCN-3 module.
func (*Module) EnclosingScope ¶ added in v0.11.0
EnclsosingScope returns the parent (== global) scope of the module
type NamedType ¶ added in v0.11.0
func (*NamedType) CompatibleTo ¶ added in v0.11.0
func (*NamedType) EnclosingScope ¶ added in v0.11.0
type NodeNotImplementedError ¶
NodeNotImplementedError is returned when a syntax node is not implemented.
func (*NodeNotImplementedError) Error ¶
func (e *NodeNotImplementedError) Error() string
type Object ¶
type Object interface { // Scope returns the enclosing (== lexical) scope of an object. EnclosingScope() Scope }
Object represents a type system object; such a scope, a types, a variable, ...
type RedefinitionError ¶
func (*RedefinitionError) Error ¶
func (e *RedefinitionError) Error() string
type Ref ¶
type Ref struct { Expr ast.Expr // The expression that refers to the object. Scp Scope // The context ( == scope) of the reference. Obj Object // The object referenced by the reference. }
Ref is a reference to an object.
func (*Ref) CompatibleTo ¶ added in v0.11.0
func (*Ref) EnclosingScope ¶
type Scope ¶
type Scope interface { Object // Insert inserts an object into the scope. Insert(name string, obj Object) Object // Lookup returns the object with the given name in the scope. Lookup(name string) Object // Names returns the names of all objects in the scope. Names() []string }
Scope represents a TTCN-3 scope; such as a modules, a function, ...
type Struct ¶ added in v0.11.0
type Struct struct { Scope Scope // contains filtered or unexported fields }
Struct represents a structured type, such as record, set, union or enumerated.
func (*Struct) CompatibleTo ¶ added in v0.11.0
func (*Struct) EnclosingScope ¶ added in v0.11.0
type Type ¶
type Type interface { Object Kind() Kind // Compatible returns true if the type is compatible with the given type. CompatibleTo(other Type) bool }
Type represents a TTCN-3 type.