Skip to main content

hawdb_sql_syntax/
lib.rs

1// Copyright 2026 Nowledge
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! In-progress HawDB-owned PostgreSQL SQL/PGQ syntax frontend.
16//!
17//! This crate owns tokens, byte spans, structured syntax errors, and syntax ASTs.
18//! Semantic binding and logical-plan lowering belong to `hawdb-sql`.
19//!
20//! This frontend is not yet selected by `Database::query_sql*`; the existing
21//! relational execution path still uses upstream `sqlparser`. Syntax acceptance
22//! alone does not qualify a statement family for production execution.
23//!
24//! The [SQL/PGQ specification] defines the compatibility contract. The
25//! [implementation and routing checklist] tracks the remaining parser/binder
26//! differential coverage, catalog durability, and shared query-pipeline
27//! qualification required before enabling production routing. Parser selection
28//! must be explicit by statement family, never a retry after another parser fails.
29//!
30//! [SQL/PGQ specification]: https://github.com/nowledge-co/hawdb/blob/main/docs/specs/POSTGRES_SQL_PGQ_SPEC.md
31//! [implementation and routing checklist]: https://github.com/nowledge-co/hawdb/blob/main/TODO.md#p1-postgresql-sqlpgq-compatibility
32
33mod ast;
34mod error;
35mod lexer;
36mod parser;
37mod span;
38mod token;
39
40pub use ast::*;
41pub use error::{SyntaxError, SyntaxErrorCode};
42pub use lexer::{tokenize, tokenize_with_config, LexerConfig};
43pub use parser::{
44    parse_graph_table, parse_pgq_statement, parse_postgres_select, parse_postgres_statement,
45};
46pub use span::Span;
47pub use token::{Token, TokenKind};