[−][src]Trait antlr_rust::token_factory::TokenFactory
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
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>,
&'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.
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>
fn create<T: ?Sized>(
&'a self,
source: Option<&mut T>,
ttype: isize,
text: Option<String>,
channel: isize,
start: isize,
stop: isize,
line: isize,
column: isize
) -> Self::Tok where
T: CharStream<Self::From>,
[src]
&'a self,
source: Option<&mut T>,
ttype: isize,
text: Option<String>,
channel: isize,
start: isize,
stop: isize,
line: isize,
column: isize
) -> Self::Tok where
T: CharStream<Self::From>,
fn create_invalid() -> Self::Tok
[src]
impl<'a> TokenFactory<'a> for OwningTokenFactory
[src]
type Inner = OwningToken
type Tok = Box<Self::Inner>
type Data = str
type From = String
fn create<T: ?Sized>(
&'a self,
source: Option<&mut T>,
ttype: isize,
text: Option<String>,
channel: isize,
start: isize,
stop: isize,
line: isize,
column: isize
) -> Self::Tok where
T: CharStream<String>,
[src]
&'a self,
source: Option<&mut T>,
ttype: isize,
text: Option<String>,
channel: isize,
start: isize,
stop: isize,
line: isize,
column: isize
) -> Self::Tok where
T: CharStream<String>,
fn create_invalid() -> Self::Tok
[src]
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]
TF: TokenFactory<'input, Tok = Box<Tok>, Inner = Tok>,
Tok: Token<Data = TF::Data> + Clone + TidAble<'input>,
&'a Tok: Default,
type Inner = Tok
type Tok = &'input Tok
type Data = TF::Data
type From = TF::From
fn create<T: ?Sized>(
&'input 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>,
[src]
&'input 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>,