analyzer

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package analyzer implements source code static semantic analysis. It's important to keep errors as human-readable as possible because they are what end-user is facing when something goes wrong.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrModuleWithoutPkgs    = errors.New("Module must contain at least one package")
	ErrEntryModNotFound     = errors.New("Entry module is not found")
	ErrMainPkgNotFound      = errors.New("Main package not found")
	ErrPkgWithoutFiles      = errors.New("Package must contain at least one file")
	ErrUnknownEntityKind    = errors.New("Entity kind can only be either component, interface, type of constant")
	ErrCompilerVersion      = errors.New("Incompatible compiler version")
	ErrDepModWithoutVersion = errors.New("Every dependency module must have version")
)
View Source
var (
	ErrNodeWrongEntity        = errors.New("Node can only refer to components or interfaces")
	ErrNodeTypeArgsMissing    = errors.New("Not enough type arguments")
	ErrNodeTypeArgsTooMuch    = errors.New("Too much type arguments")
	ErrNonComponentNodeWithDI = errors.New("Only component node can have dependency injection")
	ErrUnusedNode             = errors.New("Unused node found")
	ErrUnusedNodeInport       = errors.New("Unused node inport")
	ErrUnusedNodeOutports     = errors.New("All node's outports are unused")
	ErrSenderIsEmpty          = errors.New("Sender in network must contain port address, constant reference or message literal")
	ErrReadSelfOut            = errors.New("Component cannot read from self outport")
	ErrWriteSelfIn            = errors.New("Component cannot write to self inport")
	ErrInportNotFound         = errors.New("Referenced inport not found in component's interface")
	ErrOutportNotFound        = errors.New(
		"Referenced inport not found in component's interface",
	)
	ErrNodeNotFound               = errors.New("Referenced node not found")
	ErrNormCompWithExtern         = errors.New("Component with nodes or network cannot use #extern directive")
	ErrNormComponentWithoutNet    = errors.New("Component must have network except it uses #extern directive")
	ErrNormNodeBind               = errors.New("Node can't use #bind if it isn't instantiated with the component that use #extern")
	ErrInterfaceNodeBindDirective = errors.New("Interface node cannot use #bind directive")
	ErrExternNoArgs               = errors.New("Component that use #extern directive must provide at least one argument")
	ErrBindDirectiveArgs          = errors.New("Node with #bind directive must provide exactly one argument")
	ErrExternOverloadingArg       = errors.New("Component that use #extern with more than one argument must provide arguments in a form of <type, component_ref> pairs")
	ErrExternOverloadingNodeArgs  = errors.New("Node instantiated with component with #extern with > 1 argument, must have exactly one type-argument for overloading")
)
View Source
var (
	ErrUnusedOutports                = errors.New("All component's outports are unused")
	ErrUnusedOutport                 = errors.New("Unused outport found")
	ErrUnusedInports                 = errors.New("All component inports are unused")
	ErrUnusedInport                  = errors.New("Unused inport found")
	ErrLiteralSenderTypeEmpty        = errors.New("Literal network sender must contain message value")
	ErrComplexLiteralSender          = errors.New("Literal network sender must have primitive type")
	ErrIllegalPortlessConnection     = errors.New("Connection to a node, with more than one port, must always has a port name")
	ErrGuardMixedWithExplicitErrConn = errors.New("If node has error guard '?' it's ':err' outport must not be explicitly used in the network")
)
View Source
var (
	ErrAutoPortsArgNonStruct               = errors.New("Type argument for component with struct inports directive must be struct")
	ErrAutoPortsNodeTypeArgsCount          = errors.New("Note that uses component with struct inports directive must pass exactly one type argument")
	ErrAutoPortsTypeParamConstr            = errors.New("Component that uses struct inports directive must have type parameter with struct constraint")
	ErrAutoPortsTypeParamsCount            = errors.New("Component that uses struct inports directive must have type parameter with have exactly one type parameter")
	ErrNormalInportsWithAutoPortsDirective = errors.New("Component that uses struct inports directive must have no defined inports")
	ErrGuardNotAllowedForNode              = errors.New("Guard is not allowed for nodes without 'err' output")
	ErrGuardNotAllowedForComponent         = errors.New("Guard is not allowed for components without 'err' output")
)
View Source
var (
	ErrEmptyConst         = errors.New("Constant must either have value or reference to another constant")
	ErrEntityNotConst     = errors.New("Constant refers to an entity that is not constant")
	ErrResolveConstType   = errors.New("Cannot resolve constant type")
	ErrUnionConst         = errors.New("Constant cannot have type union")
	ErrConstSeveralValues = errors.New("Constant cannot have several values at once")
)
View Source
var (
	ErrInterfaceTypeParams = errors.New("Cannot resolve interface type parameters")
	ErrEmptyInports        = errors.New("Interface must have inports")
	ErrEmptyOutports       = errors.New("Interface must have outports")
	ErrInvalidInports      = errors.New("Inports are invalid")
	ErrInvalidOutports     = errors.New("Outports are invalid")
)
View Source
var (
	ErrMainComponentWithTypeParams     = errors.New("Main component cannot have type parameters")
	ErrEntityNotFoundByNodeRef         = errors.New("Node references to entity that cannot be found")
	ErrMainComponentInportsCount       = errors.New("Main component must have exactly 1 inport")
	ErrMainComponentOutportsCount      = errors.New("Main component must have exactly 1 outport")
	ErrMainComponentWithoutEnterInport = errors.New("Main component must have 'enter' inport")
	ErrMainComponentWithoutExitOutport = errors.New("Main component must have 'exit' outport")
	ErrMainPortIsArray                 = errors.New("Main component cannot have array ports")
	ErrMainComponentPortTypeNotAny     = errors.New("Main component's ports must be of type any")
	ErrMainComponentNodeNotComponent   = errors.New("Main component's nodes must only refer to components")
)
View Source
var (
	ErrMainEntityNotFound       = errors.New("Main entity is not found")
	ErrMainEntityIsNotComponent = errors.New("Main entity is not a component")
	ErrMainEntityExported       = errors.New("Main entity cannot be exported")
	ErrMainPkgExports           = errors.New("Main package must cannot have exported entities")
)
View Source
var ErrEmptyTypeDefBody = fmt.Errorf("Type definition must have non-empty body")

Functions

This section is empty.

Types

type Analyzer

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

func MustNew

func MustNew(version string, resolver ts.Resolver) Analyzer

func (Analyzer) AnalyzeBuild

func (a Analyzer) AnalyzeBuild(build src.Build) (src.Build, *compiler.Error)

func (Analyzer) AnalyzeExecutableBuild

func (a Analyzer) AnalyzeExecutableBuild(build src.Build, mainPkgName string) (src.Build, *compiler.Error)

Jump to

Keyboard shortcuts

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