aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/macros.rs4
-rw-r--r--crates/ra_hir/src/macros/mbe.rs6
-rw-r--r--crates/ra_hir/src/macros/tt.rs14
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
204fn 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 @@
1use ra_syntax::SmolStr; 1use ra_syntax::SmolStr;
2 2
3use crate::macros::tt;
4
3struct MacroRules { 5struct MacroRules {
4 rules: Vec<Rule>, 6 rules: Vec<Rule>,
5} 7}
@@ -48,3 +50,7 @@ struct Ident {
48struct Var { 50struct Var {
49 text: SmolStr, 51 text: SmolStr,
50} 52}
53
54fn 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 @@
1use ra_syntax::SmolStr; 1use ra_syntax::SmolStr;
2 2
3enum TokenTree { 3pub(crate) enum TokenTree {
4 Leaf(Leaf), 4 Leaf(Leaf),
5 Subtree(Subtree), 5 Subtree(Subtree),
6} 6}
7 7
8enum Leaf { 8pub(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
14struct Subtree { 14pub(crate) struct Subtree {
15 delimiter: Delimiter, 15 delimiter: Delimiter,
16 token_trees: Vec<TokenTree>, 16 token_trees: Vec<TokenTree>,
17} 17}
18 18
19enum Delimiter { 19pub(crate) enum Delimiter {
20 Parenthesis, 20 Parenthesis,
21 Brace, 21 Brace,
22 Bracket, 22 Bracket,
23 None, 23 None,
24} 24}
25 25
26struct Literal { 26pub(crate) struct Literal {
27 text: SmolStr, 27 text: SmolStr,
28} 28}
29 29
30struct Punct { 30pub(crate) struct Punct {
31 char: char, 31 char: char,
32} 32}
33 33
34struct Ident { 34pub(crate) struct Ident {
35 text: SmolStr, 35 text: SmolStr,
36} 36}