types

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package types provides type inference and checking for TTCN-3.

Index

Constants

This section is empty.

Variables

View Source
var (
	Integer = &Basic{Kind: IntegerType}
)

Functions

func Equal

func Equal(a, b Object) bool

Equal returns true if the two object are equal.

Types

type Basic

type Basic struct {
	Kind Kind
}

Basic represents a basic TTCN-3 type, such as integer, boolean, ...

func (*Basic) CompatibleTo

func (b *Basic) CompatibleTo(other Type) bool

func (*Basic) EnclosingScope

func (b *Basic) EnclosingScope() Scope

func (*Basic) String

func (b *Basic) String() string

func (*Basic) Underlying

func (b *Basic) Underlying() Type

type Info

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

func (*Info) InsertTree

func (info *Info) InsertTree(n ast.Node, scp Scope) error

InsertTree inserts the given syntax tree n into the given parent scope scp.

func (*Info) Position

func (info *Info) Position(pos loc.Pos) loc.Position

func (*Info) TypeOf

func (info *Info) TypeOf(n ast.Node, scp Scope) Type

type Kind

type Kind string

Kind returns the kind of the object.

const (
	IntegerType Kind = "integer"
)

type NodeNotImplementedError

type NodeNotImplementedError struct {
	Node ast.Node
}

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 Range

type Range interface {
	Begin() loc.Position
	End() loc.Position
}

Range represents a range of TTCN-3 source code.

type RedefinitionError

type RedefinitionError struct {
	Name           string
	OldPos, NewPos loc.Position
}

func (*RedefinitionError) Error

func (e *RedefinitionError) Error() string

type Ref

type Ref struct {
	Expr ast.Expr // The expression that refers to the object.
	// contains filtered or unexported fields
}

Ref is a reference to an object.

func (*Ref) EnclosingScope

func (r *Ref) EnclosingScope() Scope

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 Type

type Type interface {
	Object

	// Underlying returns the underlying (== root) type of the type.
	Underlying() Type

	// Compatible returns true if the type is compatible with the given type.
	CompatibleTo(other Type) bool
}

Type represents a TTCN-3 type.

type Var

type Var struct {
	Name  string
	Type  Type
	Scope Scope
	// contains filtered or unexported fields
}

Var represents a variable.

func (*Var) Begin

func (v *Var) Begin() loc.Position

func (*Var) EnclosingScope

func (v *Var) EnclosingScope() Scope

func (*Var) End

func (v *Var) End() loc.Position

Jump to

Keyboard shortcuts

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