Skip to main content

Crate rudb_parse

Crate rudb_parse 

Source
Expand description

The SQL lexer, parser and AST, with a textual form that round trips.

Rank 1 in the layer rule. See xtask/layers.toml and spec/18-package-layout.md.

The grammar under grammar/ is DuckDB’s own, vendored verbatim and checked by cargo xtask grammar. Everything derived from it lands in generated and is written by cargo xtask gen-grammar. spec/20-the-grammar.md is the argument for doing it that way and the list of what it does and does not buy.

Re-exports§

pub use ast::Ast;
pub use generated::keywords::COLUMN_NAME;
pub use generated::keywords::FUNC_NAME;
pub use generated::keywords::KEYWORDS;
pub use generated::keywords::LONGEST;
pub use generated::keywords::RESERVED;
pub use generated::keywords::TYPE_NAME;
pub use generated::keywords::UNRESERVED;
pub use matcher::NONE;
pub use matcher::ParseNode;
pub use matcher::Tree;
pub use matcher::parse;
pub use matcher::parse_from;
pub use matcher::parse_tokens;
pub use rules::Node;
pub use rules::Op;
pub use rules::Rule;
pub use rules::Suggestion;
pub use rules::can_start;
pub use rules::rule;
pub use rules::token_key;
pub use token::Flags;
pub use token::Kind;
pub use token::NOT_A_KEYWORD;
pub use token::Token;
pub use tokenize::classes;
pub use tokenize::lookup;
pub use tokenize::tokenize;
pub use transform::parse_ast;
pub use transform::transform;

Modules§

ast
rudb’s abstract syntax tree.
generated
Tables derived from the vendored grammar.
matcher
Walking the rule table over a token vector, producing a parse tree.
rules
The shape of the generated rule table, and the filter that reads it.
token
What the tokenizer produces and what the matcher consumes.
tokenize
The tokenizer, matched to DuckDB’s by behaviour.
transform
From the parse tree to the AST.