Documentation
¶
Overview ¶
This package defines source code entities - abstractions that end-user (a programmer) operates on. For convenience these structures have json tags. This is not clean architecture but it's very handy for LSP.
Index ¶
- Constants
- func IsArrayBypassIdx(idx *uint8) bool
- func IsArrayBypassPortAddr(addr *PortAddr) bool
- func MissingNodeName(index int) string
- type AutoportsDirective
- type BindDirective
- type BindTypeDirective
- type Build
- type CommentTag
- type Comments
- type Component
- type Connection
- type ConnectionReceiver
- type ConnectionSender
- type Const
- type ConstValue
- type Directive
- type DirectiveKind
- type Directives
- type EntitiesResult
- type Entity
- type EntityKind
- type ExternDirective
- type File
- type IO
- type Import
- type Interface
- type InteropableComponent
- type Module
- type ModuleManifest
- type MsgLiteral
- type Node
- type Package
- type Port
- type PortAddr
- type Scope
- func (s Scope) Entity(entityRef core.EntityRef) (Entity, core.Location, error)
- func (s Scope) GetComponent(entityRef core.EntityRef) ([]Component, error)
- func (s Scope) GetConst(entityRef core.EntityRef) (Const, core.Location, error)
- func (s Scope) GetEntityKind(entityRef core.EntityRef) (EntityKind, error)
- func (s Scope) GetFirstInportName(nodes map[string]Node, portAddr PortAddr) (string, error)
- func (s Scope) GetFirstOutportName(nodes map[string]Node, portAddr PortAddr) (string, error)
- func (s Scope) GetNodeIOByPortAddr(nodes map[string]Node, portAddr PortAddr) (IO, error)
- func (s Scope) GetType(ref core.EntityRef) (ts.Def, ts.Scope, error)
- func (s Scope) IsTopType(expr ts.Expr) bool
- func (s Scope) Location() *core.Location
- func (s Scope) Relocate(location core.Location) Scope
- type TypeArgs
- type TypeParams
- type UnionLiteral
Constants ¶
const ArrayBypassIdx uint8 = 255
const MissingNodeNamePrefix = "__missing_node_name__"
Variables ¶
This section is empty.
Functions ¶
func IsArrayBypassIdx ¶
func IsArrayBypassPortAddr ¶
func MissingNodeName ¶
Types ¶
type AutoportsDirective ¶ added in v0.41.0
type AutoportsDirective struct{}
AutoportsDirective requests ports derived from a component type argument.
type BindDirective ¶ added in v0.41.0
BindDirective identifies the constant bound to a node.
type BindTypeDirective ¶ added in v0.41.0
BindTypeDirective carries a source-level type expression for later resolution.
type CommentTag ¶ added in v0.37.0
type Comments ¶ added in v0.37.0
type Comments struct {
TextBlocks []string `json:"textBlocks,omitempty"`
Inports map[string]string `json:"inports,omitempty"`
Outports map[string]string `json:"outports,omitempty"`
Examples []string `json:"examples,omitempty"`
Tags []CommentTag `json:"tags,omitempty"`
Meta core.Meta `json:"meta"`
}
Comments is a parsed comment payload attached to an entity.
type Component ¶
type Component struct {
Directives Directives `json:"directives,omitempty"`
Nodes map[string]Node `json:"nodes,omitempty"`
Net []Connection `json:"net,omitempty"`
Interface `json:"interface"`
Meta core.Meta `json:"meta"`
}
type Connection ¶
type Connection struct {
Senders []ConnectionSender `json:"sender,omitempty"`
Receivers []ConnectionReceiver `json:"receiver,omitempty"`
Meta core.Meta `json:"meta"`
}
type ConnectionReceiver ¶
type ConnectionReceiver struct {
PortAddr *PortAddr `json:"portAddr,omitempty"`
ChainedConnection *Connection `json:"chainedConnection,omitempty"`
Meta core.Meta `json:"meta"`
}
type ConnectionSender ¶
type ConnectionSender struct {
PortAddr *PortAddr `json:"portAddr,omitempty"`
Const *Const `json:"const,omitempty"`
StructSelector []string `json:"selector,omitempty"`
Meta core.Meta `json:"meta"`
}
func (ConnectionSender) String ¶
func (s ConnectionSender) String() string
type Const ¶
type Const struct {
TypeExpr ts.Expr `json:"typeExpr"`
Value ConstValue `json:"value"`
Meta core.Meta `json:"meta"`
}
Const represents abstraction that allow to define reusable message value.
type ConstValue ¶
type ConstValue struct {
Ref *core.EntityRef `json:"ref,omitempty"`
Message *MsgLiteral `json:"message,omitempty"`
Meta core.Meta `json:"meta"`
}
func (ConstValue) String ¶
func (c ConstValue) String() string
type Directive ¶
type Directive struct {
Extern *ExternDirective `json:"extern,omitempty"`
Bind *BindDirective `json:"bind,omitempty"`
Autoports *AutoportsDirective `json:"autoports,omitempty"`
BindType *BindTypeDirective `json:"bindType,omitempty"`
Meta core.Meta `json:"meta"`
}
Directive is a typed compiler instruction. Exactly one variant must be set.
func NewBindDirective ¶ added in v0.41.0
NewBindDirective constructs a compiler-generated #bind directive.
func (*Directive) Kind ¶ added in v0.41.0
func (d *Directive) Kind() DirectiveKind
Kind returns the kind of the populated directive variant.
type DirectiveKind ¶ added in v0.41.0
type DirectiveKind string
DirectiveKind identifies a compiler directive understood by the parser.
const ( DirectiveKindExtern DirectiveKind = "extern" DirectiveKindBind DirectiveKind = "bind" DirectiveKindAutoports DirectiveKind = "autoports" DirectiveKindBindType DirectiveKind = "bind_type" )
type Directives ¶ added in v0.41.0
type Directives []Directive
Directives preserves source order and duplicate directives for analysis.
func (Directives) Find ¶ added in v0.41.0
func (d Directives) Find(kind DirectiveKind) (Directive, bool)
Find returns the first directive with the requested kind.
func (Directives) Has ¶ added in v0.41.0
func (d Directives) Has(kind DirectiveKind) bool
Has reports whether a directive of the requested kind is present.
type EntitiesResult ¶
type Entity ¶
type EntityKind ¶
type EntityKind string
const ( ComponentEntity EntityKind = "component_entity" ConstEntity EntityKind = "const_entity" TypeEntity EntityKind = "type_entity" InterfaceEntity EntityKind = "interface_entity" )
type ExternDirective ¶ added in v0.41.0
type ExternDirective struct {
Ref string `json:"ref"`
}
ExternDirective names a runtime-function registry entry.
type Interface ¶
type Interface struct {
TypeParams TypeParams `json:"typeParams"`
IO IO `json:"io"`
Meta core.Meta `json:"meta"`
}
Interface describes abstract component.
type InteropableComponent ¶
InteropableComponent describes a component that can be exported to go.
type Module ¶
type Module struct {
Packages map[string]Package `json:"packages,omitempty"`
Manifest ModuleManifest `json:"manifest"`
}
Module is unit of distribution.
type ModuleManifest ¶
type MsgLiteral ¶
type MsgLiteral struct {
Bool *bool `json:"bool,omitempty"`
Int *int `json:"int,omitempty"`
Float *float64 `json:"float,omitempty"`
Str *string `json:"str,omitempty"`
DictOrStruct map[string]ConstValue `json:"dict,omitempty"`
Union *UnionLiteral `json:"union,omitempty"`
List []ConstValue `json:"vec,omitempty"`
Meta core.Meta `json:"meta"`
}
func (MsgLiteral) String ¶
func (m MsgLiteral) String() string
type Node ¶
type Node struct {
Directives Directives `json:"directives,omitempty"`
DIArgs map[string]Node `json:"diArgs,omitempty"`
OverloadIndex *int `json:"overloadIndex,omitempty"`
TypeArgs TypeArgs `json:"typeArgs,omitempty"`
EntityRef core.EntityRef `json:"entityRef"`
Meta core.Meta `json:"meta"`
ErrGuard bool `json:"errGuard,omitempty"`
}
type Package ¶
func (Package) Entities ¶
func (pkg Package) Entities() func(func(EntitiesResult) bool)
Entities iterates over all entities in the package using the range-func protocol.
func (Package) GetInteropableComponents ¶
func (pkg Package) GetInteropableComponents() []InteropableComponent
GetInteropableComponents finds all public components in the package that have exactly one inport and one outport (valid for go interop). components that don't meet this criteria are silently ignored.
type PortAddr ¶
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
func (Scope) GetComponent ¶
TODO rename to GetComponents
func (Scope) GetEntityKind ¶
func (s Scope) GetEntityKind(entityRef core.EntityRef) (EntityKind, error)
func (Scope) GetFirstInportName ¶
func (Scope) GetFirstOutportName ¶
func (Scope) GetNodeIOByPortAddr ¶
type TypeParams ¶
func (TypeParams) String ¶
func (t TypeParams) String() string