aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_macros/src/mbe.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_macros/src/mbe.rs')
-rw-r--r--crates/ra_macros/src/mbe.rs72
1 files changed, 0 insertions, 72 deletions
diff --git a/crates/ra_macros/src/mbe.rs b/crates/ra_macros/src/mbe.rs
deleted file mode 100644
index d4106a41c..000000000
--- a/crates/ra_macros/src/mbe.rs
+++ /dev/null
@@ -1,72 +0,0 @@
1use smol_str::SmolStr;
2
3pub(crate) use crate::tt::{Delimiter, Punct};
4
5pub use crate::{
6 mbe_parser::parse,
7 mbe_expander::exapnd,
8};
9
10#[derive(Debug)]
11pub struct MacroRules {
12 pub(crate) rules: Vec<Rule>,
13}
14
15#[derive(Debug)]
16pub(crate) struct Rule {
17 pub(crate) lhs: Subtree,
18 pub(crate) rhs: Subtree,
19}
20
21#[derive(Debug)]
22pub(crate) enum TokenTree {
23 Leaf(Leaf),
24 Subtree(Subtree),
25 Repeat(Repeat),
26}
27impl_froms!(TokenTree: Leaf, Subtree, Repeat);
28
29#[derive(Debug)]
30pub(crate) enum Leaf {
31 Literal(Literal),
32 Punct(Punct),
33 Ident(Ident),
34 Var(Var),
35}
36impl_froms!(Leaf: Literal, Punct, Ident, Var);
37
38#[derive(Debug)]
39pub(crate) struct Subtree {
40 pub(crate) delimiter: Delimiter,
41 pub(crate) token_trees: Vec<TokenTree>,
42}
43
44#[derive(Debug)]
45pub(crate) struct Repeat {
46 pub(crate) subtree: Subtree,
47 pub(crate) kind: RepeatKind,
48 pub(crate) separator: Option<char>,
49}
50
51#[derive(Debug)]
52pub(crate) enum RepeatKind {
53 ZeroOrMore,
54 OneOrMore,
55 ZeroOrOne,
56}
57
58#[derive(Debug)]
59pub(crate) struct Literal {
60 pub(crate) text: SmolStr,
61}
62
63#[derive(Debug)]
64pub(crate) struct Ident {
65 pub(crate) text: SmolStr,
66}
67
68#[derive(Debug)]
69pub(crate) struct Var {
70 pub(crate) text: SmolStr,
71 pub(crate) kind: Option<SmolStr>,
72}