Rule

Enum Rule 

Source
pub enum Rule {
Show 95 variants EOI, WHITESPACE, NEWLINE, COMMENT, sql, statement, compound_select, union_clause, select_stmt, insert_stmt, update_stmt, delete_stmt, column_list, value_rows, value_row, set_list, set_item, distinct, projection, projection_list, projection_item, from_item, table_factor, join_clause, where_clause, group_by_clause, having_clause, order_by_clause, limit_clause, order_list, order_item, identifier_list, expr_list, expr, or_expr, and_expr, not_expr, comparison, comparison_suffix, in_rhs, comp_op, addition, multiplication, unary, primary, function_call, column, literal, boolean, number, string, alias, alias_identifier, identifier, RESERVED_KEYWORD, SELECT_KEY, FROM_KEY, WHERE_KEY, GROUP_KEY, BY_KEY, HAVING_KEY, ORDER_KEY, LIMIT_KEY, AS_KEY, JOIN_KEY, INNER_KEY, LEFT_KEY, RIGHT_KEY, FULL_KEY, USING_KEY, ON_KEY, DISTINCT_KEY, ASC_KEY, DESC_KEY, AND_KEY, OR_KEY, NOT_KEY, LIKE_KEY, TRUE_KEY, FALSE_KEY, NULL_KEY, INSERT_KEY, INTO_KEY, VALUES_KEY, UPDATE_KEY, SET_KEY, DELETE_KEY, UNION_KEY, ALL_KEY, BETWEEN_KEY, IN_KEY, IS_KEY, JOIN_TYPE, OUTER_KEY, SPACE,
}

Variants§

§

EOI

End-of-input

§

WHITESPACE

Whitespace characters including spaces, tabs, newlines, and comments

§

NEWLINE

Newline characters (Unix and Windows style)

§

COMMENT

SQL comments starting with –

§

sql

Root rule for SQL parsing - starts and ends with input boundaries

§

statement

SQL statement types (SELECT, INSERT, UPDATE, DELETE)

§

compound_select

Compound SELECT with UNION support

§

union_clause

UNION clause for combining SELECT statements

§

select_stmt

SELECT statement with optional FROM, JOIN, and WHERE clauses

§

insert_stmt

INSERT statement

§

update_stmt

UPDATE statement with optional WHERE clause

§

delete_stmt

DELETE statement with optional WHERE clause

§

column_list

List of columns in parentheses

§

value_rows

Multiple rows of values for INSERT statements

§

value_row

Single row of values

§

set_list

List of column assignments for UPDATE statements

§

set_item

Single column assignment (column = value)

§

distinct

DISTINCT keyword

§

projection

SELECT projection (* or column list)

§

projection_list

List of projected columns/expressions

§

projection_item

Single projected item with optional alias

§

from_item

FROM clause item (table or subquery)

§

table_factor

Table reference with optional alias

§

join_clause

JOIN clause with ON condition

§

where_clause

WHERE clause with boolean expression

§

group_by_clause

GROUP BY clause

§

having_clause

HAVING clause with boolean expression

§

order_by_clause

ORDER BY clause

§

limit_clause

LIMIT clause with number

§

order_list

List of ordering expressions

§

order_item

Single ordering expression with optional direction

§

identifier_list

List of identifiers separated by commas

§

expr_list

List of expressions separated by commas

§

expr

Root expression rule

§

or_expr

OR expression (left-associative)

§

and_expr

AND expression (left-associative)

§

not_expr

NOT expression (optional NOT prefix)

§

comparison

Comparison expression with optional comparison operators

§

comparison_suffix

Comparison operators and special constructs (BETWEEN, IN, IS NULL)

§

in_rhs

Right-hand side of IN operator (subquery or expression list)

§

comp_op

Comparison operators (=, <>, !=, <=, >=, <, >, LIKE, NOT LIKE)

§

addition

Addition and subtraction (left-associative)

§

multiplication

Multiplication and division (left-associative)

§

unary

Unary plus/minus operators

§

primary

Primary expression elements (literals, functions, columns, subexpressions)

§

function_call

Function call with optional arguments

§

column

Column reference (table.column or just column)

§

literal

Literal values (numbers, strings, NULL, booleans)

§

boolean

Boolean literals (TRUE, FALSE)

§

number

Numeric literals with optional decimal part

§

string

String literals in single quotes with escape sequences

§

alias

Table or column alias

§

alias_identifier

Alias identifier (cannot be reserved keyword)

§

identifier

General identifier (letters, digits, underscore, dollar sign)

§

RESERVED_KEYWORD

Reserved SQL keywords that cannot be used as identifiers

§

SELECT_KEY

SQL Keywords (case-insensitive) SELECT keyword

§

FROM_KEY

FROM keyword

§

WHERE_KEY

WHERE keyword

§

GROUP_KEY

GROUP keyword

§

BY_KEY

BY keyword

§

HAVING_KEY

HAVING keyword

§

ORDER_KEY

ORDER keyword

§

LIMIT_KEY

LIMIT keyword

§

AS_KEY

AS keyword

§

JOIN_KEY

JOIN keyword

§

INNER_KEY

INNER keyword

§

LEFT_KEY

LEFT keyword

§

RIGHT_KEY

RIGHT keyword

§

FULL_KEY

FULL keyword

§

USING_KEY

USING keyword

§

ON_KEY

ON keyword

§

DISTINCT_KEY

DISTINCT keyword

§

ASC_KEY

ASC keyword

§

DESC_KEY

DESC keyword

§

AND_KEY

AND keyword

§

OR_KEY

OR keyword

§

NOT_KEY

NOT keyword

§

LIKE_KEY

LIKE keyword

§

TRUE_KEY

TRUE keyword

§

FALSE_KEY

FALSE keyword

§

NULL_KEY

NULL keyword

§

INSERT_KEY

INSERT keyword

§

INTO_KEY

INTO keyword

§

VALUES_KEY

VALUES keyword

§

UPDATE_KEY

UPDATE keyword

§

SET_KEY

SET keyword

§

DELETE_KEY

DELETE keyword

§

UNION_KEY

UNION keyword

§

ALL_KEY

ALL keyword

§

BETWEEN_KEY

BETWEEN keyword

§

IN_KEY

IN keyword

§

IS_KEY

IS keyword

§

JOIN_TYPE

JOIN type keywords (INNER, LEFT [OUTER], RIGHT, FULL)

§

OUTER_KEY

OUTER keyword

§

SPACE

Single space character

Implementations§

Source§

impl Rule

Source

pub fn all_rules() -> &'static [Rule]

Trait Implementations§

Source§

impl Clone for Rule

Source§

fn clone(&self) -> Rule

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Rule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Rule

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Rule

Source§

fn cmp(&self, other: &Rule) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl Parser<Rule> for SqlParser

Source§

fn parse<'i>(rule: Rule, input: &'i str) -> Result<Pairs<'i, Rule>, Error<Rule>>

Parses a &str starting from rule.
Source§

impl PartialEq for Rule

Source§

fn eq(&self, other: &Rule) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Rule

Source§

fn partial_cmp(&self, other: &Rule) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Rule

Source§

impl Eq for Rule

Source§

impl StructuralPartialEq for Rule

Auto Trait Implementations§

§

impl Freeze for Rule

§

impl RefUnwindSafe for Rule

§

impl Send for Rule

§

impl Sync for Rule

§

impl Unpin for Rule

§

impl UnwindSafe for Rule

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> RuleType for T
where T: Copy + Debug + Eq + Hash + Ord,