[][src]Trait antlr_rust::token_factory::TokenFactory

pub trait TokenFactory<'a>: TidAble<'a> + Sized {
    type Inner: Token<Data = Self::Data> + ?Sized + 'a;
    type Tok: Borrow<Self::Inner> + Clone + 'a + Debug;
    type Data: InputData + ?Sized;
    type From: Borrow<Self::Data> + Into<Cow<'a, Self::Data>>;
    fn create<T: ?Sized>(
        &'a self,
        source: Option<&mut T>,
        ttype: isize,
        text: Option<<Self::Data as ToOwned>::Owned>,
        channel: isize,
        start: isize,
        stop: isize,
        line: isize,
        column: isize
    ) -> Self::Tok
    where
        T: CharStream<Self::From>
;
fn create_invalid() -> Self::Tok; }

Trait for creating tokens

Associated Types

type Inner: Token<Data = Self::Data> + ?Sized + 'a

type of tokens emitted by this factory

type Tok: Borrow<Self::Inner> + Clone + 'a + Debug

ownership of the emitted tokens

type Data: InputData + ?Sized

type of the underlying storage

type From: Borrow<Self::Data> + Into<Cow<'a, Self::Data>>

type of the reference to Self::Data that factory needs for producing tokens

Loading content...

Required methods

fn create<T: ?Sized>(
    &'a self,
    source: Option<&mut T>,
    ttype: isize,
    text: Option<<Self::Data as ToOwned>::Owned>,
    channel: isize,
    start: isize,
    stop: isize,
    line: isize,
    column: isize
) -> Self::Tok where
    T: CharStream<Self::From>, 

Creates token

fn create_invalid() -> Self::Tok

Creates invalid token Invalid tokens must have TOKEN_INVALID_TYPE token type.

Loading content...

Implementors

impl<'a> TokenFactory<'a> for CommonTokenFactory[src]

type Inner = CommonToken<'a>

type Tok = Box<Self::Inner>

type Data = str

type From = Cow<'a, str>

impl<'a> TokenFactory<'a> for OwningTokenFactory[src]

type Inner = OwningToken

type Tok = Box<Self::Inner>

type Data = str

type From = String

impl<'input, TF, Tok> TokenFactory<'input> for ArenaFactory<'input, TF, Tok> where
    TF: TokenFactory<'input, Tok = Box<Tok>, Inner = Tok>,
    Tok: Token<Data = TF::Data> + Clone + TidAble<'input>,
    &'a Tok: Default
[src]

type Inner = Tok

type Tok = &'input Tok

type Data = TF::Data

type From = TF::From

Loading content...