pub struct TokenShape {
pub name: String,
pub pat: BytePat,
pub window: usize,
pub precedence: Precedence,
pub id: u8,
pub guard: Option<fn(&[u8]) -> bool>,
}Expand description
One declared token shape.
Fields§
§name: StringThe name the \{name} atom uses.
pat: BytePatThe whole-anchored byte-pattern, bounded by construction.
window: usizeLongest byte length this shape can match, from BytePat::max_len.
precedence: PrecedenceWhere it sits against the built-in cascade.
id: u8The payload of the crate::token::TokenKind::Custom the lexer
emits for it.
guard: Option<fn(&[u8]) -> bool>A check on the bytes the pattern accepted, where the shape’s standard defines one: a token the check refuses is not this shape.
Trait Implementations§
Source§impl Clone for TokenShape
impl Clone for TokenShape
Auto Trait Implementations§
impl Freeze for TokenShape
impl RefUnwindSafe for TokenShape
impl Send for TokenShape
impl Sync for TokenShape
impl Unpin for TokenShape
impl UnsafeUnpin for TokenShape
impl UnwindSafe for TokenShape
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