callables
¶
Module for callable ASTx.
Classes:
-
Argument
–AST class for argument definition.
-
Arguments
–AST class for argument definition.
-
Function
–AST class for function definition.
-
FunctionCall
–AST class for function call.
-
FunctionPrototype
–AST class for function prototype declaration.
-
FunctionReturn
–AST class for function
return
statement. -
LambdaExpr
–AST class for lambda expressions.
Argument
¶
Argument(name: str, type_: DataType, mutability: MutabilityKind = constant, default: Expr = UNDEFINED, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: Variable
AST class for argument definition.
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/callables.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/callables.py
60 61 62 63 64 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|
Arguments
¶
AST class for argument definition.
Methods:
-
append
–Append a new node to the stack.
-
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/callables.py
72 73 74 75 |
|
append
¶
append(value: ASTType) -> None
Append a new node to the stack.
Source code in src/astx/base.py
305 306 307 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/callables.py
81 82 83 84 85 86 87 88 89 90 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|
Function
¶
Function(prototype: FunctionPrototype, body: Block, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: StatementType
AST class for function definition.
Methods:
-
get_struct
–Get the AST structure that represent the object.
-
to_json
–Return an json string that represents the object.
-
to_yaml
–Return an yaml string that represents the object.
Attributes:
Source code in src/astx/callables.py
216 217 218 219 220 221 222 223 224 225 226 227 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Get the AST structure that represent the object.
Source code in src/astx/callables.py
247 248 249 250 251 252 253 254 255 256 257 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|
FunctionCall
¶
FunctionCall(fn: Function, args: Iterable[DataType], type_: DataType = AnyType(), loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: DataType
AST class for function call.
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/callables.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/callables.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|
FunctionPrototype
¶
FunctionPrototype(name: str, args: Arguments, return_type: AnyType, scope: ScopeKind = global_, visibility: VisibilityKind = public, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: StatementType
AST class for function prototype declaration.
Methods:
-
get_struct
–Get the AST structure that represent 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/callables.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Get the AST structure that represent the object.
Source code in src/astx/callables.py
174 175 176 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|
FunctionReturn
¶
FunctionReturn(value: DataType, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: StatementType
AST class for function return
statement.
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/callables.py
186 187 188 189 190 191 192 193 194 195 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the object.
Source code in src/astx/callables.py
201 202 203 204 205 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|
LambdaExpr
¶
LambdaExpr(body: Expr, params: Arguments = Arguments(), loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Bases: Expr
AST class for lambda expressions.
Methods:
-
get_struct
–Return the AST structure of the lambda expression.
-
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/callables.py
268 269 270 271 272 273 274 275 276 277 278 |
|
get_struct
¶
get_struct(simplified: bool = False) -> ReprStruct
Return the AST structure of the lambda expression.
Source code in src/astx/callables.py
285 286 287 288 289 290 291 292 |
|
to_json
¶
Return an json string that represents the object.
Source code in src/astx/base.py
265 266 267 |
|
to_yaml
¶
Return an yaml string that represents the object.
Source code in src/astx/base.py
259 260 261 262 263 |
|