aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/macros
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-30 20:58:52 +0000
committerAleksey Kladov <[email protected]>2019-01-31 20:23:30 +0000
commitc09c6fc97c1d553dd348383eb98fc7a4788030cb (patch)
tree2a89c345b5bbc25943b971a3752988e52a8edef9 /crates/ra_hir/src/macros
parenta4342a7feeaca642a64ad908432a17b31f081e01 (diff)
start tt convertions boilerplate
Diffstat (limited to 'crates/ra_hir/src/macros')
-rw-r--r--crates/ra_hir/src/macros/tt.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_hir/src/macros/tt.rs b/crates/ra_hir/src/macros/tt.rs
index 817cb262e..11b1089d3 100644
--- a/crates/ra_hir/src/macros/tt.rs
+++ b/crates/ra_hir/src/macros/tt.rs
@@ -4,16 +4,18 @@ pub(crate) enum TokenTree {
4 Leaf(Leaf), 4 Leaf(Leaf),
5 Subtree(Subtree), 5 Subtree(Subtree),
6} 6}
7impl_froms!(TokenTree: Leaf, Subtree);
7 8
8pub(crate) enum Leaf { 9pub(crate) enum Leaf {
9 Literal(Literal), 10 Literal(Literal),
10 Punct(Punct), 11 Punct(Punct),
11 Ident(Ident), 12 Ident(Ident),
12} 13}
14impl_froms!(Leaf: Literal, Punct, Ident);
13 15
14pub(crate) struct Subtree { 16pub(crate) struct Subtree {
15 delimiter: Delimiter, 17 pub(crate) delimiter: Delimiter,
16 token_trees: Vec<TokenTree>, 18 pub(crate) token_trees: Vec<TokenTree>,
17} 19}
18 20
19pub(crate) enum Delimiter { 21pub(crate) enum Delimiter {
@@ -24,13 +26,13 @@ pub(crate) enum Delimiter {
24} 26}
25 27
26pub(crate) struct Literal { 28pub(crate) struct Literal {
27 text: SmolStr, 29 pub(crate) text: SmolStr,
28} 30}
29 31
30pub(crate) struct Punct { 32pub(crate) struct Punct {
31 char: char, 33 pub(crate) char: char,
32} 34}
33 35
34pub(crate) struct Ident { 36pub(crate) struct Ident {
35 text: SmolStr, 37 pub(crate) text: SmolStr,
36} 38}