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
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.
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.

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§

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.