mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-01 15:58:47 +00:00
51 lines
566 B
Rust
51 lines
566 B
Rust
|
use ra_syntax::SmolStr;
|
||
|
|
||
|
struct MacroRules {
|
||
|
rules: Vec<Rule>,
|
||
|
}
|
||
|
|
||
|
struct Rule {
|
||
|
lhs: TokenTree,
|
||
|
rhs: TokenTree,
|
||
|
}
|
||
|
|
||
|
enum TokenTree {
|
||
|
Leaf(Leaf),
|
||
|
Subtree(Subtree),
|
||
|
}
|
||
|
|
||
|
enum Leaf {
|
||
|
Literal(Literal),
|
||
|
Punct(Punct),
|
||
|
Ident(Ident),
|
||
|
Var(Var),
|
||
|
}
|
||
|
|
||
|
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,
|
||
|
}
|
||
|
|
||
|
struct Var {
|
||
|
text: SmolStr,
|
||
|
}
|