aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/macros
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/macros')
-rw-r--r--crates/ra_hir/src/macros/mbe.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/crates/ra_hir/src/macros/mbe.rs b/crates/ra_hir/src/macros/mbe.rs
new file mode 100644
index 000000000..5c1771a15
--- /dev/null
+++ b/crates/ra_hir/src/macros/mbe.rs
@@ -0,0 +1,50 @@
1use ra_syntax::SmolStr;
2
3struct MacroRules {
4 rules: Vec<Rule>,
5}
6
7struct Rule {
8 lhs: TokenTree,
9 rhs: TokenTree,
10}
11
12enum TokenTree {
13 Leaf(Leaf),
14 Subtree(Subtree),
15}
16
17enum Leaf {
18 Literal(Literal),
19 Punct(Punct),
20 Ident(Ident),
21 Var(Var),
22}
23
24struct Subtree {
25 delimiter: Delimiter,
26 token_trees: Vec<TokenTree>,
27}
28
29enum Delimiter {
30 Parenthesis,
31 Brace,
32 Bracket,
33 None,
34}
35
36struct Literal {
37 text: SmolStr,
38}
39
40struct Punct {
41 char: char,
42}
43
44struct Ident {
45 text: SmolStr,
46}
47
48struct Var {
49 text: SmolStr,
50}