// Contract for the `name` package. Implementations: words.mbt, ident.mbt,
// namer.mbt.
///|
/// Split an identifier into words.
///
/// Handles snake_case, kebab-case and dot/segment separators, camelCase and
/// PascalCase boundaries (`HttpApi`), acronym boundaries (`HTTPServer` ->
/// `HTTP`, `Server`), digits attached to the preceding word (`v2Api` -> `v2`,
/// `Api`), Rust raw-identifier prefixes (`r#Name`, including after separators),
/// and non-alphanumeric separators (`_ - . $ / #`). Empty words are dropped;
/// word case is preserved.
declare pub fn split_words(input : String) -> Array[String]
///|
/// Join the words of `input` in PascalCase (`fooBarBaz` -> `FooBarBaz`,
/// `GOLEM-INVOCATION-ID` -> `GolemInvocationId`).
/// The result is NOT guaranteed to be a valid identifier (a leading digit
/// word stays a leading digit) — use `ident_pascal` for that.
declare pub fn to_pascal(input : String) -> String
///|
/// Join the words of `input` in camelCase (`foo_barBaz` -> `fooBarBaz`,
/// `GOLEM-INVOCATION-ID` -> `golemInvocationId`).
declare pub fn to_camel(input : String) -> String
///|
/// Join the words of `input` in lower_snake_case (`HttpApi_2` -> `http_api_2`).
declare pub fn to_snake(input : String) -> String
///|
/// Join the words of `input` in lower-kebab-case (`HttpApi` -> `http-api`).
declare pub fn to_kebab(input : String) -> String
///|
/// True if `s` is a MoonBit keyword, lexer reserved keyword, wildcard `_`,
/// `self`/`Self`, or boolean literal `true`/`false`.
declare pub fn is_keyword(s : String) -> Bool
///|
/// Append `_` to `name` when it is a keyword; otherwise return it unchanged.
declare pub fn escape_keyword(name : String) -> String
///|
/// Strip Rust `r#` raw-identifier prefixes (at start or after a separator) and
/// map every character outside `[A-Za-z0-9]` to `_`.
declare pub fn sanitize(input : String) -> String
///|
/// Ensure `s` is a valid MoonBit value identifier body (not empty, not bare
/// `_`, not starting with a digit).
declare pub fn ensure_valid_ident(s : String) -> String
///|
/// Ensure `s` is a valid MoonBit type/variant identifier body (starts with
/// `[A-Z]`).
declare pub fn ensure_valid_type_ident(s : String) -> String
///|
/// Sanitize + PascalCase + UIDENT validity + keyword escape: a valid type
/// identifier from any input (`r#CreateParams` -> `CreateParams`,
/// `$float` -> `Float`, `2xx` -> `V2Xx`, `""` -> `Unnamed`, `self` -> `Self_`).
declare pub fn ident_pascal(input : String) -> String
///|
/// Sanitize + lower_snake_case + LIDENT validity + keyword escape: a valid
/// value identifier from any input (`type` -> `type_`, `displayName` ->
/// `display_name`, `$float` -> `float`, `""` -> `__`).
declare pub fn ident_snake(input : String) -> String
///|
/// Create a new empty scoped unique-name allocator.
declare pub fn Namer::new() -> Namer
///|
/// True if `name` has already been reserved or allocated in this scope.
declare pub fn Namer::is_taken(self : Namer, name : String) -> Bool
///|
/// Reserve `name` so future allocations in this scope will not return it.
declare pub fn Namer::reserve(self : Namer, name : String) -> Unit
///|
/// Reserve MoonBit's un-declarable built-in type names (`Error`, `Unit`, etc.).
declare pub fn Namer::reserve_builtin_types(self : Namer) -> Unit
///|
/// Allocate a unique identifier based on `base` (sanitized, keyword-escaped,
/// and made valid).
declare pub fn Namer::unique(self : Namer, base : String) -> String
///|
/// Allocate a unique MoonBit type/variant identifier based on `base`
/// (guaranteed to start with `[A-Z]`).
declare pub fn Namer::unique_type(self : Namer, base : String) -> String