AST
This interface makes Python's ast
nodes accessible to Kotlin. It does not contain any complex logic but rather aims at making all Python ast
properties accessible to Kotlin (under the same name as in Python).
Python's AST object are mapped as close as possible to the original. Exceptions:
Types
Represents a ast.AST
node as returned by Python's ast
parser.
Several classes are duplicated in the python AST for async and non-async variants. This interface is a common interface for those AST classes.
Represents ast.expr
expressions. Note: do not confuse with
Note: We currently only support Module
s.
ast.ExceptHandler = class ExceptHandler(excepthandler) | ExceptHandler(expr? type, identifier? name, stmt* body)
Represents ast.Expr
expressions. Note: do not confuse with
This interface denotes that this is an "async" node.
ast.For and ast.AsyncFor are not related according to the Python syntax. However, they are so similar, that we make use of this interface to avoid a lot of duplicate code.
ast.FunctionDef and ast.AsyncFunctionDef are not related according to the Python syntax. However, they are so similar, that we make use of this interface to avoid a lot of duplicate code.
ast.With and ast.AsyncWith are not related according to the Python syntax. However, they are so similar, that we make use of this interface to avoid a lot of duplicate code.
TODO
Some nodes, such as ast.stmt
AST.BaseStmt and ast.expr
AST.BaseExpr nodes have extra location properties as implemented here.