Expand description
surql-parser — Standalone SurrealQL parser extracted from SurrealDB.
Provides a complete SurrealQL parser without depending on the SurrealDB engine. Useful for building tools, linters, formatters, IDE extensions, and migration systems.
§Quick Start
let ast = surql_parser::parse("SELECT name, age FROM user WHERE age > 18").unwrap();
assert!(!ast.expressions.is_empty());§Sync with SurrealDB
Parser source is auto-extracted from SurrealDB via tools/transform/.
See UPSTREAM_SYNC.md for details.
Re-exports§
pub use upstream::sql::Ast;pub use upstream::sql::expression::Expr;pub use upstream::syn::ParserSettings;pub use upstream::sql::Kind;pub use upstream::sql::Idiom;pub use upstream::sql::statements;pub use upstream::syn::error;
Modules§
- compat
- Compatibility stubs for types referenced by the upstream parser code.
- config
- Configuration constants for the parser.
- upstream
- Auto-generated from SurrealDB source. DO NOT EDIT MANUALLY.
Structs§
Functions§
- extract_
definitions - Extract all DEFINE statements from a SurrealQL string.
- format
- Format an AST back to SurrealQL string.
- is_
reserved_ keyword - Check if a string could be a reserved keyword in certain contexts.
- list_
functions - List all function names defined in a SurrealQL string.
- list_
tables - List all table names defined in a SurrealQL string.
- parse
- Parse a SurrealQL query string into an AST.
- parse_
kind - Parse a SurrealQL type annotation (e.g.,
record<user>,option<string>). - parse_
with_ settings - Parse a SurrealQL query with custom parser settings.