rust/crates/ra_hir/src/macros/tt.rs

37 lines
492 B
Rust
Raw Normal View History

2019-01-30 14:02:27 -06:00
use ra_syntax::SmolStr;
2019-01-30 14:25:02 -06:00
pub(crate) enum TokenTree {
2019-01-30 14:02:27 -06:00
Leaf(Leaf),
Subtree(Subtree),
}
2019-01-30 14:25:02 -06:00
pub(crate) enum Leaf {
2019-01-30 14:02:27 -06:00
Literal(Literal),
Punct(Punct),
Ident(Ident),
}
2019-01-30 14:25:02 -06:00
pub(crate) struct Subtree {
2019-01-30 14:02:27 -06:00
delimiter: Delimiter,
token_trees: Vec<TokenTree>,
}
2019-01-30 14:25:02 -06:00
pub(crate) enum Delimiter {
2019-01-30 14:02:27 -06:00
Parenthesis,
Brace,
Bracket,
None,
}
2019-01-30 14:25:02 -06:00
pub(crate) struct Literal {
2019-01-30 14:02:27 -06:00
text: SmolStr,
}
2019-01-30 14:25:02 -06:00
pub(crate) struct Punct {
2019-01-30 14:02:27 -06:00
char: char,
}
2019-01-30 14:25:02 -06:00
pub(crate) struct Ident {
2019-01-30 14:02:27 -06:00
text: SmolStr,
}