Merge #2628
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:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user