Skip to main content

Crate model_core

Crate model_core 

Source
Expand description

Language-neutral source code metamodel.

A Model is a set of entities (namespaces, files, types, callables, variables) linked by containment (parent) and by typed relations (calls, references, inheritance…), each relation keeping all its occurrence sites. Frontends fill a ModelBuilder; analyses read the frozen, compact Model through EntityRef and RelationRef.

Structs§

EntityId
Index of an entity in its crate::Model; only meaningful there.
EntityRef
An entity of a Model; cheap to copy.
KeyError
KindId
Index of a kind in its Metamodel; one byte in the entity row, so a model holds at most 256 kinds.
KindInfo
What the metamodel knows about one kind.
LanguageId
Open language identifier (java, typescript, python, pharo…): supporting a new language must not require changing this crate.
MemoryStats
Approximate heap usage, to watch the cost of keeping every occurrence.
Metamodel
Kinds of a model. Ids 0..15 are the archetypes’ default kinds (KindId::of); finer kinds are defined after them, by name.
Model
Frozen, compact model.
ModelBuilder
Mutable model under construction. Entities are keyed: frontends that meet the same symbol (tree-sitter, then SCIP) share one entity. Relations are deduplicated on (from, kind, to, provenance); each occurrence site is kept.
Package
manager name version; empty parts are written ..
Range
0-based, end exclusive (same convention as SCIP and tree-sitter points). Serialised as [start_line, start_col, end_line, end_col].
RelationId
Index of a relation in its crate::Model.
RelationRef
A relation of a Model with all its occurrence sites; cheap to copy.
SiteFlags
One byte per occurrence site, stored beside the range. Bits combine (READ | WRITE for x += 1); unknown bits are preserved.
TraitMask
Bit set of traits (composable capabilities); bit meanings belong to whoever defines the traits, not to this crate.

Enums§

Descriptor
EntityKind
Provenance
Who asserted a fact: lets analyses weigh syntactic guesses against compiler-grade SCIP data.
RelationKind
Kind of a relation. Containment is not a relation: it is the entity’s parent.
SymbolKey
Value

Constants§

BRANCHES_PROP
Number of cyclomatic decision points extracted from an entity’s syntax (if, loops, catch, logical operators…). A frontend fact, not a derived metric: model-analysis computes cyclomatic complexity from it.
SCHEME
Scheme of keys built by Model frontends (not by a SCIP indexer).

Type Aliases§

Props
Open-ended facts a frontend or an analysis attaches to an entity (annotations, modifiers, visibility, HTTP endpoints…). Keys are namespaced by convention: java.annotations, http.endpoints.