diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-19 09:56:39 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-19 09:56:39 +0100 |
commit | ab0a96586fd54858106cb6ac112d61eb657426f6 (patch) | |
tree | 86bbf2601069f6b0007dc181c824ef706d08c60d /crates/ra_syntax/src/grammar.ron | |
parent | d55f1136d6444b1f50b9092c36a976d0e1c26202 (diff) | |
parent | a6d51e09610989821aaf79871bcab0661c9b0f74 (diff) |
Merge #1148
1148: Add token_tree_to_xxx functions r=matklad a=edwin0cheng
<del>As discus in PR #1147 , this PR added a `mbe::MacroKind` .
Currently only 2 kind of macro are supported, `SourceFile` and `Block`.</del>
Added following functions for `tt::TokenTree` and `ast::Node` conversion:
* token_tree_to_expr
* token_tree_to_pat
* token_tree_to_ty
* token_tree_to_macro_stmts
* token_tree_to_macro_items
And added two new syntax kind:
* MACRO_ITEMS
* MACRO_STMTS
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/grammar.ron')
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index b41241287..663e3a2f9 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -247,6 +247,10 @@ Grammar( | |||
247 | "ARG_LIST", | 247 | "ARG_LIST", |
248 | "TYPE_BOUND", | 248 | "TYPE_BOUND", |
249 | "TYPE_BOUND_LIST", | 249 | "TYPE_BOUND_LIST", |
250 | |||
251 | // macro related | ||
252 | "MACRO_ITEMS", | ||
253 | "MACRO_STMTS", | ||
250 | ], | 254 | ], |
251 | ast: { | 255 | ast: { |
252 | "SourceFile": ( | 256 | "SourceFile": ( |
@@ -668,5 +672,16 @@ Grammar( | |||
668 | "TypeArg": (options: ["TypeRef"]), | 672 | "TypeArg": (options: ["TypeRef"]), |
669 | "AssocTypeArg": (options: ["NameRef", "TypeRef"]), | 673 | "AssocTypeArg": (options: ["NameRef", "TypeRef"]), |
670 | "LifetimeArg": (), | 674 | "LifetimeArg": (), |
675 | |||
676 | "MacroItems": ( | ||
677 | traits: [ "ModuleItemOwner", "FnDefOwner" ], | ||
678 | ), | ||
679 | |||
680 | "MacroStmts" : ( | ||
681 | options: [ "Expr" ], | ||
682 | collections: [ | ||
683 | ["statements", "Stmt"], | ||
684 | ], | ||
685 | ) | ||
671 | }, | 686 | }, |
672 | ) | 687 | ) |