start token tree module

This commit is contained in:
Aleksey Kladov 2019-01-30 23:02:27 +03:00
parent 1bf47d43db
commit b8f56f89c6
2 changed files with 39 additions and 0 deletions

View file

@ -1,3 +1,6 @@
#[allow(unused)]
mod token_tree;
/// Machinery for macro expansion.
///
/// One of the more complicated things about macros is managing the source code

View file

@ -0,0 +1,36 @@
use ra_syntax::SmolStr;
enum TokenTree {
Leaf(Leaf),
Subtree(Subtree),
}
enum Leaf {
Literal(Literal),
Punct(Punct),
Ident(Ident),
}
struct Subtree {
delimiter: Delimiter,
token_trees: Vec<TokenTree>,
}
enum Delimiter {
Parenthesis,
Brace,
Bracket,
None,
}
struct Literal {
text: SmolStr,
}
struct Punct {
char: char,
}
struct Ident {
text: SmolStr,
}