Class PythonAstParser
java.lang.Object
io.micronaut.python.processing.PythonAstParser
Parses Python source files into the internal Python processing model.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe result of a transformation. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()extractCalls(org.graalvm.polyglot.Source source) Extracts call metadata from Python source without executing it.static StringgetPackageNameOfSource(String srcDir, org.graalvm.polyglot.Source source) parse(String sources, String packageName, VisitorContext visitorContext) Parse the given sources located within the given source directory.parse(List<org.graalvm.polyglot.Source> sources, List<String> srcDirs, VisitorContext visitorContext) Parse the given sources located within the given source directory.process(String sources, VisitorContext visitorContext) process(String sources, String packageName, VisitorContext visitorContext) transform(VisitorContext visitorContext, String sources) @NotNull List<PythonAstParser.TransformResult> transform(VisitorContext visitorContext, org.graalvm.polyglot.Source... pythonSource)
-
Field Details
-
PYTHON
- See Also:
-
INJECT_RESOURCES
- See Also:
-
-
Constructor Details
-
PythonAstParser
public PythonAstParser()
-
-
Method Details
-
parse
-
parse
-
parse
-
parse
Parse the given sources located within the given source directory.- Parameters:
sources- The sourcessrcDir- The source directory- Returns:
- The parsed environment
-
parse
public PythonEnvironment parse(List<org.graalvm.polyglot.Source> sources, List<String> srcDirs, VisitorContext visitorContext) Parse the given sources located within the given source directory.- Parameters:
sources- The sourcessrcDirs- The source directoriesvisitorContext- The visitor context for constant resolution- Returns:
- The parsed environment
-
getPackageNameOfSource
-
transform
-
extractCalls
Extracts call metadata from Python source without executing it.- Parameters:
source- Python source- Returns:
- discovered calls
-
transform
@NotNull public @NotNull List<PythonAstParser.TransformResult> transform(VisitorContext visitorContext, org.graalvm.polyglot.Source... pythonSource) -
process
-
process
-
close
public void close()
-