[−][src]Trait antlr_rust::token_factory::TokenFactory
Trait for creating tokens.
Associated Types
type Inner: Token<Data = Self::Data> + ?Sized + 'a
[src]
Type of tokens emitted by this factory.
type Tok: Borrow<Self::Inner> + Clone + 'a + Debug
[src]
Ownership of the emitted tokens
type Data: InputData + ?Sized
[src]
Type of the underlying storage
type From
[src]
Type of the CharStream
that factory can produce tokens from
Required methods
pub 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>,
[src]
&'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 either from sourse
or from pure data in text
Either source
or text
are not None
pub fn create_invalid() -> Self::Tok
[src]
Creates invalid token
Invalid tokens must have TOKEN_INVALID_TYPE
token type.
pub fn get_data(from: Self::From) -> Cow<'a, Self::Data>
[src]
Creates Self::Data
representation for from
for lexer to work with
when it does not need to create full token
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>
pub 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>,
pub fn create_invalid() -> Self::Tok
[src]
pub fn get_data(from: Self::From) -> Cow<'a, Self::Data>
[src]
impl<'a> TokenFactory<'a> for OwningTokenFactory
[src]
type Inner = OwningToken
type Tok = Box<Self::Inner>
type Data = str
type From = String
pub 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>,
pub fn create_invalid() -> Self::Tok
[src]
pub fn get_data(from: Self::From) -> Cow<'a, Self::Data>
[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
pub 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>,