Documentation
¶
Overview ¶
Package symbols builds an immutable per-document scope tree and a global qualified-name index over a parsed ast.RootNamespace.
Index ¶
- func DocNameOf(scope *Scope) string
- func FQNOf(sym *Symbol) string
- func SameElement(a, b *Symbol) bool
- func SetDocName(scope *Scope, name string)
- type AnnotationFacts
- type AnnotationValueFacts
- type DimensionFactorFacts
- type DimensionFacts
- type ElementFilter
- type ElementKey
- type FilterOp
- type FilterPredicate
- type FilterValue
- type FilterValueKind
- type Index
- func (idx *Index) AddDocument(name string, root *ast.RootNamespace)
- func (idx *Index) AddRecords(name string, entries []RecordEntry)
- func (idx *Index) Declaring(fqn string) *Symbol
- func (idx *Index) DocumentOfRoot(scope *Scope) string
- func (idx *Index) DocumentRoot(name string) *Scope
- func (idx *Index) ExpandWildcardImports()
- func (idx *Index) FQNs() []string
- func (idx *Index) FQNsEndingIn(name string, limit int) []string
- func (idx *Index) GetFQN(sym *Symbol) string
- func (idx *Index) HiddenFrom(fqn, fromFQN string) bool
- func (idx *Index) Library(sym *Symbol) bool
- func (idx *Index) LookupDirectChildren(prefix string) []*Symbol
- func (idx *Index) LookupDirectChildrenFrom(prefix, fromFQN string) []*Symbol
- func (idx *Index) LookupQualified(fqn string) []*Symbol
- func (idx *Index) LookupQualifiedFrom(fqn, fromFQN string) []*Symbol
- func (idx *Index) MarkLibrary(name string)
- func (idx *Index) NamespaceFiltersOf(fqn string) []ElementFilter
- func (idx *Index) ReexportGates(doc, fqn string, sym *Symbol, from string) [][]ElementFilter
- func (idx *Index) ReexportVisible(doc, fqn string, sym *Symbol) bool
- func (idx *Index) RemoveDocument(name string)
- func (idx *Index) SetNamespaceFilters(fqn, doc string, filters []ElementFilter)
- func (idx *Index) TopLevelBindings(doc string) []RootBinding
- func (idx *Index) WildcardImportsOf(fqn string) []WildcardImport
- type RecordEntry
- type RootBinding
- type Scope
- func (s *Scope) AddChild(c *Scope)
- func (s *Scope) AllMembers() []*Symbol
- func (s *Scope) AnonymousMembers() []*Symbol
- func (s *Scope) BodyLocal() bool
- func (s *Scope) ChildFor(node ast.Node) *Scope
- func (s *Scope) Children() []*Scope
- func (s *Scope) Define(name string, sym *Symbol)
- func (s *Scope) DefineAnonymous(sym *Symbol)
- func (s *Scope) DocName() string
- func (s *Scope) HasAnonymousMembers() bool
- func (s *Scope) LookupLocal(name string) (*Symbol, bool)
- func (s *Scope) LookupLocalAll(name string) []*Symbol
- func (s *Scope) MemberNames() []string
- func (s *Scope) Members() []*Symbol
- func (s *Scope) Node() ast.Node
- func (s *Scope) Owner() *Symbol
- func (s *Scope) Parent() *Scope
- func (s *Scope) SetOwner(sym *Symbol)
- type Symbol
- type SymbolKind
- type UnitFactorFacts
- type UnitFacts
- type WildcardImport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DocNameOf ¶
DocNameOf is the document a scope belongs to, read from the name SetDocName stamped on the scope and its symbols. It identifies a scope tree the index does not hold — a document builds its own for the editor — by name rather than by identity, a document declaring nothing but an import included.
func FQNOf ¶
FQNOf returns a symbol's fully-qualified name from its owner scope chain, so a caller holding a symbol but no index can still name it.
func SameElement ¶
SameElement reports whether a and b denote one element, whichever scope tree each was reached through. A nil symbol denotes no element, itself included.
func SetDocName ¶
SetDocName stamps name onto every symbol in the scope tree (members and all descendant scopes), recording which document declares each symbol. Recursion follows the child links, so scopes no symbol owns — loop bodies and body-expression parameters — are stamped too.
Types ¶
type AnnotationFacts ¶
type AnnotationFacts struct {
TypeFQN string
Values []AnnotationValueFacts
}
AnnotationFacts is one metadata annotation of a cached library symbol: the fully-qualified name of the metadata type annotating it, and the values the annotation body binds its features to, as written.
type AnnotationValueFacts ¶
type AnnotationValueFacts struct {
Feature string
Value FilterValue
}
AnnotationValueFacts is one feature binding inside an annotation body (`@Safety{isMandatory = true;}`), holding the value already evaluated, so that a filter condition reading it decides the same way where the declaration it came from is gone.
type DimensionFactorFacts ¶
DimensionFactorFacts is one base quantity of a dimension, named by its qualified name, and its exponent.
type DimensionFacts ¶
type DimensionFacts struct {
Factors []DimensionFactorFacts
}
DimensionFacts is a quantity dimension as a cached library symbol carries it: the base quantities it is a product of powers of, each named by its qualified name. Empty factors are the dimension of a count or a ratio of like quantities.
type ElementFilter ¶
ElementFilter is one element-filter condition, as it applies to the elements an enumeration would surface: the condition of a `filter <expr>;` member of a namespace (KerML 8.2.4 ElementFilterMembership) or of an import's `[...]` clause (`import P::*[@Safety]`, SysML v2 7.4.4).
A condition is a predicate over one candidate element, not a value expression, and evaluating it needs the metadata annotating the candidate — knowledge the symbol layer does not have. So a filter is carried here in the two forms the evaluator in semantics can run:
- Expr, the condition as parsed, together with the Scope its names resolve against. This is what a live-parsed document holds.
- Pred, the condition compiled to element references already resolved to fully-qualified names. This is what a library restored from an index cache holds, whose declarations — and the scopes that gave its names meaning — are gone. It is what makes a filtered import behave the same way for a parsed and for a cache-restored library.
func ImportFiltersIn ¶
func ImportFiltersIn(scope *Scope) []ElementFilter
ImportFiltersIn returns the filter clauses of the imports the namespace owning scope declares (`import P::*[@Safety]`), in declaration order. It is what a validation pass reads: the conditions an import states are checked where they are written, whichever lookup later applies them.
func NamespaceFiltersIn ¶
func NamespaceFiltersIn(scope *Scope) []ElementFilter
NamespaceFiltersIn returns the filter conditions the namespace owning scope declares. It is what a lookup through an import consults: the namespace's `filter` members restrict its imported memberships, whichever route reaches them (KerML 8.2.4).
Unlike NamespaceFiltersOf, which answers for a namespace registered in the index, this reads the declaration a scope was built from, so it also answers for a `filter` member of a definition or usage body — where the training corpus puts one, in a view definition restricting what its views expose.
func (ElementFilter) IsZero ¶
func (f ElementFilter) IsZero() bool
IsZero reports whether there is no condition to apply.
func (ElementFilter) Same ¶
func (f ElementFilter) Same(g ElementFilter) bool
Same reports whether two filters are the same condition, so that two routes to one re-exported name can be compared. A condition is identified by the declaration it was written in: the expression node and the scope its names resolve against, or the compiled predicate a restored library carries.
func (ElementFilter) String ¶
func (f ElementFilter) String() string
String describes a filter for a snapshot of the index. It deliberately renders only whether a condition applies: the same condition reaches a parsed document as an expression and a restored library as a compiled predicate, and the contract between the two is that they select the same elements, which is asserted over resolution rather than over this text.
type ElementKey ¶
type ElementKey struct {
// contains filtered or unexported fields
}
ElementKey identifies the declaration a symbol was built from, since a document and the global index build their own symbol for one declaration. A symbol with no declaring document — restored from cache — is identified by pointer instead.
type FilterOp ¶
type FilterOp uint8
FilterOp is the operation a compiled filter predicate node performs.
const ( // FilterUnsupported is a condition, or part of one, outside the subset the // filter evaluator implements. It has no truth value: it is reported, and // never silently taken to be true or false. FilterUnsupported FilterOp = iota FilterAnd FilterOr FilterXor FilterImplies FilterNot // FilterClassify is `@T`: the candidate is annotated by metadata // conforming to TypeFQN. FilterClassify // FilterMetaClassify is `@@T`: the candidate's own metaclass conforms to // TypeFQN. FilterMetaClassify FilterEq FilterNeq FilterLt FilterLe FilterGt FilterGe // FilterConst is a literal, or an element reference used as one (an // enumeration literal), held in Value. FilterConst // FilterFeature is the value the candidate's annotation of TypeFQN binds // Feature to. FilterFeature )
type FilterPredicate ¶
type FilterPredicate struct {
Op FilterOp
Operands []*FilterPredicate
// TypeFQN is the metadata type a classification tests against, or whose
// annotation a feature is read from.
TypeFQN string
// Feature is the annotation feature FilterFeature reads.
Feature string
// Value is the constant FilterConst yields.
Value FilterValue
// Reason says why a FilterUnsupported node cannot be evaluated, phrased for
// a diagnostic message.
Reason string
// Span locates the part of the condition this node came from.
Span source.Span
}
FilterPredicate is an element-filter condition compiled to the form the evaluator runs: a tree over the candidate element, with every element the condition names resolved to its fully-qualified name. Compiling before evaluating is what lets one condition be evaluated against many candidates, and lets a condition outlive the declaration it was written in.
type FilterValue ¶
type FilterValue struct {
Kind FilterValueKind
Bool bool
Int int64
Real float64
Str string
RefFQN string
}
FilterValue is a constant a filter predicate yields or compares: a literal, or the element an enumeration-literal reference names.
type FilterValueKind ¶
type FilterValueKind uint8
FilterValueKind discriminates a constant a filter predicate compares.
const ( FilterValueUnknown FilterValueKind = iota FilterValueBool FilterValueInt FilterValueReal FilterValueString // FilterValueRef is a reference to an element used as a value, such as an // enumeration literal, compared by identity of the element it names. FilterValueRef // FilterValueEmpty is the absence of a value — the empty sequence a feature // bound to nothing has. It is a result, unlike FilterValueUnknown, which // says a value could not be determined. FilterValueEmpty )
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index aggregates symbol information across all documents in a workspace. It owns each document's root scope and a global map from fully-qualified name to the symbol(s) declared under it. Per-document contributions are tracked so a document can be removed or re-added without leaving stale entries — the names it declared and the ones its wildcard imports surfaced alike.
func NewIndexFromDoc ¶
func NewIndexFromDoc(name string, root *ast.RootNamespace) *Index
NewIndexFromDoc builds an Index containing a single document.
func (*Index) AddDocument ¶
func (idx *Index) AddDocument(name string, root *ast.RootNamespace)
AddDocument builds the scope tree for root and records its symbols under their fully-qualified names. Re-adding the same document name first removes the document's previous contributions, so the index stays exact.
The names the document's wildcard imports surface are added by ExpandWildcardImports, which the caller runs once the documents it wants indexed are in: adding a document cannot know whether the target of an import it states is still to come.
func (*Index) AddRecords ¶
func (idx *Index) AddRecords(name string, entries []RecordEntry)
AddRecords registers synthetic, AST-less symbols for a document directly by their fully-qualified names. It first removes any prior contributions for name (idempotent re-add), mirroring AddDocument — the wildcard imports a record carries are expanded by a later ExpandWildcardImports, as a parsed document's are. Symbols added this way carry no Decl/Scope and are keyed only by FQN, which is sufficient for qualified-name resolution against library content restored from cache.
func (*Index) Declaring ¶
Declaring returns the symbol fqn declares, and nil when fqn only re-exports a declaration made elsewhere. The lookup is made from fqn itself, so a private member is visible where it is declared.
func (*Index) DocumentOfRoot ¶
DocumentOfRoot returns the name of the document whose root scope this is, or "" for any other scope.
func (*Index) DocumentRoot ¶
DocumentRoot returns the root scope for the named document, or nil.
func (*Index) ExpandWildcardImports ¶
func (idx *Index) ExpandWildcardImports()
ExpandWildcardImports adds re-exported symbols for every package with a wildcard import like `import ISQMechanics::*`, making the target's members visible through the importing package's FQN. Call it after the documents to index are in; AddDocument and AddRecords do not expand on their own, while RemoveDocument does, so the index a removal leaves is the one a fresh build over the remaining documents would produce.
Imports chain — KerML imports Kernel::*, which imports Core::*, which imports Root::* — so a single pass would only propagate one level and its result would depend on the order the importing packages happened to be visited in. Passes therefore repeat until nothing new is re-exported, over the importers in name order, which makes the outcome independent of both map iteration order and of whether a document was parsed or restored from cache.
A pass touches only the importers a change since the last expansion can reach: one whose imports changed, one whose import now resolves to a different namespace, and one importing a namespace whose members changed. Calling it when nothing changed costs one resolution of each import and registers nothing, so a caller that expands after every edit pays for the edit rather than for the workspace.
An importer whose imports no longer support what it re-exported has those re-exports dropped before the pass derives again, since a re-export can be reached by more than one route and a cycle of imports would otherwise let one support itself. Dropping propagates: it takes members from a namespace, which is a change the importers of *that* namespace see on the next pass.
func (*Index) FQNsEndingIn ¶
FQNsEndingIn returns up to limit registered fully-qualified names whose last segment is name, in name order. Used to suggest a candidate for a reference whose qualifying namespace is not loaded.
func (*Index) GetFQN ¶
GetFQN returns the fully-qualified name for a symbol by walking its owner scope chain. Returns the local name if the symbol has no owner scope (root-level symbol).
func (*Index) HiddenFrom ¶
HiddenFrom reports whether every symbol registered under fqn is one only a private import surfaced there, seen from the namespace fromFQN. It is the reason LookupQualifiedFrom found nothing, so a caller that falls back to another lookup route — the qualified walk's inheritance-aware member search, which reaches cached symbols through LookupDirectChildren — asks here first and stops, rather than resurfacing a name KerML 8.2.3.3 hides.
func (*Index) LookupDirectChildren ¶
LookupDirectChildren returns all symbols whose FQN is exactly prefix::name (direct children of the given prefix). This supports wildcard imports from packages that don't have populated Scopes.
func (*Index) LookupDirectChildrenFrom ¶
LookupDirectChildrenFrom is LookupDirectChildren as seen from the namespace named by fromFQN ("" meaning from outside): children that only prefix's own private imports brought in are dropped (KerML 8.2.3.3).
func (*Index) LookupQualified ¶
LookupQualified returns the symbols a qualified reference from outside the naming namespace reaches under the exact fully-qualified name. A namespace's own member shadows one of the same name that a wildcard import re-exported through it, as in SI::min, which is SI's minute and not the imported min function, and a name only a *private* import surfaced is not reachable at all: it is a member of the namespace, but not a visible one (KerML 8.2.3.3).
func (*Index) LookupQualifiedFrom ¶
LookupQualifiedFrom is LookupQualified as seen from the namespace named by fromFQN. A private import is visible inside the namespace that declares it and inside everything nested in it, so a reference made from there — including the target of an alias the namespace declares — still reaches a privately imported name that the same lookup from anywhere else does not (KerML 8.2.3.3).
fromFQN is the FQN of the referring namespace; "" means "from outside", which is what an ordinary qualified reference elsewhere in the workspace gets.
func (*Index) MarkLibrary ¶
MarkLibrary records that the named document holds bundled library content, not the workspace's own. Call it after the document is added: adding a document removes its previous contributions, and the mark with them. Only what the document declares is marked, not the names it re-exports.
func (*Index) NamespaceFiltersOf ¶
func (idx *Index) NamespaceFiltersOf(fqn string) []ElementFilter
NamespaceFiltersOf returns the filter conditions declared by the namespace registered under fqn, over the documents declaring it in name order.
func (*Index) ReexportGates ¶
func (idx *Index) ReexportGates(doc, fqn string, sym *Symbol, from string) [][]ElementFilter
ReexportGates returns the element-filter conditions the name fqn is subject to when it reaches a lookup as sym, one entry per route that surfaced it: the conditions of the import that surfaced it along that route plus the importing namespace's own `filter` members. A name a namespace declares itself has no route and so no conditions.
The resolver reads them and evaluates them against its semantic model, and admits the element when any route's conditions all hold: a candidate every route rejects is not a member of the namespace it appears under, so no route to it resolves (KerML 8.2.4). A private import's route only answers a lookup made from within the importing namespace, which from names ("" for one made from anywhere else).
func (*Index) ReexportVisible ¶
ReexportVisible reports whether a lookup made in doc reaches sym under the name fqn. A root-level name a wildcard import surfaced is a member of the importing document's own root namespace, so it is not visible in another document (KerML 8.2.3.3); a name under a namespace is visible wherever that namespace is.
func (*Index) RemoveDocument ¶
RemoveDocument drops all of the named document's contributions from the global index and forgets its root scope: the names it declared, the wildcard imports it stated, and the re-exports those imports surfaced. A re-export a surviving document also surfaces stays, as does the declaredAt entry a surviving declaration owns.
Removal re-expands what it invalidated before returning, so the index it leaves is the one a fresh build over the remaining documents produces — a caller does not have to know that removing a document can break a chain of imports (A imports B imports C) or make an ambiguous import target resolvable. Unknown names are a no-op.
func (*Index) SetNamespaceFilters ¶
func (idx *Index) SetNamespaceFilters(fqn, doc string, filters []ElementFilter)
SetNamespaceFilters records the filter conditions doc declares for the namespace registered under fqn. A library restored from an index cache states them this way, having no declaration left to read them from.
func (*Index) TopLevelBindings ¶
func (idx *Index) TopLevelBindings(doc string) []RootBinding
TopLevelBindings returns the names registered at the root of the index as seen from doc ("" meaning from outside every document) and the symbol each names: the library's top-level packages and every document's top-level declarations, less the names only another document's private import surfaced (KerML 8.2.3.3). A caller gating those names by their element filters needs the name, since a borrowed symbol's own name is not the root name it appears under.
func (*Index) WildcardImportsOf ¶
func (idx *Index) WildcardImportsOf(fqn string) []WildcardImport
WildcardImportsOf returns the wildcard-import targets recorded for the namespace registered under fqn ("" for a document root), over the documents declaring it in name order.
type RecordEntry ¶
type RecordEntry struct {
FQN string
ShortName string // short name (e.g., "kg" for "kilogram"), empty if none
Kind SymbolKind
Span source.Span
Supers []string // FQNs of the specialization targets of a def/usage
WildcardImports []WildcardImport // for packages: its `import X::*` declarations
AliasTarget string // for aliases: raw target text of "alias X for Y"
Unit *UnitFacts // for measurement units: their reduction to base units
Dimension *DimensionFacts // for measurement units: the quantity dimension they measure in
// Annotations are the metadata annotating the symbol, which an element
// filter classifies it by and its absent declaration would have stated.
Annotations []AnnotationFacts
// NamespaceFilters are the conditions of the namespace's `filter` members,
// compiled: they restrict what it re-exports, and the declaration they were
// written in is gone.
NamespaceFilters []*FilterPredicate
}
RecordEntry is a minimal, AST-less description of a symbol, used to populate the index from a persisted cache record instead of a parsed document.
type RootBinding ¶
RootBinding is a name registered at the index root and the symbol it names.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope is a node in the immutable per-document scope tree. It owns the symbols declared directly within a namespace-like construct and links to its parent and child scopes.
func BodyExprScope ¶
BodyExprScope returns the scope holding body's parameters. A body without parameters declares nothing, so its result resolves in parent.
func Build ¶
func Build(root *ast.RootNamespace) *Scope
Build constructs the immutable scope tree for a parsed document.
func ConstraintBodyScope ¶
ConstraintBodyScope returns the scope a require/assume body resolves against: the one its declarations were built into, or parent for a body declaring none.
func TriggerScope ¶
func TriggerScope(parent *Scope, trans *ast.TransitionMember) *Scope
TriggerScope returns the innermost scope trans's guard and effect resolve against: the one holding the parameters its trigger declares when it declares any, the transition's own scope when it has one, and parent otherwise.
func (*Scope) AllMembers ¶
AllMembers returns all symbols in this scope (including anonymous members).
func (*Scope) AnonymousMembers ¶
AnonymousMembers returns the members declared without a name, in declaration order. One may still have an effective name, taken from a feature it implicitly redefines, which only the semantic model knows (KerML 7.3.4.5).
func (*Scope) BodyLocal ¶
BodyLocal reports whether this scope's names exist only inside the body that declares them, so a subtree search such as a recursive import must skip it.
func (*Scope) ChildFor ¶
ChildFor returns the child scope the given declaration owns, or nil. It is the first such child, as two children of one node are one body scoped twice.
func (*Scope) Define ¶
Define registers sym under the given name key. Multiple symbols may share a key (duplicate declarations); all are retained in definition order.
func (*Scope) DefineAnonymous ¶
DefineAnonymous adds an anonymous symbol (without name) to this scope.
func (*Scope) HasAnonymousMembers ¶
HasAnonymousMembers reports whether any member is declared without a name.
func (*Scope) LookupLocal ¶
LookupLocal returns the first symbol defined under name in this scope only. A declared name wins over an effective one taken from a referenced feature.
func (*Scope) LookupLocalAll ¶
LookupLocalAll returns every symbol defined under name in this scope only.
func (*Scope) MemberNames ¶
MemberNames returns the member keys of this scope in declaration order.
func (*Scope) Members ¶
Members returns the distinct symbols declared directly in this scope, in definition order. A symbol registered under both its short and primary name appears once. Callers must not mutate the returned slice's symbols.
type Symbol ¶
type Symbol struct {
Name string // the key this Symbol was primarily created for
Kind SymbolKind // classification
Decl ast.Node // the declaring AST node
Visibility ast.Visibility // declared visibility
DeclSpan source.Span // span of the declaration (for diagnostics)
NameSpan source.Span // span of the declared identifier alone (for rename); zero when unknown
Scope *Scope // the child scope this declaration owns, or nil for leaves
OwnerScope *Scope // the enclosing scope this declaration was declared in
// LeadingTrivia is the comment/note trivia attached to the member wrapper
// preceding this declaration (captured before unwrap, since wrappers carry
// the trivia while the unwrapped inner Decl does not). Used for doc hover.
LeadingTrivia []ast.Trivia
DocName string // name of the document that declares this symbol (stamped after Build)
// SuperFQNs are the fully-qualified names of the specialization targets
// (specializes/subsets/redefines), populated for cached library symbols
// where Decl=nil. Empty for live-parsed symbols, which use Decl instead.
SuperFQNs []string
// AliasTargetFQN is the raw qualified name text of the alias target
// ("alias X for Y" → "Y"), populated for cached stdlib aliases where Decl=nil.
// Empty for non-aliases or live-parsed aliases (which use Decl instead).
AliasTargetFQN string
// ShortName is the short name from Identification (e.g., "kg" for "kilogram").
// Populated for cached symbols where Decl=nil. Empty if no short name.
ShortName string
// EffectiveName reports that Name was taken from the feature this
// declaration references rather than declared (KerML Feature::effectiveName).
EffectiveName bool
// Unit is the reduced measurement-unit form persisted for a cached library
// symbol, whose declaration is absent: without it the conversion a unit
// declares could not be read back. Nil for a symbol that is not a
// measurement unit, and for live-parsed symbols, which use Decl instead.
Unit *UnitFacts
// Dimension is the quantity dimension persisted for a cached library symbol,
// whose declaration is absent: the power factors a unit definition states are
// declared members with bound values, which the declaration takes with it.
// Nil for a symbol whose dimension is not determined, and for live-parsed
// symbols, which are read from Decl instead.
Dimension *DimensionFacts
// NamingTarget is the reference that named this symbol when EffectiveName
// is set: the target of its reference subsetting or redefinition. Resolving
// that reference must not see the name it gave away, or it would resolve to
// the feature that borrowed it (KerML 7.3.4.5).
NamingTarget ast.Node
// Annotations are the metadata annotations of a cached library symbol,
// whose declaration is absent: an element filter classifies a candidate by
// the metadata annotating it, so a restored symbol has to carry what its
// declaration would have said. Empty for live-parsed symbols, which are read
// from Decl instead.
Annotations []AnnotationFacts
}
Symbol describes one declared name. The same declaration may be reachable through more than one Symbol only when it declares both a short and a primary name; in that case a single Symbol is registered under both keys.
func PreferDeclared ¶
PreferDeclared drops symbols whose name was borrowed from a referenced feature when the key also has a declared one, which is how a `perform p;` shorthand and a declaration named p coexist in one scope.
type SymbolKind ¶
type SymbolKind int
SymbolKind classifies a declared name.
const ( SymbolUnknown SymbolKind = iota SymbolPackage SymbolNamespace SymbolAlias SymbolDependency SymbolComment SymbolDocumentation SymbolTextualRepresentation SymbolPartDef SymbolAttributeDef SymbolPartUsage SymbolAttributeUsage // Tier A definitions. SymbolItemDef SymbolOccurrenceDef SymbolIndividualDef SymbolMetadataDef SymbolMetaclass // KerML metaclass (similar to metadata def) SymbolEnumerationDef SymbolViewDef SymbolViewpointDef SymbolRenderingDef SymbolConcernDef // Tier B definitions. SymbolConnectionDef SymbolFlowDef SymbolPortDef SymbolInterfaceDef SymbolAllocationDef // Tier C definitions. SymbolActionDef SymbolStateDef SymbolCalcDef SymbolConstraintDef SymbolRequirementDef SymbolCaseDef SymbolAnalysisCaseDef SymbolVerificationCaseDef SymbolUseCaseDef // Tier A usages. SymbolItemUsage SymbolOccurrenceUsage SymbolIndividualUsage SymbolMetadataUsage SymbolEnumerationUsage SymbolViewUsage SymbolViewpointUsage SymbolRenderingUsage SymbolConcernUsage // Tier B usages. SymbolConnectionUsage SymbolFlowUsage SymbolPortUsage SymbolInterfaceUsage SymbolAllocationUsage // Tier C usages. SymbolActionUsage SymbolStateUsage SymbolCalcUsage SymbolConstraintUsage SymbolRequirementUsage SymbolCaseUsage SymbolAnalysisCaseUsage SymbolVerificationCaseUsage SymbolUseCaseUsage // SymbolConnectorEnd is an end feature a connector usage declares in its // connect clause (`connect bead references t.bead`). SymbolConnectorEnd // SymbolKerMLType classifies a KerML type declaration — `class`, // `classifier`, `struct`, `assoc`, `behavior`, `predicate` — which the SysML // definition taxonomy has no counterpart for. SymbolKerMLType )
func (SymbolKind) String ¶
func (k SymbolKind) String() string
String returns the display name of the kind.
type UnitFactorFacts ¶
UnitFactorFacts is one base unit of a reduced measurement unit, named by its qualified name, and its exponent.
type UnitFacts ¶
type UnitFacts struct {
ScaleNum float64
ScaleDen float64
Factors []UnitFactorFacts
// Irreducible marks a measurement unit whose reduction is not derivable
// from its declaration, so that it is still known to be a unit.
Irreducible bool
}
UnitFacts is a measurement unit reduced to a scale factor over base units, each named by its qualified name. It is what a cached library symbol carries in place of the declaration the reduction was computed from.
type WildcardImport ¶
type WildcardImport struct {
Target string
Private bool
Filter ElementFilter
}
WildcardImport is one `import X::*` declaration: the target's raw qualified name text, whether the import was declared private, and the filter condition restricting what it brings in (`import X::*[@Safety]`), which is zero for an unfiltered import.