Skip to main content

Crate vvv_core

Crate vvv_core 

Source
Expand description

The plugin contract of vvv: what a language needs to be one.

The nouns every crate shares (spans, positions, symbols, addresses), the traits a language implements (lang::Language, resolve::Layout, resolve::Surgery), what they are given (query::Query, resolve::Project) and what they hand back (search::RawMatch, facts::Facts, edit::Edit). No parser, no file system, no lifecycle: everything here is plain, serializable data, so a plugin can move behind a process or WASM boundary without changing the model. What the engine does with it lives in vvv-engine.

A language is described by rule tables, and they read alike: a rule is built by new(..) or a kind constructor, under(kind) scopes it to a node whose direct parent has that kind, within(kind) to a node with that ancestor, and the remaining builders (field, leading, visibility) say where the rest of the declaration lives.

Re-exports§

pub use calls::CallKind;
pub use calls::CallRule;
pub use calls::CallSite;
pub use calls::CalleeRule;
pub use edit::ChangeSet;
pub use edit::Edit;
pub use edit::EditConflict;
pub use facts::Facts;
pub use facts::FactsError;
pub use facts::Token;
pub use highlight::Highlight;
pub use highlight::HighlightKind;
pub use highlight::HighlightRule;
pub use import::ImportBinding;
pub use import::ImportGrammar;
pub use import::ImportGroup;
pub use import::ImportNesting;
pub use import::ImportRef;
pub use import::ImportRule;
pub use import::ReExportRule;
pub use lang::Grammar;
pub use lang::Language;
pub use lang::LanguageId;
pub use lang::LanguageRegistry;
pub use navigation::BindingNamespace;
pub use navigation::BindingRule;
pub use navigation::ConstructorShape;
pub use navigation::ImportScope;
pub use navigation::LexicalBinding;
pub use navigation::MacroScopeRule;
pub use navigation::ModuleDeclaration;
pub use navigation::ModuleScope;
pub use navigation::ModuleScopeRule;
pub use navigation::NamedImport;
pub use navigation::NamedImportRule;
pub use navigation::PatternAlternatives;
pub use navigation::PatternBinding;
pub use navigation::PatternConstructor;
pub use navigation::PatternReference;
pub use navigation::PatternRole;
pub use navigation::PatternScope;
pub use navigation::QualifiedImport;
pub use navigation::QualifiedImportRule;
pub use navigation::ScopeUncertainty;
pub use oracle::Oracle;
pub use oracle::Referent;
pub use paths::ModulePath;
pub use paths::Name;
pub use paths::PathHead;
pub use paths::PathSyntax;
pub use paths::RelPath;
pub use query::Query;
pub use query::QueryBuilder;
pub use query::QueryError;
pub use resolve::Address;
pub use resolve::Dependency;
pub use resolve::FileSet;
pub use resolve::GroupedImport;
pub use resolve::GroupedImports;
pub use resolve::Layout;
pub use resolve::Package;
pub use resolve::PackageId;
pub use resolve::Packages;
pub use resolve::Parsed;
pub use resolve::Project;
pub use resolve::RegroupError;
pub use resolve::Regrouped;
pub use resolve::RegroupedEntry;
pub use resolve::RegroupedOutcome;
pub use resolve::ResolveError;
pub use resolve::SideEdit;
pub use resolve::Surgery;
pub use search::Capture;
pub use search::CaptureValue;
pub use search::RawMatch;
pub use search::Role;
pub use search::SearchError;
pub use semantics::ReachKind;
pub use semantics::Semantics;
pub use semantics::VisibilityRule;
pub use signature::DeclarationSignature;
pub use signature::SignatureRule;
pub use symbol::CompanionOwnership;
pub use symbol::CompanionPiece;
pub use symbol::DeclarationPieces;
pub use symbol::Modifier;
pub use symbol::ModifierAt;
pub use symbol::Symbol;
pub use symbol::SymbolKind;
pub use symbol::SymbolRule;
pub use symbol::UnknownSymbolKind;
pub use text::Position;
pub use text::SourceText;
pub use text::Span;
pub use text::SpanError;

Modules§

calls
Syntactic call sites and declarative extraction rules; no target inference.
edit
Text edits and the ChangeSet every mutating refactor produces.
facts
Everything a language can say about one file from one parse.
highlight
Syntax colouring as data. A grammar declares which node kinds are strings, comments, types and so on (HighlightRule); a language returns Highlight spans for a text; a display decides the colours.
import
Import references as data, and the declarative rules that find them.
lang
The language plugin boundary.
navigation
Lexical and imported bindings used by navigation, independent of mutation scope.
oracle
A second opinion on what a token refers to, from something that knows more than syntax — a compiler, a language server, an index. The graph judges every token by the file’s imports and the layout; where that leaves a token unresolved, an oracle may say what it is.
paths
Names and paths as types, never as text.
query
What the user is looking for. Declarative and serializable so the CLI, a TUI form, and a JSON request all build the same value.
resolve
How files and import paths map onto a language’s namespace.
search
Search results as plain data.
semantics
What a language’s syntax means: the table that gives facts their sense.
signature
Exact declaration headers, including their attached comments and attributes.
symbol
Language-neutral view of declarations.
text
Byte-oriented text primitives shared by every layer.