pub enum Token {
Show 38 variants
EOF,
Word(Word),
Number(String),
Char(char),
SingleQuotedString(String),
DollarQuotedString(DollarQuotedString),
CstyleEscapesString(CstyleEscapedString),
NationalStringLiteral(String),
HexStringLiteral(String),
Parameter(String),
Comma,
Whitespace(Whitespace),
Op(String),
Eq,
Neq,
Lt,
Gt,
LtEq,
GtEq,
Plus,
Minus,
Mul,
Div,
Mod,
LParen,
RParen,
Period,
Colon,
DoubleColon,
SemiColon,
Backslash,
LBracket,
RBracket,
Pipe,
Caret,
LBrace,
RBrace,
RArrow,
}
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)
Op(String)
Custom Operator
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 >=
Plus
Plus operator +
Minus
Minus operator -
Mul
Multiplication operator *
Div
Division operator /
Mod
Modulo Operator %
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 ]
Pipe
Pipe |
Caret
Caret ^
LBrace
Left brace {
RBrace
Right brace }
RArrow
Right Arrow =>
Implementations§
Source§impl Token
impl Token
pub fn make_keyword(keyword: &str) -> Self
pub fn make_word(word: &str, quote_style: Option<char>) -> Self
pub fn with_location(self, location: Location) -> TokenWithLocation
Trait Implementations§
Source§impl<I> Parser<I, TokenWithLocation, ErrMode<ContextError>> for Tokenwhere
I: TokenStream,
impl<I> Parser<I, TokenWithLocation, ErrMode<ContextError>> for Tokenwhere
I: TokenStream,
Source§fn parse_next(
&mut self,
input: &mut I,
) -> ModalResult<TokenWithLocation, ContextError>
fn parse_next( &mut self, input: &mut I, ) -> ModalResult<TokenWithLocation, ContextError>
Stream
], turning it into the output Read more§fn parse(
&mut self,
input: I,
) -> Result<O, ParseError<I, <E as ParserError<I>>::Inner>>where
Self: Sized,
I: Stream + StreamIsPartial,
E: ParserError<I>,
<E as ParserError<I>>::Inner: ParserError<I>,
fn parse(
&mut self,
input: I,
) -> Result<O, ParseError<I, <E as ParserError<I>>::Inner>>where
Self: Sized,
I: Stream + StreamIsPartial,
E: ParserError<I>,
<E as ParserError<I>>::Inner: ParserError<I>,
input
, generating O
from it§fn parse_peek(&mut self, input: I) -> Result<(I, O), E>
fn parse_peek(&mut self, input: I) -> Result<(I, O), E>
Stream
], turning it into the output Read more§fn by_ref(&mut self) -> ByRef<'_, Self, I, O, E>where
Self: Sized,
fn by_ref(&mut self) -> ByRef<'_, Self, I, O, E>where
Self: Sized,
&mut Self
as a parser Read more§fn default_value<O2>(self) -> DefaultValue<Self, I, O, O2, E>
fn default_value<O2>(self) -> DefaultValue<Self, I, O, O2, E>
§fn output_into<O2>(self) -> OutputInto<Self, I, O, O2, E>
fn output_into<O2>(self) -> OutputInto<Self, I, O, O2, E>
std::convert::From
Read more§fn take(self) -> Take<Self, I, O, E>where
Self: Sized,
I: Stream,
fn take(self) -> Take<Self, I, O, E>where
Self: Sized,
I: Stream,
§fn with_taken(self) -> WithTaken<Self, I, O, E>where
Self: Sized,
I: Stream,
fn with_taken(self) -> WithTaken<Self, I, O, E>where
Self: Sized,
I: Stream,
§fn span(self) -> Span<Self, I, O, E>where
Self: Sized,
I: Stream + Location,
fn span(self) -> Span<Self, I, O, E>where
Self: Sized,
I: Stream + Location,
§fn with_span(self) -> WithSpan<Self, I, O, E>where
Self: Sized,
I: Stream + Location,
fn with_span(self) -> WithSpan<Self, I, O, E>where
Self: Sized,
I: Stream + Location,
§fn map<G, O2>(self, map: G) -> Map<Self, G, I, O, O2, E>
fn map<G, O2>(self, map: G) -> Map<Self, G, I, O, O2, E>
§fn try_map<G, O2, E2>(self, map: G) -> TryMap<Self, G, I, O, O2, E, E2>
fn try_map<G, O2, E2>(self, map: G) -> TryMap<Self, G, I, O, O2, E, E2>
Result
over the output of a parser. Read more§fn verify_map<G, O2>(self, map: G) -> VerifyMap<Self, G, I, O, O2, E>
fn verify_map<G, O2>(self, map: G) -> VerifyMap<Self, G, I, O, O2, E>
§fn flat_map<G, H, O2>(self, map: G) -> FlatMap<Self, G, H, I, O, O2, E>
fn flat_map<G, H, O2>(self, map: G) -> FlatMap<Self, G, H, I, O, O2, E>
§fn parse_to<O2>(self) -> ParseTo<Self, I, O, O2, E>where
Self: Sized,
I: Stream,
O: ParseSlice<O2>,
E: ParserError<I>,
fn parse_to<O2>(self) -> ParseTo<Self, I, O, O2, E>where
Self: Sized,
I: Stream,
O: ParseSlice<O2>,
E: ParserError<I>,
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>
fn verify<G, O2>(self, filter: G) -> Verify<Self, G, I, O, O2, E>
§fn context<C>(self, context: C) -> Context<Self, I, O, E, C>
fn context<C>(self, context: C) -> Context<Self, I, O, E, C>
§fn complete_err(self) -> CompleteErr<Self, I, O, E>where
Self: Sized,
fn complete_err(self) -> CompleteErr<Self, I, O, E>where
Self: Sized,
Incomplete
][crate::error::ErrMode::Incomplete] into [Backtrack
][crate::error::ErrMode::Backtrack] Read more§fn err_into<E2>(self) -> ErrInto<Self, I, O, E, E2>
fn err_into<E2>(self) -> ErrInto<Self, I, O, E, E2>
std::convert::From
Source§impl PartialEq<Token> for TokenWithLocation
impl PartialEq<Token> for TokenWithLocation
Source§impl PartialEq<TokenWithLocation> for Token
impl PartialEq<TokenWithLocation> for Token
impl Eq for Token
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> 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more