@@ -197,6 +197,20 @@ pub struct MacroItems {
197197impl ast:: HasModuleItem for MacroItems { }
198198impl MacroItems { }
199199
200+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
201+ pub struct MacroEagerInput {
202+ pub ( crate ) syntax : SyntaxNode ,
203+ }
204+ impl MacroEagerInput {
205+ pub fn l_paren_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ '(' ] ) }
206+ pub fn exprs ( & self ) -> AstChildren < Expr > { support:: children ( & self . syntax ) }
207+ pub fn r_paren_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ ')' ] ) }
208+ pub fn l_curly_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ '{' ] ) }
209+ pub fn r_curly_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ '}' ] ) }
210+ pub fn l_brack_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ '[' ] ) }
211+ pub fn r_brack_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ ']' ] ) }
212+ }
213+
200214#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
201215pub struct MacroStmts {
202216 pub ( crate ) syntax : SyntaxNode ,
@@ -1922,6 +1936,17 @@ impl AstNode for MacroItems {
19221936 }
19231937 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
19241938}
1939+ impl AstNode for MacroEagerInput {
1940+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == MACRO_EAGER_INPUT }
1941+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
1942+ if Self :: can_cast ( syntax. kind ( ) ) {
1943+ Some ( Self { syntax } )
1944+ } else {
1945+ None
1946+ }
1947+ }
1948+ fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
1949+ }
19251950impl AstNode for MacroStmts {
19261951 fn can_cast ( kind : SyntaxKind ) -> bool { kind == MACRO_STMTS }
19271952 fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -4360,6 +4385,11 @@ impl std::fmt::Display for MacroItems {
43604385 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
43614386 }
43624387}
4388+ impl std:: fmt:: Display for MacroEagerInput {
4389+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
4390+ std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
4391+ }
4392+ }
43634393impl std:: fmt:: Display for MacroStmts {
43644394 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
43654395 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
0 commit comments