Skip to main content

TsqlGrammar

Struct TsqlGrammar 

Source
pub struct TsqlGrammar;
Expand description

TSQL grammar — extends ANSI with SQL Server–specific statements.

Trait Implementations§

Source§

impl Grammar for TsqlGrammar

Source§

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>, )

TSQL override: additionally tracks BEGIN/END block depth and stops at GO batch separators.

Source§

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>

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>

ANSI-only statement dispatch. Dialect impls can call this as fallback.
Source§

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>

Parse a single statement (terminated by ; or EOF).
Source§

fn parse_select_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_select_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_select_target(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_from_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_table_reference(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

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

fn parse_where_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_group_by_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_having_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_order_by_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_order_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_limit_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_offset_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_with_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_cte_definition(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_set_operation(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_join_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_insert_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_values_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_update_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_set_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_delete_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_create_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_create_table_body( &self, ctx: &mut ParseContext<'_>, children: Vec<Segment>, ) -> Option<Segment>

Source§

fn parse_drop_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_alter_statement(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Parse an expression. This uses a simple precedence climbing approach.
Source§

fn parse_or_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_and_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_not_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_comparison_expression( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>

Source§

fn parse_addition_expression( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>

Source§

fn parse_multiplication_expression( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>

Source§

fn parse_unary_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_primary_expression( &self, ctx: &mut ParseContext<'_>, ) -> Option<Segment>

Source§

fn parse_paren_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_paren_subquery(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_case_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_when_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_exists_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_cast_expression(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_data_type(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_identifier(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_qualified_name(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Parse a possibly qualified name: a, a.b, a.b.c
Source§

fn parse_name_or_function(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Source§

fn parse_over_clause(&self, ctx: &mut ParseContext<'_>) -> Option<Segment>

Parse OVER clause: OVER (PARTITION BY ... ORDER BY ... ROWS/RANGE ...) or OVER window_name
Source§

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>

Parse ORDER BY inside a window spec (reuses expression parsing).
Source§

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>

Parse a simple statement (USE, TRUNCATE, etc.) by consuming until end.
Source§

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>, )

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>

Parse parenthesized content as a simple block.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.