Documentation
¶
Index ¶
Constants ¶
const CodeEndpointNotOfMachine = "endpoint-not-of-machine"
CodeEndpointNotOfMachine marks a transition endpoint naming a vertex the machine the transition belongs to does not own (UML 2.5.1 §14.2.3.9).
const CodeNoOutgoingTransition = "no-outgoing-transition"
CodeNoOutgoingTransition marks a routing pseudostate no transition leaves, which a transition reaching it terminates nowhere at (UML 2.5.1 §15.7.18).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstraintPass ¶
type ConstraintPass struct{}
ConstraintPass runs the depth-C semantic constraint checks over a document's symbol tree: specialization-cycle detection, multiplicity-range validity, and subsetting multiplicity conformance (design §4.1). It runs at LevelConstraint, after type checking; it relies on the shared semantic model for the resolved specialization graph and extracted multiplicities.
func (ConstraintPass) Level ¶
func (ConstraintPass) Level() PassLevel
func (ConstraintPass) Run ¶
func (ConstraintPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic
type Context ¶
type Context struct {
Name string
Index *symbols.Index
ParseDiagnostics []Diagnostic
// contains filtered or unexported fields
}
Context carries shared state made available to every pass in a run: the document name, the global symbol index, a lazily-created shared resolver, and the syntax diagnostics produced by the caller's parse (passes must not import the parser, so these enter here).
func NewContext ¶
func NewContext(name string, idx *symbols.Index, parseDiags []Diagnostic) *Context
NewContext builds a Context for a document.
type Diagnostic ¶
type Diagnostic struct {
Severity Severity
Span source.Span
Message string
Code string // stable identifier for filtering / quick-fix selection
Source string // the pass ID that produced this diagnostic
// Fixes are the unambiguous edits resolving the diagnostic, offered by an
// editor as quick fixes.
Fixes []quickfix.Fix
}
Diagnostic is a single validation finding produced by a pass.
func Analyze ¶
func Analyze(name string, root *ast.RootNamespace, parseDiags []Diagnostic, idx *symbols.Index) []Diagnostic
Analyze runs the default validation passes over a single parsed document and returns diagnostics sorted by span offset, then source, then message. parseDiags are the parser's diagnostics, already adapted to passes.Diagnostic by the caller.
type ElementFilterPass ¶
type ElementFilterPass struct{}
ElementFilterPass checks the element-filter conditions a document writes: the `filter` members of a namespace (KerML 8.2.4) and the `[...]` clause of an import or expose (SysML v2 7.4.4). A condition is a predicate over one candidate element, so it has to be boolean-valued and it has to be a form the filter evaluator can decide; a condition that is neither selects nothing, and name resolution keeps every candidate rather than hiding model content on a verdict it could not reach.
It runs at LevelType: deciding what a condition yields needs the elements it names to have resolved, and adds nothing over the unresolved-reference diagnostics when they have not.
func (ElementFilterPass) Level ¶
func (ElementFilterPass) Level() PassLevel
func (ElementFilterPass) Run ¶
func (ElementFilterPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic
type NameResolutionPass ¶
type NameResolutionPass struct{}
NameResolutionPass resolves every reference in a document via the Plan-3 resolver and reports unresolved / ambiguous references.
func (NameResolutionPass) Level ¶
func (NameResolutionPass) Level() PassLevel
Level reports the name-resolution dependency level.
func (NameResolutionPass) Run ¶
func (NameResolutionPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic
Run resolves the document and adapts resolver diagnostics.
type Pass ¶
type Pass interface {
Level() PassLevel
Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic
}
Pass is a single validation rule. Level reports its dependency tier; Run executes it over a whole document and returns any diagnostics found.
type PassLevel ¶
type PassLevel int
PassLevel is the dependency tier of a validation pass. Passes at a higher level are skipped when a lower level produced an error, avoiding cascade noise (e.g. no type-check on an unresolved reference).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds an ordered set of validation passes.
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns the default pass registry: syntax, name resolution, state transitions, type checking, and semantic constraints.
func (*Registry) Run ¶
func (r *Registry) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic
Run executes all registered passes in ascending PassLevel order and returns their accumulated diagnostics. If a pass at some level emits an Error-severity diagnostic, passes at strictly higher levels are skipped to avoid cascade noise. Passes at the same level always run.
type StateTransitionPass ¶
type StateTransitionPass struct{}
StateTransitionPass checks that every transition names one source and one target vertex of its own machine (UML 2.5.1 §14.2.3.9), and that a routing pseudostate is left by one (§15.7.18).
func (StateTransitionPass) Level ¶
func (StateTransitionPass) Level() PassLevel
Level reports the name-resolution level: resolved endpoints are all it reads.
func (StateTransitionPass) Run ¶
func (StateTransitionPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic
Run checks every state machine the document declares.
type SyntaxPass ¶
type SyntaxPass struct{}
SyntaxPass surfaces the parser-produced diagnostics carried on the Context. The passes package does not import parser; the caller adapts parser diagnostics into passes.Diagnostic and stores them on Context.ParseDiagnostics.
func (SyntaxPass) Level ¶
func (SyntaxPass) Level() PassLevel
Level reports that syntax is the lowest dependency level.
func (SyntaxPass) Run ¶
func (SyntaxPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic
Run returns the parse diagnostics carried on the context.
type TypeCheckPass ¶
type TypeCheckPass struct{}
TypeCheckPass validates that each def/usage relationship target has a symbol kind compatible with the source node and relationship kind (spec §6.3), and types expressions (operands, bound values, invocation arguments) against the stdlib scalar lattice. It runs at LevelType, after name resolution; unresolved targets are skipped.
func (TypeCheckPass) Level ¶
func (TypeCheckPass) Level() PassLevel
func (TypeCheckPass) Run ¶
func (TypeCheckPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic