mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
add conversion boilerplate
This commit is contained in:
parent
ca327f35ad
commit
a4342a7fee
@ -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
|
||||
}
|
||||
|
@ -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() }
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user