add conversion boilerplate

This commit is contained in:
Aleksey Kladov 2019-01-30 23:25:02 +03:00
parent ca327f35ad
commit a4342a7fee
3 changed files with 17 additions and 7 deletions

View 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
}

View 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() }
}

View 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,
}