Skip to main content

cratestack_parser/
public_lists.rs

1//! Public lists the parser owns: builtin scalar names and reserved
2//! multi-file keywords (split out of `lib.rs`, which is at the line ceiling).
3
4use crate::validate;
5
6/// Canonical scalar type names built into the `.cstack` language (e.g.
7/// `String`, `Int`, `Decimal`, ...), including `Page` (which is valid only
8/// as a procedure return type — see `validate::type_names::validate_type_ref`
9/// — not as a plain field type).
10///
11/// This is the same list `cratestack-lsp`'s autocompletion and the
12/// `cratestack-pg`/`cratestack-sqlite` emitter/decoder round-trip tests
13/// assert against, so a new builtin scalar only has to be added here once —
14/// see cratestack#232 for why that matters (this list had already silently
15/// drifted from the LSP's hand-copied one before this accessor existed).
16pub fn builtin_type_names() -> &'static [&'static str] {
17    validate::builtin_type_names()
18}
19
20/// Words reserved for the multi-file schema grammar. Consumers that accept
21/// prospective identifiers, such as the LSP rename flow, must reject this
22/// canonical list before producing source the parser cannot read.
23pub fn reserved_multi_file_keywords() -> &'static [&'static str] {
24    validate::multi_file_schema_keywords()
25}