2628: Add macro 2.0 support in parser r=matklad a=edwin0cheng

This PR added a new syntax kind : `MACRO_DEF` and a keyword `MACRO_KW`

there are two syntax for declarative macro 2.0 :
1. Normal : `macro m { ($i:ident) => {} }` , which handle similar to legacy one. 
2. Call like: `macro m($i:ident) {}`, it produces a single token tree which have two child token trees : `($i:ident)` and `{}`

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
bors[bot]
2019-12-21 10:47:47 +00:00
committed by GitHub
10 changed files with 279 additions and 331 deletions

View File

@@ -94,7 +94,8 @@ Grammar(
"return",
"try",
"box",
"await"
"await",
"macro"
],
contextual_keywords: [
"auto",
@@ -140,6 +141,7 @@ Grammar(
"TYPE_ALIAS_DEF",
"MACRO_CALL",
"TOKEN_TREE",
"MACRO_DEF",
"PAREN_TYPE",
"TUPLE_TYPE",