start token tree module
This commit is contained in:
parent
1bf47d43db
commit
b8f56f89c6
2 changed files with 39 additions and 0 deletions
|
@ -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
|
||||
|
|
36
crates/ra_hir/src/macros/token_tree.rs
Normal file
36
crates/ra_hir/src/macros/token_tree.rs
Normal 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,
|
||||
}
|
Loading…
Add table
Reference in a new issue