pub enum TokenCategory {
Keyword,
Operator,
String,
Number,
Variable,
Comment,
Punctuation,
Command,
Path,
Flag,
Error,
}Expand description
Semantic category for syntax highlighting.
Stable enum that groups tokens by purpose. Consumers match on categories instead of individual tokens, insulating them from lexer evolution.
Variants§
Keyword
Keywords: if, then, else, for, while, function, return, etc.
Operator
Operators: |, &&, ||, >, >>, 2>&1, =, ==, etc.
String
String literals: “…”, ‘…’, heredocs
Number
Numeric literals: 123, 3.14, arithmetic expressions
Variable
Variable references: $foo, ${bar}, $1, $@, $#, $?, $$
Comment
Comments: # …
Punctuation
Punctuation: ; , . ( ) { } [ ]
Command
Identifiers in command position
Path
Absolute paths: /foo/bar
Flag
Flags: –long, -s, +x
Error
Invalid tokens
Trait Implementations§
Source§impl Clone for TokenCategory
impl Clone for TokenCategory
Source§fn clone(&self) -> TokenCategory
fn clone(&self) -> TokenCategory
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenCategory
impl Debug for TokenCategory
Source§impl Hash for TokenCategory
impl Hash for TokenCategory
Source§impl PartialEq for TokenCategory
impl PartialEq for TokenCategory
impl Copy for TokenCategory
impl Eq for TokenCategory
impl StructuralPartialEq for TokenCategory
Auto Trait Implementations§
impl Freeze for TokenCategory
impl RefUnwindSafe for TokenCategory
impl Send for TokenCategory
impl Sync for TokenCategory
impl Unpin for TokenCategory
impl UnsafeUnpin for TokenCategory
impl UnwindSafe for TokenCategory
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.