]> git.lizzy.rs Git - rust.git/commitdiff
add conversion boilerplate
authorAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 30 Jan 2019 20:25:02 +0000 (23:25 +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/mbe.rs
crates/ra_hir/src/macros/tt.rs

index 6190b2c084ab27c4b968c798549fbaa7d4e97837..647df4260cf6876b0cc82261ec289d370a1db10e 100644 (file)
@@ -200,3 +200,7 @@ pub(crate) fn expand_macro_invocation(
     let (def, input) = MacroDef::from_call(macro_call)?;
     def.expand(input).map(Arc::new)
 }
+
+fn macro_call_to_tt(call: &ast::MacroCall) -> Option<tt::TokenTree> {
+    None
+}
index 5c1771a15d87b8ede1c516e2fd016f27ed99872c..2d7965b62103f4ff6cdb955ae9d44201565becfb 100644 (file)
@@ -1,5 +1,7 @@
 use ra_syntax::SmolStr;
 
+use crate::macros::tt;
+
 struct MacroRules {
     rules: Vec<Rule>,
 }
@@ -48,3 +50,7 @@ struct Ident {
 struct Var {
     text: SmolStr,
 }
+
+fn parse(tt: tt::TokenTree) -> MacroRules {
+    MacroRules { rules: Vec::new() }
+}
index 7026ce3b3f928f61eb634a8e16b821a2b511c8f6..817cb262ea888083ddfc0847baffc0f50ca19376 100644 (file)
@@ -1,36 +1,36 @@
 use ra_syntax::SmolStr;
 
-enum TokenTree {
+pub(crate) enum TokenTree {
     Leaf(Leaf),
     Subtree(Subtree),
 }
 
-enum Leaf {
+pub(crate) enum Leaf {
     Literal(Literal),
     Punct(Punct),
     Ident(Ident),
 }
 
-struct Subtree {
+pub(crate) struct Subtree {
     delimiter: Delimiter,
     token_trees: Vec<TokenTree>,
 }
 
-enum Delimiter {
+pub(crate) enum Delimiter {
     Parenthesis,
     Brace,
     Bracket,
     None,
 }
 
-struct Literal {
+pub(crate) struct Literal {
     text: SmolStr,
 }
 
-struct Punct {
+pub(crate) struct Punct {
     char: char,
 }
 
-struct Ident {
+pub(crate) struct Ident {
     text: SmolStr,
 }