subscript
¶
Module for subscripts definitions/declarations.
Classes:
-
SubscriptExpr
–AST class for subscript expressions.
SubscriptExpr
¶
SubscriptExpr(value: Expr, index: Optional[Expr] = None, lower: Optional[Expr] = None, upper: Optional[Expr] = None, step: Optional[Expr] = None, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: Expr
AST class for subscript expressions.
Parameters:
-
value
(Expr
) –The expression representing the object being indexed (e.g.,
-
an
– -
index
(Optional[Expr]
, default:None
) –The index of the variable.
-
lower
(Optional[Expr]
, default:None
) –The lower bound of the slice (inclusive).
-
upper
(Optional[Expr]
, default:None
) –The upper bound of the slice (exclusive).
-
step
(Optional[Expr]
, default:None
) –The step size for the slice.
-
loc
(SourceLocation
, default:NO_SOURCE_LOCATION
) –The source location of the expression.
-
parent
(Optional[ASTNodes]
, default:None
) –The parent AST node.
Methods:
-
get_struct
–Return the AST structure of the object.
-
to_json
–Return an json string that represents the object.
-
to_yaml
–Return an yaml string that represents the object.
Source code in src/astx/subscript.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/subscript.py
118 119 120 121 122 123 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
294 295 296 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
288 289 290 291 292 |
|