Enum TSXToken

Source
pub enum TSXToken {
Show 98 variants Identifier(String), Keyword(TSXKeyword), NumberLiteral(String), StringLiteral(String, Quoted), MultiLineComment(String), Comment(String), HashBangComment(String), RegexLiteral(String), RegexFlagLiteral(String), TemplateLiteralStart, TemplateLiteralChunk(String), TemplateLiteralEnd, TemplateLiteralExpressionStart, TemplateLiteralExpressionEnd, Comma, SemiColon, Colon, Dot, At, Spread, Assign, Arrow, OpenParentheses, CloseParentheses, OpenBrace, CloseBrace, OpenBracket, CloseBracket, OpenChevron, CloseChevron, Add, Subtract, Multiply, Divide, QuestionMark, Exponent, Modulo, AddAssign, SubtractAssign, MultiplyAssign, DivideAssign, ExponentAssign, ModuloAssign, Increment, Decrement, BitwiseShiftLeft, BitwiseShiftRight, BitwiseShiftRightUnsigned, BitwiseShiftLeftAssign, BitwiseShiftRightAssign, BitwiseShiftRightUnsignedAssign, BitwiseOr, BitwiseXOr, BitwiseAnd, BitwiseNot, BitwiseOrAssign, BitwiseAndAssign, BitwiseXorAssign, LogicalOr, LogicalAnd, LogicalNot, LogicalOrAssign, LogicalAndAssign, Equal, NotEqual, StrictEqual, StrictNotEqual, GreaterThanEqual, LessThanEqual, OptionalChain, OptionalCall, OptionalIndex, NullishCoalescing, NullishCoalescingAssign, OptionalMember, NonOptionalMember, HashTag, JSXOpeningTagStart, JSXTagName(String), JSXOpeningTagEnd, JSXClosingTagStart, JSXClosingTagName(String), JSXSelfClosingTag, JSXAttributeKey(String), JSXAttributeAssign, JSXAttributeValue(String), JSXContent(String), JSXContentLineBreak, JSXExpressionStart, JSXExpressionEnd, JSXFragmentStart, JSXFragmentEnd, JSXComment(String), DocTypeHTML, InvertAssign, ComposeOperator, PipeOperator, EOS,
}
Expand description

All JS Tokens with extensions including TypeScript, JSX and more

Variants§

§

Identifier(String)

§

Keyword(TSXKeyword)

§

NumberLiteral(String)

§

StringLiteral(String, Quoted)

§

MultiLineComment(String)

§

Comment(String)

§

HashBangComment(String)

§

RegexLiteral(String)

§

RegexFlagLiteral(String)

§

TemplateLiteralStart

§

TemplateLiteralChunk(String)

§

TemplateLiteralEnd

§

TemplateLiteralExpressionStart

§

TemplateLiteralExpressionEnd

§

Comma

§

SemiColon

§

Colon

§

Dot

§

At

@

§

Spread

§

Assign

§

Arrow

=>

§

OpenParentheses

(

§

CloseParentheses

)

§

OpenBrace

{

§

CloseBrace

}

§

OpenBracket

[

§

CloseBracket

]

§

OpenChevron

<

§

CloseChevron

>

§

Add

§

Subtract

§

Multiply

§

Divide

§

QuestionMark

§

Exponent

§

Modulo

§

AddAssign

§

SubtractAssign

§

MultiplyAssign

§

DivideAssign

§

ExponentAssign

§

ModuloAssign

§

Increment

§

Decrement

§

BitwiseShiftLeft

§

BitwiseShiftRight

§

BitwiseShiftRightUnsigned

§

BitwiseShiftLeftAssign

§

BitwiseShiftRightAssign

§

BitwiseShiftRightUnsignedAssign

§

BitwiseOr

§

BitwiseXOr

§

BitwiseAnd

§

BitwiseNot

§

BitwiseOrAssign

§

BitwiseAndAssign

§

BitwiseXorAssign

§

LogicalOr

§

LogicalAnd

§

LogicalNot

§

LogicalOrAssign

§

LogicalAndAssign

§

Equal

§

NotEqual

§

StrictEqual

§

StrictNotEqual

§

GreaterThanEqual

§

LessThanEqual

§

OptionalChain

§

OptionalCall

§

OptionalIndex

§

NullishCoalescing

§

NullishCoalescingAssign

§

OptionalMember

?:

§

NonOptionalMember

!:

§

HashTag

For scripts thing

§

JSXOpeningTagStart

§

JSXTagName(String)

§

JSXOpeningTagEnd

§

JSXClosingTagStart

§

JSXClosingTagName(String)

This also covers the end of a token, thus no TSXToken::JSXClosingTagEnd

§

JSXSelfClosingTag

/>

§

JSXAttributeKey(String)

§

JSXAttributeAssign

§

JSXAttributeValue(String)

§

JSXContent(String)

§

JSXContentLineBreak

§

JSXExpressionStart

The start and end of expressions either as a node or a attribute

§

JSXExpressionEnd

§

JSXFragmentStart

§

JSXFragmentEnd

§

JSXComment(String)

§

DocTypeHTML

For top level HTML

§

InvertAssign

§

ComposeOperator

§

PipeOperator

§

EOS

Implementations§

Source§

impl TSXToken

Source

pub fn is_identifier_or_ident(&self) -> bool

Source

pub fn is_comment(&self) -> bool

Source

pub fn try_into_comment( token: Token<TSXToken, TokenStart>, ) -> Result<(String, bool, Span), Token<TSXToken, TokenStart>>

Returns (*content*, *is_multiline*, *position*)

Source

pub fn is_expression_prefix(&self) -> bool

Used for lexing regular expression and JSX literals differently

Source

pub fn is_expression_postfix(&self) -> bool

For trailing expression comments

Source

pub fn from_slice(slice: &str) -> Self

Returns a keyword token else an identifier literal

Trait Implementations§

Source§

impl Debug for TSXToken

Source§

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

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

impl FiniteAutomataConstructor for TSXToken

Source§

type FiniteAutomata = States

Source§

fn new_automaton() -> States

Source§

impl PartialEq for TSXToken

Source§

fn eq(&self, other: &Self) -> 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 SizedToken for TSXToken

Source§

fn length(&self) -> u32

Source§

impl TokenTrait for TSXToken

Source§

fn is_skippable(&self) -> bool

Use this for nully tokens. Will be skipped under TokenReader::expect_next
Source§

impl TryFrom<&TSXToken> for BinaryAssignmentOperator

Source§

type Error = ()

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

fn try_from(expression: &TSXToken) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&TSXToken> for BinaryOperator

Source§

type Error = ()

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

fn try_from(expression: &TSXToken) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&TSXToken> for IncrementOrDecrement

Source§

type Error = ()

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

fn try_from(token: &TSXToken) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&TSXToken> for UnaryOperator

Source§

type Error = ()

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

fn try_from(expression: &TSXToken) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&TSXToken> for UnaryPostfixAssignmentOperator

Source§

type Error = ()

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

fn try_from(token: &TSXToken) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&TSXToken> for UnaryPrefixAssignmentOperator

Source§

type Error = ()

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

fn try_from(token: &TSXToken) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for TSXToken

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.