Skip to main content

vvv_core/
lib.rs

1//! The plugin contract of `vvv`: what a language needs to be one.
2//!
3//! The nouns every crate shares (spans, positions, symbols, addresses), the
4//! traits a language implements ([`lang::Language`], [`resolve::Layout`],
5//! [`resolve::Surgery`]), what they are given ([`query::Query`],
6//! [`resolve::Project`]) and what they hand back ([`search::RawMatch`],
7//! [`facts::Facts`], [`edit::Edit`]). No parser, no file system, no
8//! lifecycle: everything here is plain, serializable data, so a plugin can
9//! move behind a process or WASM boundary without changing the model. What
10//! the engine does with it lives in `vvv-engine`.
11//!
12//! A language is described by rule tables, and they read alike: a rule is
13//! built by `new(..)` or a kind constructor, `under(kind)` scopes it to a
14//! node whose direct parent has that kind, `within(kind)` to a node with
15//! that ancestor, and the remaining builders (`field`, `leading`,
16//! `visibility`) say where the rest of the declaration lives.
17
18pub mod calls;
19pub mod edit;
20pub mod facts;
21pub mod highlight;
22pub mod import;
23pub mod lang;
24pub mod navigation;
25pub mod oracle;
26pub mod paths;
27pub mod query;
28pub mod resolve;
29pub mod search;
30pub mod semantics;
31pub mod signature;
32pub mod symbol;
33pub mod text;
34
35pub use calls::{CallKind, CallRule, CallSite, CalleeRule};
36pub use edit::{ChangeSet, Edit, EditConflict};
37pub use facts::{Facts, FactsError, Token};
38pub use highlight::{Highlight, HighlightKind, HighlightRule};
39pub use import::{
40    ImportBinding, ImportGrammar, ImportGroup, ImportNesting, ImportRef, ImportRule, ReExportRule,
41};
42pub use lang::{Grammar, Language, LanguageId, LanguageRegistry};
43pub use navigation::{
44    BindingNamespace, BindingRule, ConstructorShape, ImportScope, LexicalBinding, MacroScopeRule,
45    ModuleDeclaration, ModuleScope, ModuleScopeRule, NamedImport, NamedImportRule,
46    PatternAlternatives, PatternBinding, PatternConstructor, PatternReference, PatternRole,
47    PatternScope, QualifiedImport, QualifiedImportRule, ScopeUncertainty,
48};
49pub use oracle::{Oracle, Referent};
50pub use paths::{ModulePath, Name, PathHead, PathSyntax, RelPath};
51pub use query::{Query, QueryBuilder, QueryError};
52pub use resolve::{
53    Address, Dependency, FileSet, GroupedImport, GroupedImports, Layout, Package, PackageId,
54    Packages, Parsed, Project, RegroupError, Regrouped, RegroupedEntry, RegroupedOutcome,
55    ResolveError, SideEdit, Surgery,
56};
57pub use search::{Capture, CaptureValue, RawMatch, Role, SearchError};
58pub use semantics::{ReachKind, Semantics, VisibilityRule};
59pub use signature::{DeclarationSignature, SignatureRule};
60pub use symbol::{
61    CompanionOwnership, CompanionPiece, DeclarationPieces, Modifier, ModifierAt, Symbol,
62    SymbolKind, SymbolRule, UnknownSymbolKind,
63};
64pub use text::{Position, SourceText, Span, SpanError};