Files
rdbms-playground/src/dsl/mod.rs
T
claude@clouddev1 41b7e9a049 style: format the whole tree with cargo fmt (stock defaults, #35)
One-time, mechanical reformat — no functional changes. The tree was not
rustfmt-clean (~1800 hunks across ~100 files); this brings it to stock
`cargo fmt` defaults so a `cargo fmt --check` CI gate can follow.
Behaviour-preserving: 2509 pass / 0 fail / 1 ignored (unchanged baseline),
clippy clean. A .git-blame-ignore-revs entry follows so `git blame`
skips this commit.
2026-06-17 21:39:19 +00:00

59 lines
1.9 KiB
Rust

//! The Playground DSL.
//!
//! The DSL is the simplified, beginner-friendly command surface
//! described in ADR-0003. This module owns its grammar
//! (`parser`), its abstract syntax tree (`command`), and the
//! user-facing type vocabulary (`types`).
//!
//! Raw SQL handling for advanced mode is intentionally *not* in
//! this module — that path uses `sqlparser-rs` and lives
//! elsewhere when it lands.
pub mod action;
pub mod command;
pub mod grammar;
pub mod parser;
pub mod shortid;
pub mod sql_functions;
pub mod types;
pub mod value;
pub mod walker;
pub use action::ReferentialAction;
pub use command::{
AlterTableAction, AppCommand, ChangeColumnMode, ColumnSpec, Command, CompareOp, CopyScope,
Expr, IndexSelector, MessagesValue, ModeValue, Operand, Predicate, RelationshipSelector,
RowFilter, ShowListKind, SqlForeignKey,
};
pub use parser::{ParseError, parse_command};
pub use types::Type;
pub use value::Value;
/// Prefix every echoed DSL command carries in the output
/// panel — i.e. `[simple] running: <input>` reads as
/// `[simple]` (tag) + `running: ` (this constant) + the
/// user's input.
///
/// The catalog template `dsl.running` is contracted to equal
/// `format!("{ECHO_PREFIX}{{input}}")`. The constant lives
/// in code because the echo-line renderer (ADR-0022 §5)
/// peels this prefix off and re-tokenises the rest for
/// highlighting; a unit test (`echo_prefix_matches_catalog_template`)
/// pins the binding.
pub const ECHO_PREFIX: &str = "running: ";
#[cfg(test)]
mod tests {
use super::ECHO_PREFIX;
#[test]
fn echo_prefix_matches_catalog_template() {
// The catalog template `dsl.running` must produce
// `<ECHO_PREFIX><input>` so the echo-line renderer can
// peel the prefix and re-tokenise the rest. A
// translator changing the prefix breaks this test.
let rendered = crate::t!("dsl.running", input = "");
assert_eq!(rendered, ECHO_PREFIX);
}
}