Expand description
Syntax kinds for sql-dialect-fmt, a Snowflake SQL formatter + highlighter toolchain.
SyntaxKind is the single enumeration of every token kind and (eventually) every
node kind in the grammar. It is #[repr(u16)] and contiguous so it can be cheaply
converted to/from the u16 that the rowan lossless tree stores.
The lexer produces only token kinds; the parser later introduces node kinds and assembles the lossless concrete syntax tree (CST). Keeping kinds in one crate lets the lexer, parser, formatter and highlighter all speak the same vocabulary.
§Modules
kind— theSyntaxKindenum plus itsu16conversions and predicates.keyword— case-insensitive recognition of keyword text (keyword_kind) plus its dialect-aware reservation (keyword_kind_for,KeywordDialect).types— canonical built-in type words shared by highlighters and editor integrations.dialect— theDialectruntime selector threaded through lexer, parser, and formatter.lang—rowanlossless-tree integration, behind therowanfeature.
Macros§
- T
- Map a punctuation/operator token to its
crate::SyntaxKind.
Enums§
- Dialect
- The SQL dialect a lex/parse/format request targets.
- Keyword
Dialect - Which dialect(s) reserve a given keyword. The grammar treats a word as a keyword only when the
active
Dialectreserves it; otherwise the word is an ordinary identifier. - Syntax
Kind - Every lexical token kind and syntax node kind understood by sql-dialect-fmt.
Constants§
- BUILTIN_
TYPE_ WORDS - Built-in type words recognized by sql-dialect-fmt.
Functions§
- is_
builtin_ type - Case-insensitive built-in type lookup.
- keyword_
kind - Map an identifier’s text to its keyword kind, case-insensitively, using Snowflake semantics.
- keyword_
kind_ for - Like
keyword_kind, but a word counts as a keyword only whendialectreserves it. - keyword_
texts - Canonical lowercase keyword spellings, in the same sorted order as the lookup table.