sql_dialect_fmt_syntax/lib.rs
1#![allow(non_camel_case_types)]
2//! Syntax kinds for **sql-dialect-fmt**, a Snowflake SQL formatter + highlighter toolchain.
3//!
4//! [`SyntaxKind`] is the single enumeration of every token kind and (eventually) every
5//! node kind in the grammar. It is `#[repr(u16)]` and contiguous so it can be cheaply
6//! converted to/from the `u16` that the `rowan` lossless tree stores.
7//!
8//! The lexer produces only *token* kinds; the parser later introduces *node* kinds and
9//! assembles the lossless concrete syntax tree (CST). Keeping kinds in one crate lets the
10//! lexer, parser, formatter and highlighter all speak the same vocabulary.
11//!
12//! ## Modules
13//! * `kind` — the [`SyntaxKind`] enum plus its `u16` conversions and predicates.
14//! * `keyword` — case-insensitive recognition of keyword text ([`keyword_kind`]) plus its
15//! dialect-aware reservation ([`keyword_kind_for`], [`KeywordDialect`]).
16//! * `types` — canonical built-in type words shared by highlighters and editor integrations.
17//! * `dialect` — the [`Dialect`] runtime selector threaded through lexer, parser, and formatter.
18//! * `lang` — `rowan` lossless-tree integration, behind the `rowan` feature.
19
20#[macro_use]
21mod macros;
22
23mod dialect;
24mod keyword;
25mod kind;
26#[cfg(feature = "rowan")]
27mod lang;
28mod types;
29
30pub use dialect::Dialect;
31pub use keyword::{keyword_kind, keyword_kind_for, keyword_texts, KeywordDialect};
32pub use kind::SyntaxKind;
33pub use types::{is_builtin_type, BUILTIN_TYPE_WORDS};
34
35#[cfg(feature = "rowan")]
36pub use lang::{SnowflakeLang, SyntaxElement, SyntaxNode, SyntaxToken};