diff --git a/crates/ra_hir/src/macros.rs b/crates/ra_hir/src/macros.rs index 7ca34d43451..9aa70683656 100644 --- a/crates/ra_hir/src/macros.rs +++ b/crates/ra_hir/src/macros.rs @@ -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 diff --git a/crates/ra_hir/src/macros/token_tree.rs b/crates/ra_hir/src/macros/token_tree.rs new file mode 100644 index 00000000000..7026ce3b3f9 --- /dev/null +++ b/crates/ra_hir/src/macros/token_tree.rs @@ -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, +} + +enum Delimiter { + Parenthesis, + Brace, + Bracket, + None, +} + +struct Literal { + text: SmolStr, +} + +struct Punct { + char: char, +} + +struct Ident { + text: SmolStr, +}