Lexer

Trait Lexer 

Source
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§

Source

type Input: IntStream

Concrete input stream used by this parser

Required Methods§

Source

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

Source

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
Source

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

Source

fn pop_mode(&mut self) -> Option<usize>

Pops mode from internal mode stack

Source

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

Source

fn set_mode(&mut self, m: usize)

Sets lexer mode discarding current one

Source

fn more(&mut self)

Used to informs lexer that it should consider next token as a continuation of the current one

Source

fn skip(&mut self)

Tells lexer to completely ignore and not emit current token.

Implementors§

Source§

impl<'input, T, Input, TF> Lexer<'input> for BaseLexer<'input, T, Input, TF>
where T: LexerRecog<'input, Self> + 'static, Input: CharStream<TF::From>, TF: TokenFactory<'input>,

Source§

type Input = Input