risingwave_sqlparser::tokenizer

Enum Token

source
pub enum Token {
Show 70 variants EOF, Word(Word), Number(String), Char(char), SingleQuotedString(String), DollarQuotedString(DollarQuotedString), CstyleEscapesString(CstyleEscapedString), NationalStringLiteral(String), HexStringLiteral(String), Parameter(String), Comma, Whitespace(Whitespace), DoubleEq, Eq, Neq, Lt, Gt, LtEq, GtEq, Spaceship, Plus, Minus, Mul, Div, Mod, Concat, LParen, RParen, Period, Colon, DoubleColon, SemiColon, Backslash, LBracket, RBracket, Ampersand, Pipe, Caret, Prefix, LBrace, RBrace, RArrow, Sharp, Tilde, TildeAsterisk, ExclamationMarkTilde, ExclamationMarkTildeAsterisk, DoubleTilde, DoubleTildeAsterisk, ExclamationMarkDoubleTilde, ExclamationMarkDoubleTildeAsterisk, ShiftLeft, ShiftRight, ExclamationMark, DoubleExclamationMark, AtSign, PGSquareRoot, PGCubeRoot, Arrow, LongArrow, HashArrow, HashLongArrow, HashMinus, AtArrow, ArrowAt, QuestionMark, QuestionMarkPipe, QuestionMarkAmpersand, AtQuestionMark, AtAt,
}
Expand description

SQL Token enumeration

Variants§

§

EOF

An end-of-file marker, not a real token

§

Word(Word)

A keyword (like SELECT) or an optionally quoted SQL identifier

§

Number(String)

An unsigned numeric literal

§

Char(char)

A character that could not be tokenized

§

SingleQuotedString(String)

Single quoted string: i.e: ‘string’

§

DollarQuotedString(DollarQuotedString)

Dollar quoted string: i.e: $$string$$ or $tag_name$string$tag_name$

§

CstyleEscapesString(CstyleEscapedString)

Single quoted string with c-style escapes: i.e: E’string’

§

NationalStringLiteral(String)

“National” string literal: i.e: N’string’

§

HexStringLiteral(String)

Hexadecimal string literal: i.e.: X’deadbeef’

§

Parameter(String)

Parameter symbols: i.e: $1, $2

§

Comma

Comma

§

Whitespace(Whitespace)

Whitespace (space, tab, etc)

§

DoubleEq

Double equals sign ==

§

Eq

Equality operator =

§

Neq

Not Equals operator <> (or != in some dialects)

§

Lt

Less Than operator <

§

Gt

Greater Than operator >

§

LtEq

Less Than Or Equals operator <=

§

GtEq

Greater Than Or Equals operator >=

§

Spaceship

Spaceship operator <=>

§

Plus

Plus operator +

§

Minus

Minus operator -

§

Mul

Multiplication operator *

§

Div

Division operator /

§

Mod

Modulo Operator %

§

Concat

String concatenation ||

§

LParen

Left parenthesis (

§

RParen

Right parenthesis )

§

Period

Period (used for compound identifiers or projections into nested types)

§

Colon

Colon :

§

DoubleColon

DoubleColon :: (used for casting in postgresql)

§

SemiColon

SemiColon ; used as separator for COPY and payload

§

Backslash

Backslash \ used in terminating the COPY payload with \.

§

LBracket

Left bracket [

§

RBracket

Right bracket ]

§

Ampersand

Ampersand &

§

Pipe

Pipe |

§

Caret

Caret ^

§

Prefix

Prefix ^@

§

LBrace

Left brace {

§

RBrace

Right brace }

§

RArrow

Right Arrow =>

§

Sharp

Sharp # used for PostgreSQL Bitwise XOR operator

§

Tilde

Tilde ~ used for PostgreSQL Bitwise NOT operator or case sensitive match regular expression operator

§

TildeAsterisk

~* , a case insensitive match regular expression operator in PostgreSQL

§

ExclamationMarkTilde

!~ , a case sensitive not match regular expression operator in PostgreSQL

§

ExclamationMarkTildeAsterisk

!~* , a case insensitive not match regular expression operator in PostgreSQL

§

DoubleTilde

~~, a case sensitive LIKE expression operator in PostgreSQL

§

DoubleTildeAsterisk

~~* , a case insensitive ILIKE regular expression operator in PostgreSQL

§

ExclamationMarkDoubleTilde

!~~ , a case sensitive NOT LIKE regular expression operator in PostgreSQL

§

ExclamationMarkDoubleTildeAsterisk

!~~* , a case insensitive NOT ILIKE regular expression operator in PostgreSQL

§

ShiftLeft

<<, a bitwise shift left operator in PostgreSQL

§

ShiftRight

>>, a bitwise shift right operator in PostgreSQL

§

ExclamationMark

Exclamation Mark ! used for PostgreSQL factorial operator

§

DoubleExclamationMark

Double Exclamation Mark !! used for PostgreSQL prefix factorial operator

§

AtSign

AtSign @ used for PostgreSQL abs operator

§

PGSquareRoot

|/, a square root math operator in PostgreSQL

§

PGCubeRoot

||/ , a cube root math operator in PostgreSQL

§

Arrow

->, access JSON object field or array element in PostgreSQL

§

LongArrow

->>, access JSON object field or array element as text in PostgreSQL

§

HashArrow

#>, extract JSON sub-object at the specified path in PostgreSQL

§

HashLongArrow

#>>, extract JSON sub-object at the specified path as text in PostgreSQL

§

HashMinus

#-, delete a key from a JSON object in PostgreSQL

§

AtArrow

@>, does the left JSON value contain the right JSON path/value entries at the top level

§

ArrowAt

<@, does the right JSON value contain the left JSON path/value entries at the top level

§

QuestionMark

?, does the string exist as a top-level key within the JSON value

§

QuestionMarkPipe

?|, do any of the strings exist as top-level keys or array elements?

§

QuestionMarkAmpersand

?&, do all of the strings exist as top-level keys or array elements?

§

AtQuestionMark

@?, does JSON path return any item for the specified JSON value?

§

AtAt

@@, returns the result of a JSON path predicate check for the specified JSON value.

Implementations§

source§

impl Token

source

pub fn make_keyword(keyword: &str) -> Self

source

pub fn make_word(word: &str, quote_style: Option<char>) -> Self

source

pub fn with_location(self, location: Location) -> TokenWithLocation

Trait Implementations§

source§

impl Clone for Token

source§

fn clone(&self) -> Token

Returns a copy 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 Token

source§

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

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

impl Display for Token

source§

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

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

impl Hash for Token

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<I> Parser<I, TokenWithLocation, ContextError> for Token
where I: TokenStream,

source§

fn parse_next( &mut self, input: &mut I, ) -> PResult<TokenWithLocation, ContextError>

Take tokens from the [Stream], turning it into the output Read more
§

fn parse_peek(&mut self, input: I) -> Result<(I, O), ErrMode<E>>

Take tokens from the [Stream], turning it into the output Read more
§

fn by_ref(&mut self) -> ByRef<'_, Self>
where Self: Sized,

Treat &mut Self as a parser Read more
§

fn value<O2>(self, val: O2) -> Value<Self, I, O, O2, E>
where Self: Sized, O2: Clone,

Produce the provided value Read more
§

fn default_value<O2>(self) -> DefaultValue<Self, I, O, O2, E>
where Self: Sized, O2: Default,

Produce a type’s default value Read more
§

fn void(self) -> Void<Self, I, O, E>
where Self: Sized,

Discards the output of the Parser Read more
§

fn output_into<O2>(self) -> OutputInto<Self, I, O, O2, E>
where Self: Sized, O: Into<O2>,

Convert the parser’s output to another type using std::convert::From Read more
§

fn recognize(self) -> Recognize<Self, I, O, E>
where Self: Sized, I: Stream,

Produce the consumed input as produced value. Read more
§

fn with_recognized(self) -> WithRecognized<Self, I, O, E>
where Self: Sized, I: Stream,

Produce the consumed input with the output Read more
§

fn map<G, O2>(self, map: G) -> Map<Self, G, I, O, O2, E>
where G: FnMut(O) -> O2, Self: Sized,

Maps a function over the output of a parser Read more
§

fn try_map<G, O2, E2>(self, map: G) -> TryMap<Self, G, I, O, O2, E, E2>
where Self: Sized, G: FnMut(O) -> Result<O2, E2>, I: Stream, E: FromExternalError<I, E2>,

Applies a function returning a Result over the output of a parser. Read more
§

fn verify_map<G, O2>(self, map: G) -> VerifyMap<Self, G, I, O, O2, E>
where Self: Sized, G: FnMut(O) -> Option<O2>, I: Stream, E: ParserError<I>,

Apply both [Parser::verify] and [Parser::map]. Read more
§

fn flat_map<G, H, O2>(self, map: G) -> FlatMap<Self, G, H, I, O, O2, E>
where Self: Sized, G: FnMut(O) -> H, H: Parser<I, O2, E>,

Creates a parser from the output of this one Read more
§

fn parse_to<O2>(self) -> ParseTo<Self, I, O, O2, E>
where Self: Sized, I: Stream, O: ParseSlice<O2>, E: ParserError<I>,

Apply std::str::FromStr to the output of the parser Read more
§

fn verify<G, O2>(self, filter: G) -> Verify<Self, G, I, O, O2, E>
where Self: Sized, G: FnMut(&O2) -> bool, I: Stream, O: Borrow<O2>, E: ParserError<I>, O2: ?Sized,

Returns the output of the child parser if it satisfies a verification function. Read more
§

fn context<C>(self, context: C) -> Context<Self, I, O, E, C>
where Self: Sized, I: Stream, E: AddContext<I, C>, C: Clone + Debug,

If parsing fails, add context to the error Read more
§

fn complete_err(self) -> CompleteErr<Self>
where Self: Sized,

Transforms [Incomplete][crate::error::ErrMode::Incomplete] into [Backtrack][crate::error::ErrMode::Backtrack] Read more
§

fn err_into<E2>(self) -> ErrInto<Self, I, O, E, E2>
where Self: Sized, E: Into<E2>,

Convert the parser’s error to another type using std::convert::From
source§

impl PartialEq<Token> for TokenWithLocation

source§

fn eq(&self, other: &Token) -> 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 PartialEq<TokenWithLocation> for Token

source§

fn eq(&self, other: &TokenWithLocation) -> 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 PartialEq for Token

source§

fn eq(&self, other: &Token) -> 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 Eq for Token

source§

impl StructuralPartialEq for Token

Auto Trait Implementations§

§

impl Freeze for Token

§

impl RefUnwindSafe for Token

§

impl Send for Token

§

impl Sync for Token

§

impl Unpin for Token

§

impl UnwindSafe for Token

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
source§

impl<I, O, E, T> ParserExt<I, O, E> for T
where T: Parser<I, O, E>,

source§

fn expect(self, expected: &'static str) -> Context<Self, I, O, E, StrContext>
where Self: Sized, I: Stream, E: AddContext<I, StrContext>,

Add a context to the error message. Read more
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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more