Expand description
Literify
Stringifies (and concats) literal within the passed token stream inside ~() group. It is also possible to concaternate with other strings inside the group.
This can be useful when you need to stringify a literal for a use in macro,
but macro expects a literal token tree, so usage of stringify! is not possible.
Example
use logos::Logos;
literify::literify! {
#[derive(Debug, PartialEq, Logos)]
enum Token {
#[token(~("amog" u s))]
Amogus,
}
}
assert_eq!(
Token::lexer("amogus").next(),
Some(Ok(Token::Amogus)),
);Macros
- Stringify (and concat, also with strings) identifiers inside token stream