Skip to main content

Crate surql_parser

Crate surql_parser 

Source
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§

SchemaDefinitions

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.