pub enum Token {
Show 36 variants
Word(Word),
Arrow,
Hash,
At,
Dot,
DotDotDot,
Bang,
LParen,
RParen,
LBracket,
RBracket,
LBrace,
RBrace,
Semi,
Comma,
BackQuote,
Template {
raw: Atom,
cooked: Result<Atom, Error>,
},
Colon,
ColonColon,
BinOp(BinOpToken),
AssignOp(AssignOp),
DollarLBrace,
QuestionMark,
PlusPlus,
MinusMinus,
Tilde,
Str {
value: JsWord,
raw: Atom,
},
Regex(Atom, Atom),
Num {
value: f64,
raw: Atom,
},
BigInt {
value: Box<BigInt>,
raw: Atom,
},
JSXName {
name: JsWord,
},
JSXText {
raw: Atom,
},
JSXTagStart,
JSXTagEnd,
Shebang(Atom),
Error(Error),
}
Variants§
Word(Word)
Identifier, “null”, “true”, “false”.
Contains null
and ``
Arrow
‘=>’
Hash
‘#’
At
‘@’
Dot
‘.’
DotDotDot
‘…’
Bang
‘!’
LParen
‘(’
RParen
‘)’
LBracket
[
RBracket
‘]’
LBrace
‘{’
RBrace
‘}’
Semi
‘;’
Comma
‘,’
BackQuote
‘`’
Template
Colon
‘:’
ColonColon
‘::’
BinOp(BinOpToken)
AssignOp(AssignOp)
DollarLBrace
‘${’
QuestionMark
‘?’
PlusPlus
++
MinusMinus
--
Tilde
~
Str
String literal. Span of this token contains quote.
Regex(Atom, Atom)
Regexp literal.
Num
TODO: Make Num as enum and separate decimal, binary, ..etc
BigInt
JSXName
JSXText
JSXTagStart
JSXTagEnd
Shebang(Atom)
Error(Error)
Implementations§
source§impl Token
impl Token
pub fn starts_expr(&self) -> bool
pub fn before_expr(&self) -> bool
Trait Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
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 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>
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