Trait antlr_rust::token_factory::TokenFactory
source · [−]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;
fn create<T>(
&'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> + ?Sized;
fn create_invalid() -> Self::Tok;
fn get_data(from: Self::From) -> Cow<'a, Self::Data>;
}
Expand description
Trait for creating tokens.
Required Associated Types
Required Methods
Creates token either from sourse
or from pure data in text
Either source
or text
are not None
fn create_invalid() -> Self::Tok
fn create_invalid() -> Self::Tok
Creates invalid token
Invalid tokens must have TOKEN_INVALID_TYPE
token type.