Skip to main content

Crate sql_dialect_fmt_syntax

Crate sql_dialect_fmt_syntax 

Source
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 — the SyntaxKind enum plus its u16 conversions 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 — the Dialect runtime selector threaded through lexer, parser, and formatter.
  • langrowan lossless-tree integration, behind the rowan feature.

Macros§

T
Map a punctuation/operator token to its crate::SyntaxKind.

Enums§

Dialect
The SQL dialect a lex/parse/format request targets.
KeywordDialect
Which dialect(s) reserve a given keyword. The grammar treats a word as a keyword only when the active Dialect reserves it; otherwise the word is an ordinary identifier.
SyntaxKind
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 when dialect reserves it.
keyword_texts
Canonical lowercase keyword spellings, in the same sorted order as the lookup table.