1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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
//! Python AST node definitions and utilities.
//!
//! AST nodes are very similary defined like [Python AST](https://docs.python.org/3/library/ast.html).
//! But a few exceptions exist due to parser optimization.
//! They can be transformed to matching Python-styled AST in reasonable cost.
//!
//! [PythonArguments] is replaced by [Arguments]. The new [Arguments] type representation uses a new type
//! [ArgWithDefault] to represent arguments with default values. See each type documentation for more details.
//!
//! A few top-level sum types are renamed to human friendly names.
//! [CmpOp] refers `cmpop`
//! [UnaryOp] refers `unaryop`
//! [BoolOp] refers `boolop`
//! [WithItem] refers `withitem`
//! [ExceptHandler] refers `excepthandler`
//!
mod builtin;
mod generic;
mod impls;
mod ranged;
#[cfg(feature = "unparse")]
mod unparse;
#[cfg(feature = "malachite-bigint")]
pub use malachite_bigint as bigint;
#[cfg(feature = "num-bigint")]
pub use num_bigint as bigint;
pub use builtin::*;
pub use generic::*;
pub use ranged::Ranged;
pub use rustpython_parser_core::{text_size, ConversionFlag};
pub trait Node {
const NAME: &'static str;
const FIELD_NAMES: &'static [&'static str];
}
#[cfg(feature = "fold")]
pub mod fold;
#[cfg(feature = "fold")]
pub use fold::Fold;
#[cfg(feature = "visitor")]
mod visitor {
use super::generic::*;
include!("gen/visitor.rs");
}
#[cfg(feature = "location")]
pub mod located;
#[cfg(feature = "location")]
mod source_locator;
#[cfg(feature = "location")]
pub use rustpython_parser_core::source_code;
#[cfg(feature = "visitor")]
pub use visitor::Visitor;
#[cfg(feature = "constant-optimization")]
mod optimizer;
#[cfg(feature = "constant-optimization")]
pub use optimizer::ConstantOptimizer;