[][src]Struct antlr_rust::BaseLexer

pub struct BaseLexer<'input, T: LexerRecog<'input, Self> + 'static, Input: CharStream<TF::From>, TF: TokenFactory<'input> = CommonTokenFactory> {
    pub interpreter: Option<Box<LexerATNSimulator>>,
    pub input: Option<Input>,
    pub token_start_char_index: isize,
    pub token_start_line: isize,
    pub token_start_column: isize,
    pub token_type: isize,
    pub token: Option<TF::Tok>,
    pub channel: isize,
    pub mode: usize,
    pub text: Option<<TF::Data as ToOwned>::Owned>,
    // some fields omitted
}

Default implementation of Lexer

Public fields in this struct are intended to be used by embedded actions

Fields

interpreter: Option<Box<LexerATNSimulator>>

LexerATNSimulator instance of this lexer

input: Option<Input>

CharStream used by this lexer

token_start_char_index: isizetoken_start_line: isizetoken_start_column: isizetoken_type: isize

Overrides token type emitted by lexer for current token

token: Option<TF::Tok>

Make it Some to override token that is currently being generated by lexer

channel: isize

Channel lexer is currently assigning tokens to

mode: usize

Mode lexer is currently in

text: Option<<TF::Data as ToOwned>::Owned>

Make it Some to override text for token that is currently being generated by lexer

Implementations

impl<'input, T, Input, TF> BaseLexer<'input, T, Input, TF> where
    T: LexerRecog<'input, Self> + 'static,
    Input: CharStream<TF::From>,
    TF: TokenFactory<'input>, 
[src]

pub fn get_char_index(&self) -> isize[src]

Current position in input stream

pub fn get_text<'a>(&'a self) -> Cow<'a, TF::Data> where
    'input: 'a, 
[src]

Current token text

pub fn set_text(&mut self, _text: <TF::Data as ToOwned>::Owned)[src]

Used from lexer actions to override text of the token that will be emitted next

pub fn add_error_listener(
    &mut self,
    listener: Box<dyn ErrorListener<'input, Self>>
)
[src]

Add error listener

pub fn remove_error_listeners(&mut self)[src]

Remove and drop all error listeners

pub fn new_base_lexer(
    input: Input,
    interpreter: LexerATNSimulator,
    recog: T,
    factory: &'input TF
) -> Self
[src]

Creates new lexer instance

Trait Implementations

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

type Target = T

The resulting type after dereferencing.

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

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>, 
[src]

type Input = Input

Concrete input stream used by this parser

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

type TF = TF

TokenFactory this token source produce tokens with

Auto Trait Implementations

impl<'input, T, Input, TF = CommonTokenFactory> !RefUnwindSafe for BaseLexer<'input, T, Input, TF>[src]

impl<'input, T, Input, TF = CommonTokenFactory> !Send for BaseLexer<'input, T, Input, TF>[src]

impl<'input, T, Input, TF = CommonTokenFactory> !Sync for BaseLexer<'input, T, Input, TF>[src]

impl<'input, T, Input, TF> Unpin for BaseLexer<'input, T, Input, TF> where
    Input: Unpin,
    T: Unpin,
    <<TF as TokenFactory<'input>>::Data as ToOwned>::Owned: Unpin,
    <TF as TokenFactory<'input>>::Tok: Unpin
[src]

impl<'input, T, Input, TF = CommonTokenFactory> !UnwindSafe for BaseLexer<'input, T, Input, TF>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> NodeText for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.