Enum ezno_parser::TSXToken

source ·
pub enum TSXToken {
Show 97 variants Identifier(String), Keyword(TSXKeyword), NumberLiteral(String), StringLiteral(String, Quoted), MultiLineComment(String), Comment(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), DividesOperator, 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)

§

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)

§

DividesOperator

§

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

§

type FiniteAutomata = States

source§

fn new_automaton() -> States

source§

impl PartialEq for TSXToken

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

§

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

§

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

§

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

§

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

§

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

§

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>,

§

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>,

§

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.