dsl-parse 0.1.0

Facade over sqlparser / pg_query producing a unified SQL Statement representation for duck-sqllsp.
Documentation

dsl-parse

SQL parser facade for duck-sqllsp.

Parses SQL into a unified Statement representation, so the rest of duck-sqllsp never has to care which backend produced it.

Two backends sit behind one API:

  • libpg_query (default) — the real PostgreSQL grammar, via FFI. This is what gives PG-complete syntax coverage: MERGE, FETCH FIRST, ON DELETE SET NULL (col), and the rest.
  • sqlparser — pure Rust, no C toolchain, and the fallback for MySQL / SQLite / MSSQL.
use dsl_parse::{parse, Dialect};

let file = parse("SELECT id FROM users;", Dialect::Postgres);
assert_eq!(file.statements.len(), 1);

split::split_statements slices a document on top-level semicolons before parsing, so one syntax error does not poison the whole file — it handles dollar-quoted bodies, nested block comments, and escapes.

Part of duck-sqllsp, a multi-dialect SQL language server. This crate is usable on its own.

Licensed MIT.