pub enum Symbol {
Show 31 variants
Word(String),
Alpha(char),
Digit(usize),
Underscore,
Dash,
Assignment,
Plus,
LeftBrace,
RightBrace,
LeftBracket,
RightBracket,
LeftParenthesis,
RightParenthesis,
Colon,
Semicolon,
Join,
Directive,
Escape,
Slash,
Comma,
Decimal,
DoubleQuote,
SingleQuote,
LeftAngle,
RightAngle,
Unicode(String),
Newline,
Whitespace(Whitespace),
Comment(String),
Eoi,
Void,
}
Expand description
The symbol of a Token
Variants§
Word(String)
A word is a contiguous sequence of letters, digits, and underscores. A word will never start with a digit.
Alpha(char)
A single alphanumeric character
Digit(usize)
Parsed digits will always be a single digit, but generated digits may have multiple digits.
Underscore
_
Dash
Assignment
=
Plus
LeftBrace
{
RightBrace
}
LeftBracket
[
RightBracket
]
LeftParenthesis
(
RightParenthesis
)
Colon
:
Semicolon
;
Join
Directive
Escape
\
Slash
/
Comma
,
Decimal
.
DoubleQuote
“”
SingleQuote
’
LeftAngle
<
RightAngle
Unicode(String)
A unicode character
Newline
A newline \n
Whitespace(Whitespace)
A Whitespace
character
Comment(String)
A comment Comments are not parsed, but are kept in the token stream so that they can be outputted in the same format as the input.
Comments have two forms:
Single line comments start with //
and end with a newline.
Multi line comments start with /*
and end with */
.
Eoi
End of input
Void
Void token, not outputted
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub const fn is_whitespace(&self) -> bool
pub const fn is_whitespace(&self) -> bool
Check if a symbol is Whitespace
or Comment
Sourcepub const fn is_newline(&self) -> bool
pub const fn is_newline(&self) -> bool
Check if a symbol is Newline
Trait Implementations§
impl Eq for Symbol
impl StructuralPartialEq for Symbol
Auto Trait Implementations§
impl Freeze for Symbol
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
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