Documentation
¶
Overview ¶
Package identity computes the effective repository identity of the symbols of an analyzed model: the id of an element's IdentityMetadata::ElementId annotation when it carries one, the normative UUID of a named standard library element, the id derived from its qualified name otherwise, plus the project scope its nearest enclosing ProjectRef declares. It is a side table keyed by symbol; the AST is never touched.
Index ¶
- Constants
- func ElementIdAbout(path, id string) string
- func ElementIdInline(id string) string
- func LibraryLanguage(tier symbols.LibraryTier) (normative.Language, bool)
- func ProjectRefAbout(path, projectID string) string
- func ProjectRefInline(projectID string) string
- func Root(sym *symbols.Symbol) *symbols.Symbol
- type Catalog
- type Declaration
- type Info
- type LibraryElement
- type Scope
- type ScopeDeclaration
- type Source
- type Table
Constants ¶
const ( ElementIdFQN = "IdentityMetadata::ElementId" ProjectRefFQN = "IdentityMetadata::ProjectRef" )
FQNs of the identity metadata definitions in the bundled library.
Variables ¶
This section is empty.
Functions ¶
func ElementIdAbout ¶ added in v0.5.0
ElementIdAbout renders a standalone ElementId annotation naming its element by the qualified path that resolves to it where the annotation is written.
func ElementIdInline ¶ added in v0.5.0
ElementIdInline renders an ElementId annotation for the body of the element it identifies.
func LibraryLanguage ¶ added in v0.8.0
func LibraryLanguage(tier symbols.LibraryTier) (normative.Language, bool)
LibraryLanguage is the half of the standard library a bundled tier belongs to: Kernel is KerML, Systems and Domain are SysML; extensions and workspace are neither.
func ProjectRefAbout ¶ added in v0.5.0
ProjectRefAbout renders a standalone ProjectRef annotation naming the namespace it binds by qualified path.
func ProjectRefInline ¶ added in v0.5.0
ProjectRefInline renders a ProjectRef annotation for the body of the namespace it binds.
Types ¶
type Catalog ¶ added in v0.8.0
type Catalog struct {
// contains filtered or unexported fields
}
Catalog indexes the normative ids of the bundled library by id: a version-5 UUID cannot be reversed, only looked up. Elements are indexed by name too.
func LibraryCatalog ¶ added in v0.8.0
LibraryCatalog is the catalog of the library idx holds, shared by every overlay over one base.
func (*Catalog) Element ¶ added in v0.8.0
func (c *Catalog) Element(id string) (*LibraryElement, bool)
Element is the library element whose normative id is id.
func (*Catalog) ElementNamed ¶ added in v0.8.0
func (c *Catalog) ElementNamed(fqn string) (*LibraryElement, bool)
ElementNamed is the library element whose qualified name is fqn.
func (*Catalog) Elements ¶ added in v0.8.0
func (c *Catalog) Elements() []*LibraryElement
Elements lists the catalogued elements in library walk order.
func (*Catalog) OwningMembership ¶ added in v0.8.0
func (c *Catalog) OwningMembership(id string) (*LibraryElement, bool)
OwningMembership is the library element whose owning membership has normative id id.
type Declaration ¶
type Declaration struct {
// ID is the annotation's evaluated id; meaningful when Declared.
ID string
// Declared reports the id evaluated to a constant string.
Declared bool
// About marks an `about`-form annotation stated away from the element.
About bool
// Node is the annotating node itself, so a consumer that absorbs the
// annotation into identity can identify it in the tree.
Node ast.Node
// Span locates the annotating node, for diagnostics.
Span source.Span
// Scope is where the annotating node is declared; for an `about`-form
// annotation that may be another document than the element's.
Scope *symbols.Scope
}
Declaration is one ElementId annotation of an element, whether written inline (`@ElementId {...}`) or from elsewhere (`metadata : ElementId about x;`).
type Info ¶
type Info struct {
Symbol *symbols.Symbol
// FQN is the symbol's qualified name, which the derived id encodes.
FQN string
// EffectiveID is the annotated id when declared, the normative id of a
// standard library element otherwise, the derived id failing both.
EffectiveID string
// Source is which of the three EffectiveID is.
Source Source
// Language is the library half a normative id is minted under; zero otherwise.
Language normative.Language
// Annotated reports an ElementId annotation on the element.
Annotated bool
// Declared reports that the annotation's id evaluated to a constant
// string; when false the derived id stands.
Declared bool
// DeclaredID is the evaluated ElementId id, possibly empty.
DeclaredID string
// AnnotationSpan locates the ElementId annotation, for diagnostics.
AnnotationSpan source.Span
// Declarations lists every ElementId annotation of the element, inline
// ones first, `about`-form ones after.
Declarations []Declaration
// Scope is the nearest enclosing ProjectRef binding; nil when unbound.
Scope *Scope
}
Info is one symbol's identity: its effective id, where it came from, and the project scope it resolves against.
func Of ¶ added in v0.5.0
Of computes the identity of one symbol without building a whole table; ok is false for a symbol that has no qualified name to derive an id from.
func (*Info) Normative ¶ added in v0.8.0
Normative reports an effective id the norm fixes for the element.
func (*Info) OwningMembershipID ¶ added in v0.8.0
OwningMembershipID is the normative id of the membership owning a standard library element; "" for any other, whose membership id derives from its own.
type LibraryElement ¶ added in v0.8.0
type LibraryElement struct {
Symbol *symbols.Symbol
FQN string
Language normative.Language
ID string
OwningMembershipID string
}
LibraryElement is one named element of the standard library and the ids the norm fixes for it and for the membership that owns it.
type Scope ¶
type Scope struct {
ProjectID string
Branch string
Org string
// Symbol is the namespace carrying the ProjectRef annotation.
Symbol *symbols.Symbol
// Declarations lists every ProjectRef annotation of the namespace, inline
// ones first, `about`-form ones after. The first supplies the binding.
Declarations []ScopeDeclaration
}
Scope is one ProjectRef annotation's project binding. Two scopes name the same project when org and projectId agree; branch selects a version of one project, never another identity, so it plays no part in equality.
type ScopeDeclaration ¶
type ScopeDeclaration struct {
ProjectID string
Branch string
Org string
// Node is the annotating node itself, so a consumer that absorbs the
// annotation into provenance can identify it in the tree.
Node ast.Node
// Span locates the annotating node, for diagnostics.
Span source.Span
// Scope is where the annotating node is declared.
Scope *symbols.Scope
}
ScopeDeclaration is one ProjectRef annotation of a namespace, whether written inline or from elsewhere with an `about` clause.
func (ScopeDeclaration) Key ¶
func (d ScopeDeclaration) Key() string
Key names the project a declaration binds to; branch selects a version of one project, never another identity, so it plays no part.
type Source ¶ added in v0.8.0
type Source uint8
Source is where an element's effective id comes from.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is the identity side table of one analyzed scope tree.
func Build ¶
Build computes the identity side table of every named symbol under the given roots, in root order.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package normative derives the name-based UUIDs (RFC 4122 v5) KerML fixes for the named elements of the standard library, as the SysML v2 pilot does:
|
Package normative derives the name-based UUIDs (RFC 4122 v5) KerML fixes for the named elements of the standard library, as the SysML v2 pilot does: |