//! Variables, line references, aggregators, and autocomplete for CalcPad.
//!
//! This module provides the features from Epic 5 (Variables, Line References &
//! Aggregators) that extend the CalcPad engine beyond simple per-line evaluation:
//!
//! - **Line references** (`line1`, `#1`): Reference the result of a specific line
//!   by number, with renumbering support when lines are inserted/deleted and
//!   circular reference detection.
//!
//! - **Aggregators** (`sum`, `total`, `subtotal`, `average`/`avg`, `min`, `max`,
//!   `count`, `grand total`): Compute over a section of lines bounded by headings
//!   or other aggregator lines.
//!
//! - **Autocomplete**: Provides completion suggestions for variables, functions,
//!   keywords, and units based on prefix matching (2+ characters).
//!
//! Note: Variable declaration/usage (`x = 5`, then `x * 2`) and previous-line
//! references (`prev`, `ans`) are handled by the core engine modules:
//! - `context.rs` / `EvalContext` — stores variables and resolves `__prev`
//! - `sheet_context.rs` / `SheetContext` — manages multi-line evaluation with
//!   dependency tracking, storing line results as `__line_N` variables
//! - `interpreter.rs` — evaluates `LineRef`, `PrevRef`, and `FunctionCall` AST nodes
//! - `lexer.rs` / `parser.rs` — tokenize and parse `lineN`, `#N`, `prev`, `ans`

pub mod aggregators;
pub mod autocomplete;
pub mod references;

// Re-export key types for convenience.
pub use aggregators::{
    AggregatorKind, collect_section_values, compute_aggregation, compute_grand_total,
    detect_aggregator, is_heading, is_section_boundary,
};
pub use autocomplete::{
    get_completions, CompletionContext, CompletionItem, CompletionKind, CompletionResult,
};
pub use references::{
    detect_circular_line_refs, extract_line_refs, renumber_after_delete, renumber_after_insert,
};
