pub trait Lexer<'input>: TokenSource<'input> + Recognizer<'input, Node = EmptyContextType<'input, <Self as TokenAware<'input>>::TF>> {
type Input: IntStream;
// Required methods
fn input(&mut self) -> &mut Self::Input;
fn set_channel(&mut self, v: isize);
fn push_mode(&mut self, m: usize);
fn pop_mode(&mut self) -> Option<usize>;
fn set_type(&mut self, t: isize);
fn set_mode(&mut self, m: usize);
fn more(&mut self);
fn skip(&mut self);
}
Expand description
Lexer functionality required by LexerATNSimulator
to work properly
Required Associated Types§
Required Methods§
Sourcefn input(&mut self) -> &mut Self::Input
fn input(&mut self) -> &mut Self::Input
Same as TokenStream::get_input_stream
but returns concrete type instance
important for proper inlining in hot code of LexerATNSimulator
Sourcefn set_channel(&mut self, v: isize)
fn set_channel(&mut self, v: isize)
Sets channel where current token will be pushed
By default two channels are available:
LEXER_DEFAULT_TOKEN_CHANNEL
LEXER_HIDDEN
Sourcefn push_mode(&mut self, m: usize)
fn push_mode(&mut self, m: usize)
Pushes current mode to internal mode stack and sets m
as current lexer mode
`pop_mode should be used to recover previous mode
Sourcefn set_type(&mut self, t: isize)
fn set_type(&mut self, t: isize)
Sets type of the current token Called from action to override token that will be emitted by lexer