@@ -197,6 +197,20 @@ pub struct MacroItems {
197
197
impl ast:: HasModuleItem for MacroItems { }
198
198
impl MacroItems { }
199
199
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
+
200
214
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
201
215
pub struct MacroStmts {
202
216
pub ( crate ) syntax : SyntaxNode ,
@@ -1922,6 +1936,17 @@ impl AstNode for MacroItems {
1922
1936
}
1923
1937
fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
1924
1938
}
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
+ }
1925
1950
impl AstNode for MacroStmts {
1926
1951
fn can_cast ( kind : SyntaxKind ) -> bool { kind == MACRO_STMTS }
1927
1952
fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -4360,6 +4385,11 @@ impl std::fmt::Display for MacroItems {
4360
4385
std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
4361
4386
}
4362
4387
}
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
+ }
4363
4393
impl std:: fmt:: Display for MacroStmts {
4364
4394
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
4365
4395
std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
0 commit comments