symbolique 0.1.0

Symbol table pipeline for language servers — parse, link, merge, and resolve symbols across files, built on the laburnum LSP framework.
// Copyright Two Neutron Stars Incorporated and contributors
// SPDX-License-Identifier: BlueOak-1.0.0

//! Core types and traits for the symbol table system.
//!
//! This module defines the fundamental building blocks used throughout the
//! symbolique crate:
//! - **Ident**: Trait for identifier types that represent names in the source
//!   language
//! - **Span**: Re-exported `laburnum::Span` for source location tracking
//! - **Symbol**: The core enum representing different kinds of symbols
//! - **Value**: Trait for literal values stored in symbols
//! - **SymbolId**: Stable, unique identifier for symbols
//!
//! # Design Principles
//!
//! The core module separates structural concerns (how symbols are organized)
//! from semantic concerns (what symbols mean in a specific language). This
//! allows the same symbol table infrastructure to support diverse language
//! designs.
//!
//! # Type Relationships
//!
//! ```text
//! SymbolEngine<V, I>
//!     ├─ V: Value (literal values)
//!     └─ I: Ident (identifiers)
//! ```
//!
//! The type parameters are interconnected: identifiers know their source spans,
//! values can reference identifiers, and everything tracks source locations for
//! error reporting.

pub mod ident;
pub mod symbol;
pub mod usage;

pub use {
  ident::{
    Ident,
    StringIdent,
  },
  laburnum::Span,
  symbol::{
    DefaultValue,
    Symbol,
    SymbolPath,
    SymbolSortKey,
    SymbolVisibility,
    Value,
  },
  usage::{
    PositionEntry,
    SymbolInfo,
    SymbolUsage,
  },
};

/// Allows value types to report all their internal spans for position indexing.
///
/// When a value has multiple source locations (e.g., a struct literal with
/// separate field spans), implementing this trait enables LSP features like
/// "find references" and "go to definition" to locate each individual part.
///
/// The spans returned are indexed by
/// `SymbolEngine::create_definition_with_value_indexing` so that cursor
/// positions within any part of the value resolve to the containing symbol.
pub trait ValueSpans {
  /// Returns all spans associated with this value.
  fn value_spans(&self) -> Vec<laburnum::Span>;
}