@@ -344,6 +344,131 @@ def get_struct(self, simplified: bool = False) -> ReprStruct:
344
344
return self ._prepare_struct (key , value , simplified )
345
345
346
346
347
+ @public
348
+ @typechecked
349
+ class AsyncForRangeLoopStmt (StatementType ):
350
+ """AST class for asynchronous `For` Range Statement."""
351
+
352
+ variable : InlineVariableDeclaration
353
+ start : Optional [Expr ]
354
+ end : Expr
355
+ step : Optional [Expr ]
356
+ body : Block
357
+
358
+ def __init__ (
359
+ self ,
360
+ variable : InlineVariableDeclaration ,
361
+ start : Optional [Expr ],
362
+ end : Expr ,
363
+ step : Optional [Expr ],
364
+ body : Block ,
365
+ loc : SourceLocation = NO_SOURCE_LOCATION ,
366
+ parent : Optional [ASTNodes ] = None ,
367
+ ) -> None :
368
+ """Initialize the AsyncForRangeLoopStmt instance."""
369
+ super ().__init__ (loc = loc , parent = parent )
370
+ self .variable = variable
371
+ self .start = start
372
+ self .end = end
373
+ self .step = step
374
+ self .body = body
375
+ self .kind = ASTKind .AsyncRangeLoopStmtKind
376
+
377
+ def __str__ (self ) -> str :
378
+ """Return a string that represents the object."""
379
+ start = self .start
380
+ end = self .end
381
+ step = self .step
382
+ var_name = self .variable .name
383
+ return f"AsyncForRangeLoopStmt({ var_name } =[{ start } :{ end } :{ step } ])"
384
+
385
+ def get_struct (self , simplified : bool = False ) -> ReprStruct :
386
+ """Return the AST structure of the object."""
387
+ for_start = {
388
+ "start" : {}
389
+ if self .start is None
390
+ else self .start .get_struct (simplified )
391
+ }
392
+ for_end = {"end" : self .end .get_struct (simplified )}
393
+ for_step = {
394
+ "step" : {}
395
+ if self .step is None
396
+ else self .step .get_struct (simplified )
397
+ }
398
+ for_body = self .body .get_struct (simplified )
399
+
400
+ key = "ASYNC-FOR-RANGE-LOOP-STMT"
401
+ value : ReprStruct = {
402
+ ** cast (DictDataTypesStruct , for_start ),
403
+ ** cast (DictDataTypesStruct , for_end ),
404
+ ** cast (DictDataTypesStruct , for_step ),
405
+ ** cast (DictDataTypesStruct , for_body ),
406
+ }
407
+ return self ._prepare_struct (key , value , simplified )
408
+
409
+
410
+ @public
411
+ @typechecked
412
+ class AsyncForRangeLoopExpr (Expr ):
413
+ """AST class for asynchronous `For` Range Expression."""
414
+
415
+ variable : InlineVariableDeclaration
416
+ start : Optional [Expr ]
417
+ end : Expr
418
+ step : Optional [Expr ]
419
+ body : Block
420
+
421
+ def __init__ (
422
+ self ,
423
+ variable : InlineVariableDeclaration ,
424
+ start : Optional [Expr ],
425
+ end : Expr ,
426
+ step : Optional [Expr ],
427
+ body : Block ,
428
+ loc : SourceLocation = NO_SOURCE_LOCATION ,
429
+ parent : Optional [ASTNodes ] = None ,
430
+ ) -> None :
431
+ """Initialize the AsyncForRangeLoopExpr instance."""
432
+ super ().__init__ (loc = loc , parent = parent )
433
+ self .variable = variable
434
+ self .start = start
435
+ self .end = end
436
+ self .step = step
437
+ self .body = body
438
+ self .kind = ASTKind .AsyncRangeLoopExprKind
439
+
440
+ def __str__ (self ) -> str :
441
+ """Return a string that represents the object."""
442
+ var_name = self .variable .name
443
+ return f"AsyncForRangeLoopExpr[{ var_name } ]"
444
+
445
+ def get_struct (self , simplified : bool = False ) -> ReprStruct :
446
+ """Return the AST structure of the object."""
447
+ for_var = {"var" : self .variable .get_struct (simplified )}
448
+ for_start = {
449
+ "start" : {}
450
+ if self .start is None
451
+ else self .start .get_struct (simplified )
452
+ }
453
+ for_end = {"end" : self .end .get_struct (simplified )}
454
+ for_step = {
455
+ "step" : {}
456
+ if self .step is None
457
+ else self .step .get_struct (simplified )
458
+ }
459
+ for_body = self .body .get_struct (simplified )
460
+
461
+ key = "ASYNC-FOR-RANGE-LOOP-EXPR"
462
+ value : ReprStruct = {
463
+ ** cast (DictDataTypesStruct , for_var ),
464
+ ** cast (DictDataTypesStruct , for_start ),
465
+ ** cast (DictDataTypesStruct , for_end ),
466
+ ** cast (DictDataTypesStruct , for_step ),
467
+ ** cast (DictDataTypesStruct , for_body ),
468
+ }
469
+ return self ._prepare_struct (key , value , simplified )
470
+
471
+
347
472
@public
348
473
@typechecked
349
474
class WhileStmt (StatementType ):
0 commit comments