pub struct Parser<'a> { /* private fields */ }Expand description
RQL Parser
Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_grant_statement(&mut self) -> Result<GrantStmt, ParseError>
pub fn parse_grant_statement(&mut self) -> Result<GrantStmt, ParseError>
Parse a GRANT statement. Caller must have already verified the
current token is the GRANT ident (it is not a lexer keyword —
the lexer maps it to Token::Ident("GRANT")).
Sourcepub fn parse_revoke_statement(&mut self) -> Result<RevokeStmt, ParseError>
pub fn parse_revoke_statement(&mut self) -> Result<RevokeStmt, ParseError>
Parse a REVOKE statement. Caller must have already verified the
current token is the REVOKE ident.
Sourcepub fn parse_alter_user_statement(
&mut self,
) -> Result<AlterUserStmt, ParseError>
pub fn parse_alter_user_statement( &mut self, ) -> Result<AlterUserStmt, ParseError>
Parse ALTER USER name <attrs>. Caller has just consumed
Token::Alter.
Sourcepub fn parse_create_iam_policy_after_keywords(
&mut self,
) -> Result<QueryExpr, ParseError>
pub fn parse_create_iam_policy_after_keywords( &mut self, ) -> Result<QueryExpr, ParseError>
Parse CREATE POLICY '<id>' AS '<json>'. Caller has consumed
CREATE POLICY already and confirmed the next token is a
string literal (the IAM-flavoured form). Returns the
QueryExpr::CreateIamPolicy variant.
Sourcepub fn parse_drop_iam_policy_after_keywords(
&mut self,
) -> Result<QueryExpr, ParseError>
pub fn parse_drop_iam_policy_after_keywords( &mut self, ) -> Result<QueryExpr, ParseError>
Parse DROP POLICY '<id>'. Caller has consumed DROP POLICY
and verified the next token is a string literal.
Sourcepub fn parse_attach_policy(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_attach_policy(&mut self) -> Result<QueryExpr, ParseError>
Parse ATTACH POLICY '<id>' TO { USER | GROUP } <name>.
Caller has consumed nothing — leading ATTACH is still on
the token stream.
Sourcepub fn parse_detach_policy(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_detach_policy(&mut self) -> Result<QueryExpr, ParseError>
Parse DETACH POLICY '<id>' FROM { USER | GROUP } <name>.
Sourcepub fn parse_simulate_policy(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_simulate_policy(&mut self) -> Result<QueryExpr, ParseError>
Parse SIMULATE <name> ACTION <verb> ON <kind>:<name>.
Sourcepub fn parse_show_iam_after_show(
&mut self,
) -> Result<Option<QueryExpr>, ParseError>
pub fn parse_show_iam_after_show( &mut self, ) -> Result<Option<QueryExpr>, ParseError>
Parse SHOW POLICIES [FOR USER <name> | FOR GROUP <name>] or
SHOW EFFECTIVE PERMISSIONS FOR <name> [ON <kind>:<name>].
Caller has just consumed SHOW.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
pub fn parse_config_command(&mut self) -> Result<QueryExpr, ParseError>
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_with_cte(&mut self) -> Result<QueryWithCte, ParseError>
pub fn parse_with_cte(&mut self) -> Result<QueryWithCte, ParseError>
Parse a complete query with optional WITH clause
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_create_table_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_table_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: CREATE TABLE [IF NOT EXISTS] name (col1 TYPE [modifiers], …)
Sourcepub fn parse_drop_table_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_table_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: DROP TABLE [IF EXISTS] name
Sourcepub fn parse_create_table_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_table_body(&mut self) -> Result<QueryExpr, ParseError>
Parse the body of CREATE TABLE after CREATE TABLE has been consumed
Sourcepub fn parse_explain_alter_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_explain_alter_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: EXPLAIN ALTER FOR CREATE TABLE name (…) [FORMAT JSON|SQL]
Pure read: does not execute DDL. Returns a schema-diff rendering of the difference between the table’s current contract and the target CREATE TABLE body.
Sourcepub fn parse_drop_table_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_table_body(&mut self) -> Result<QueryExpr, ParseError>
Parse the body of DROP TABLE after DROP TABLE has been consumed
pub fn parse_drop_graph_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_vector_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_document_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_keyed_body( &mut self, model: CollectionModel, ) -> Result<QueryExpr, ParseError>
pub fn parse_drop_keyed_body( &mut self, model: CollectionModel, ) -> Result<QueryExpr, ParseError>
pub fn parse_drop_kv_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_collection_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_truncate_body( &mut self, model: Option<CollectionModel>, ) -> Result<QueryExpr, ParseError>
Sourcepub fn parse_alter_table_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_alter_table_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: ALTER TABLE name ADD/DROP/RENAME COLUMN …
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_insert_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_insert_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: INSERT INTO table [NODE|EDGE|VECTOR|DOCUMENT|KV] (col1, col2) VALUES (val1, val2), (val3, val4) [RETURNING]
Sourcepub fn parse_with_clauses(
&mut self,
) -> Result<(Option<u64>, Option<u64>, Vec<(String, Value)>, Option<AutoEmbedConfig>), ParseError>
pub fn parse_with_clauses( &mut self, ) -> Result<(Option<u64>, Option<u64>, Vec<(String, Value)>, Option<AutoEmbedConfig>), ParseError>
Parse WITH clauses: WITH TTL | EXPIRES AT | METADATA | AUTO EMBED Returns (ttl_ms, expires_at_ms, metadata, auto_embed)
Sourcepub fn parse_update_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_update_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: UPDATE table SET col1=val1, col2=val2 [WHERE filter] [WITH TTL|EXPIRES AT|METADATA]
Sourcepub fn parse_delete_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_delete_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: DELETE FROM table [WHERE filter]
Sourcepub fn parse_ask_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_ask_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: ASK ‘question’ [USING provider] [MODEL ‘model’] [DEPTH n] [LIMIT n] [COLLECTION col]
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_expr(&mut self) -> Result<Expr, ParseError>
pub fn parse_expr(&mut self) -> Result<Expr, ParseError>
Parse a complete expression at the lowest precedence level.
Entry point for every caller that wants an Expr tree.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_filter(&mut self) -> Result<Filter, ParseError>
pub fn parse_filter(&mut self) -> Result<Filter, ParseError>
Parse a filter expression (WHERE condition)
Sourcepub fn parse_field_ref(&mut self) -> Result<FieldRef, ParseError>
pub fn parse_field_ref(&mut self) -> Result<FieldRef, ParseError>
Parse field reference (table.column or just column)
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_match_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_match_query(&mut self) -> Result<QueryExpr, ParseError>
Parse MATCH … RETURN query
Sourcepub fn parse_graph_pattern(&mut self) -> Result<GraphPattern, ParseError>
pub fn parse_graph_pattern(&mut self) -> Result<GraphPattern, ParseError>
Parse graph pattern: (a)-[r]->(b)
Sourcepub fn parse_node_pattern(&mut self) -> Result<NodePattern, ParseError>
pub fn parse_node_pattern(&mut self) -> Result<NodePattern, ParseError>
Parse node pattern: (alias:Type {props})
Sourcepub fn parse_property_filters(
&mut self,
) -> Result<Vec<PropertyFilter>, ParseError>
pub fn parse_property_filters( &mut self, ) -> Result<Vec<PropertyFilter>, ParseError>
Parse property filters in braces: {name: ‘value’, age: 25}
Sourcepub fn parse_return_list(&mut self) -> Result<Vec<Projection>, ParseError>
pub fn parse_return_list(&mut self) -> Result<Vec<Projection>, ParseError>
Parse RETURN list
Sourcepub fn parse_node_label(&self, name: &str) -> Result<String, ParseError>
pub fn parse_node_label(&self, name: &str) -> Result<String, ParseError>
Normalize a parsed node-type token to its label-string form. The
pentest-flavoured aliases (VULN, TECH, CERT) are kept so
existing query strings continue to parse, but the result is just
the canonical lowercase label and is no longer constrained to a
closed enum.
Sourcepub fn parse_edge_label(&self, name: &str) -> Result<String, ParseError>
pub fn parse_edge_label(&self, name: &str) -> Result<String, ParseError>
Edge label counterpart to [parse_node_label].
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_graph_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_graph_command(&mut self) -> Result<QueryExpr, ParseError>
Parse: GRAPH subcommand …
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_hybrid_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_hybrid_query(&mut self) -> Result<QueryExpr, ParseError>
Parse HYBRID query combining structured and vector search
Syntax:
HYBRID
FROM table [WHERE ...] | MATCH pattern [WHERE ...]
VECTOR SEARCH collection
SIMILAR TO ...
FUSION RERANK(weight) | FILTER_THEN_SEARCH | SEARCH_THEN_FILTER | RRF(k) | INTERSECTION | UNION(sw, vw)
[LIMIT n]Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_create_index_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_index_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: CREATE [UNIQUE] INDEX [IF NOT EXISTS] name ON table (col1, …) [USING method]
Called after Token::Create has been consumed and we’ve peeked Token::Index
or Token::Unique.
Sourcepub fn parse_drop_index_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_index_query(&mut self) -> Result<QueryExpr, ParseError>
Parse: DROP INDEX [IF EXISTS] name ON table
Called after Token::Drop has been consumed and we’ve peeked Token::Index.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_from_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_from_query(&mut self) -> Result<QueryExpr, ParseError>
Parse FROM … JOIN (GRAPH / PATH / TABLE / VECTOR / HYBRID) query
Sourcepub fn is_join_keyword(&self) -> bool
pub fn is_join_keyword(&self) -> bool
Check if current token is a join keyword
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_kv_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_kv_command(&mut self) -> Result<QueryExpr, ParseError>
Parse KV <verb> … (called after the leading KV token is consumed).
Sourcepub fn parse_vault_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_vault_command(&mut self) -> Result<QueryExpr, ParseError>
Parse VAULT <verb> … (called before consuming the leading identifier).
Sourcepub fn parse_unseal_vault_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_unseal_vault_command(&mut self) -> Result<QueryExpr, ParseError>
Parse UNSEAL VAULT <collection.key>.
Sourcepub fn parse_vault_lifecycle_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_vault_lifecycle_command(&mut self) -> Result<QueryExpr, ParseError>
Parse top-level ROTATE/HISTORY/DELETE/PURGE VAULT <collection.key>.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_create_migration_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_migration_body(&mut self) -> Result<QueryExpr, ParseError>
Parse: CREATE MIGRATION name [DEPENDS ON dep1, dep2] [BATCH n ROWS] [NO ROLLBACK] body_sql
Called after CREATE has been consumed and MIGRATION ident detected.
Sourcepub fn parse_apply_migration(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_apply_migration(&mut self) -> Result<QueryExpr, ParseError>
Parse: APPLY MIGRATION name | APPLY MIGRATION * [FOR TENANT id]
Sourcepub fn parse_rollback_migration_after_keyword(
&mut self,
) -> Result<QueryExpr, ParseError>
pub fn parse_rollback_migration_after_keyword( &mut self, ) -> Result<QueryExpr, ParseError>
Parse: ROLLBACK MIGRATION name (called after ROLLBACK is consumed)
Sourcepub fn parse_explain_migration_after_keyword(
&mut self,
) -> Result<QueryExpr, ParseError>
pub fn parse_explain_migration_after_keyword( &mut self, ) -> Result<QueryExpr, ParseError>
Parse: EXPLAIN MIGRATION name (called after EXPLAIN is consumed)
Sourcepub fn collect_remaining_input(&mut self) -> String
pub fn collect_remaining_input(&mut self) -> String
Collect all remaining tokens into a single string (joined with spaces). Used to capture the raw SQL body of a migration.
Sourcepub fn expect_string_or_ident(&mut self) -> Result<String, ParseError>
pub fn expect_string_or_ident(&mut self) -> Result<String, ParseError>
Try to consume a bare identifier or a single-quoted string literal.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_path_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_path_query(&mut self) -> Result<QueryExpr, ParseError>
Parse PATH FROM … TO … query
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_hll_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_hll_command(&mut self) -> Result<QueryExpr, ParseError>
Parse HLL subcommand: HLL ADD|COUNT|MERGE|INFO name …
Sourcepub fn parse_sketch_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_sketch_command(&mut self) -> Result<QueryExpr, ParseError>
Parse SKETCH subcommand: SKETCH ADD|COUNT|MERGE|INFO name …
Sourcepub fn parse_filter_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_filter_command(&mut self) -> Result<QueryExpr, ParseError>
Parse FILTER subcommand: FILTER ADD|CHECK|DELETE|COUNT|INFO name …
Sourcepub fn parse_create_probabilistic(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_probabilistic(&mut self) -> Result<QueryExpr, ParseError>
Parse CREATE HLL|SKETCH|FILTER … (called after CREATE has been consumed)
Sourcepub fn parse_drop_probabilistic(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_probabilistic(&mut self) -> Result<QueryExpr, ParseError>
Parse DROP HLL|SKETCH|FILTER … (called after DROP has been consumed)
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_create_queue_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_queue_body(&mut self) -> Result<QueryExpr, ParseError>
Parse CREATE QUEUE body (after CREATE QUEUE consumed)
Sourcepub fn parse_alter_queue_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_alter_queue_body(&mut self) -> Result<QueryExpr, ParseError>
Parse ALTER QUEUE body (after ALTER QUEUE consumed)
Sourcepub fn parse_drop_queue_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_queue_body(&mut self) -> Result<QueryExpr, ParseError>
Parse DROP QUEUE body (after DROP QUEUE consumed)
Sourcepub fn parse_queue_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_queue_command(&mut self) -> Result<QueryExpr, ParseError>
Parse QUEUE subcommand (after QUEUE token consumed)
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_search_command(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_search_command(&mut self) -> Result<QueryExpr, ParseError>
Parse: SEARCH subcommand …
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_select_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_select_query(&mut self) -> Result<QueryExpr, ParseError>
Parse SELECT … FROM … query
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn is_clause_keyword(&self) -> bool
pub fn is_clause_keyword(&self) -> bool
Check if current identifier is a clause keyword
Sourcepub fn parse_projection_list(&mut self) -> Result<Vec<Projection>, ParseError>
pub fn parse_projection_list(&mut self) -> Result<Vec<Projection>, ParseError>
Parse projection list (column selections)
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_table_clauses(
&mut self,
query: &mut TableQuery,
) -> Result<(), ParseError>
pub fn parse_table_clauses( &mut self, query: &mut TableQuery, ) -> Result<(), ParseError>
Parse table query clauses (AS OF, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, OFFSET)
Sourcepub fn parse_group_by_list(&mut self) -> Result<Vec<String>, ParseError>
pub fn parse_group_by_list(&mut self) -> Result<Vec<String>, ParseError>
Parse GROUP BY field list
Sourcepub fn parse_order_by_list(&mut self) -> Result<Vec<OrderByClause>, ParseError>
pub fn parse_order_by_list(&mut self) -> Result<Vec<OrderByClause>, ParseError>
Parse ORDER BY list.
Fase 1.6 unlock: uses the new Expr Pratt parser so
ORDER BY CAST(age AS INT), ORDER BY a + b * 2,
ORDER BY last_seen - created_at all parse cleanly. If the
parsed expression is a bare Column, we store it in the
legacy field slot and leave expr None so downstream
consumers (planner cost, mode translators) keep using the
fast path. Otherwise we stash the full tree in expr and
populate field with a synthetic marker that runtime code
never touches.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_create_timeseries_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_timeseries_body(&mut self) -> Result<QueryExpr, ParseError>
Parse CREATE TIMESERIES body (after CREATE TIMESERIES consumed)
Sourcepub fn parse_create_hypertable_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_create_hypertable_body(&mut self) -> Result<QueryExpr, ParseError>
Parse CREATE HYPERTABLE body — TimescaleDB-style.
CREATE HYPERTABLE metrics TIME_COLUMN ts CHUNK_INTERVAL ‘1d’ [TTL ‘90d’] [RETENTION 90 DAYS] – collection-level TTL (ms)
Produces the same CreateTimeSeriesQuery AST as CREATE TIMESERIES, with the hypertable field populated. The
runtime dispatcher registers the spec on the RedDB-wide
HypertableRegistry alongside creating the collection.
Sourcepub fn parse_drop_timeseries_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_timeseries_body(&mut self) -> Result<QueryExpr, ParseError>
Parse DROP TIMESERIES body (after DROP TIMESERIES consumed)
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
pub fn parse_create_tree_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_drop_tree_body(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_tree_command(&mut self) -> Result<QueryExpr, ParseError>
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_vector_query(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_vector_query(&mut self) -> Result<QueryExpr, ParseError>
Parse VECTOR SEARCH … SIMILAR TO … query
Syntax:
VECTOR SEARCH collection
SIMILAR TO [0.1, 0.2, ...] | 'text query' | (subquery)
[WHERE metadata conditions]
[METRIC L2|COSINE|INNER_PRODUCT]
[THRESHOLD 0.5]
[INCLUDE VECTORS] [INCLUDE METADATA]
[LIMIT k]Sourcepub fn parse_vector_source(&mut self) -> Result<VectorSource, ParseError>
pub fn parse_vector_source(&mut self) -> Result<VectorSource, ParseError>
Parse vector source: literal array, text, reference, or subquery
Sourcepub fn parse_metadata_filter(&mut self) -> Result<MetadataFilter, ParseError>
pub fn parse_metadata_filter(&mut self) -> Result<MetadataFilter, ParseError>
Parse metadata filter for vector queries
Sourcepub fn parse_distance_metric(&mut self) -> Result<DistanceMetric, ParseError>
pub fn parse_distance_metric(&mut self) -> Result<DistanceMetric, ParseError>
Parse distance metric
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn new(input: &'a str) -> Result<Self, ParseError>
pub fn new(input: &'a str) -> Result<Self, ParseError>
Create a new parser with default DoS limits.
Sourcepub fn with_limits(
input: &'a str,
limits: ParserLimits,
) -> Result<Self, ParseError>
pub fn with_limits( input: &'a str, limits: ParserLimits, ) -> Result<Self, ParseError>
Create a new parser with custom DoS limits.
Sourcepub fn advance(&mut self) -> Result<Token, ParseError>
pub fn advance(&mut self) -> Result<Token, ParseError>
Advance to next token
Sourcepub fn peek_next(&mut self) -> Result<&Token, ParseError>
pub fn peek_next(&mut self) -> Result<&Token, ParseError>
Peek one token past the current parser position without consuming it.
Sourcepub fn check_keyword(&self, keyword: &Token) -> bool
pub fn check_keyword(&self, keyword: &Token) -> bool
Check if current token is a specific keyword
Sourcepub fn expect(&mut self, expected: Token) -> Result<Token, ParseError>
pub fn expect(&mut self, expected: Token) -> Result<Token, ParseError>
Consume a specific token or error
Sourcepub fn expect_ident(&mut self) -> Result<String, ParseError>
pub fn expect_ident(&mut self) -> Result<String, ParseError>
Consume an identifier and return its value
Sourcepub fn expect_ident_or_keyword(&mut self) -> Result<String, ParseError>
pub fn expect_ident_or_keyword(&mut self) -> Result<String, ParseError>
Consume an identifier or keyword (for type names where keywords are valid)
Sourcepub fn consume(&mut self, expected: &Token) -> Result<bool, ParseError>
pub fn consume(&mut self, expected: &Token) -> Result<bool, ParseError>
Try to consume a token, returning true if consumed
Sourcepub fn consume_ident_ci(&mut self, expected: &str) -> Result<bool, ParseError>
pub fn consume_ident_ci(&mut self, expected: &str) -> Result<bool, ParseError>
Try to consume an identifier case-insensitively (for keywords not in Token enum)
Sourcepub fn parse(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse(&mut self) -> Result<QueryExpr, ParseError>
Parse a complete query
Sourcepub fn parse_query_expr(&mut self) -> Result<QueryExpr, ParseError>
pub fn parse_query_expr(&mut self) -> Result<QueryExpr, ParseError>
Parse the main query expression (without CTEs)
Sourcepub fn parse_integer(&mut self) -> Result<i64, ParseError>
pub fn parse_integer(&mut self) -> Result<i64, ParseError>
Parse an integer literal
Sourcepub fn parse_param_slot(
&mut self,
field: &'static str,
) -> Result<usize, ParseError>
pub fn parse_param_slot( &mut self, field: &'static str, ) -> Result<usize, ParseError>
Parse a $N or ? placeholder in a non-Expr slot (e.g. the
LIMIT / MIN_SCORE slots of SEARCH SIMILAR; issue #361). The
field name is used only to enrich placeholder-mixing errors.
Returns the 0-based parameter index.
Sourcepub fn parse_positive_integer(
&mut self,
field: &'static str,
) -> Result<i64, ParseError>
pub fn parse_positive_integer( &mut self, field: &'static str, ) -> Result<i64, ParseError>
Parse a strictly-positive integer literal (> 0).
Surfaces a ValueOutOfRange error for field when the literal
is 0, negative, or starts with a unary - (which the bare
parse_integer rejects with a confusing “expected: integer”
message). Used by modifier slots like MAX_SIZE, CAPACITY,
WIDTH, DEPTH, K where zero or negative values are
semantically meaningless.
Sourcepub fn parse_float(&mut self) -> Result<f64, ParseError>
pub fn parse_float(&mut self) -> Result<f64, ParseError>
Parse float literal. Accepts an optional leading unary -
followed by a Float or Integer token so positions like
vector literals ([-0.1, …]), THRESHOLD -0.5, MIN_SCORE -0.1, RERANK(-0.3), UNION(0.7, -0.3), and geo coordinates
(LATITUDE -33.86) parse correctly. See bug #107.
Sourcepub fn parse_string(&mut self) -> Result<String, ParseError>
pub fn parse_string(&mut self) -> Result<String, ParseError>
Parse a string literal
Sourcepub fn parse_value(&mut self) -> Result<Value, ParseError>
pub fn parse_value(&mut self) -> Result<Value, ParseError>
Parse a value (delegates to parse_literal_value for full JSON support)
Sourcepub fn parse_value_list(&mut self) -> Result<Vec<Value>, ParseError>
pub fn parse_value_list(&mut self) -> Result<Vec<Value>, ParseError>
Parse value list for IN clause
Sourcepub fn parse_expr_value(&mut self) -> Result<Value, ParseError>
pub fn parse_expr_value(&mut self) -> Result<Value, ParseError>
Phase 1 cutover bridge: parse an expression via the new Pratt
parser (parser/expr.rs) and try to fold it back into a
literal Value. Used by INSERT VALUES / UPDATE SET / DEFAULT
slots that still store Value in their AST nodes — the bridge
lets them benefit from the full Expr grammar (parenthesised
literals, unary minus, CAST literals) without an AST cascade.
Folds these Expr shapes:
Expr::Literal { value, .. }→valueExpr::UnaryOp { Neg, operand: Literal(Integer/Float), .. }→ negated valueExpr::Cast { inner: Literal(text), target, .. }→ coerce(text, target) via schema::coerce
Anything else returns an error so callers can decide whether
to fall back to the legacy parse_literal_value path or
surface a “non-literal not supported in this position” error.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_frontend_statement(
&mut self,
) -> Result<FrontendStatement, ParseError>
pub fn parse_frontend_statement( &mut self, ) -> Result<FrontendStatement, ParseError>
Parse any top-level frontend statement through a single shared surface.
Sourcepub fn parse_sql_statement(&mut self) -> Result<SqlStatement, ParseError>
pub fn parse_sql_statement(&mut self) -> Result<SqlStatement, ParseError>
Parse any SQL/RQL-style command into the canonical SQL frontend IR.
Sourcepub fn parse_sql_command(&mut self) -> Result<SqlCommand, ParseError>
pub fn parse_sql_command(&mut self) -> Result<SqlCommand, ParseError>
Parse any SQL/RQL-style command through a single frontend module.
Auto Trait Implementations§
impl<'a> Freeze for Parser<'a>
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnsafeUnpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request