Crate python_ast

Source

Re-exports§

pub use ast::*;
pub use codegen::*;
pub use isidentifier::*;
pub use scope::*;
pub use symbols::*;
pub use parser::*;
pub use result::*;
pub use datamodel::*;
pub use traits::*;
pub use parser_utils::*;

Modules§

ast
python-ast-rs
codegen
Code generation for Python ASTs.
datamodel
Module representing the Python Data Model in Rust form. See: here.
isidentifier
This module uses Python to determine if a given string is a valid Python identifier or not. See here
macros
parser
parser_utils
pytypes
result
scope
symbols
Implements a Python-compatilble symbol table for Rust.
traits

Macros§

create_parse_test
Macro for generating test functions for AST parsing. Reduces duplication in test code.
extract_py_attr
Macro for extracting PyAny attributes with consistent error handling.
extract_py_type_name
Macro for extracting PyAny type names with error handling.
extract_with_context
Macro for generating PyAny attribute extraction with error context.
impl_binary_op_from_py
Macro for generating binary operator FromPyObject implementations. This handles the common pattern of extracting left, right, and op from Python binary operators.
impl_codegen_with_custom
Macro for implementing CodeGen with custom code generation logic.
impl_from_py_object_for_op_enum
Macros for reducing code duplication in the python-ast library. Macro for generating FromPyObject implementations for operator enums. This reduces the boilerplate for extracting Python operator objects.
impl_node_with_positions
Macro for generating Node trait implementations with optional position fields. This macro automatically implements the Node trait for types that have position fields.
impl_standard_codegen
Macro for generating standard CodeGen trait implementations. This reduces boilerplate for the common pattern of CodeGen implementations.
operator_match_arms
Generates repetitive match arms for operator conversions.
symbol_table_test
Macro for generating symbol table tests with consistent patterns.

Type Aliases§

PyResult
Represents the result of a Python call.