]> git.lizzy.rs Git - rust.git/commitdiff
start token tree module
authorAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 30 Jan 2019 20:02:27 +0000 (23:02 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Thu, 31 Jan 2019 20:23:30 +0000 (22:23 +0200)
crates/ra_hir/src/macros.rs
crates/ra_hir/src/macros/token_tree.rs [new file with mode: 0644]

index 7ca34d434511d670a5ae22bb38943ca3d6a4a842..9aa70683656018850d28ba01c1bb0d81b5b7e5fb 100644 (file)
@@ -1,3 +1,6 @@
+#[allow(unused)]
+mod token_tree;
+
 /// Machinery for macro expansion.
 ///
 /// One of the more complicated things about macros is managing the source code
diff --git a/crates/ra_hir/src/macros/token_tree.rs b/crates/ra_hir/src/macros/token_tree.rs
new file mode 100644 (file)
index 0000000..7026ce3
--- /dev/null
@@ -0,0 +1,36 @@
+use ra_syntax::SmolStr;
+
+enum TokenTree {
+    Leaf(Leaf),
+    Subtree(Subtree),
+}
+
+enum Leaf {
+    Literal(Literal),
+    Punct(Punct),
+    Ident(Ident),
+}
+
+struct Subtree {
+    delimiter: Delimiter,
+    token_trees: Vec<TokenTree>,
+}
+
+enum Delimiter {
+    Parenthesis,
+    Brace,
+    Bracket,
+    None,
+}
+
+struct Literal {
+    text: SmolStr,
+}
+
+struct Punct {
+    char: char,
+}
+
+struct Ident {
+    text: SmolStr,
+}