fn validate_identifier_format(
name: &str,
kind: IdentifierKind,
) -> Result<(), String>Expand description
Validates an identifier follows naming rules.
§Rules
- Start Character: Must begin with a lowercase letter (a-z, including letters with diacritical marks and non-Latin letters) or an underscore (_).
- Subsequent Characters: Can include lowercase letters, digits (0-9), underscores (_), or dollar signs ($).
- Case: All characters must be lowercase.
§Arguments
name- The identifier name to validatekind- The type of identifier (for error messages)
§Returns
Ok(())if the identifier is validErr(String)with a descriptive error message if invalid
§Examples
Valid identifiers:
users, _temp, my_table, café, 日本語, user123, price$
Invalid identifiers:
Users (uppercase)
123table (starts with digit)
my-table (contains hyphen)
MY_TABLE (uppercase)