pub struct LexerSemantics {
pub ir: SemIr,
pub predicates: Vec<LexerSemanticPredicate>,
pub actions: Vec<LexerSemanticAction>,
}Expand description
Data-driven lexer semantic tables emitted by generated lexers.
The lexer analog of crate::ParserSemantics. Grammars whose
@lexer::members state and inline actions/predicates the generator could
lower need no hand-written hooks at all (issue #206).
Fields§
§ir: SemIr§predicates: Vec<LexerSemanticPredicate>§actions: Vec<LexerSemanticAction>Implementations§
Source§impl LexerSemantics
impl LexerSemantics
Sourcepub fn eval_predicate<I>(
&self,
lexer: &BaseLexer<I>,
predicate: LexerPredicate,
) -> Option<bool>where
I: CharStream,
pub fn eval_predicate<I>(
&self,
lexer: &BaseLexer<I>,
predicate: LexerPredicate,
) -> Option<bool>where
I: CharStream,
Evaluates a lowered predicate coordinate, or None when this table has
no entry for it (the caller then falls back to hooks / policy).
Sourcepub fn exec_action<I>(
&self,
lexer: &mut BaseLexer<I>,
action: LexerCustomAction,
) -> boolwhere
I: CharStream,
pub fn exec_action<I>(
&self,
lexer: &mut BaseLexer<I>,
action: LexerCustomAction,
) -> boolwhere
I: CharStream,
Executes a lowered action coordinate, reporting whether this table owned it.
Trait Implementations§
Source§impl Clone for LexerSemantics
impl Clone for LexerSemantics
Source§fn clone(&self) -> LexerSemantics
fn clone(&self) -> LexerSemantics
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 LexerSemantics
impl Debug for LexerSemantics
Source§impl Default for LexerSemantics
impl Default for LexerSemantics
Source§fn default() -> LexerSemantics
fn default() -> LexerSemantics
Returns the “default value” for a type. Read more
impl Eq for LexerSemantics
Source§impl PartialEq for LexerSemantics
impl PartialEq for LexerSemantics
impl StructuralPartialEq for LexerSemantics
Auto Trait Implementations§
impl Freeze for LexerSemantics
impl RefUnwindSafe for LexerSemantics
impl Send for LexerSemantics
impl Sync for LexerSemantics
impl Unpin for LexerSemantics
impl UnsafeUnpin for LexerSemantics
impl UnwindSafe for LexerSemantics
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