Skip to main content

Token

Enum Token 

Source
pub enum Token {
Show 45 variants Char(char), Escaped(char), NamedClass(NamedClassToken), NamedList(String), Backreference(usize), OpenParen, CloseParen, OpenBracket, CloseBracket, OpenBrace, CloseBrace, Pipe, Caret, Dollar, Dot, Star, Plus, Question, StarPossessive, PlusPossessive, QuestionPossessive, Tilde, Hyphen, NonCapturing, PositiveLookahead, NegativeLookahead, PositiveLookbehind, NegativeLookbehind, NamedGroup(String), BestMatch, EnhanceMatch, PosixMatch, Verbose, DotAll, MultiLine, Ungreedy, CaseInsensitive, Global, Unicode, ResetMatchStart, AtomicGroup, RecursivePattern, RecursiveGroup(usize), RecursiveNamedGroup(String), Eof,
}
Expand description

Token produced by the lexer.

Variants§

§

Char(char)

Literal character.

§

Escaped(char)

Escaped character (e.g., \n, \t).

§

NamedClass(NamedClassToken)

Named class escape (e.g., \d, \w, \s).

§

NamedList(String)

Named list reference \L<name>.

§

Backreference(usize)

Backreference \1, \2, etc.

§

OpenParen

( - open group.

§

CloseParen

) - close group.

§

OpenBracket

[ - open character class.

§

CloseBracket

] - close character class.

§

OpenBrace

{ - open quantifier.

§

CloseBrace

} - close quantifier.

§

Pipe

| - alternation.

§

Caret

^ - start anchor or negation in char class.

§

Dollar

$ - end anchor.

§

Dot

. - any character.

§

Star

* - zero or more.

§

Plus

+ - one or more.

§

Question

? - zero or one, or non-greedy modifier.

§

StarPossessive

*+ - possessive zero or more (only after atom, not after another quantifier).

§

PlusPossessive

++ - possessive one or more (only after atom).

§

QuestionPossessive

?+ - possessive zero or one (only after atom).

§

Tilde

~ - fuzziness marker.

§

Hyphen

- - range in character class.

§

NonCapturing

(?: - non-capturing group.

§

PositiveLookahead

(?= - positive lookahead.

§

NegativeLookahead

(?! - negative lookahead.

§

PositiveLookbehind

(?<= - positive lookbehind.

§

NegativeLookbehind

(?<! - negative lookbehind.

§

NamedGroup(String)

(?P<name> or (?<name> - named group.

§

BestMatch

(?b) - BESTMATCH flag (search for best match instead of first).

§

EnhanceMatch

(?e) - ENHANCEMATCH flag (improve fit of fuzzy match).

§

PosixMatch

(?p) - POSIX leftmost-longest matching.

§

Verbose

(?x) - Verbose mode (ignore whitespace, allow comments).

§

DotAll

(?s) - Dot-all mode (. matches newlines).

§

MultiLine

(?m) - Multi-line mode (^/$ match at line boundaries).

§

Ungreedy

(?U) - Ungreedy mode (invert default greediness).

§

CaseInsensitive

(?i) - Case-insensitive mode.

§

Global

(?g) - Global mode (find all matches).

§

Unicode

(?u) - Unicode mode (enable Unicode character classes).

§

ResetMatchStart

\K - Reset match start (keep everything before it out of the match).

§

AtomicGroup

(?> - Atomic group (prevent backtracking).

§

RecursivePattern

(?R) - Recursive entire pattern.

§

RecursiveGroup(usize)

(?1), (?2), etc. - Recursive numbered group.

§

RecursiveNamedGroup(String)

(?&name) - Recursive named group.

§

Eof

End of input.

Trait Implementations§

Source§

impl Clone for Token

Source§

fn clone(&self) -> Token

Returns a duplicate 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 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 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 UnsafeUnpin 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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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, 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.