Skip to main content

rudb_parse/
lib.rs

1//! The SQL lexer, parser and AST, with a textual form that round trips.
2//!
3//! Rank 1 in the layer rule. See `xtask/layers.toml` and `spec/18-package-layout.md`.
4//!
5//! The grammar under `grammar/` is DuckDB's own, vendored verbatim and checked by
6//! `cargo xtask grammar`. Everything derived from it lands in `generated` and is written by
7//! `cargo xtask gen-grammar`. `spec/20-the-grammar.md` is the argument for doing it that way and
8//! the list of what it does and does not buy.
9
10#![forbid(unsafe_code)]
11
12pub mod ast;
13#[cfg(test)]
14mod corpus;
15pub mod generated;
16pub mod matcher;
17pub mod rules;
18pub mod token;
19pub mod tokenize;
20pub mod transform;
21
22pub use ast::Ast;
23pub use generated::keywords::{
24    COLUMN_NAME, FUNC_NAME, KEYWORDS, LONGEST, RESERVED, TYPE_NAME, UNRESERVED,
25};
26pub use matcher::{NONE, ParseNode, Tree, parse, parse_from, parse_tokens};
27pub use rules::{Node, Op, Rule, Suggestion, can_start, rule, token_key};
28pub use token::{Flags, Kind, NOT_A_KEYWORD, Token};
29pub use tokenize::{classes, lookup, tokenize};
30pub use transform::{parse_ast, transform};