diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/macros.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/macros/mbe.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/macros/tt.rs | 14 |
3 files changed, 17 insertions, 7 deletions
diff --git a/crates/ra_hir/src/macros.rs b/crates/ra_hir/src/macros.rs index 6190b2c08..647df4260 100644 --- a/crates/ra_hir/src/macros.rs +++ b/crates/ra_hir/src/macros.rs | |||
@@ -200,3 +200,7 @@ pub(crate) fn expand_macro_invocation( | |||
200 | let (def, input) = MacroDef::from_call(macro_call)?; | 200 | let (def, input) = MacroDef::from_call(macro_call)?; |
201 | def.expand(input).map(Arc::new) | 201 | def.expand(input).map(Arc::new) |
202 | } | 202 | } |
203 | |||
204 | fn macro_call_to_tt(call: &ast::MacroCall) -> Option<tt::TokenTree> { | ||
205 | None | ||
206 | } | ||
diff --git a/crates/ra_hir/src/macros/mbe.rs b/crates/ra_hir/src/macros/mbe.rs index 5c1771a15..2d7965b62 100644 --- a/crates/ra_hir/src/macros/mbe.rs +++ b/crates/ra_hir/src/macros/mbe.rs | |||
@@ -1,5 +1,7 @@ | |||
1 | use ra_syntax::SmolStr; | 1 | use ra_syntax::SmolStr; |
2 | 2 | ||
3 | use crate::macros::tt; | ||
4 | |||
3 | struct MacroRules { | 5 | struct MacroRules { |
4 | rules: Vec<Rule>, | 6 | rules: Vec<Rule>, |
5 | } | 7 | } |
@@ -48,3 +50,7 @@ struct Ident { | |||
48 | struct Var { | 50 | struct Var { |
49 | text: SmolStr, | 51 | text: SmolStr, |
50 | } | 52 | } |
53 | |||
54 | fn parse(tt: tt::TokenTree) -> MacroRules { | ||
55 | MacroRules { rules: Vec::new() } | ||
56 | } | ||
diff --git a/crates/ra_hir/src/macros/tt.rs b/crates/ra_hir/src/macros/tt.rs index 7026ce3b3..817cb262e 100644 --- a/crates/ra_hir/src/macros/tt.rs +++ b/crates/ra_hir/src/macros/tt.rs | |||
@@ -1,36 +1,36 @@ | |||
1 | use ra_syntax::SmolStr; | 1 | use ra_syntax::SmolStr; |
2 | 2 | ||
3 | enum TokenTree { | 3 | pub(crate) enum TokenTree { |
4 | Leaf(Leaf), | 4 | Leaf(Leaf), |
5 | Subtree(Subtree), | 5 | Subtree(Subtree), |
6 | } | 6 | } |
7 | 7 | ||
8 | enum Leaf { | 8 | pub(crate) enum Leaf { |
9 | Literal(Literal), | 9 | Literal(Literal), |
10 | Punct(Punct), | 10 | Punct(Punct), |
11 | Ident(Ident), | 11 | Ident(Ident), |
12 | } | 12 | } |
13 | 13 | ||
14 | struct Subtree { | 14 | pub(crate) struct Subtree { |
15 | delimiter: Delimiter, | 15 | delimiter: Delimiter, |
16 | token_trees: Vec<TokenTree>, | 16 | token_trees: Vec<TokenTree>, |
17 | } | 17 | } |
18 | 18 | ||
19 | enum Delimiter { | 19 | pub(crate) enum Delimiter { |
20 | Parenthesis, | 20 | Parenthesis, |
21 | Brace, | 21 | Brace, |
22 | Bracket, | 22 | Bracket, |
23 | None, | 23 | None, |
24 | } | 24 | } |
25 | 25 | ||
26 | struct Literal { | 26 | pub(crate) struct Literal { |
27 | text: SmolStr, | 27 | text: SmolStr, |
28 | } | 28 | } |
29 | 29 | ||
30 | struct Punct { | 30 | pub(crate) struct Punct { |
31 | char: char, | 31 | char: char, |
32 | } | 32 | } |
33 | 33 | ||
34 | struct Ident { | 34 | pub(crate) struct Ident { |
35 | text: SmolStr, | 35 | text: SmolStr, |
36 | } | 36 | } |