pub struct TsqlGrammar;Expand description
TSQL grammar — extends ANSI with SQL Server–specific statements.
Trait Implementations§
Source§impl Grammar for TsqlGrammar
impl Grammar for TsqlGrammar
Source§fn parse_table_hint(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_table_hint(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
TSQL table hints: WITH(NOLOCK), WITH(READUNCOMMITTED), etc.
Source§fn consume_until_end(
&self,
ctx: &mut ParseContext<'_>,
children: &mut Vec<Segment>,
)
fn consume_until_end( &self, ctx: &mut ParseContext<'_>, children: &mut Vec<Segment>, )
TSQL override: additionally tracks BEGIN/END block depth and stops at GO batch separators.
Source§fn statement_keywords(&self) -> &[&str]
fn statement_keywords(&self) -> &[&str]
Return the set of keywords that can start a statement in this dialect.
Source§fn dispatch_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn dispatch_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Dispatch a single statement based on the current token.
Called from
parse_statement after consuming leading trivia.Source§fn dispatch_ansi_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn dispatch_ansi_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
ANSI-only statement dispatch. Dialect impls can call this as fallback.
Source§fn parse_file(&self, ctx: &mut ParseContext<'_>) -> Segment
fn parse_file(&self, ctx: &mut ParseContext<'_>) -> Segment
Parse a complete SQL file: zero or more statements.
Source§fn parse_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Parse a single statement (terminated by
; or EOF).fn parse_select_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_select_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_select_target(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_from_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_table_reference(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Source§fn parse_table_reference_core(
&self,
ctx: &mut ParseContext<'_>,
) -> Option<Segment>
fn parse_table_reference_core( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>
Core table reference parsing (name/subquery + optional alias),
without table hints. Called by
parse_table_reference.fn parse_where_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_group_by_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_having_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_order_by_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_order_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_limit_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_offset_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_with_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_cte_definition(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_set_operation(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_join_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_insert_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_values_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_update_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_set_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_delete_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_create_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_create_table_body( &self, ctx: &mut ParseContext<'_>, children: Vec<Segment>, ) -> Option<Segment>
fn parse_drop_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_alter_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Source§fn parse_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Parse an expression. This uses a simple precedence climbing approach.
fn parse_or_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_and_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_not_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_comparison_expression( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>
fn parse_addition_expression( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>
fn parse_multiplication_expression( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>
fn parse_unary_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_primary_expression( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>
fn parse_paren_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_paren_subquery(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_case_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_when_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_exists_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_cast_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_data_type(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_identifier(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Source§fn parse_qualified_name(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_qualified_name(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Parse a possibly qualified name: a, a.b, a.b.c
fn parse_name_or_function(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Source§fn parse_over_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_over_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Parse OVER clause:
OVER (PARTITION BY ... ORDER BY ... ROWS/RANGE ...)
or OVER window_nameSource§fn parse_partition_by_clause(
&self,
ctx: &mut ParseContext<'_>,
) -> Option<Segment>
fn parse_partition_by_clause( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>
Parse PARTITION BY expr, expr, …
Source§fn parse_window_order_by(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_window_order_by(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Parse ORDER BY inside a window spec (reuses expression parsing).
Source§fn parse_window_frame_clause(
&self,
ctx: &mut ParseContext<'_>,
) -> Option<Segment>
fn parse_window_frame_clause( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>
Parse window frame: ROWS/RANGE/GROUPS frame_spec
Source§fn parse_simple_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_simple_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Parse a simple statement (USE, TRUNCATE, etc.) by consuming until end.
Source§fn peek_statement_start(&self, ctx: &ParseContext<'_>) -> bool
fn peek_statement_start(&self, ctx: &ParseContext<'_>) -> bool
Check if current token looks like the start of a new statement.
Source§fn consume_until_statement_end(
&self,
ctx: &mut ParseContext<'_>,
children: &mut Vec<Segment>,
)
fn consume_until_statement_end( &self, ctx: &mut ParseContext<'_>, children: &mut Vec<Segment>, )
Consume tokens until semicolon, EOF, or start of new statement.
Consume tokens until semicolon, EOF, or start of a new statement.
Tracks paren depth so that keywords inside subqueries (e.g.
SELECT
within (SELECT ...)) do not cause premature termination.Source§fn parse_paren_block(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
fn parse_paren_block(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>
Parse parenthesized content as a simple block.
Auto Trait Implementations§
impl Freeze for TsqlGrammar
impl RefUnwindSafe for TsqlGrammar
impl Send for TsqlGrammar
impl Sync for TsqlGrammar
impl Unpin for TsqlGrammar
impl UnsafeUnpin for TsqlGrammar
impl UnwindSafe for TsqlGrammar
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
Mutably borrows from an owned value. Read more