pub enum Token<'a> {
Show 67 variants
SingleLineComment(Cow<'a, str>),
MultiLineComment(Cow<'a, str>),
DocComment(Cow<'a, str>),
KeywordMod,
KeywordPart,
KeywordSketch,
KeywordOp,
KeywordFn,
KeywordIf,
KeywordElse,
KeywordUse,
KeywordAs,
KeywordReturn,
KeywordPub,
KeywordConst,
KeywordProp,
KeywordInit,
Identifier(Cow<'a, str>),
Unit(Cow<'a, str>),
LiteralInt(Cow<'a, str>),
LiteralFloat(Cow<'a, str>),
LiteralBool(bool),
LiteralString(Cow<'a, str>),
FormatStringStart,
FormatStringEnd,
StringContent(Cow<'a, str>),
Character(char),
StringFormatOpen,
StringFormatClose,
StringFormatPrecision(Cow<'a, str>),
StringFormatWidth(Cow<'a, str>),
SigilColon,
SigilSemiColon,
SigilDoubleColon,
SigilOpenBracket,
SigilCloseBracket,
SigilOpenSquareBracket,
SigilCloseSquareBracket,
SigilOpenCurlyBracket,
SigilCloseCurlyBracket,
SigilHash,
SigilDot,
SigilComma,
SigilDoubleDot,
SigilAt,
SigilSingleArrow,
SigilQuote,
OperatorAdd,
OperatorSubtract,
OperatorMultiply,
OperatorDivide,
OperatorUnion,
OperatorIntersect,
OperatorPowerXor,
OperatorGreaterThan,
OperatorLessThan,
OperatorGreaterEqual,
OperatorLessEqual,
OperatorNear,
OperatorEqual,
OperatorNotEqual,
OperatorAnd,
OperatorOr,
OperatorXor,
OperatorNot,
OperatorAssignment,
Error(LexerError),
}Expand description
Source token for µcad files
Variants§
SingleLineComment(Cow<'a, str>)
A single-line comment, starting with //
MultiLineComment(Cow<'a, str>)
A multi-line comment, starting with /* and ending with */
DocComment(Cow<'a, str>)
A doc-comment, starting with ///
KeywordMod
The mod keyword
KeywordPart
The part keyword
KeywordSketch
The sketch keyword
KeywordOp
The op keyword
KeywordFn
The fn keyword
KeywordIf
The if keyword
KeywordElse
The else keyword
KeywordUse
The use keyword
KeywordAs
The as keyword
KeywordReturn
The return keyword
KeywordPub
The pub keyword
KeywordConst
The const keyword
KeywordProp
The prop keyword
KeywordInit
The init keyword
Identifier(Cow<'a, str>)
An identifier, alphanumeric, starting with either an alpha character or a underscore
Unit(Cow<'a, str>)
A unit identifier
LiteralInt(Cow<'a, str>)
An integer literal
LiteralFloat(Cow<'a, str>)
A float literal
LiteralBool(bool)
A boolean literal
LiteralString(Cow<'a, str>)
A string literal
FormatStringStart
Double-quote indicating the start of a format string
FormatStringEnd
Double-quote indicating the end of a format string
StringContent(Cow<'a, str>)
Literal string content of a format string
Character(char)
Escaped character inside a format string
StringFormatOpen
The start of the format expression inside a format string
StringFormatClose
The end of the format expression inside a format string
StringFormatPrecision(Cow<'a, str>)
The precision specification of the format expression inside a format string
StringFormatWidth(Cow<'a, str>)
The width specification of the format expression inside a format string
SigilColon
The : symbol
SigilSemiColon
The ; symbol
SigilDoubleColon
The :: symbol
SigilOpenBracket
The ( symbol
SigilCloseBracket
The ) symbol
SigilOpenSquareBracket
The [ symbol
SigilCloseSquareBracket
The ] symbol
SigilOpenCurlyBracket
The { symbol
SigilCloseCurlyBracket
The } symbol
SigilHash
The # symbol
SigilDot
The . symbol
SigilComma
The , symbol
SigilDoubleDot
The .. symbol
SigilAt
The @ symbol
SigilSingleArrow
The -> symbol
SigilQuote
The " symbol
OperatorAdd
Add operator: +
OperatorSubtract
Subtract operator: -
OperatorMultiply
Multiply operator: -
OperatorDivide
Divide operator: /
OperatorUnion
Union operator: |
OperatorIntersect
Intersect operator: &
OperatorPowerXor
xor operator: ^
OperatorGreaterThan
Greater-than operator: >
OperatorLessThan
Less-than operator: <
OperatorGreaterEqual
Greater-or-equal operator: >=
OperatorLessEqual
Less-or-equal operator: <=
OperatorNear
Near operator: ~
OperatorEqual
Equal operator: ==
OperatorNotEqual
Not-equal operator: !=
OperatorAnd
And operator: and
OperatorOr
Or operator: or
OperatorXor
Xor operator: `xor’
OperatorNot
Not operator: !
OperatorAssignment
Assignment operator: =
Error(LexerError)
A lexer failure
When encountering an error, the lexer attempts to recover and continue emitting further tokens
Implementations§
Trait Implementations§
impl<'a> StructuralPartialEq for Token<'a>
Auto Trait Implementations§
impl<'a> Freeze for Token<'a>
impl<'a> RefUnwindSafe for Token<'a>
impl<'a> Send for Token<'a>
impl<'a> Sync for Token<'a>
impl<'a> Unpin for Token<'a>
impl<'a> UnwindSafe for Token<'a>
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,
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 moreSource§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more