diff --git a/ast-pyo3/src/gen/to_py_ast.rs b/ast-pyo3/src/gen/to_py_ast.rs index a159d0a..c3288f2 100644 --- a/ast-pyo3/src/gen/to_py_ast.rs +++ b/ast-pyo3/src/gen/to_py_ast.rs @@ -520,7 +520,7 @@ impl PyNode for ast::ExprContextDel { } } -impl PyNode for ast::Boolop { +impl PyNode for ast::BoolOp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -528,7 +528,7 @@ impl PyNode for ast::Boolop { } } -impl PyNode for ast::BoolopAnd { +impl PyNode for ast::BoolOpAnd { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -536,7 +536,7 @@ impl PyNode for ast::BoolopAnd { } } -impl PyNode for ast::BoolopOr { +impl PyNode for ast::BoolOpOr { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -656,7 +656,7 @@ impl PyNode for ast::OperatorFloorDiv { } } -impl PyNode for ast::Unaryop { +impl PyNode for ast::UnaryOp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -664,7 +664,7 @@ impl PyNode for ast::Unaryop { } } -impl PyNode for ast::UnaryopInvert { +impl PyNode for ast::UnaryOpInvert { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -672,7 +672,7 @@ impl PyNode for ast::UnaryopInvert { } } -impl PyNode for ast::UnaryopNot { +impl PyNode for ast::UnaryOpNot { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -680,7 +680,7 @@ impl PyNode for ast::UnaryopNot { } } -impl PyNode for ast::UnaryopUAdd { +impl PyNode for ast::UnaryOpUAdd { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -688,7 +688,7 @@ impl PyNode for ast::UnaryopUAdd { } } -impl PyNode for ast::UnaryopUSub { +impl PyNode for ast::UnaryOpUSub { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -696,7 +696,7 @@ impl PyNode for ast::UnaryopUSub { } } -impl PyNode for ast::Cmpop { +impl PyNode for ast::CmpOp { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -704,7 +704,7 @@ impl PyNode for ast::Cmpop { } } -impl PyNode for ast::CmpopEq { +impl PyNode for ast::CmpOpEq { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -712,7 +712,7 @@ impl PyNode for ast::CmpopEq { } } -impl PyNode for ast::CmpopNotEq { +impl PyNode for ast::CmpOpNotEq { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -720,7 +720,7 @@ impl PyNode for ast::CmpopNotEq { } } -impl PyNode for ast::CmpopLt { +impl PyNode for ast::CmpOpLt { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -728,7 +728,7 @@ impl PyNode for ast::CmpopLt { } } -impl PyNode for ast::CmpopLtE { +impl PyNode for ast::CmpOpLtE { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -736,7 +736,7 @@ impl PyNode for ast::CmpopLtE { } } -impl PyNode for ast::CmpopGt { +impl PyNode for ast::CmpOpGt { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -744,7 +744,7 @@ impl PyNode for ast::CmpopGt { } } -impl PyNode for ast::CmpopGtE { +impl PyNode for ast::CmpOpGtE { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -752,7 +752,7 @@ impl PyNode for ast::CmpopGtE { } } -impl PyNode for ast::CmpopIs { +impl PyNode for ast::CmpOpIs { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -760,7 +760,7 @@ impl PyNode for ast::CmpopIs { } } -impl PyNode for ast::CmpopIsNot { +impl PyNode for ast::CmpOpIsNot { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -768,7 +768,7 @@ impl PyNode for ast::CmpopIsNot { } } -impl PyNode for ast::CmpopIn { +impl PyNode for ast::CmpOpIn { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -776,7 +776,7 @@ impl PyNode for ast::CmpopIn { } } -impl PyNode for ast::CmpopNotIn { +impl PyNode for ast::CmpOpNotIn { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -792,7 +792,7 @@ impl PyNode for ast::Comprehension { } } -impl PyNode for ast::Excepthandler { +impl PyNode for ast::ExceptHandler { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -800,7 +800,7 @@ impl PyNode for ast::Excepthandler { } } -impl PyNode for ast::ExcepthandlerExceptHandler { +impl PyNode for ast::ExceptHandlerExceptHandler { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -840,7 +840,7 @@ impl PyNode for ast::Alias { } } -impl PyNode for ast::Withitem { +impl PyNode for ast::WithItem { #[inline] fn py_type_cache() -> &'static OnceCell<(Py, Py)> { static PY_TYPE: OnceCell<(Py, Py)> = OnceCell::new(); @@ -956,12 +956,12 @@ impl ToPyAst for ast::ExprContext { } } -impl ToPyAst for ast::Boolop { +impl ToPyAst for ast::BoolOp { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cell = match &self { - ast::Boolop::And => ast::BoolopAnd::py_type_cache(), - ast::Boolop::Or => ast::BoolopOr::py_type_cache(), + ast::BoolOp::And => ast::BoolOpAnd::py_type_cache(), + ast::BoolOp::Or => ast::BoolOpOr::py_type_cache(), }; Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } @@ -989,33 +989,33 @@ impl ToPyAst for ast::Operator { } } -impl ToPyAst for ast::Unaryop { +impl ToPyAst for ast::UnaryOp { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cell = match &self { - ast::Unaryop::Invert => ast::UnaryopInvert::py_type_cache(), - ast::Unaryop::Not => ast::UnaryopNot::py_type_cache(), - ast::Unaryop::UAdd => ast::UnaryopUAdd::py_type_cache(), - ast::Unaryop::USub => ast::UnaryopUSub::py_type_cache(), + ast::UnaryOp::Invert => ast::UnaryOpInvert::py_type_cache(), + ast::UnaryOp::Not => ast::UnaryOpNot::py_type_cache(), + ast::UnaryOp::UAdd => ast::UnaryOpUAdd::py_type_cache(), + ast::UnaryOp::USub => ast::UnaryOpUSub::py_type_cache(), }; Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } } -impl ToPyAst for ast::Cmpop { +impl ToPyAst for ast::CmpOp { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cell = match &self { - ast::Cmpop::Eq => ast::CmpopEq::py_type_cache(), - ast::Cmpop::NotEq => ast::CmpopNotEq::py_type_cache(), - ast::Cmpop::Lt => ast::CmpopLt::py_type_cache(), - ast::Cmpop::LtE => ast::CmpopLtE::py_type_cache(), - ast::Cmpop::Gt => ast::CmpopGt::py_type_cache(), - ast::Cmpop::GtE => ast::CmpopGtE::py_type_cache(), - ast::Cmpop::Is => ast::CmpopIs::py_type_cache(), - ast::Cmpop::IsNot => ast::CmpopIsNot::py_type_cache(), - ast::Cmpop::In => ast::CmpopIn::py_type_cache(), - ast::Cmpop::NotIn => ast::CmpopNotIn::py_type_cache(), + ast::CmpOp::Eq => ast::CmpOpEq::py_type_cache(), + ast::CmpOp::NotEq => ast::CmpOpNotEq::py_type_cache(), + ast::CmpOp::Lt => ast::CmpOpLt::py_type_cache(), + ast::CmpOp::LtE => ast::CmpOpLtE::py_type_cache(), + ast::CmpOp::Gt => ast::CmpOpGt::py_type_cache(), + ast::CmpOp::GtE => ast::CmpOpGtE::py_type_cache(), + ast::CmpOp::Is => ast::CmpOpIs::py_type_cache(), + ast::CmpOp::IsNot => ast::CmpOpIsNot::py_type_cache(), + ast::CmpOp::In => ast::CmpOpIn::py_type_cache(), + ast::CmpOp::NotIn => ast::CmpOpNotIn::py_type_cache(), }; Ok(Py::::as_ref(&cell.get().unwrap().1, py)) } @@ -2256,17 +2256,17 @@ impl ToPyAst for ast::Comprehension { } } -impl ToPyAst for ast::Excepthandler { +impl ToPyAst for ast::ExceptHandler { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { - ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?, + ast::ExceptHandler::ExceptHandler(cons) => cons.to_py_ast(py)?, }; Ok(instance) } } -impl ToPyAst for ast::ExcepthandlerExceptHandler { +impl ToPyAst for ast::ExceptHandlerExceptHandler { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); @@ -2376,7 +2376,7 @@ impl ToPyAst for ast::Alias { } } -impl ToPyAst for ast::Withitem { +impl ToPyAst for ast::WithItem { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); @@ -4272,17 +4272,17 @@ impl ToPyAst for ast::Comprehension { } } -impl ToPyAst for ast::Excepthandler { +impl ToPyAst for ast::ExceptHandler { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let instance = match &self { - ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?, + ast::ExceptHandler::ExceptHandler(cons) => cons.to_py_ast(py)?, }; Ok(instance) } } -impl ToPyAst for ast::ExcepthandlerExceptHandler { +impl ToPyAst for ast::ExceptHandlerExceptHandler { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); @@ -4424,7 +4424,7 @@ impl ToPyAst for ast::Alias { } } -impl ToPyAst for ast::Withitem { +impl ToPyAst for ast::WithItem { #[inline] fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> { let cache = Self::py_type_cache().get().unwrap(); @@ -4784,9 +4784,9 @@ fn init_types(py: Python) -> PyResult<()> { cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; @@ -4801,30 +4801,30 @@ fn init_types(py: Python) -> PyResult<()> { cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; - cache_py_type::(ast_module)?; + cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; cache_py_type::(ast_module)?; diff --git a/ast-pyo3/src/gen/wrapper_located.rs b/ast-pyo3/src/gen/wrapper_located.rs index d2e7b21..0aebc63 100644 --- a/ast-pyo3/src/gen/wrapper_located.rs +++ b/ast-pyo3/src/gen/wrapper_located.rs @@ -2714,47 +2714,47 @@ impl ToPyObject for ExprContextDel { #[pyclass(module="rustpython_ast.located", name="_boolop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] -pub struct Boolop; +pub struct BoolOp; -impl From<&'static ast::Boolop> for Boolop { - fn from(_node: &'static ast::Boolop) -> Self { - Boolop +impl From<&'static ast::BoolOp> for BoolOp { + fn from(_node: &'static ast::BoolOp) -> Self { + BoolOp } } #[pymethods] -impl Boolop { +impl BoolOp { #[new] fn new() -> PyClassInitializer { PyClassInitializer::from(Ast).add_subclass(Self) } } -impl ToPyObject for Boolop { +impl ToPyObject for BoolOp { fn to_object(&self, py: Python) -> PyObject { let initializer = Self::new(); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_And", extends=Boolop)] -pub struct BoolopAnd; +#[pyclass(module="rustpython_ast.located", name="_And", extends=BoolOp)] +pub struct BoolOpAnd; -impl ToPyObject for BoolopAnd { +impl ToPyObject for BoolOpAnd { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Boolop) + .add_subclass(BoolOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_Or", extends=Boolop)] -pub struct BoolopOr; +#[pyclass(module="rustpython_ast.located", name="_Or", extends=BoolOp)] +pub struct BoolOpOr; -impl ToPyObject for BoolopOr { +impl ToPyObject for BoolOpOr { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Boolop) + .add_subclass(BoolOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } @@ -2942,71 +2942,71 @@ impl ToPyObject for OperatorFloorDiv { #[pyclass(module="rustpython_ast.located", name="_unaryop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] -pub struct Unaryop; +pub struct UnaryOp; -impl From<&'static ast::Unaryop> for Unaryop { - fn from(_node: &'static ast::Unaryop) -> Self { - Unaryop +impl From<&'static ast::UnaryOp> for UnaryOp { + fn from(_node: &'static ast::UnaryOp) -> Self { + UnaryOp } } #[pymethods] -impl Unaryop { +impl UnaryOp { #[new] fn new() -> PyClassInitializer { PyClassInitializer::from(Ast).add_subclass(Self) } } -impl ToPyObject for Unaryop { +impl ToPyObject for UnaryOp { fn to_object(&self, py: Python) -> PyObject { let initializer = Self::new(); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_Invert", extends=Unaryop)] -pub struct UnaryopInvert; +#[pyclass(module="rustpython_ast.located", name="_Invert", extends=UnaryOp)] +pub struct UnaryOpInvert; -impl ToPyObject for UnaryopInvert { +impl ToPyObject for UnaryOpInvert { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Unaryop) + .add_subclass(UnaryOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_Not", extends=Unaryop)] -pub struct UnaryopNot; +#[pyclass(module="rustpython_ast.located", name="_Not", extends=UnaryOp)] +pub struct UnaryOpNot; -impl ToPyObject for UnaryopNot { +impl ToPyObject for UnaryOpNot { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Unaryop) + .add_subclass(UnaryOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_UAdd", extends=Unaryop)] -pub struct UnaryopUAdd; +#[pyclass(module="rustpython_ast.located", name="_UAdd", extends=UnaryOp)] +pub struct UnaryOpUAdd; -impl ToPyObject for UnaryopUAdd { +impl ToPyObject for UnaryOpUAdd { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Unaryop) + .add_subclass(UnaryOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_USub", extends=Unaryop)] -pub struct UnaryopUSub; +#[pyclass(module="rustpython_ast.located", name="_USub", extends=UnaryOp)] +pub struct UnaryOpUSub; -impl ToPyObject for UnaryopUSub { +impl ToPyObject for UnaryOpUSub { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Unaryop) + .add_subclass(UnaryOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } @@ -3014,143 +3014,143 @@ impl ToPyObject for UnaryopUSub { #[pyclass(module="rustpython_ast.located", name="_cmpop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] -pub struct Cmpop; +pub struct CmpOp; -impl From<&'static ast::Cmpop> for Cmpop { - fn from(_node: &'static ast::Cmpop) -> Self { - Cmpop +impl From<&'static ast::CmpOp> for CmpOp { + fn from(_node: &'static ast::CmpOp) -> Self { + CmpOp } } #[pymethods] -impl Cmpop { +impl CmpOp { #[new] fn new() -> PyClassInitializer { PyClassInitializer::from(Ast).add_subclass(Self) } } -impl ToPyObject for Cmpop { +impl ToPyObject for CmpOp { fn to_object(&self, py: Python) -> PyObject { let initializer = Self::new(); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_Eq", extends=Cmpop)] -pub struct CmpopEq; +#[pyclass(module="rustpython_ast.located", name="_Eq", extends=CmpOp)] +pub struct CmpOpEq; -impl ToPyObject for CmpopEq { +impl ToPyObject for CmpOpEq { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_NotEq", extends=Cmpop)] -pub struct CmpopNotEq; +#[pyclass(module="rustpython_ast.located", name="_NotEq", extends=CmpOp)] +pub struct CmpOpNotEq; -impl ToPyObject for CmpopNotEq { +impl ToPyObject for CmpOpNotEq { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_Lt", extends=Cmpop)] -pub struct CmpopLt; +#[pyclass(module="rustpython_ast.located", name="_Lt", extends=CmpOp)] +pub struct CmpOpLt; -impl ToPyObject for CmpopLt { +impl ToPyObject for CmpOpLt { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_LtE", extends=Cmpop)] -pub struct CmpopLtE; +#[pyclass(module="rustpython_ast.located", name="_LtE", extends=CmpOp)] +pub struct CmpOpLtE; -impl ToPyObject for CmpopLtE { +impl ToPyObject for CmpOpLtE { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_Gt", extends=Cmpop)] -pub struct CmpopGt; +#[pyclass(module="rustpython_ast.located", name="_Gt", extends=CmpOp)] +pub struct CmpOpGt; -impl ToPyObject for CmpopGt { +impl ToPyObject for CmpOpGt { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_GtE", extends=Cmpop)] -pub struct CmpopGtE; +#[pyclass(module="rustpython_ast.located", name="_GtE", extends=CmpOp)] +pub struct CmpOpGtE; -impl ToPyObject for CmpopGtE { +impl ToPyObject for CmpOpGtE { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_Is", extends=Cmpop)] -pub struct CmpopIs; +#[pyclass(module="rustpython_ast.located", name="_Is", extends=CmpOp)] +pub struct CmpOpIs; -impl ToPyObject for CmpopIs { +impl ToPyObject for CmpOpIs { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_IsNot", extends=Cmpop)] -pub struct CmpopIsNot; +#[pyclass(module="rustpython_ast.located", name="_IsNot", extends=CmpOp)] +pub struct CmpOpIsNot; -impl ToPyObject for CmpopIsNot { +impl ToPyObject for CmpOpIsNot { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_In", extends=Cmpop)] -pub struct CmpopIn; +#[pyclass(module="rustpython_ast.located", name="_In", extends=CmpOp)] +pub struct CmpOpIn; -impl ToPyObject for CmpopIn { +impl ToPyObject for CmpOpIn { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.located", name="_NotIn", extends=Cmpop)] -pub struct CmpopNotIn; +#[pyclass(module="rustpython_ast.located", name="_NotIn", extends=CmpOp)] +pub struct CmpOpNotIn; -impl ToPyObject for CmpopNotIn { +impl ToPyObject for CmpOpNotIn { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } @@ -3209,29 +3209,29 @@ impl Comprehension { #[pyclass(module="rustpython_ast.located", name="_excepthandler", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] -pub struct Excepthandler; +pub struct ExceptHandler; -impl From<&'static ast::Excepthandler> for Excepthandler { - fn from(_node: &'static ast::Excepthandler) -> Self { - Excepthandler +impl From<&'static ast::ExceptHandler> for ExceptHandler { + fn from(_node: &'static ast::ExceptHandler) -> Self { + ExceptHandler } } #[pymethods] -impl Excepthandler { +impl ExceptHandler { #[new] fn new() -> PyClassInitializer { PyClassInitializer::from(Ast).add_subclass(Self) } } -impl ToPyObject for Excepthandler { +impl ToPyObject for ExceptHandler { fn to_object(&self, py: Python) -> PyObject { let initializer = Self::new(); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyWrapper for ast::Excepthandler { +impl ToPyWrapper for ast::ExceptHandler { #[inline] fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { @@ -3240,34 +3240,34 @@ impl ToPyWrapper for ast::Excepthandler { } } -#[pyclass(module="rustpython_ast.located", name="_ExceptHandler", extends=Excepthandler, frozen)] +#[pyclass(module="rustpython_ast.located", name="_ExceptHandler", extends=ExceptHandler, frozen)] #[derive(Clone, Debug)] -pub struct ExcepthandlerExceptHandler(pub &'static ast::ExcepthandlerExceptHandler); +pub struct ExceptHandlerExceptHandler(pub &'static ast::ExceptHandlerExceptHandler); -impl From<&'static ast::ExcepthandlerExceptHandler> for ExcepthandlerExceptHandler { - fn from(node: &'static ast::ExcepthandlerExceptHandler) -> Self { - ExcepthandlerExceptHandler(node) +impl From<&'static ast::ExceptHandlerExceptHandler> for ExceptHandlerExceptHandler { + fn from(node: &'static ast::ExceptHandlerExceptHandler) -> Self { + ExceptHandlerExceptHandler(node) } } -impl ToPyObject for ExcepthandlerExceptHandler { +impl ToPyObject for ExceptHandlerExceptHandler { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Excepthandler) + .add_subclass(ExceptHandler) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyWrapper for ast::ExcepthandlerExceptHandler { +impl ToPyWrapper for ast::ExceptHandlerExceptHandler { #[inline] fn to_py_wrapper(&'static self, py: Python) -> PyResult> { - Ok(ExcepthandlerExceptHandler(self).to_object(py)) + Ok(ExceptHandlerExceptHandler(self).to_object(py)) } } #[pymethods] -impl ExcepthandlerExceptHandler { +impl ExceptHandlerExceptHandler { #[getter] #[inline] fn get_type(&self, py: Python) -> PyResult { @@ -3481,30 +3481,30 @@ impl Alias { #[pyclass(module="rustpython_ast.located", name="_withitem", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Withitem(pub &'static ast::Withitem); +pub struct WithItem(pub &'static ast::WithItem); -impl From<&'static ast::Withitem> for Withitem { - fn from(node: &'static ast::Withitem) -> Self { - Withitem(node) +impl From<&'static ast::WithItem> for WithItem { + fn from(node: &'static ast::WithItem) -> Self { + WithItem(node) } } -impl ToPyObject for Withitem { +impl ToPyObject for WithItem { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyWrapper for ast::Withitem { +impl ToPyWrapper for ast::WithItem { #[inline] fn to_py_wrapper(&'static self, py: Python) -> PyResult> { - Ok(Withitem(self).to_object(py)) + Ok(WithItem(self).to_object(py)) } } #[pymethods] -impl Withitem { +impl WithItem { #[getter] #[inline] fn get_context_expr(&self, py: Python) -> PyResult { @@ -4025,27 +4025,27 @@ impl ToPyWrapper for ast::ExprContextDel { } } -impl ToPyWrapper for ast::Boolop { +impl ToPyWrapper for ast::BoolOp { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { match &self { - Self::And => Ok(BoolopAnd.to_object(py)), - Self::Or => Ok(BoolopOr.to_object(py)), + Self::And => Ok(BoolOpAnd.to_object(py)), + Self::Or => Ok(BoolOpOr.to_object(py)), } } } -impl ToPyWrapper for ast::BoolopAnd { +impl ToPyWrapper for ast::BoolOpAnd { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(BoolopAnd.to_object(py)) + Ok(BoolOpAnd.to_object(py)) } } -impl ToPyWrapper for ast::BoolopOr { +impl ToPyWrapper for ast::BoolOpOr { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(BoolopOr.to_object(py)) + Ok(BoolOpOr.to_object(py)) } } @@ -4161,131 +4161,131 @@ impl ToPyWrapper for ast::OperatorFloorDiv { } } -impl ToPyWrapper for ast::Unaryop { +impl ToPyWrapper for ast::UnaryOp { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { match &self { - Self::Invert => Ok(UnaryopInvert.to_object(py)), - Self::Not => Ok(UnaryopNot.to_object(py)), - Self::UAdd => Ok(UnaryopUAdd.to_object(py)), - Self::USub => Ok(UnaryopUSub.to_object(py)), + Self::Invert => Ok(UnaryOpInvert.to_object(py)), + Self::Not => Ok(UnaryOpNot.to_object(py)), + Self::UAdd => Ok(UnaryOpUAdd.to_object(py)), + Self::USub => Ok(UnaryOpUSub.to_object(py)), } } } -impl ToPyWrapper for ast::UnaryopInvert { +impl ToPyWrapper for ast::UnaryOpInvert { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(UnaryopInvert.to_object(py)) + Ok(UnaryOpInvert.to_object(py)) } } -impl ToPyWrapper for ast::UnaryopNot { +impl ToPyWrapper for ast::UnaryOpNot { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(UnaryopNot.to_object(py)) + Ok(UnaryOpNot.to_object(py)) } } -impl ToPyWrapper for ast::UnaryopUAdd { +impl ToPyWrapper for ast::UnaryOpUAdd { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(UnaryopUAdd.to_object(py)) + Ok(UnaryOpUAdd.to_object(py)) } } -impl ToPyWrapper for ast::UnaryopUSub { +impl ToPyWrapper for ast::UnaryOpUSub { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(UnaryopUSub.to_object(py)) + Ok(UnaryOpUSub.to_object(py)) } } -impl ToPyWrapper for ast::Cmpop { +impl ToPyWrapper for ast::CmpOp { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { match &self { - Self::Eq => Ok(CmpopEq.to_object(py)), - Self::NotEq => Ok(CmpopNotEq.to_object(py)), - Self::Lt => Ok(CmpopLt.to_object(py)), - Self::LtE => Ok(CmpopLtE.to_object(py)), - Self::Gt => Ok(CmpopGt.to_object(py)), - Self::GtE => Ok(CmpopGtE.to_object(py)), - Self::Is => Ok(CmpopIs.to_object(py)), - Self::IsNot => Ok(CmpopIsNot.to_object(py)), - Self::In => Ok(CmpopIn.to_object(py)), - Self::NotIn => Ok(CmpopNotIn.to_object(py)), + Self::Eq => Ok(CmpOpEq.to_object(py)), + Self::NotEq => Ok(CmpOpNotEq.to_object(py)), + Self::Lt => Ok(CmpOpLt.to_object(py)), + Self::LtE => Ok(CmpOpLtE.to_object(py)), + Self::Gt => Ok(CmpOpGt.to_object(py)), + Self::GtE => Ok(CmpOpGtE.to_object(py)), + Self::Is => Ok(CmpOpIs.to_object(py)), + Self::IsNot => Ok(CmpOpIsNot.to_object(py)), + Self::In => Ok(CmpOpIn.to_object(py)), + Self::NotIn => Ok(CmpOpNotIn.to_object(py)), } } } -impl ToPyWrapper for ast::CmpopEq { +impl ToPyWrapper for ast::CmpOpEq { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopEq.to_object(py)) + Ok(CmpOpEq.to_object(py)) } } -impl ToPyWrapper for ast::CmpopNotEq { +impl ToPyWrapper for ast::CmpOpNotEq { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopNotEq.to_object(py)) + Ok(CmpOpNotEq.to_object(py)) } } -impl ToPyWrapper for ast::CmpopLt { +impl ToPyWrapper for ast::CmpOpLt { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopLt.to_object(py)) + Ok(CmpOpLt.to_object(py)) } } -impl ToPyWrapper for ast::CmpopLtE { +impl ToPyWrapper for ast::CmpOpLtE { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopLtE.to_object(py)) + Ok(CmpOpLtE.to_object(py)) } } -impl ToPyWrapper for ast::CmpopGt { +impl ToPyWrapper for ast::CmpOpGt { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopGt.to_object(py)) + Ok(CmpOpGt.to_object(py)) } } -impl ToPyWrapper for ast::CmpopGtE { +impl ToPyWrapper for ast::CmpOpGtE { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopGtE.to_object(py)) + Ok(CmpOpGtE.to_object(py)) } } -impl ToPyWrapper for ast::CmpopIs { +impl ToPyWrapper for ast::CmpOpIs { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopIs.to_object(py)) + Ok(CmpOpIs.to_object(py)) } } -impl ToPyWrapper for ast::CmpopIsNot { +impl ToPyWrapper for ast::CmpOpIsNot { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopIsNot.to_object(py)) + Ok(CmpOpIsNot.to_object(py)) } } -impl ToPyWrapper for ast::CmpopIn { +impl ToPyWrapper for ast::CmpOpIn { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopIn.to_object(py)) + Ok(CmpOpIn.to_object(py)) } } -impl ToPyWrapper for ast::CmpopNotIn { +impl ToPyWrapper for ast::CmpOpNotIn { #[inline] fn to_py_wrapper(&self, py: Python) -> PyResult> { - Ok(CmpopNotIn.to_object(py)) + Ok(CmpOpNotIn.to_object(py)) } } @@ -4356,9 +4356,9 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> { super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; @@ -4373,30 +4373,30 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> { super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; diff --git a/ast-pyo3/src/gen/wrapper_ranged.rs b/ast-pyo3/src/gen/wrapper_ranged.rs index 4fe20de..8a405c2 100644 --- a/ast-pyo3/src/gen/wrapper_ranged.rs +++ b/ast-pyo3/src/gen/wrapper_ranged.rs @@ -2714,47 +2714,47 @@ impl ToPyObject for ExprContextDel { #[pyclass(module="rustpython_ast.ranged", name="_boolop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] -pub struct Boolop; +pub struct BoolOp; -impl From<&'static ast::Boolop> for Boolop { - fn from(_node: &'static ast::Boolop) -> Self { - Boolop +impl From<&'static ast::BoolOp> for BoolOp { + fn from(_node: &'static ast::BoolOp) -> Self { + BoolOp } } #[pymethods] -impl Boolop { +impl BoolOp { #[new] fn new() -> PyClassInitializer { PyClassInitializer::from(Ast).add_subclass(Self) } } -impl ToPyObject for Boolop { +impl ToPyObject for BoolOp { fn to_object(&self, py: Python) -> PyObject { let initializer = Self::new(); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_And", extends=Boolop)] -pub struct BoolopAnd; +#[pyclass(module="rustpython_ast.ranged", name="_And", extends=BoolOp)] +pub struct BoolOpAnd; -impl ToPyObject for BoolopAnd { +impl ToPyObject for BoolOpAnd { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Boolop) + .add_subclass(BoolOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_Or", extends=Boolop)] -pub struct BoolopOr; +#[pyclass(module="rustpython_ast.ranged", name="_Or", extends=BoolOp)] +pub struct BoolOpOr; -impl ToPyObject for BoolopOr { +impl ToPyObject for BoolOpOr { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Boolop) + .add_subclass(BoolOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } @@ -2942,71 +2942,71 @@ impl ToPyObject for OperatorFloorDiv { #[pyclass(module="rustpython_ast.ranged", name="_unaryop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] -pub struct Unaryop; +pub struct UnaryOp; -impl From<&'static ast::Unaryop> for Unaryop { - fn from(_node: &'static ast::Unaryop) -> Self { - Unaryop +impl From<&'static ast::UnaryOp> for UnaryOp { + fn from(_node: &'static ast::UnaryOp) -> Self { + UnaryOp } } #[pymethods] -impl Unaryop { +impl UnaryOp { #[new] fn new() -> PyClassInitializer { PyClassInitializer::from(Ast).add_subclass(Self) } } -impl ToPyObject for Unaryop { +impl ToPyObject for UnaryOp { fn to_object(&self, py: Python) -> PyObject { let initializer = Self::new(); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_Invert", extends=Unaryop)] -pub struct UnaryopInvert; +#[pyclass(module="rustpython_ast.ranged", name="_Invert", extends=UnaryOp)] +pub struct UnaryOpInvert; -impl ToPyObject for UnaryopInvert { +impl ToPyObject for UnaryOpInvert { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Unaryop) + .add_subclass(UnaryOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_Not", extends=Unaryop)] -pub struct UnaryopNot; +#[pyclass(module="rustpython_ast.ranged", name="_Not", extends=UnaryOp)] +pub struct UnaryOpNot; -impl ToPyObject for UnaryopNot { +impl ToPyObject for UnaryOpNot { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Unaryop) + .add_subclass(UnaryOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_UAdd", extends=Unaryop)] -pub struct UnaryopUAdd; +#[pyclass(module="rustpython_ast.ranged", name="_UAdd", extends=UnaryOp)] +pub struct UnaryOpUAdd; -impl ToPyObject for UnaryopUAdd { +impl ToPyObject for UnaryOpUAdd { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Unaryop) + .add_subclass(UnaryOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_USub", extends=Unaryop)] -pub struct UnaryopUSub; +#[pyclass(module="rustpython_ast.ranged", name="_USub", extends=UnaryOp)] +pub struct UnaryOpUSub; -impl ToPyObject for UnaryopUSub { +impl ToPyObject for UnaryOpUSub { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Unaryop) + .add_subclass(UnaryOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } @@ -3014,143 +3014,143 @@ impl ToPyObject for UnaryopUSub { #[pyclass(module="rustpython_ast.ranged", name="_cmpop", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] -pub struct Cmpop; +pub struct CmpOp; -impl From<&'static ast::Cmpop> for Cmpop { - fn from(_node: &'static ast::Cmpop) -> Self { - Cmpop +impl From<&'static ast::CmpOp> for CmpOp { + fn from(_node: &'static ast::CmpOp) -> Self { + CmpOp } } #[pymethods] -impl Cmpop { +impl CmpOp { #[new] fn new() -> PyClassInitializer { PyClassInitializer::from(Ast).add_subclass(Self) } } -impl ToPyObject for Cmpop { +impl ToPyObject for CmpOp { fn to_object(&self, py: Python) -> PyObject { let initializer = Self::new(); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_Eq", extends=Cmpop)] -pub struct CmpopEq; +#[pyclass(module="rustpython_ast.ranged", name="_Eq", extends=CmpOp)] +pub struct CmpOpEq; -impl ToPyObject for CmpopEq { +impl ToPyObject for CmpOpEq { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_NotEq", extends=Cmpop)] -pub struct CmpopNotEq; +#[pyclass(module="rustpython_ast.ranged", name="_NotEq", extends=CmpOp)] +pub struct CmpOpNotEq; -impl ToPyObject for CmpopNotEq { +impl ToPyObject for CmpOpNotEq { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_Lt", extends=Cmpop)] -pub struct CmpopLt; +#[pyclass(module="rustpython_ast.ranged", name="_Lt", extends=CmpOp)] +pub struct CmpOpLt; -impl ToPyObject for CmpopLt { +impl ToPyObject for CmpOpLt { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_LtE", extends=Cmpop)] -pub struct CmpopLtE; +#[pyclass(module="rustpython_ast.ranged", name="_LtE", extends=CmpOp)] +pub struct CmpOpLtE; -impl ToPyObject for CmpopLtE { +impl ToPyObject for CmpOpLtE { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_Gt", extends=Cmpop)] -pub struct CmpopGt; +#[pyclass(module="rustpython_ast.ranged", name="_Gt", extends=CmpOp)] +pub struct CmpOpGt; -impl ToPyObject for CmpopGt { +impl ToPyObject for CmpOpGt { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_GtE", extends=Cmpop)] -pub struct CmpopGtE; +#[pyclass(module="rustpython_ast.ranged", name="_GtE", extends=CmpOp)] +pub struct CmpOpGtE; -impl ToPyObject for CmpopGtE { +impl ToPyObject for CmpOpGtE { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_Is", extends=Cmpop)] -pub struct CmpopIs; +#[pyclass(module="rustpython_ast.ranged", name="_Is", extends=CmpOp)] +pub struct CmpOpIs; -impl ToPyObject for CmpopIs { +impl ToPyObject for CmpOpIs { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_IsNot", extends=Cmpop)] -pub struct CmpopIsNot; +#[pyclass(module="rustpython_ast.ranged", name="_IsNot", extends=CmpOp)] +pub struct CmpOpIsNot; -impl ToPyObject for CmpopIsNot { +impl ToPyObject for CmpOpIsNot { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_In", extends=Cmpop)] -pub struct CmpopIn; +#[pyclass(module="rustpython_ast.ranged", name="_In", extends=CmpOp)] +pub struct CmpOpIn; -impl ToPyObject for CmpopIn { +impl ToPyObject for CmpOpIn { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } } -#[pyclass(module="rustpython_ast.ranged", name="_NotIn", extends=Cmpop)] -pub struct CmpopNotIn; +#[pyclass(module="rustpython_ast.ranged", name="_NotIn", extends=CmpOp)] +pub struct CmpOpNotIn; -impl ToPyObject for CmpopNotIn { +impl ToPyObject for CmpOpNotIn { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Cmpop) + .add_subclass(CmpOp) .add_subclass(Self); Py::new(py, initializer).unwrap().into_py(py) } @@ -3209,29 +3209,29 @@ impl Comprehension { #[pyclass(module="rustpython_ast.ranged", name="_excepthandler", extends=super::Ast, frozen, subclass)] #[derive(Clone, Debug)] -pub struct Excepthandler; +pub struct ExceptHandler; -impl From<&'static ast::Excepthandler> for Excepthandler { - fn from(_node: &'static ast::Excepthandler) -> Self { - Excepthandler +impl From<&'static ast::ExceptHandler> for ExceptHandler { + fn from(_node: &'static ast::ExceptHandler) -> Self { + ExceptHandler } } #[pymethods] -impl Excepthandler { +impl ExceptHandler { #[new] fn new() -> PyClassInitializer { PyClassInitializer::from(Ast).add_subclass(Self) } } -impl ToPyObject for Excepthandler { +impl ToPyObject for ExceptHandler { fn to_object(&self, py: Python) -> PyObject { let initializer = Self::new(); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyWrapper for ast::Excepthandler { +impl ToPyWrapper for ast::ExceptHandler { #[inline] fn to_py_wrapper(&'static self, py: Python) -> PyResult> { match &self { @@ -3240,34 +3240,34 @@ impl ToPyWrapper for ast::Excepthandler { } } -#[pyclass(module="rustpython_ast.ranged", name="_ExceptHandler", extends=Excepthandler, frozen)] +#[pyclass(module="rustpython_ast.ranged", name="_ExceptHandler", extends=ExceptHandler, frozen)] #[derive(Clone, Debug)] -pub struct ExcepthandlerExceptHandler(pub &'static ast::ExcepthandlerExceptHandler); +pub struct ExceptHandlerExceptHandler(pub &'static ast::ExceptHandlerExceptHandler); -impl From<&'static ast::ExcepthandlerExceptHandler> for ExcepthandlerExceptHandler { - fn from(node: &'static ast::ExcepthandlerExceptHandler) -> Self { - ExcepthandlerExceptHandler(node) +impl From<&'static ast::ExceptHandlerExceptHandler> for ExceptHandlerExceptHandler { + fn from(node: &'static ast::ExceptHandlerExceptHandler) -> Self { + ExceptHandlerExceptHandler(node) } } -impl ToPyObject for ExcepthandlerExceptHandler { +impl ToPyObject for ExceptHandlerExceptHandler { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast) - .add_subclass(Excepthandler) + .add_subclass(ExceptHandler) .add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyWrapper for ast::ExcepthandlerExceptHandler { +impl ToPyWrapper for ast::ExceptHandlerExceptHandler { #[inline] fn to_py_wrapper(&'static self, py: Python) -> PyResult> { - Ok(ExcepthandlerExceptHandler(self).to_object(py)) + Ok(ExceptHandlerExceptHandler(self).to_object(py)) } } #[pymethods] -impl ExcepthandlerExceptHandler { +impl ExceptHandlerExceptHandler { #[getter] #[inline] fn get_type(&self, py: Python) -> PyResult { @@ -3481,30 +3481,30 @@ impl Alias { #[pyclass(module="rustpython_ast.ranged", name="_withitem", extends=super::Ast, frozen)] #[derive(Clone, Debug)] -pub struct Withitem(pub &'static ast::Withitem); +pub struct WithItem(pub &'static ast::WithItem); -impl From<&'static ast::Withitem> for Withitem { - fn from(node: &'static ast::Withitem) -> Self { - Withitem(node) +impl From<&'static ast::WithItem> for WithItem { + fn from(node: &'static ast::WithItem) -> Self { + WithItem(node) } } -impl ToPyObject for Withitem { +impl ToPyObject for WithItem { fn to_object(&self, py: Python) -> PyObject { let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone()); Py::new(py, initializer).unwrap().into_py(py) } } -impl ToPyWrapper for ast::Withitem { +impl ToPyWrapper for ast::WithItem { #[inline] fn to_py_wrapper(&'static self, py: Python) -> PyResult> { - Ok(Withitem(self).to_object(py)) + Ok(WithItem(self).to_object(py)) } } #[pymethods] -impl Withitem { +impl WithItem { #[getter] #[inline] fn get_context_expr(&self, py: Python) -> PyResult { @@ -4060,9 +4060,9 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> { super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; @@ -4077,30 +4077,30 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> { super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; super::init_type::(py, m)?; - super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; + super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; - super::init_type::(py, m)?; + super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; super::init_type::(py, m)?; diff --git a/ast/asdl_rs.py b/ast/asdl_rs.py index 8a3bc3b..517a4b4 100755 --- a/ast/asdl_rs.py +++ b/ast/asdl_rs.py @@ -31,6 +31,14 @@ BUILTIN_INT_NAMES = { "conversion": "ConversionFlag", } +RENAME_MAP = { + "cmpop": "cmp_op", + "unaryop": "unary_op", + "boolop": "bool_op", + "excepthandler": "except_handler", + "withitem": "with_item", +} + RUST_KEYWORDS = { "if", "while", @@ -124,6 +132,7 @@ def rust_type_name(name): This function special cases the default types provided by asdl. """ + name = RENAME_MAP.get(name, name) if name in asdl.builtin_types: builtin = BUILTIN_TYPE_NAMES[name] return builtin @@ -444,7 +453,9 @@ class StructVisitor(EmitVisitor): def visitType(self, type, depth=0): if hasattr(type, "doc"): doc = "/// " + type.doc.replace("\n", "\n/// ") + "\n" - self.emit(doc, depth) + else: + doc = f"/// See also [{type.name}](https://docs.python.org/3/library/ast.html#ast.{type.name})" + self.emit(doc, depth) self.visit(type.value, type, depth) def visitSum(self, sum, type, depth): @@ -525,11 +536,6 @@ class StructVisitor(EmitVisitor): def sum_with_constructors(self, sum, type, depth): type_info = self.type_info[type.name] rust_name = rust_type_name(type.name) - # all the attributes right now are for location, so if it has attrs we - # can just wrap it in Attributed<> - - for t in sum.types: - self.sum_subtype_struct(type_info, t, rust_name, depth) self.emit_attrs(depth) self.emit("#[derive(is_macro::Is)]", depth) @@ -545,7 +551,12 @@ class StructVisitor(EmitVisitor): self.emit("}", depth) self.emit("", depth) + for t in sum.types: + self.sum_subtype_struct(type_info, t, rust_name, depth) + + def sum_subtype_struct(self, sum_type_info, t, rust_name, depth): + self.emit(f"""/// See also [{t.name}](https://docs.python.org/3/library/ast.html#ast.{t.name})""", depth) self.emit_attrs(depth) payload_name = f"{rust_name}{t.name}" self.emit(f"pub struct {payload_name} {{", depth) diff --git a/ast/src/gen/fold.rs b/ast/src/gen/fold.rs index f239830..5fe48e9 100644 --- a/ast/src/gen/fold.rs +++ b/ast/src/gen/fold.rs @@ -390,16 +390,16 @@ pub trait Fold { fn fold_expr_context(&mut self, node: ExprContext) -> Result { fold_expr_context(self, node) } - fn fold_boolop(&mut self, node: Boolop) -> Result { + fn fold_boolop(&mut self, node: BoolOp) -> Result { fold_boolop(self, node) } fn fold_operator(&mut self, node: Operator) -> Result { fold_operator(self, node) } - fn fold_unaryop(&mut self, node: Unaryop) -> Result { + fn fold_unaryop(&mut self, node: UnaryOp) -> Result { fold_unaryop(self, node) } - fn fold_cmpop(&mut self, node: Cmpop) -> Result { + fn fold_cmpop(&mut self, node: CmpOp) -> Result { fold_cmpop(self, node) } fn fold_comprehension( @@ -410,14 +410,14 @@ pub trait Fold { } fn fold_excepthandler( &mut self, - node: Excepthandler, - ) -> Result, Self::Error> { + node: ExceptHandler, + ) -> Result, Self::Error> { fold_excepthandler(self, node) } fn fold_excepthandler_except_handler( &mut self, - node: ExcepthandlerExceptHandler, - ) -> Result, Self::Error> { + node: ExceptHandlerExceptHandler, + ) -> Result, Self::Error> { fold_excepthandler_except_handler(self, node) } fn fold_arguments( @@ -435,7 +435,7 @@ pub trait Fold { fn fold_alias(&mut self, node: Alias) -> Result, Self::Error> { fold_alias(self, node) } - fn fold_withitem(&mut self, node: Withitem) -> Result, Self::Error> { + fn fold_withitem(&mut self, node: WithItem) -> Result, Self::Error> { fold_withitem(self, node) } fn fold_match_case( @@ -2210,8 +2210,8 @@ pub fn fold_expr_context + ?Sized>( ) -> Result { Ok(node) } -impl Foldable for Boolop { - type Mapped = Boolop; +impl Foldable for BoolOp { + type Mapped = BoolOp; fn fold + ?Sized>( self, folder: &mut F, @@ -2221,8 +2221,8 @@ impl Foldable for Boolop { } pub fn fold_boolop + ?Sized>( #[allow(unused)] folder: &mut F, - node: Boolop, -) -> Result { + node: BoolOp, +) -> Result { Ok(node) } impl Foldable for Operator { @@ -2240,8 +2240,8 @@ pub fn fold_operator + ?Sized>( ) -> Result { Ok(node) } -impl Foldable for Unaryop { - type Mapped = Unaryop; +impl Foldable for UnaryOp { + type Mapped = UnaryOp; fn fold + ?Sized>( self, folder: &mut F, @@ -2251,12 +2251,12 @@ impl Foldable for Unaryop { } pub fn fold_unaryop + ?Sized>( #[allow(unused)] folder: &mut F, - node: Unaryop, -) -> Result { + node: UnaryOp, +) -> Result { Ok(node) } -impl Foldable for Cmpop { - type Mapped = Cmpop; +impl Foldable for CmpOp { + type Mapped = CmpOp; fn fold + ?Sized>( self, folder: &mut F, @@ -2266,8 +2266,8 @@ impl Foldable for Cmpop { } pub fn fold_cmpop + ?Sized>( #[allow(unused)] folder: &mut F, - node: Cmpop, -) -> Result { + node: CmpOp, +) -> Result { Ok(node) } impl Foldable for Comprehension { @@ -2304,8 +2304,8 @@ pub fn fold_comprehension + ?Sized>( range, }) } -impl Foldable for Excepthandler { - type Mapped = Excepthandler; +impl Foldable for ExceptHandler { + type Mapped = ExceptHandler; fn fold + ?Sized>( self, folder: &mut F, @@ -2315,17 +2315,17 @@ impl Foldable for Excepthandler { } pub fn fold_excepthandler + ?Sized>( #[allow(unused)] folder: &mut F, - node: Excepthandler, -) -> Result, F::Error> { + node: ExceptHandler, +) -> Result, F::Error> { let folded = match node { - Excepthandler::ExceptHandler(cons) => { - Excepthandler::ExceptHandler(Foldable::fold(cons, folder)?) + ExceptHandler::ExceptHandler(cons) => { + ExceptHandler::ExceptHandler(Foldable::fold(cons, folder)?) } }; Ok(folded) } -impl Foldable for ExcepthandlerExceptHandler { - type Mapped = ExcepthandlerExceptHandler; +impl Foldable for ExceptHandlerExceptHandler { + type Mapped = ExceptHandlerExceptHandler; fn fold + ?Sized>( self, folder: &mut F, @@ -2335,9 +2335,9 @@ impl Foldable for ExcepthandlerExceptHandler { } pub fn fold_excepthandler_except_handler + ?Sized>( #[allow(unused)] folder: &mut F, - node: ExcepthandlerExceptHandler, -) -> Result, F::Error> { - let ExcepthandlerExceptHandler { + node: ExceptHandlerExceptHandler, +) -> Result, F::Error> { + let ExceptHandlerExceptHandler { type_, name, body, @@ -2349,7 +2349,7 @@ pub fn fold_excepthandler_except_handler + ?Sized>( let name = Foldable::fold(name, folder)?; let body = Foldable::fold(body, folder)?; let range = folder.map_user(range, context)?; - Ok(ExcepthandlerExceptHandler { + Ok(ExceptHandlerExceptHandler { type_, name, body, @@ -2472,8 +2472,8 @@ pub fn fold_alias + ?Sized>( range, }) } -impl Foldable for Withitem { - type Mapped = Withitem; +impl Foldable for WithItem { + type Mapped = WithItem; fn fold + ?Sized>( self, folder: &mut F, @@ -2483,9 +2483,9 @@ impl Foldable for Withitem { } pub fn fold_withitem + ?Sized>( #[allow(unused)] folder: &mut F, - node: Withitem, -) -> Result, F::Error> { - let Withitem { + node: WithItem, +) -> Result, F::Error> { + let WithItem { context_expr, optional_vars, range, @@ -2494,7 +2494,7 @@ pub fn fold_withitem + ?Sized>( let context_expr = Foldable::fold(context_expr, folder)?; let optional_vars = Foldable::fold(optional_vars, folder)?; let range = folder.map_user_cfg(range, context)?; - Ok(Withitem { + Ok(WithItem { context_expr, optional_vars, range, diff --git a/ast/src/gen/generic.rs b/ast/src/gen/generic.rs index 57d2d19..3b193ec 100644 --- a/ast/src/gen/generic.rs +++ b/ast/src/gen/generic.rs @@ -9,17 +9,17 @@ pub enum Ast { Stmt(Stmt), Expr(Expr), ExprContext(ExprContext), - Boolop(Boolop), + BoolOp(BoolOp), Operator(Operator), - Unaryop(Unaryop), - Cmpop(Cmpop), + UnaryOp(UnaryOp), + CmpOp(CmpOp), Comprehension(Comprehension), - Excepthandler(Excepthandler), + ExceptHandler(ExceptHandler), Arguments(Arguments), Arg(Arg), Keyword(Keyword), Alias(Alias), - Withitem(Withitem), + WithItem(WithItem), MatchCase(MatchCase), Pattern(Pattern), TypeIgnore(TypeIgnore), @@ -53,9 +53,9 @@ impl From for Ast { } } -impl From for Ast { - fn from(node: Boolop) -> Self { - Ast::Boolop(node) +impl From for Ast { + fn from(node: BoolOp) -> Self { + Ast::BoolOp(node) } } @@ -65,15 +65,15 @@ impl From for Ast { } } -impl From for Ast { - fn from(node: Unaryop) -> Self { - Ast::Unaryop(node) +impl From for Ast { + fn from(node: UnaryOp) -> Self { + Ast::UnaryOp(node) } } -impl From for Ast { - fn from(node: Cmpop) -> Self { - Ast::Cmpop(node) +impl From for Ast { + fn from(node: CmpOp) -> Self { + Ast::CmpOp(node) } } @@ -83,9 +83,9 @@ impl From> for Ast { } } -impl From> for Ast { - fn from(node: Excepthandler) -> Self { - Ast::Excepthandler(node) +impl From> for Ast { + fn from(node: ExceptHandler) -> Self { + Ast::ExceptHandler(node) } } @@ -113,9 +113,9 @@ impl From> for Ast { } } -impl From> for Ast { - fn from(node: Withitem) -> Self { - Ast::Withitem(node) +impl From> for Ast { + fn from(node: WithItem) -> Self { + Ast::WithItem(node) } } @@ -137,6 +137,16 @@ impl From> for Ast { } } +/// See also [mod](https://docs.python.org/3/library/ast.html#ast.mod) +#[derive(Clone, Debug, PartialEq, is_macro::Is)] +pub enum Mod { + Module(ModModule), + Interactive(ModInteractive), + Expression(ModExpression), + FunctionType(ModFunctionType), +} + +/// See also [Module](https://docs.python.org/3/library/ast.html#ast.Module) #[derive(Clone, Debug, PartialEq)] pub struct ModModule { pub range: OptionalRange, @@ -159,6 +169,7 @@ impl From> for Ast { } } +/// See also [Interactive](https://docs.python.org/3/library/ast.html#ast.Interactive) #[derive(Clone, Debug, PartialEq)] pub struct ModInteractive { pub range: OptionalRange, @@ -180,6 +191,7 @@ impl From> for Ast { } } +/// See also [Expression](https://docs.python.org/3/library/ast.html#ast.Expression) #[derive(Clone, Debug, PartialEq)] pub struct ModExpression { pub range: OptionalRange, @@ -201,6 +213,7 @@ impl From> for Ast { } } +/// See also [FunctionType](https://docs.python.org/3/library/ast.html#ast.FunctionType) #[derive(Clone, Debug, PartialEq)] pub struct ModFunctionType { pub range: OptionalRange, @@ -223,648 +236,12 @@ impl From> for Ast { } } -#[derive(Clone, Debug, PartialEq, is_macro::Is)] -pub enum Mod { - Module(ModModule), - Interactive(ModInteractive), - Expression(ModExpression), - FunctionType(ModFunctionType), -} - impl Node for Mod { const NAME: &'static str = "mod"; const FIELD_NAMES: &'static [&'static str] = &[]; } -#[derive(Clone, Debug, PartialEq)] -pub struct StmtFunctionDef { - pub range: R, - pub name: Identifier, - pub args: Box>, - pub body: Vec>, - pub decorator_list: Vec>, - pub returns: Option>>, - pub type_comment: Option, -} - -impl Node for StmtFunctionDef { - const NAME: &'static str = "FunctionDef"; - const FIELD_NAMES: &'static [&'static str] = &[ - "name", - "args", - "body", - "decorator_list", - "returns", - "type_comment", - ]; -} -impl From> for Stmt { - fn from(payload: StmtFunctionDef) -> Self { - Stmt::FunctionDef(payload) - } -} -impl From> for Ast { - fn from(payload: StmtFunctionDef) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtAsyncFunctionDef { - pub range: R, - pub name: Identifier, - pub args: Box>, - pub body: Vec>, - pub decorator_list: Vec>, - pub returns: Option>>, - pub type_comment: Option, -} - -impl Node for StmtAsyncFunctionDef { - const NAME: &'static str = "AsyncFunctionDef"; - const FIELD_NAMES: &'static [&'static str] = &[ - "name", - "args", - "body", - "decorator_list", - "returns", - "type_comment", - ]; -} -impl From> for Stmt { - fn from(payload: StmtAsyncFunctionDef) -> Self { - Stmt::AsyncFunctionDef(payload) - } -} -impl From> for Ast { - fn from(payload: StmtAsyncFunctionDef) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtClassDef { - pub range: R, - pub name: Identifier, - pub bases: Vec>, - pub keywords: Vec>, - pub body: Vec>, - pub decorator_list: Vec>, -} - -impl Node for StmtClassDef { - const NAME: &'static str = "ClassDef"; - const FIELD_NAMES: &'static [&'static str] = - &["name", "bases", "keywords", "body", "decorator_list"]; -} -impl From> for Stmt { - fn from(payload: StmtClassDef) -> Self { - Stmt::ClassDef(payload) - } -} -impl From> for Ast { - fn from(payload: StmtClassDef) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtReturn { - pub range: R, - pub value: Option>>, -} - -impl Node for StmtReturn { - const NAME: &'static str = "Return"; - const FIELD_NAMES: &'static [&'static str] = &["value"]; -} -impl From> for Stmt { - fn from(payload: StmtReturn) -> Self { - Stmt::Return(payload) - } -} -impl From> for Ast { - fn from(payload: StmtReturn) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtDelete { - pub range: R, - pub targets: Vec>, -} - -impl Node for StmtDelete { - const NAME: &'static str = "Delete"; - const FIELD_NAMES: &'static [&'static str] = &["targets"]; -} -impl From> for Stmt { - fn from(payload: StmtDelete) -> Self { - Stmt::Delete(payload) - } -} -impl From> for Ast { - fn from(payload: StmtDelete) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtAssign { - pub range: R, - pub targets: Vec>, - pub value: Box>, - pub type_comment: Option, -} - -impl Node for StmtAssign { - const NAME: &'static str = "Assign"; - const FIELD_NAMES: &'static [&'static str] = &["targets", "value", "type_comment"]; -} -impl From> for Stmt { - fn from(payload: StmtAssign) -> Self { - Stmt::Assign(payload) - } -} -impl From> for Ast { - fn from(payload: StmtAssign) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtAugAssign { - pub range: R, - pub target: Box>, - pub op: Operator, - pub value: Box>, -} - -impl Node for StmtAugAssign { - const NAME: &'static str = "AugAssign"; - const FIELD_NAMES: &'static [&'static str] = &["target", "op", "value"]; -} -impl From> for Stmt { - fn from(payload: StmtAugAssign) -> Self { - Stmt::AugAssign(payload) - } -} -impl From> for Ast { - fn from(payload: StmtAugAssign) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtAnnAssign { - pub range: R, - pub target: Box>, - pub annotation: Box>, - pub value: Option>>, - pub simple: bool, -} - -impl Node for StmtAnnAssign { - const NAME: &'static str = "AnnAssign"; - const FIELD_NAMES: &'static [&'static str] = &["target", "annotation", "value", "simple"]; -} -impl From> for Stmt { - fn from(payload: StmtAnnAssign) -> Self { - Stmt::AnnAssign(payload) - } -} -impl From> for Ast { - fn from(payload: StmtAnnAssign) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtFor { - pub range: R, - pub target: Box>, - pub iter: Box>, - pub body: Vec>, - pub orelse: Vec>, - pub type_comment: Option, -} - -impl Node for StmtFor { - const NAME: &'static str = "For"; - const FIELD_NAMES: &'static [&'static str] = - &["target", "iter", "body", "orelse", "type_comment"]; -} -impl From> for Stmt { - fn from(payload: StmtFor) -> Self { - Stmt::For(payload) - } -} -impl From> for Ast { - fn from(payload: StmtFor) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtAsyncFor { - pub range: R, - pub target: Box>, - pub iter: Box>, - pub body: Vec>, - pub orelse: Vec>, - pub type_comment: Option, -} - -impl Node for StmtAsyncFor { - const NAME: &'static str = "AsyncFor"; - const FIELD_NAMES: &'static [&'static str] = - &["target", "iter", "body", "orelse", "type_comment"]; -} -impl From> for Stmt { - fn from(payload: StmtAsyncFor) -> Self { - Stmt::AsyncFor(payload) - } -} -impl From> for Ast { - fn from(payload: StmtAsyncFor) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtWhile { - pub range: R, - pub test: Box>, - pub body: Vec>, - pub orelse: Vec>, -} - -impl Node for StmtWhile { - const NAME: &'static str = "While"; - const FIELD_NAMES: &'static [&'static str] = &["test", "body", "orelse"]; -} -impl From> for Stmt { - fn from(payload: StmtWhile) -> Self { - Stmt::While(payload) - } -} -impl From> for Ast { - fn from(payload: StmtWhile) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtIf { - pub range: R, - pub test: Box>, - pub body: Vec>, - pub orelse: Vec>, -} - -impl Node for StmtIf { - const NAME: &'static str = "If"; - const FIELD_NAMES: &'static [&'static str] = &["test", "body", "orelse"]; -} -impl From> for Stmt { - fn from(payload: StmtIf) -> Self { - Stmt::If(payload) - } -} -impl From> for Ast { - fn from(payload: StmtIf) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtWith { - pub range: R, - pub items: Vec>, - pub body: Vec>, - pub type_comment: Option, -} - -impl Node for StmtWith { - const NAME: &'static str = "With"; - const FIELD_NAMES: &'static [&'static str] = &["items", "body", "type_comment"]; -} -impl From> for Stmt { - fn from(payload: StmtWith) -> Self { - Stmt::With(payload) - } -} -impl From> for Ast { - fn from(payload: StmtWith) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtAsyncWith { - pub range: R, - pub items: Vec>, - pub body: Vec>, - pub type_comment: Option, -} - -impl Node for StmtAsyncWith { - const NAME: &'static str = "AsyncWith"; - const FIELD_NAMES: &'static [&'static str] = &["items", "body", "type_comment"]; -} -impl From> for Stmt { - fn from(payload: StmtAsyncWith) -> Self { - Stmt::AsyncWith(payload) - } -} -impl From> for Ast { - fn from(payload: StmtAsyncWith) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtMatch { - pub range: R, - pub subject: Box>, - pub cases: Vec>, -} - -impl Node for StmtMatch { - const NAME: &'static str = "Match"; - const FIELD_NAMES: &'static [&'static str] = &["subject", "cases"]; -} -impl From> for Stmt { - fn from(payload: StmtMatch) -> Self { - Stmt::Match(payload) - } -} -impl From> for Ast { - fn from(payload: StmtMatch) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtRaise { - pub range: R, - pub exc: Option>>, - pub cause: Option>>, -} - -impl Node for StmtRaise { - const NAME: &'static str = "Raise"; - const FIELD_NAMES: &'static [&'static str] = &["exc", "cause"]; -} -impl From> for Stmt { - fn from(payload: StmtRaise) -> Self { - Stmt::Raise(payload) - } -} -impl From> for Ast { - fn from(payload: StmtRaise) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtTry { - pub range: R, - pub body: Vec>, - pub handlers: Vec>, - pub orelse: Vec>, - pub finalbody: Vec>, -} - -impl Node for StmtTry { - const NAME: &'static str = "Try"; - const FIELD_NAMES: &'static [&'static str] = &["body", "handlers", "orelse", "finalbody"]; -} -impl From> for Stmt { - fn from(payload: StmtTry) -> Self { - Stmt::Try(payload) - } -} -impl From> for Ast { - fn from(payload: StmtTry) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtTryStar { - pub range: R, - pub body: Vec>, - pub handlers: Vec>, - pub orelse: Vec>, - pub finalbody: Vec>, -} - -impl Node for StmtTryStar { - const NAME: &'static str = "TryStar"; - const FIELD_NAMES: &'static [&'static str] = &["body", "handlers", "orelse", "finalbody"]; -} -impl From> for Stmt { - fn from(payload: StmtTryStar) -> Self { - Stmt::TryStar(payload) - } -} -impl From> for Ast { - fn from(payload: StmtTryStar) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtAssert { - pub range: R, - pub test: Box>, - pub msg: Option>>, -} - -impl Node for StmtAssert { - const NAME: &'static str = "Assert"; - const FIELD_NAMES: &'static [&'static str] = &["test", "msg"]; -} -impl From> for Stmt { - fn from(payload: StmtAssert) -> Self { - Stmt::Assert(payload) - } -} -impl From> for Ast { - fn from(payload: StmtAssert) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtImport { - pub range: R, - pub names: Vec>, -} - -impl Node for StmtImport { - const NAME: &'static str = "Import"; - const FIELD_NAMES: &'static [&'static str] = &["names"]; -} -impl From> for Stmt { - fn from(payload: StmtImport) -> Self { - Stmt::Import(payload) - } -} -impl From> for Ast { - fn from(payload: StmtImport) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtImportFrom { - pub range: R, - pub module: Option, - pub names: Vec>, - pub level: Option, -} - -impl Node for StmtImportFrom { - const NAME: &'static str = "ImportFrom"; - const FIELD_NAMES: &'static [&'static str] = &["module", "names", "level"]; -} -impl From> for Stmt { - fn from(payload: StmtImportFrom) -> Self { - Stmt::ImportFrom(payload) - } -} -impl From> for Ast { - fn from(payload: StmtImportFrom) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtGlobal { - pub range: R, - pub names: Vec, -} - -impl Node for StmtGlobal { - const NAME: &'static str = "Global"; - const FIELD_NAMES: &'static [&'static str] = &["names"]; -} -impl From> for Stmt { - fn from(payload: StmtGlobal) -> Self { - Stmt::Global(payload) - } -} -impl From> for Ast { - fn from(payload: StmtGlobal) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtNonlocal { - pub range: R, - pub names: Vec, -} - -impl Node for StmtNonlocal { - const NAME: &'static str = "Nonlocal"; - const FIELD_NAMES: &'static [&'static str] = &["names"]; -} -impl From> for Stmt { - fn from(payload: StmtNonlocal) -> Self { - Stmt::Nonlocal(payload) - } -} -impl From> for Ast { - fn from(payload: StmtNonlocal) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtExpr { - pub range: R, - pub value: Box>, -} - -impl Node for StmtExpr { - const NAME: &'static str = "Expr"; - const FIELD_NAMES: &'static [&'static str] = &["value"]; -} -impl From> for Stmt { - fn from(payload: StmtExpr) -> Self { - Stmt::Expr(payload) - } -} -impl From> for Ast { - fn from(payload: StmtExpr) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtPass { - pub range: R, -} - -impl Node for StmtPass { - const NAME: &'static str = "Pass"; - const FIELD_NAMES: &'static [&'static str] = &[]; -} -impl From> for Stmt { - fn from(payload: StmtPass) -> Self { - Stmt::Pass(payload) - } -} -impl From> for Ast { - fn from(payload: StmtPass) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtBreak { - pub range: R, -} - -impl Node for StmtBreak { - const NAME: &'static str = "Break"; - const FIELD_NAMES: &'static [&'static str] = &[]; -} -impl From> for Stmt { - fn from(payload: StmtBreak) -> Self { - Stmt::Break(payload) - } -} -impl From> for Ast { - fn from(payload: StmtBreak) -> Self { - Stmt::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct StmtContinue { - pub range: R, -} - -impl Node for StmtContinue { - const NAME: &'static str = "Continue"; - const FIELD_NAMES: &'static [&'static str] = &[]; -} -impl From> for Stmt { - fn from(payload: StmtContinue) -> Self { - Stmt::Continue(payload) - } -} -impl From> for Ast { - fn from(payload: StmtContinue) -> Self { - Stmt::from(payload).into() - } -} - +/// See also [stmt](https://docs.python.org/3/library/ast.html#ast.stmt) #[derive(Clone, Debug, PartialEq, is_macro::Is)] pub enum Stmt { #[is(name = "function_def_stmt")] @@ -923,609 +300,668 @@ pub enum Stmt { Continue(StmtContinue), } +/// See also [FunctionDef](https://docs.python.org/3/library/ast.html#ast.FunctionDef) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtFunctionDef { + pub range: R, + pub name: Identifier, + pub args: Box>, + pub body: Vec>, + pub decorator_list: Vec>, + pub returns: Option>>, + pub type_comment: Option, +} + +impl Node for StmtFunctionDef { + const NAME: &'static str = "FunctionDef"; + const FIELD_NAMES: &'static [&'static str] = &[ + "name", + "args", + "body", + "decorator_list", + "returns", + "type_comment", + ]; +} +impl From> for Stmt { + fn from(payload: StmtFunctionDef) -> Self { + Stmt::FunctionDef(payload) + } +} +impl From> for Ast { + fn from(payload: StmtFunctionDef) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [AsyncFunctionDef](https://docs.python.org/3/library/ast.html#ast.AsyncFunctionDef) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtAsyncFunctionDef { + pub range: R, + pub name: Identifier, + pub args: Box>, + pub body: Vec>, + pub decorator_list: Vec>, + pub returns: Option>>, + pub type_comment: Option, +} + +impl Node for StmtAsyncFunctionDef { + const NAME: &'static str = "AsyncFunctionDef"; + const FIELD_NAMES: &'static [&'static str] = &[ + "name", + "args", + "body", + "decorator_list", + "returns", + "type_comment", + ]; +} +impl From> for Stmt { + fn from(payload: StmtAsyncFunctionDef) -> Self { + Stmt::AsyncFunctionDef(payload) + } +} +impl From> for Ast { + fn from(payload: StmtAsyncFunctionDef) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [ClassDef](https://docs.python.org/3/library/ast.html#ast.ClassDef) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtClassDef { + pub range: R, + pub name: Identifier, + pub bases: Vec>, + pub keywords: Vec>, + pub body: Vec>, + pub decorator_list: Vec>, +} + +impl Node for StmtClassDef { + const NAME: &'static str = "ClassDef"; + const FIELD_NAMES: &'static [&'static str] = + &["name", "bases", "keywords", "body", "decorator_list"]; +} +impl From> for Stmt { + fn from(payload: StmtClassDef) -> Self { + Stmt::ClassDef(payload) + } +} +impl From> for Ast { + fn from(payload: StmtClassDef) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Return](https://docs.python.org/3/library/ast.html#ast.Return) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtReturn { + pub range: R, + pub value: Option>>, +} + +impl Node for StmtReturn { + const NAME: &'static str = "Return"; + const FIELD_NAMES: &'static [&'static str] = &["value"]; +} +impl From> for Stmt { + fn from(payload: StmtReturn) -> Self { + Stmt::Return(payload) + } +} +impl From> for Ast { + fn from(payload: StmtReturn) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Delete](https://docs.python.org/3/library/ast.html#ast.Delete) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtDelete { + pub range: R, + pub targets: Vec>, +} + +impl Node for StmtDelete { + const NAME: &'static str = "Delete"; + const FIELD_NAMES: &'static [&'static str] = &["targets"]; +} +impl From> for Stmt { + fn from(payload: StmtDelete) -> Self { + Stmt::Delete(payload) + } +} +impl From> for Ast { + fn from(payload: StmtDelete) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Assign](https://docs.python.org/3/library/ast.html#ast.Assign) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtAssign { + pub range: R, + pub targets: Vec>, + pub value: Box>, + pub type_comment: Option, +} + +impl Node for StmtAssign { + const NAME: &'static str = "Assign"; + const FIELD_NAMES: &'static [&'static str] = &["targets", "value", "type_comment"]; +} +impl From> for Stmt { + fn from(payload: StmtAssign) -> Self { + Stmt::Assign(payload) + } +} +impl From> for Ast { + fn from(payload: StmtAssign) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [AugAssign](https://docs.python.org/3/library/ast.html#ast.AugAssign) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtAugAssign { + pub range: R, + pub target: Box>, + pub op: Operator, + pub value: Box>, +} + +impl Node for StmtAugAssign { + const NAME: &'static str = "AugAssign"; + const FIELD_NAMES: &'static [&'static str] = &["target", "op", "value"]; +} +impl From> for Stmt { + fn from(payload: StmtAugAssign) -> Self { + Stmt::AugAssign(payload) + } +} +impl From> for Ast { + fn from(payload: StmtAugAssign) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [AnnAssign](https://docs.python.org/3/library/ast.html#ast.AnnAssign) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtAnnAssign { + pub range: R, + pub target: Box>, + pub annotation: Box>, + pub value: Option>>, + pub simple: bool, +} + +impl Node for StmtAnnAssign { + const NAME: &'static str = "AnnAssign"; + const FIELD_NAMES: &'static [&'static str] = &["target", "annotation", "value", "simple"]; +} +impl From> for Stmt { + fn from(payload: StmtAnnAssign) -> Self { + Stmt::AnnAssign(payload) + } +} +impl From> for Ast { + fn from(payload: StmtAnnAssign) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [For](https://docs.python.org/3/library/ast.html#ast.For) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtFor { + pub range: R, + pub target: Box>, + pub iter: Box>, + pub body: Vec>, + pub orelse: Vec>, + pub type_comment: Option, +} + +impl Node for StmtFor { + const NAME: &'static str = "For"; + const FIELD_NAMES: &'static [&'static str] = + &["target", "iter", "body", "orelse", "type_comment"]; +} +impl From> for Stmt { + fn from(payload: StmtFor) -> Self { + Stmt::For(payload) + } +} +impl From> for Ast { + fn from(payload: StmtFor) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [AsyncFor](https://docs.python.org/3/library/ast.html#ast.AsyncFor) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtAsyncFor { + pub range: R, + pub target: Box>, + pub iter: Box>, + pub body: Vec>, + pub orelse: Vec>, + pub type_comment: Option, +} + +impl Node for StmtAsyncFor { + const NAME: &'static str = "AsyncFor"; + const FIELD_NAMES: &'static [&'static str] = + &["target", "iter", "body", "orelse", "type_comment"]; +} +impl From> for Stmt { + fn from(payload: StmtAsyncFor) -> Self { + Stmt::AsyncFor(payload) + } +} +impl From> for Ast { + fn from(payload: StmtAsyncFor) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [While](https://docs.python.org/3/library/ast.html#ast.While) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtWhile { + pub range: R, + pub test: Box>, + pub body: Vec>, + pub orelse: Vec>, +} + +impl Node for StmtWhile { + const NAME: &'static str = "While"; + const FIELD_NAMES: &'static [&'static str] = &["test", "body", "orelse"]; +} +impl From> for Stmt { + fn from(payload: StmtWhile) -> Self { + Stmt::While(payload) + } +} +impl From> for Ast { + fn from(payload: StmtWhile) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [If](https://docs.python.org/3/library/ast.html#ast.If) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtIf { + pub range: R, + pub test: Box>, + pub body: Vec>, + pub orelse: Vec>, +} + +impl Node for StmtIf { + const NAME: &'static str = "If"; + const FIELD_NAMES: &'static [&'static str] = &["test", "body", "orelse"]; +} +impl From> for Stmt { + fn from(payload: StmtIf) -> Self { + Stmt::If(payload) + } +} +impl From> for Ast { + fn from(payload: StmtIf) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [With](https://docs.python.org/3/library/ast.html#ast.With) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtWith { + pub range: R, + pub items: Vec>, + pub body: Vec>, + pub type_comment: Option, +} + +impl Node for StmtWith { + const NAME: &'static str = "With"; + const FIELD_NAMES: &'static [&'static str] = &["items", "body", "type_comment"]; +} +impl From> for Stmt { + fn from(payload: StmtWith) -> Self { + Stmt::With(payload) + } +} +impl From> for Ast { + fn from(payload: StmtWith) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [AsyncWith](https://docs.python.org/3/library/ast.html#ast.AsyncWith) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtAsyncWith { + pub range: R, + pub items: Vec>, + pub body: Vec>, + pub type_comment: Option, +} + +impl Node for StmtAsyncWith { + const NAME: &'static str = "AsyncWith"; + const FIELD_NAMES: &'static [&'static str] = &["items", "body", "type_comment"]; +} +impl From> for Stmt { + fn from(payload: StmtAsyncWith) -> Self { + Stmt::AsyncWith(payload) + } +} +impl From> for Ast { + fn from(payload: StmtAsyncWith) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Match](https://docs.python.org/3/library/ast.html#ast.Match) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtMatch { + pub range: R, + pub subject: Box>, + pub cases: Vec>, +} + +impl Node for StmtMatch { + const NAME: &'static str = "Match"; + const FIELD_NAMES: &'static [&'static str] = &["subject", "cases"]; +} +impl From> for Stmt { + fn from(payload: StmtMatch) -> Self { + Stmt::Match(payload) + } +} +impl From> for Ast { + fn from(payload: StmtMatch) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Raise](https://docs.python.org/3/library/ast.html#ast.Raise) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtRaise { + pub range: R, + pub exc: Option>>, + pub cause: Option>>, +} + +impl Node for StmtRaise { + const NAME: &'static str = "Raise"; + const FIELD_NAMES: &'static [&'static str] = &["exc", "cause"]; +} +impl From> for Stmt { + fn from(payload: StmtRaise) -> Self { + Stmt::Raise(payload) + } +} +impl From> for Ast { + fn from(payload: StmtRaise) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Try](https://docs.python.org/3/library/ast.html#ast.Try) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtTry { + pub range: R, + pub body: Vec>, + pub handlers: Vec>, + pub orelse: Vec>, + pub finalbody: Vec>, +} + +impl Node for StmtTry { + const NAME: &'static str = "Try"; + const FIELD_NAMES: &'static [&'static str] = &["body", "handlers", "orelse", "finalbody"]; +} +impl From> for Stmt { + fn from(payload: StmtTry) -> Self { + Stmt::Try(payload) + } +} +impl From> for Ast { + fn from(payload: StmtTry) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [TryStar](https://docs.python.org/3/library/ast.html#ast.TryStar) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtTryStar { + pub range: R, + pub body: Vec>, + pub handlers: Vec>, + pub orelse: Vec>, + pub finalbody: Vec>, +} + +impl Node for StmtTryStar { + const NAME: &'static str = "TryStar"; + const FIELD_NAMES: &'static [&'static str] = &["body", "handlers", "orelse", "finalbody"]; +} +impl From> for Stmt { + fn from(payload: StmtTryStar) -> Self { + Stmt::TryStar(payload) + } +} +impl From> for Ast { + fn from(payload: StmtTryStar) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Assert](https://docs.python.org/3/library/ast.html#ast.Assert) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtAssert { + pub range: R, + pub test: Box>, + pub msg: Option>>, +} + +impl Node for StmtAssert { + const NAME: &'static str = "Assert"; + const FIELD_NAMES: &'static [&'static str] = &["test", "msg"]; +} +impl From> for Stmt { + fn from(payload: StmtAssert) -> Self { + Stmt::Assert(payload) + } +} +impl From> for Ast { + fn from(payload: StmtAssert) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Import](https://docs.python.org/3/library/ast.html#ast.Import) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtImport { + pub range: R, + pub names: Vec>, +} + +impl Node for StmtImport { + const NAME: &'static str = "Import"; + const FIELD_NAMES: &'static [&'static str] = &["names"]; +} +impl From> for Stmt { + fn from(payload: StmtImport) -> Self { + Stmt::Import(payload) + } +} +impl From> for Ast { + fn from(payload: StmtImport) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [ImportFrom](https://docs.python.org/3/library/ast.html#ast.ImportFrom) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtImportFrom { + pub range: R, + pub module: Option, + pub names: Vec>, + pub level: Option, +} + +impl Node for StmtImportFrom { + const NAME: &'static str = "ImportFrom"; + const FIELD_NAMES: &'static [&'static str] = &["module", "names", "level"]; +} +impl From> for Stmt { + fn from(payload: StmtImportFrom) -> Self { + Stmt::ImportFrom(payload) + } +} +impl From> for Ast { + fn from(payload: StmtImportFrom) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Global](https://docs.python.org/3/library/ast.html#ast.Global) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtGlobal { + pub range: R, + pub names: Vec, +} + +impl Node for StmtGlobal { + const NAME: &'static str = "Global"; + const FIELD_NAMES: &'static [&'static str] = &["names"]; +} +impl From> for Stmt { + fn from(payload: StmtGlobal) -> Self { + Stmt::Global(payload) + } +} +impl From> for Ast { + fn from(payload: StmtGlobal) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Nonlocal](https://docs.python.org/3/library/ast.html#ast.Nonlocal) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtNonlocal { + pub range: R, + pub names: Vec, +} + +impl Node for StmtNonlocal { + const NAME: &'static str = "Nonlocal"; + const FIELD_NAMES: &'static [&'static str] = &["names"]; +} +impl From> for Stmt { + fn from(payload: StmtNonlocal) -> Self { + Stmt::Nonlocal(payload) + } +} +impl From> for Ast { + fn from(payload: StmtNonlocal) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Expr](https://docs.python.org/3/library/ast.html#ast.Expr) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtExpr { + pub range: R, + pub value: Box>, +} + +impl Node for StmtExpr { + const NAME: &'static str = "Expr"; + const FIELD_NAMES: &'static [&'static str] = &["value"]; +} +impl From> for Stmt { + fn from(payload: StmtExpr) -> Self { + Stmt::Expr(payload) + } +} +impl From> for Ast { + fn from(payload: StmtExpr) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Pass](https://docs.python.org/3/library/ast.html#ast.Pass) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtPass { + pub range: R, +} + +impl Node for StmtPass { + const NAME: &'static str = "Pass"; + const FIELD_NAMES: &'static [&'static str] = &[]; +} +impl From> for Stmt { + fn from(payload: StmtPass) -> Self { + Stmt::Pass(payload) + } +} +impl From> for Ast { + fn from(payload: StmtPass) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Break](https://docs.python.org/3/library/ast.html#ast.Break) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtBreak { + pub range: R, +} + +impl Node for StmtBreak { + const NAME: &'static str = "Break"; + const FIELD_NAMES: &'static [&'static str] = &[]; +} +impl From> for Stmt { + fn from(payload: StmtBreak) -> Self { + Stmt::Break(payload) + } +} +impl From> for Ast { + fn from(payload: StmtBreak) -> Self { + Stmt::from(payload).into() + } +} + +/// See also [Continue](https://docs.python.org/3/library/ast.html#ast.Continue) +#[derive(Clone, Debug, PartialEq)] +pub struct StmtContinue { + pub range: R, +} + +impl Node for StmtContinue { + const NAME: &'static str = "Continue"; + const FIELD_NAMES: &'static [&'static str] = &[]; +} +impl From> for Stmt { + fn from(payload: StmtContinue) -> Self { + Stmt::Continue(payload) + } +} +impl From> for Ast { + fn from(payload: StmtContinue) -> Self { + Stmt::from(payload).into() + } +} + impl Node for Stmt { const NAME: &'static str = "stmt"; const FIELD_NAMES: &'static [&'static str] = &[]; } -#[derive(Clone, Debug, PartialEq)] -pub struct ExprBoolOp { - pub range: R, - pub op: Boolop, - pub values: Vec>, -} - -impl Node for ExprBoolOp { - const NAME: &'static str = "BoolOp"; - const FIELD_NAMES: &'static [&'static str] = &["op", "values"]; -} -impl From> for Expr { - fn from(payload: ExprBoolOp) -> Self { - Expr::BoolOp(payload) - } -} -impl From> for Ast { - fn from(payload: ExprBoolOp) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprNamedExpr { - pub range: R, - pub target: Box>, - pub value: Box>, -} - -impl Node for ExprNamedExpr { - const NAME: &'static str = "NamedExpr"; - const FIELD_NAMES: &'static [&'static str] = &["target", "value"]; -} -impl From> for Expr { - fn from(payload: ExprNamedExpr) -> Self { - Expr::NamedExpr(payload) - } -} -impl From> for Ast { - fn from(payload: ExprNamedExpr) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprBinOp { - pub range: R, - pub left: Box>, - pub op: Operator, - pub right: Box>, -} - -impl Node for ExprBinOp { - const NAME: &'static str = "BinOp"; - const FIELD_NAMES: &'static [&'static str] = &["left", "op", "right"]; -} -impl From> for Expr { - fn from(payload: ExprBinOp) -> Self { - Expr::BinOp(payload) - } -} -impl From> for Ast { - fn from(payload: ExprBinOp) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprUnaryOp { - pub range: R, - pub op: Unaryop, - pub operand: Box>, -} - -impl Node for ExprUnaryOp { - const NAME: &'static str = "UnaryOp"; - const FIELD_NAMES: &'static [&'static str] = &["op", "operand"]; -} -impl From> for Expr { - fn from(payload: ExprUnaryOp) -> Self { - Expr::UnaryOp(payload) - } -} -impl From> for Ast { - fn from(payload: ExprUnaryOp) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprLambda { - pub range: R, - pub args: Box>, - pub body: Box>, -} - -impl Node for ExprLambda { - const NAME: &'static str = "Lambda"; - const FIELD_NAMES: &'static [&'static str] = &["args", "body"]; -} -impl From> for Expr { - fn from(payload: ExprLambda) -> Self { - Expr::Lambda(payload) - } -} -impl From> for Ast { - fn from(payload: ExprLambda) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprIfExp { - pub range: R, - pub test: Box>, - pub body: Box>, - pub orelse: Box>, -} - -impl Node for ExprIfExp { - const NAME: &'static str = "IfExp"; - const FIELD_NAMES: &'static [&'static str] = &["test", "body", "orelse"]; -} -impl From> for Expr { - fn from(payload: ExprIfExp) -> Self { - Expr::IfExp(payload) - } -} -impl From> for Ast { - fn from(payload: ExprIfExp) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprDict { - pub range: R, - pub keys: Vec>>, - pub values: Vec>, -} - -impl Node for ExprDict { - const NAME: &'static str = "Dict"; - const FIELD_NAMES: &'static [&'static str] = &["keys", "values"]; -} -impl From> for Expr { - fn from(payload: ExprDict) -> Self { - Expr::Dict(payload) - } -} -impl From> for Ast { - fn from(payload: ExprDict) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprSet { - pub range: R, - pub elts: Vec>, -} - -impl Node for ExprSet { - const NAME: &'static str = "Set"; - const FIELD_NAMES: &'static [&'static str] = &["elts"]; -} -impl From> for Expr { - fn from(payload: ExprSet) -> Self { - Expr::Set(payload) - } -} -impl From> for Ast { - fn from(payload: ExprSet) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprListComp { - pub range: R, - pub elt: Box>, - pub generators: Vec>, -} - -impl Node for ExprListComp { - const NAME: &'static str = "ListComp"; - const FIELD_NAMES: &'static [&'static str] = &["elt", "generators"]; -} -impl From> for Expr { - fn from(payload: ExprListComp) -> Self { - Expr::ListComp(payload) - } -} -impl From> for Ast { - fn from(payload: ExprListComp) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprSetComp { - pub range: R, - pub elt: Box>, - pub generators: Vec>, -} - -impl Node for ExprSetComp { - const NAME: &'static str = "SetComp"; - const FIELD_NAMES: &'static [&'static str] = &["elt", "generators"]; -} -impl From> for Expr { - fn from(payload: ExprSetComp) -> Self { - Expr::SetComp(payload) - } -} -impl From> for Ast { - fn from(payload: ExprSetComp) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprDictComp { - pub range: R, - pub key: Box>, - pub value: Box>, - pub generators: Vec>, -} - -impl Node for ExprDictComp { - const NAME: &'static str = "DictComp"; - const FIELD_NAMES: &'static [&'static str] = &["key", "value", "generators"]; -} -impl From> for Expr { - fn from(payload: ExprDictComp) -> Self { - Expr::DictComp(payload) - } -} -impl From> for Ast { - fn from(payload: ExprDictComp) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprGeneratorExp { - pub range: R, - pub elt: Box>, - pub generators: Vec>, -} - -impl Node for ExprGeneratorExp { - const NAME: &'static str = "GeneratorExp"; - const FIELD_NAMES: &'static [&'static str] = &["elt", "generators"]; -} -impl From> for Expr { - fn from(payload: ExprGeneratorExp) -> Self { - Expr::GeneratorExp(payload) - } -} -impl From> for Ast { - fn from(payload: ExprGeneratorExp) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprAwait { - pub range: R, - pub value: Box>, -} - -impl Node for ExprAwait { - const NAME: &'static str = "Await"; - const FIELD_NAMES: &'static [&'static str] = &["value"]; -} -impl From> for Expr { - fn from(payload: ExprAwait) -> Self { - Expr::Await(payload) - } -} -impl From> for Ast { - fn from(payload: ExprAwait) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprYield { - pub range: R, - pub value: Option>>, -} - -impl Node for ExprYield { - const NAME: &'static str = "Yield"; - const FIELD_NAMES: &'static [&'static str] = &["value"]; -} -impl From> for Expr { - fn from(payload: ExprYield) -> Self { - Expr::Yield(payload) - } -} -impl From> for Ast { - fn from(payload: ExprYield) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprYieldFrom { - pub range: R, - pub value: Box>, -} - -impl Node for ExprYieldFrom { - const NAME: &'static str = "YieldFrom"; - const FIELD_NAMES: &'static [&'static str] = &["value"]; -} -impl From> for Expr { - fn from(payload: ExprYieldFrom) -> Self { - Expr::YieldFrom(payload) - } -} -impl From> for Ast { - fn from(payload: ExprYieldFrom) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprCompare { - pub range: R, - pub left: Box>, - pub ops: Vec, - pub comparators: Vec>, -} - -impl Node for ExprCompare { - const NAME: &'static str = "Compare"; - const FIELD_NAMES: &'static [&'static str] = &["left", "ops", "comparators"]; -} -impl From> for Expr { - fn from(payload: ExprCompare) -> Self { - Expr::Compare(payload) - } -} -impl From> for Ast { - fn from(payload: ExprCompare) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprCall { - pub range: R, - pub func: Box>, - pub args: Vec>, - pub keywords: Vec>, -} - -impl Node for ExprCall { - const NAME: &'static str = "Call"; - const FIELD_NAMES: &'static [&'static str] = &["func", "args", "keywords"]; -} -impl From> for Expr { - fn from(payload: ExprCall) -> Self { - Expr::Call(payload) - } -} -impl From> for Ast { - fn from(payload: ExprCall) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprFormattedValue { - pub range: R, - pub value: Box>, - pub conversion: ConversionFlag, - pub format_spec: Option>>, -} - -impl Node for ExprFormattedValue { - const NAME: &'static str = "FormattedValue"; - const FIELD_NAMES: &'static [&'static str] = &["value", "conversion", "format_spec"]; -} -impl From> for Expr { - fn from(payload: ExprFormattedValue) -> Self { - Expr::FormattedValue(payload) - } -} -impl From> for Ast { - fn from(payload: ExprFormattedValue) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprJoinedStr { - pub range: R, - pub values: Vec>, -} - -impl Node for ExprJoinedStr { - const NAME: &'static str = "JoinedStr"; - const FIELD_NAMES: &'static [&'static str] = &["values"]; -} -impl From> for Expr { - fn from(payload: ExprJoinedStr) -> Self { - Expr::JoinedStr(payload) - } -} -impl From> for Ast { - fn from(payload: ExprJoinedStr) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprConstant { - pub range: R, - pub value: Constant, - pub kind: Option, -} - -impl Node for ExprConstant { - const NAME: &'static str = "Constant"; - const FIELD_NAMES: &'static [&'static str] = &["value", "kind"]; -} -impl From> for Expr { - fn from(payload: ExprConstant) -> Self { - Expr::Constant(payload) - } -} -impl From> for Ast { - fn from(payload: ExprConstant) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprAttribute { - pub range: R, - pub value: Box>, - pub attr: Identifier, - pub ctx: ExprContext, -} - -impl Node for ExprAttribute { - const NAME: &'static str = "Attribute"; - const FIELD_NAMES: &'static [&'static str] = &["value", "attr", "ctx"]; -} -impl From> for Expr { - fn from(payload: ExprAttribute) -> Self { - Expr::Attribute(payload) - } -} -impl From> for Ast { - fn from(payload: ExprAttribute) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprSubscript { - pub range: R, - pub value: Box>, - pub slice: Box>, - pub ctx: ExprContext, -} - -impl Node for ExprSubscript { - const NAME: &'static str = "Subscript"; - const FIELD_NAMES: &'static [&'static str] = &["value", "slice", "ctx"]; -} -impl From> for Expr { - fn from(payload: ExprSubscript) -> Self { - Expr::Subscript(payload) - } -} -impl From> for Ast { - fn from(payload: ExprSubscript) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprStarred { - pub range: R, - pub value: Box>, - pub ctx: ExprContext, -} - -impl Node for ExprStarred { - const NAME: &'static str = "Starred"; - const FIELD_NAMES: &'static [&'static str] = &["value", "ctx"]; -} -impl From> for Expr { - fn from(payload: ExprStarred) -> Self { - Expr::Starred(payload) - } -} -impl From> for Ast { - fn from(payload: ExprStarred) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprName { - pub range: R, - pub id: Identifier, - pub ctx: ExprContext, -} - -impl Node for ExprName { - const NAME: &'static str = "Name"; - const FIELD_NAMES: &'static [&'static str] = &["id", "ctx"]; -} -impl From> for Expr { - fn from(payload: ExprName) -> Self { - Expr::Name(payload) - } -} -impl From> for Ast { - fn from(payload: ExprName) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprList { - pub range: R, - pub elts: Vec>, - pub ctx: ExprContext, -} - -impl Node for ExprList { - const NAME: &'static str = "List"; - const FIELD_NAMES: &'static [&'static str] = &["elts", "ctx"]; -} -impl From> for Expr { - fn from(payload: ExprList) -> Self { - Expr::List(payload) - } -} -impl From> for Ast { - fn from(payload: ExprList) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprTuple { - pub range: R, - pub elts: Vec>, - pub ctx: ExprContext, -} - -impl Node for ExprTuple { - const NAME: &'static str = "Tuple"; - const FIELD_NAMES: &'static [&'static str] = &["elts", "ctx"]; -} -impl From> for Expr { - fn from(payload: ExprTuple) -> Self { - Expr::Tuple(payload) - } -} -impl From> for Ast { - fn from(payload: ExprTuple) -> Self { - Expr::from(payload).into() - } -} - -#[derive(Clone, Debug, PartialEq)] -pub struct ExprSlice { - pub range: R, - pub lower: Option>>, - pub upper: Option>>, - pub step: Option>>, -} - -impl Node for ExprSlice { - const NAME: &'static str = "Slice"; - const FIELD_NAMES: &'static [&'static str] = &["lower", "upper", "step"]; -} -impl From> for Expr { - fn from(payload: ExprSlice) -> Self { - Expr::Slice(payload) - } -} -impl From> for Ast { - fn from(payload: ExprSlice) -> Self { - Expr::from(payload).into() - } -} - +/// See also [expr](https://docs.python.org/3/library/ast.html#ast.expr) #[derive(Clone, Debug, PartialEq, is_macro::Is)] pub enum Expr { #[is(name = "bool_op_expr")] @@ -1584,11 +1020,637 @@ pub enum Expr { Slice(ExprSlice), } +/// See also [BoolOp](https://docs.python.org/3/library/ast.html#ast.BoolOp) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprBoolOp { + pub range: R, + pub op: BoolOp, + pub values: Vec>, +} + +impl Node for ExprBoolOp { + const NAME: &'static str = "BoolOp"; + const FIELD_NAMES: &'static [&'static str] = &["op", "values"]; +} +impl From> for Expr { + fn from(payload: ExprBoolOp) -> Self { + Expr::BoolOp(payload) + } +} +impl From> for Ast { + fn from(payload: ExprBoolOp) -> Self { + Expr::from(payload).into() + } +} + +/// See also [NamedExpr](https://docs.python.org/3/library/ast.html#ast.NamedExpr) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprNamedExpr { + pub range: R, + pub target: Box>, + pub value: Box>, +} + +impl Node for ExprNamedExpr { + const NAME: &'static str = "NamedExpr"; + const FIELD_NAMES: &'static [&'static str] = &["target", "value"]; +} +impl From> for Expr { + fn from(payload: ExprNamedExpr) -> Self { + Expr::NamedExpr(payload) + } +} +impl From> for Ast { + fn from(payload: ExprNamedExpr) -> Self { + Expr::from(payload).into() + } +} + +/// See also [BinOp](https://docs.python.org/3/library/ast.html#ast.BinOp) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprBinOp { + pub range: R, + pub left: Box>, + pub op: Operator, + pub right: Box>, +} + +impl Node for ExprBinOp { + const NAME: &'static str = "BinOp"; + const FIELD_NAMES: &'static [&'static str] = &["left", "op", "right"]; +} +impl From> for Expr { + fn from(payload: ExprBinOp) -> Self { + Expr::BinOp(payload) + } +} +impl From> for Ast { + fn from(payload: ExprBinOp) -> Self { + Expr::from(payload).into() + } +} + +/// See also [UnaryOp](https://docs.python.org/3/library/ast.html#ast.UnaryOp) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprUnaryOp { + pub range: R, + pub op: UnaryOp, + pub operand: Box>, +} + +impl Node for ExprUnaryOp { + const NAME: &'static str = "UnaryOp"; + const FIELD_NAMES: &'static [&'static str] = &["op", "operand"]; +} +impl From> for Expr { + fn from(payload: ExprUnaryOp) -> Self { + Expr::UnaryOp(payload) + } +} +impl From> for Ast { + fn from(payload: ExprUnaryOp) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Lambda](https://docs.python.org/3/library/ast.html#ast.Lambda) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprLambda { + pub range: R, + pub args: Box>, + pub body: Box>, +} + +impl Node for ExprLambda { + const NAME: &'static str = "Lambda"; + const FIELD_NAMES: &'static [&'static str] = &["args", "body"]; +} +impl From> for Expr { + fn from(payload: ExprLambda) -> Self { + Expr::Lambda(payload) + } +} +impl From> for Ast { + fn from(payload: ExprLambda) -> Self { + Expr::from(payload).into() + } +} + +/// See also [IfExp](https://docs.python.org/3/library/ast.html#ast.IfExp) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprIfExp { + pub range: R, + pub test: Box>, + pub body: Box>, + pub orelse: Box>, +} + +impl Node for ExprIfExp { + const NAME: &'static str = "IfExp"; + const FIELD_NAMES: &'static [&'static str] = &["test", "body", "orelse"]; +} +impl From> for Expr { + fn from(payload: ExprIfExp) -> Self { + Expr::IfExp(payload) + } +} +impl From> for Ast { + fn from(payload: ExprIfExp) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Dict](https://docs.python.org/3/library/ast.html#ast.Dict) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprDict { + pub range: R, + pub keys: Vec>>, + pub values: Vec>, +} + +impl Node for ExprDict { + const NAME: &'static str = "Dict"; + const FIELD_NAMES: &'static [&'static str] = &["keys", "values"]; +} +impl From> for Expr { + fn from(payload: ExprDict) -> Self { + Expr::Dict(payload) + } +} +impl From> for Ast { + fn from(payload: ExprDict) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Set](https://docs.python.org/3/library/ast.html#ast.Set) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprSet { + pub range: R, + pub elts: Vec>, +} + +impl Node for ExprSet { + const NAME: &'static str = "Set"; + const FIELD_NAMES: &'static [&'static str] = &["elts"]; +} +impl From> for Expr { + fn from(payload: ExprSet) -> Self { + Expr::Set(payload) + } +} +impl From> for Ast { + fn from(payload: ExprSet) -> Self { + Expr::from(payload).into() + } +} + +/// See also [ListComp](https://docs.python.org/3/library/ast.html#ast.ListComp) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprListComp { + pub range: R, + pub elt: Box>, + pub generators: Vec>, +} + +impl Node for ExprListComp { + const NAME: &'static str = "ListComp"; + const FIELD_NAMES: &'static [&'static str] = &["elt", "generators"]; +} +impl From> for Expr { + fn from(payload: ExprListComp) -> Self { + Expr::ListComp(payload) + } +} +impl From> for Ast { + fn from(payload: ExprListComp) -> Self { + Expr::from(payload).into() + } +} + +/// See also [SetComp](https://docs.python.org/3/library/ast.html#ast.SetComp) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprSetComp { + pub range: R, + pub elt: Box>, + pub generators: Vec>, +} + +impl Node for ExprSetComp { + const NAME: &'static str = "SetComp"; + const FIELD_NAMES: &'static [&'static str] = &["elt", "generators"]; +} +impl From> for Expr { + fn from(payload: ExprSetComp) -> Self { + Expr::SetComp(payload) + } +} +impl From> for Ast { + fn from(payload: ExprSetComp) -> Self { + Expr::from(payload).into() + } +} + +/// See also [DictComp](https://docs.python.org/3/library/ast.html#ast.DictComp) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprDictComp { + pub range: R, + pub key: Box>, + pub value: Box>, + pub generators: Vec>, +} + +impl Node for ExprDictComp { + const NAME: &'static str = "DictComp"; + const FIELD_NAMES: &'static [&'static str] = &["key", "value", "generators"]; +} +impl From> for Expr { + fn from(payload: ExprDictComp) -> Self { + Expr::DictComp(payload) + } +} +impl From> for Ast { + fn from(payload: ExprDictComp) -> Self { + Expr::from(payload).into() + } +} + +/// See also [GeneratorExp](https://docs.python.org/3/library/ast.html#ast.GeneratorExp) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprGeneratorExp { + pub range: R, + pub elt: Box>, + pub generators: Vec>, +} + +impl Node for ExprGeneratorExp { + const NAME: &'static str = "GeneratorExp"; + const FIELD_NAMES: &'static [&'static str] = &["elt", "generators"]; +} +impl From> for Expr { + fn from(payload: ExprGeneratorExp) -> Self { + Expr::GeneratorExp(payload) + } +} +impl From> for Ast { + fn from(payload: ExprGeneratorExp) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Await](https://docs.python.org/3/library/ast.html#ast.Await) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprAwait { + pub range: R, + pub value: Box>, +} + +impl Node for ExprAwait { + const NAME: &'static str = "Await"; + const FIELD_NAMES: &'static [&'static str] = &["value"]; +} +impl From> for Expr { + fn from(payload: ExprAwait) -> Self { + Expr::Await(payload) + } +} +impl From> for Ast { + fn from(payload: ExprAwait) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Yield](https://docs.python.org/3/library/ast.html#ast.Yield) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprYield { + pub range: R, + pub value: Option>>, +} + +impl Node for ExprYield { + const NAME: &'static str = "Yield"; + const FIELD_NAMES: &'static [&'static str] = &["value"]; +} +impl From> for Expr { + fn from(payload: ExprYield) -> Self { + Expr::Yield(payload) + } +} +impl From> for Ast { + fn from(payload: ExprYield) -> Self { + Expr::from(payload).into() + } +} + +/// See also [YieldFrom](https://docs.python.org/3/library/ast.html#ast.YieldFrom) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprYieldFrom { + pub range: R, + pub value: Box>, +} + +impl Node for ExprYieldFrom { + const NAME: &'static str = "YieldFrom"; + const FIELD_NAMES: &'static [&'static str] = &["value"]; +} +impl From> for Expr { + fn from(payload: ExprYieldFrom) -> Self { + Expr::YieldFrom(payload) + } +} +impl From> for Ast { + fn from(payload: ExprYieldFrom) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Compare](https://docs.python.org/3/library/ast.html#ast.Compare) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprCompare { + pub range: R, + pub left: Box>, + pub ops: Vec, + pub comparators: Vec>, +} + +impl Node for ExprCompare { + const NAME: &'static str = "Compare"; + const FIELD_NAMES: &'static [&'static str] = &["left", "ops", "comparators"]; +} +impl From> for Expr { + fn from(payload: ExprCompare) -> Self { + Expr::Compare(payload) + } +} +impl From> for Ast { + fn from(payload: ExprCompare) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Call](https://docs.python.org/3/library/ast.html#ast.Call) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprCall { + pub range: R, + pub func: Box>, + pub args: Vec>, + pub keywords: Vec>, +} + +impl Node for ExprCall { + const NAME: &'static str = "Call"; + const FIELD_NAMES: &'static [&'static str] = &["func", "args", "keywords"]; +} +impl From> for Expr { + fn from(payload: ExprCall) -> Self { + Expr::Call(payload) + } +} +impl From> for Ast { + fn from(payload: ExprCall) -> Self { + Expr::from(payload).into() + } +} + +/// See also [FormattedValue](https://docs.python.org/3/library/ast.html#ast.FormattedValue) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprFormattedValue { + pub range: R, + pub value: Box>, + pub conversion: ConversionFlag, + pub format_spec: Option>>, +} + +impl Node for ExprFormattedValue { + const NAME: &'static str = "FormattedValue"; + const FIELD_NAMES: &'static [&'static str] = &["value", "conversion", "format_spec"]; +} +impl From> for Expr { + fn from(payload: ExprFormattedValue) -> Self { + Expr::FormattedValue(payload) + } +} +impl From> for Ast { + fn from(payload: ExprFormattedValue) -> Self { + Expr::from(payload).into() + } +} + +/// See also [JoinedStr](https://docs.python.org/3/library/ast.html#ast.JoinedStr) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprJoinedStr { + pub range: R, + pub values: Vec>, +} + +impl Node for ExprJoinedStr { + const NAME: &'static str = "JoinedStr"; + const FIELD_NAMES: &'static [&'static str] = &["values"]; +} +impl From> for Expr { + fn from(payload: ExprJoinedStr) -> Self { + Expr::JoinedStr(payload) + } +} +impl From> for Ast { + fn from(payload: ExprJoinedStr) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Constant](https://docs.python.org/3/library/ast.html#ast.Constant) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprConstant { + pub range: R, + pub value: Constant, + pub kind: Option, +} + +impl Node for ExprConstant { + const NAME: &'static str = "Constant"; + const FIELD_NAMES: &'static [&'static str] = &["value", "kind"]; +} +impl From> for Expr { + fn from(payload: ExprConstant) -> Self { + Expr::Constant(payload) + } +} +impl From> for Ast { + fn from(payload: ExprConstant) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Attribute](https://docs.python.org/3/library/ast.html#ast.Attribute) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprAttribute { + pub range: R, + pub value: Box>, + pub attr: Identifier, + pub ctx: ExprContext, +} + +impl Node for ExprAttribute { + const NAME: &'static str = "Attribute"; + const FIELD_NAMES: &'static [&'static str] = &["value", "attr", "ctx"]; +} +impl From> for Expr { + fn from(payload: ExprAttribute) -> Self { + Expr::Attribute(payload) + } +} +impl From> for Ast { + fn from(payload: ExprAttribute) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Subscript](https://docs.python.org/3/library/ast.html#ast.Subscript) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprSubscript { + pub range: R, + pub value: Box>, + pub slice: Box>, + pub ctx: ExprContext, +} + +impl Node for ExprSubscript { + const NAME: &'static str = "Subscript"; + const FIELD_NAMES: &'static [&'static str] = &["value", "slice", "ctx"]; +} +impl From> for Expr { + fn from(payload: ExprSubscript) -> Self { + Expr::Subscript(payload) + } +} +impl From> for Ast { + fn from(payload: ExprSubscript) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Starred](https://docs.python.org/3/library/ast.html#ast.Starred) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprStarred { + pub range: R, + pub value: Box>, + pub ctx: ExprContext, +} + +impl Node for ExprStarred { + const NAME: &'static str = "Starred"; + const FIELD_NAMES: &'static [&'static str] = &["value", "ctx"]; +} +impl From> for Expr { + fn from(payload: ExprStarred) -> Self { + Expr::Starred(payload) + } +} +impl From> for Ast { + fn from(payload: ExprStarred) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Name](https://docs.python.org/3/library/ast.html#ast.Name) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprName { + pub range: R, + pub id: Identifier, + pub ctx: ExprContext, +} + +impl Node for ExprName { + const NAME: &'static str = "Name"; + const FIELD_NAMES: &'static [&'static str] = &["id", "ctx"]; +} +impl From> for Expr { + fn from(payload: ExprName) -> Self { + Expr::Name(payload) + } +} +impl From> for Ast { + fn from(payload: ExprName) -> Self { + Expr::from(payload).into() + } +} + +/// See also [List](https://docs.python.org/3/library/ast.html#ast.List) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprList { + pub range: R, + pub elts: Vec>, + pub ctx: ExprContext, +} + +impl Node for ExprList { + const NAME: &'static str = "List"; + const FIELD_NAMES: &'static [&'static str] = &["elts", "ctx"]; +} +impl From> for Expr { + fn from(payload: ExprList) -> Self { + Expr::List(payload) + } +} +impl From> for Ast { + fn from(payload: ExprList) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Tuple](https://docs.python.org/3/library/ast.html#ast.Tuple) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprTuple { + pub range: R, + pub elts: Vec>, + pub ctx: ExprContext, +} + +impl Node for ExprTuple { + const NAME: &'static str = "Tuple"; + const FIELD_NAMES: &'static [&'static str] = &["elts", "ctx"]; +} +impl From> for Expr { + fn from(payload: ExprTuple) -> Self { + Expr::Tuple(payload) + } +} +impl From> for Ast { + fn from(payload: ExprTuple) -> Self { + Expr::from(payload).into() + } +} + +/// See also [Slice](https://docs.python.org/3/library/ast.html#ast.Slice) +#[derive(Clone, Debug, PartialEq)] +pub struct ExprSlice { + pub range: R, + pub lower: Option>>, + pub upper: Option>>, + pub step: Option>>, +} + +impl Node for ExprSlice { + const NAME: &'static str = "Slice"; + const FIELD_NAMES: &'static [&'static str] = &["lower", "upper", "step"]; +} +impl From> for Expr { + fn from(payload: ExprSlice) -> Self { + Expr::Slice(payload) + } +} +impl From> for Ast { + fn from(payload: ExprSlice) -> Self { + Expr::from(payload).into() + } +} + impl Node for Expr { const NAME: &'static str = "expr"; const FIELD_NAMES: &'static [&'static str] = &[]; } +/// See also [expr_context](https://docs.python.org/3/library/ast.html#ast.expr_context) #[derive(Clone, Debug, PartialEq, is_macro::Is, Copy, Hash, Eq)] pub enum ExprContext { Load, @@ -1692,78 +1754,80 @@ impl Node for ExprContext { const FIELD_NAMES: &'static [&'static str] = &[]; } +/// See also [boolop](https://docs.python.org/3/library/ast.html#ast.boolop) #[derive(Clone, Debug, PartialEq, is_macro::Is, Copy, Hash, Eq)] -pub enum Boolop { +pub enum BoolOp { And, Or, } -impl Boolop { +impl BoolOp { #[inline] - pub const fn and(&self) -> Option { + pub const fn and(&self) -> Option { match self { - Boolop::And => Some(BoolopAnd), + BoolOp::And => Some(BoolOpAnd), _ => None, } } #[inline] - pub const fn or(&self) -> Option { + pub const fn or(&self) -> Option { match self { - Boolop::Or => Some(BoolopOr), + BoolOp::Or => Some(BoolOpOr), _ => None, } } } -pub struct BoolopAnd; -impl From for Boolop { - fn from(_: BoolopAnd) -> Self { - Boolop::And +pub struct BoolOpAnd; +impl From for BoolOp { + fn from(_: BoolOpAnd) -> Self { + BoolOp::And } } -impl From for Ast { - fn from(_: BoolopAnd) -> Self { - Boolop::And.into() +impl From for Ast { + fn from(_: BoolOpAnd) -> Self { + BoolOp::And.into() } } -impl Node for BoolopAnd { +impl Node for BoolOpAnd { const NAME: &'static str = "And"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for BoolopAnd { +impl std::cmp::PartialEq for BoolOpAnd { #[inline] - fn eq(&self, other: &Boolop) -> bool { - matches!(other, Boolop::And) + fn eq(&self, other: &BoolOp) -> bool { + matches!(other, BoolOp::And) } } -pub struct BoolopOr; -impl From for Boolop { - fn from(_: BoolopOr) -> Self { - Boolop::Or +pub struct BoolOpOr; +impl From for BoolOp { + fn from(_: BoolOpOr) -> Self { + BoolOp::Or } } -impl From for Ast { - fn from(_: BoolopOr) -> Self { - Boolop::Or.into() +impl From for Ast { + fn from(_: BoolOpOr) -> Self { + BoolOp::Or.into() } } -impl Node for BoolopOr { +impl Node for BoolOpOr { const NAME: &'static str = "Or"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for BoolopOr { +impl std::cmp::PartialEq for BoolOpOr { #[inline] - fn eq(&self, other: &Boolop) -> bool { - matches!(other, Boolop::Or) + fn eq(&self, other: &BoolOp) -> bool { + matches!(other, BoolOp::Or) } } -impl Node for Boolop { +impl Node for BoolOp { const NAME: &'static str = "boolop"; const FIELD_NAMES: &'static [&'static str] = &[]; } +/// See also [operator](https://docs.python.org/3/library/ast.html#ast.operator) #[derive(Clone, Debug, PartialEq, is_macro::Is, Copy, Hash, Eq)] pub enum Operator { Add, @@ -2177,142 +2241,144 @@ impl Node for Operator { const FIELD_NAMES: &'static [&'static str] = &[]; } +/// See also [unaryop](https://docs.python.org/3/library/ast.html#ast.unaryop) #[derive(Clone, Debug, PartialEq, is_macro::Is, Copy, Hash, Eq)] -pub enum Unaryop { +pub enum UnaryOp { Invert, Not, UAdd, USub, } -impl Unaryop { +impl UnaryOp { #[inline] - pub const fn invert(&self) -> Option { + pub const fn invert(&self) -> Option { match self { - Unaryop::Invert => Some(UnaryopInvert), + UnaryOp::Invert => Some(UnaryOpInvert), _ => None, } } #[inline] - pub const fn not(&self) -> Option { + pub const fn not(&self) -> Option { match self { - Unaryop::Not => Some(UnaryopNot), + UnaryOp::Not => Some(UnaryOpNot), _ => None, } } #[inline] - pub const fn u_add(&self) -> Option { + pub const fn u_add(&self) -> Option { match self { - Unaryop::UAdd => Some(UnaryopUAdd), + UnaryOp::UAdd => Some(UnaryOpUAdd), _ => None, } } #[inline] - pub const fn u_sub(&self) -> Option { + pub const fn u_sub(&self) -> Option { match self { - Unaryop::USub => Some(UnaryopUSub), + UnaryOp::USub => Some(UnaryOpUSub), _ => None, } } } -pub struct UnaryopInvert; -impl From for Unaryop { - fn from(_: UnaryopInvert) -> Self { - Unaryop::Invert +pub struct UnaryOpInvert; +impl From for UnaryOp { + fn from(_: UnaryOpInvert) -> Self { + UnaryOp::Invert } } -impl From for Ast { - fn from(_: UnaryopInvert) -> Self { - Unaryop::Invert.into() +impl From for Ast { + fn from(_: UnaryOpInvert) -> Self { + UnaryOp::Invert.into() } } -impl Node for UnaryopInvert { +impl Node for UnaryOpInvert { const NAME: &'static str = "Invert"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for UnaryopInvert { +impl std::cmp::PartialEq for UnaryOpInvert { #[inline] - fn eq(&self, other: &Unaryop) -> bool { - matches!(other, Unaryop::Invert) + fn eq(&self, other: &UnaryOp) -> bool { + matches!(other, UnaryOp::Invert) } } -pub struct UnaryopNot; -impl From for Unaryop { - fn from(_: UnaryopNot) -> Self { - Unaryop::Not +pub struct UnaryOpNot; +impl From for UnaryOp { + fn from(_: UnaryOpNot) -> Self { + UnaryOp::Not } } -impl From for Ast { - fn from(_: UnaryopNot) -> Self { - Unaryop::Not.into() +impl From for Ast { + fn from(_: UnaryOpNot) -> Self { + UnaryOp::Not.into() } } -impl Node for UnaryopNot { +impl Node for UnaryOpNot { const NAME: &'static str = "Not"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for UnaryopNot { +impl std::cmp::PartialEq for UnaryOpNot { #[inline] - fn eq(&self, other: &Unaryop) -> bool { - matches!(other, Unaryop::Not) + fn eq(&self, other: &UnaryOp) -> bool { + matches!(other, UnaryOp::Not) } } -pub struct UnaryopUAdd; -impl From for Unaryop { - fn from(_: UnaryopUAdd) -> Self { - Unaryop::UAdd +pub struct UnaryOpUAdd; +impl From for UnaryOp { + fn from(_: UnaryOpUAdd) -> Self { + UnaryOp::UAdd } } -impl From for Ast { - fn from(_: UnaryopUAdd) -> Self { - Unaryop::UAdd.into() +impl From for Ast { + fn from(_: UnaryOpUAdd) -> Self { + UnaryOp::UAdd.into() } } -impl Node for UnaryopUAdd { +impl Node for UnaryOpUAdd { const NAME: &'static str = "UAdd"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for UnaryopUAdd { +impl std::cmp::PartialEq for UnaryOpUAdd { #[inline] - fn eq(&self, other: &Unaryop) -> bool { - matches!(other, Unaryop::UAdd) + fn eq(&self, other: &UnaryOp) -> bool { + matches!(other, UnaryOp::UAdd) } } -pub struct UnaryopUSub; -impl From for Unaryop { - fn from(_: UnaryopUSub) -> Self { - Unaryop::USub +pub struct UnaryOpUSub; +impl From for UnaryOp { + fn from(_: UnaryOpUSub) -> Self { + UnaryOp::USub } } -impl From for Ast { - fn from(_: UnaryopUSub) -> Self { - Unaryop::USub.into() +impl From for Ast { + fn from(_: UnaryOpUSub) -> Self { + UnaryOp::USub.into() } } -impl Node for UnaryopUSub { +impl Node for UnaryOpUSub { const NAME: &'static str = "USub"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for UnaryopUSub { +impl std::cmp::PartialEq for UnaryOpUSub { #[inline] - fn eq(&self, other: &Unaryop) -> bool { - matches!(other, Unaryop::USub) + fn eq(&self, other: &UnaryOp) -> bool { + matches!(other, UnaryOp::USub) } } -impl Node for Unaryop { +impl Node for UnaryOp { const NAME: &'static str = "unaryop"; const FIELD_NAMES: &'static [&'static str] = &[]; } +/// See also [cmpop](https://docs.python.org/3/library/ast.html#ast.cmpop) #[derive(Clone, Debug, PartialEq, is_macro::Is, Copy, Hash, Eq)] -pub enum Cmpop { +pub enum CmpOp { Eq, NotEq, Lt, @@ -2324,313 +2390,314 @@ pub enum Cmpop { In, NotIn, } -impl Cmpop { +impl CmpOp { #[inline] - pub const fn cmpop_eq(&self) -> Option { + pub const fn cmp_op_eq(&self) -> Option { match self { - Cmpop::Eq => Some(CmpopEq), + CmpOp::Eq => Some(CmpOpEq), _ => None, } } #[inline] - pub const fn cmpop_not_eq(&self) -> Option { + pub const fn cmp_op_not_eq(&self) -> Option { match self { - Cmpop::NotEq => Some(CmpopNotEq), + CmpOp::NotEq => Some(CmpOpNotEq), _ => None, } } #[inline] - pub const fn cmpop_lt(&self) -> Option { + pub const fn cmp_op_lt(&self) -> Option { match self { - Cmpop::Lt => Some(CmpopLt), + CmpOp::Lt => Some(CmpOpLt), _ => None, } } #[inline] - pub const fn cmpop_lt_e(&self) -> Option { + pub const fn cmp_op_lt_e(&self) -> Option { match self { - Cmpop::LtE => Some(CmpopLtE), + CmpOp::LtE => Some(CmpOpLtE), _ => None, } } #[inline] - pub const fn cmpop_gt(&self) -> Option { + pub const fn cmp_op_gt(&self) -> Option { match self { - Cmpop::Gt => Some(CmpopGt), + CmpOp::Gt => Some(CmpOpGt), _ => None, } } #[inline] - pub const fn cmpop_gt_e(&self) -> Option { + pub const fn cmp_op_gt_e(&self) -> Option { match self { - Cmpop::GtE => Some(CmpopGtE), + CmpOp::GtE => Some(CmpOpGtE), _ => None, } } #[inline] - pub const fn cmpop_is(&self) -> Option { + pub const fn cmp_op_is(&self) -> Option { match self { - Cmpop::Is => Some(CmpopIs), + CmpOp::Is => Some(CmpOpIs), _ => None, } } #[inline] - pub const fn cmpop_is_not(&self) -> Option { + pub const fn cmp_op_is_not(&self) -> Option { match self { - Cmpop::IsNot => Some(CmpopIsNot), + CmpOp::IsNot => Some(CmpOpIsNot), _ => None, } } #[inline] - pub const fn cmpop_in(&self) -> Option { + pub const fn cmp_op_in(&self) -> Option { match self { - Cmpop::In => Some(CmpopIn), + CmpOp::In => Some(CmpOpIn), _ => None, } } #[inline] - pub const fn cmpop_not_in(&self) -> Option { + pub const fn cmp_op_not_in(&self) -> Option { match self { - Cmpop::NotIn => Some(CmpopNotIn), + CmpOp::NotIn => Some(CmpOpNotIn), _ => None, } } } -pub struct CmpopEq; -impl From for Cmpop { - fn from(_: CmpopEq) -> Self { - Cmpop::Eq +pub struct CmpOpEq; +impl From for CmpOp { + fn from(_: CmpOpEq) -> Self { + CmpOp::Eq } } -impl From for Ast { - fn from(_: CmpopEq) -> Self { - Cmpop::Eq.into() +impl From for Ast { + fn from(_: CmpOpEq) -> Self { + CmpOp::Eq.into() } } -impl Node for CmpopEq { +impl Node for CmpOpEq { const NAME: &'static str = "Eq"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopEq { +impl std::cmp::PartialEq for CmpOpEq { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::Eq) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::Eq) } } -pub struct CmpopNotEq; -impl From for Cmpop { - fn from(_: CmpopNotEq) -> Self { - Cmpop::NotEq +pub struct CmpOpNotEq; +impl From for CmpOp { + fn from(_: CmpOpNotEq) -> Self { + CmpOp::NotEq } } -impl From for Ast { - fn from(_: CmpopNotEq) -> Self { - Cmpop::NotEq.into() +impl From for Ast { + fn from(_: CmpOpNotEq) -> Self { + CmpOp::NotEq.into() } } -impl Node for CmpopNotEq { +impl Node for CmpOpNotEq { const NAME: &'static str = "NotEq"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopNotEq { +impl std::cmp::PartialEq for CmpOpNotEq { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::NotEq) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::NotEq) } } -pub struct CmpopLt; -impl From for Cmpop { - fn from(_: CmpopLt) -> Self { - Cmpop::Lt +pub struct CmpOpLt; +impl From for CmpOp { + fn from(_: CmpOpLt) -> Self { + CmpOp::Lt } } -impl From for Ast { - fn from(_: CmpopLt) -> Self { - Cmpop::Lt.into() +impl From for Ast { + fn from(_: CmpOpLt) -> Self { + CmpOp::Lt.into() } } -impl Node for CmpopLt { +impl Node for CmpOpLt { const NAME: &'static str = "Lt"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopLt { +impl std::cmp::PartialEq for CmpOpLt { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::Lt) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::Lt) } } -pub struct CmpopLtE; -impl From for Cmpop { - fn from(_: CmpopLtE) -> Self { - Cmpop::LtE +pub struct CmpOpLtE; +impl From for CmpOp { + fn from(_: CmpOpLtE) -> Self { + CmpOp::LtE } } -impl From for Ast { - fn from(_: CmpopLtE) -> Self { - Cmpop::LtE.into() +impl From for Ast { + fn from(_: CmpOpLtE) -> Self { + CmpOp::LtE.into() } } -impl Node for CmpopLtE { +impl Node for CmpOpLtE { const NAME: &'static str = "LtE"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopLtE { +impl std::cmp::PartialEq for CmpOpLtE { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::LtE) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::LtE) } } -pub struct CmpopGt; -impl From for Cmpop { - fn from(_: CmpopGt) -> Self { - Cmpop::Gt +pub struct CmpOpGt; +impl From for CmpOp { + fn from(_: CmpOpGt) -> Self { + CmpOp::Gt } } -impl From for Ast { - fn from(_: CmpopGt) -> Self { - Cmpop::Gt.into() +impl From for Ast { + fn from(_: CmpOpGt) -> Self { + CmpOp::Gt.into() } } -impl Node for CmpopGt { +impl Node for CmpOpGt { const NAME: &'static str = "Gt"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopGt { +impl std::cmp::PartialEq for CmpOpGt { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::Gt) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::Gt) } } -pub struct CmpopGtE; -impl From for Cmpop { - fn from(_: CmpopGtE) -> Self { - Cmpop::GtE +pub struct CmpOpGtE; +impl From for CmpOp { + fn from(_: CmpOpGtE) -> Self { + CmpOp::GtE } } -impl From for Ast { - fn from(_: CmpopGtE) -> Self { - Cmpop::GtE.into() +impl From for Ast { + fn from(_: CmpOpGtE) -> Self { + CmpOp::GtE.into() } } -impl Node for CmpopGtE { +impl Node for CmpOpGtE { const NAME: &'static str = "GtE"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopGtE { +impl std::cmp::PartialEq for CmpOpGtE { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::GtE) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::GtE) } } -pub struct CmpopIs; -impl From for Cmpop { - fn from(_: CmpopIs) -> Self { - Cmpop::Is +pub struct CmpOpIs; +impl From for CmpOp { + fn from(_: CmpOpIs) -> Self { + CmpOp::Is } } -impl From for Ast { - fn from(_: CmpopIs) -> Self { - Cmpop::Is.into() +impl From for Ast { + fn from(_: CmpOpIs) -> Self { + CmpOp::Is.into() } } -impl Node for CmpopIs { +impl Node for CmpOpIs { const NAME: &'static str = "Is"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopIs { +impl std::cmp::PartialEq for CmpOpIs { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::Is) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::Is) } } -pub struct CmpopIsNot; -impl From for Cmpop { - fn from(_: CmpopIsNot) -> Self { - Cmpop::IsNot +pub struct CmpOpIsNot; +impl From for CmpOp { + fn from(_: CmpOpIsNot) -> Self { + CmpOp::IsNot } } -impl From for Ast { - fn from(_: CmpopIsNot) -> Self { - Cmpop::IsNot.into() +impl From for Ast { + fn from(_: CmpOpIsNot) -> Self { + CmpOp::IsNot.into() } } -impl Node for CmpopIsNot { +impl Node for CmpOpIsNot { const NAME: &'static str = "IsNot"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopIsNot { +impl std::cmp::PartialEq for CmpOpIsNot { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::IsNot) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::IsNot) } } -pub struct CmpopIn; -impl From for Cmpop { - fn from(_: CmpopIn) -> Self { - Cmpop::In +pub struct CmpOpIn; +impl From for CmpOp { + fn from(_: CmpOpIn) -> Self { + CmpOp::In } } -impl From for Ast { - fn from(_: CmpopIn) -> Self { - Cmpop::In.into() +impl From for Ast { + fn from(_: CmpOpIn) -> Self { + CmpOp::In.into() } } -impl Node for CmpopIn { +impl Node for CmpOpIn { const NAME: &'static str = "In"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopIn { +impl std::cmp::PartialEq for CmpOpIn { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::In) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::In) } } -pub struct CmpopNotIn; -impl From for Cmpop { - fn from(_: CmpopNotIn) -> Self { - Cmpop::NotIn +pub struct CmpOpNotIn; +impl From for CmpOp { + fn from(_: CmpOpNotIn) -> Self { + CmpOp::NotIn } } -impl From for Ast { - fn from(_: CmpopNotIn) -> Self { - Cmpop::NotIn.into() +impl From for Ast { + fn from(_: CmpOpNotIn) -> Self { + CmpOp::NotIn.into() } } -impl Node for CmpopNotIn { +impl Node for CmpOpNotIn { const NAME: &'static str = "NotIn"; const FIELD_NAMES: &'static [&'static str] = &[]; } -impl std::cmp::PartialEq for CmpopNotIn { +impl std::cmp::PartialEq for CmpOpNotIn { #[inline] - fn eq(&self, other: &Cmpop) -> bool { - matches!(other, Cmpop::NotIn) + fn eq(&self, other: &CmpOp) -> bool { + matches!(other, CmpOp::NotIn) } } -impl Node for Cmpop { +impl Node for CmpOp { const NAME: &'static str = "cmpop"; const FIELD_NAMES: &'static [&'static str] = &[]; } +/// See also [comprehension](https://docs.python.org/3/library/ast.html#ast.comprehension) #[derive(Clone, Debug, PartialEq)] pub struct Comprehension { pub range: OptionalRange, @@ -2645,39 +2712,42 @@ impl Node for Comprehension { const FIELD_NAMES: &'static [&'static str] = &["target", "iter", "ifs", "is_async"]; } +/// See also [excepthandler](https://docs.python.org/3/library/ast.html#ast.excepthandler) +#[derive(Clone, Debug, PartialEq, is_macro::Is)] +pub enum ExceptHandler { + ExceptHandler(ExceptHandlerExceptHandler), +} + +/// See also [ExceptHandler](https://docs.python.org/3/library/ast.html#ast.ExceptHandler) #[derive(Clone, Debug, PartialEq)] -pub struct ExcepthandlerExceptHandler { +pub struct ExceptHandlerExceptHandler { pub range: R, pub type_: Option>>, pub name: Option, pub body: Vec>, } -impl Node for ExcepthandlerExceptHandler { +impl Node for ExceptHandlerExceptHandler { const NAME: &'static str = "ExceptHandler"; const FIELD_NAMES: &'static [&'static str] = &["type", "name", "body"]; } -impl From> for Excepthandler { - fn from(payload: ExcepthandlerExceptHandler) -> Self { - Excepthandler::ExceptHandler(payload) +impl From> for ExceptHandler { + fn from(payload: ExceptHandlerExceptHandler) -> Self { + ExceptHandler::ExceptHandler(payload) } } -impl From> for Ast { - fn from(payload: ExcepthandlerExceptHandler) -> Self { - Excepthandler::from(payload).into() +impl From> for Ast { + fn from(payload: ExceptHandlerExceptHandler) -> Self { + ExceptHandler::from(payload).into() } } -#[derive(Clone, Debug, PartialEq, is_macro::Is)] -pub enum Excepthandler { - ExceptHandler(ExcepthandlerExceptHandler), -} - -impl Node for Excepthandler { +impl Node for ExceptHandler { const NAME: &'static str = "excepthandler"; const FIELD_NAMES: &'static [&'static str] = &[]; } +/// See also [arguments](https://docs.python.org/3/library/ast.html#ast.arguments) #[derive(Clone, Debug, PartialEq)] pub struct PythonArguments { pub range: OptionalRange, @@ -2703,6 +2773,7 @@ impl Node for PythonArguments { ]; } +/// See also [arg](https://docs.python.org/3/library/ast.html#ast.arg) #[derive(Clone, Debug, PartialEq)] pub struct Arg { pub range: R, @@ -2716,6 +2787,7 @@ impl Node for Arg { const FIELD_NAMES: &'static [&'static str] = &["arg", "annotation", "type_comment"]; } +/// See also [keyword](https://docs.python.org/3/library/ast.html#ast.keyword) #[derive(Clone, Debug, PartialEq)] pub struct Keyword { pub range: R, @@ -2728,6 +2800,7 @@ impl Node for Keyword { const FIELD_NAMES: &'static [&'static str] = &["arg", "value"]; } +/// See also [alias](https://docs.python.org/3/library/ast.html#ast.alias) #[derive(Clone, Debug, PartialEq)] pub struct Alias { pub range: R, @@ -2740,18 +2813,20 @@ impl Node for Alias { const FIELD_NAMES: &'static [&'static str] = &["name", "asname"]; } +/// See also [withitem](https://docs.python.org/3/library/ast.html#ast.withitem) #[derive(Clone, Debug, PartialEq)] -pub struct Withitem { +pub struct WithItem { pub range: OptionalRange, pub context_expr: Expr, pub optional_vars: Option>>, } -impl Node for Withitem { +impl Node for WithItem { const NAME: &'static str = "withitem"; const FIELD_NAMES: &'static [&'static str] = &["context_expr", "optional_vars"]; } +/// See also [match_case](https://docs.python.org/3/library/ast.html#ast.match_case) #[derive(Clone, Debug, PartialEq)] pub struct MatchCase { pub range: OptionalRange, @@ -2765,6 +2840,20 @@ impl Node for MatchCase { const FIELD_NAMES: &'static [&'static str] = &["pattern", "guard", "body"]; } +/// See also [pattern](https://docs.python.org/3/library/ast.html#ast.pattern) +#[derive(Clone, Debug, PartialEq, is_macro::Is)] +pub enum Pattern { + MatchValue(PatternMatchValue), + MatchSingleton(PatternMatchSingleton), + MatchSequence(PatternMatchSequence), + MatchMapping(PatternMatchMapping), + MatchClass(PatternMatchClass), + MatchStar(PatternMatchStar), + MatchAs(PatternMatchAs), + MatchOr(PatternMatchOr), +} + +/// See also [MatchValue](https://docs.python.org/3/library/ast.html#ast.MatchValue) #[derive(Clone, Debug, PartialEq)] pub struct PatternMatchValue { pub range: R, @@ -2786,6 +2875,7 @@ impl From> for Ast { } } +/// See also [MatchSingleton](https://docs.python.org/3/library/ast.html#ast.MatchSingleton) #[derive(Clone, Debug, PartialEq)] pub struct PatternMatchSingleton { pub range: R, @@ -2807,6 +2897,7 @@ impl From> for Ast { } } +/// See also [MatchSequence](https://docs.python.org/3/library/ast.html#ast.MatchSequence) #[derive(Clone, Debug, PartialEq)] pub struct PatternMatchSequence { pub range: R, @@ -2828,6 +2919,7 @@ impl From> for Ast { } } +/// See also [MatchMapping](https://docs.python.org/3/library/ast.html#ast.MatchMapping) #[derive(Clone, Debug, PartialEq)] pub struct PatternMatchMapping { pub range: R, @@ -2851,6 +2943,7 @@ impl From> for Ast { } } +/// See also [MatchClass](https://docs.python.org/3/library/ast.html#ast.MatchClass) #[derive(Clone, Debug, PartialEq)] pub struct PatternMatchClass { pub range: R, @@ -2875,6 +2968,7 @@ impl From> for Ast { } } +/// See also [MatchStar](https://docs.python.org/3/library/ast.html#ast.MatchStar) #[derive(Clone, Debug, PartialEq)] pub struct PatternMatchStar { pub range: R, @@ -2896,6 +2990,7 @@ impl From> for Ast { } } +/// See also [MatchAs](https://docs.python.org/3/library/ast.html#ast.MatchAs) #[derive(Clone, Debug, PartialEq)] pub struct PatternMatchAs { pub range: R, @@ -2918,6 +3013,7 @@ impl From> for Ast { } } +/// See also [MatchOr](https://docs.python.org/3/library/ast.html#ast.MatchOr) #[derive(Clone, Debug, PartialEq)] pub struct PatternMatchOr { pub range: R, @@ -2939,23 +3035,18 @@ impl From> for Ast { } } -#[derive(Clone, Debug, PartialEq, is_macro::Is)] -pub enum Pattern { - MatchValue(PatternMatchValue), - MatchSingleton(PatternMatchSingleton), - MatchSequence(PatternMatchSequence), - MatchMapping(PatternMatchMapping), - MatchClass(PatternMatchClass), - MatchStar(PatternMatchStar), - MatchAs(PatternMatchAs), - MatchOr(PatternMatchOr), -} - impl Node for Pattern { const NAME: &'static str = "pattern"; const FIELD_NAMES: &'static [&'static str] = &[]; } +/// See also [type_ignore](https://docs.python.org/3/library/ast.html#ast.type_ignore) +#[derive(Clone, Debug, PartialEq, is_macro::Is)] +pub enum TypeIgnore { + TypeIgnore(TypeIgnoreTypeIgnore), +} + +/// See also [TypeIgnore](https://docs.python.org/3/library/ast.html#ast.TypeIgnore) #[derive(Clone, Debug, PartialEq)] pub struct TypeIgnoreTypeIgnore { pub range: OptionalRange, @@ -2978,11 +3069,6 @@ impl From> for Ast { } } -#[derive(Clone, Debug, PartialEq, is_macro::Is)] -pub enum TypeIgnore { - TypeIgnore(TypeIgnoreTypeIgnore), -} - impl Node for TypeIgnore { const NAME: &'static str = "type_ignore"; const FIELD_NAMES: &'static [&'static str] = &[]; diff --git a/ast/src/gen/located.rs b/ast/src/gen/located.rs index 8f69675..63a7b47 100644 --- a/ast/src/gen/located.rs +++ b/ast/src/gen/located.rs @@ -989,11 +989,11 @@ pub type ExprContextStore = crate::generic::ExprContextStore; pub type ExprContextDel = crate::generic::ExprContextDel; -pub type Boolop = crate::generic::Boolop; +pub type BoolOp = crate::generic::BoolOp; -pub type BoolopAnd = crate::generic::BoolopAnd; +pub type BoolOpAnd = crate::generic::BoolOpAnd; -pub type BoolopOr = crate::generic::BoolopOr; +pub type BoolOpOr = crate::generic::BoolOpOr; pub type Operator = crate::generic::Operator; @@ -1023,37 +1023,37 @@ pub type OperatorBitAnd = crate::generic::OperatorBitAnd; pub type OperatorFloorDiv = crate::generic::OperatorFloorDiv; -pub type Unaryop = crate::generic::Unaryop; +pub type UnaryOp = crate::generic::UnaryOp; -pub type UnaryopInvert = crate::generic::UnaryopInvert; +pub type UnaryOpInvert = crate::generic::UnaryOpInvert; -pub type UnaryopNot = crate::generic::UnaryopNot; +pub type UnaryOpNot = crate::generic::UnaryOpNot; -pub type UnaryopUAdd = crate::generic::UnaryopUAdd; +pub type UnaryOpUAdd = crate::generic::UnaryOpUAdd; -pub type UnaryopUSub = crate::generic::UnaryopUSub; +pub type UnaryOpUSub = crate::generic::UnaryOpUSub; -pub type Cmpop = crate::generic::Cmpop; +pub type CmpOp = crate::generic::CmpOp; -pub type CmpopEq = crate::generic::CmpopEq; +pub type CmpOpEq = crate::generic::CmpOpEq; -pub type CmpopNotEq = crate::generic::CmpopNotEq; +pub type CmpOpNotEq = crate::generic::CmpOpNotEq; -pub type CmpopLt = crate::generic::CmpopLt; +pub type CmpOpLt = crate::generic::CmpOpLt; -pub type CmpopLtE = crate::generic::CmpopLtE; +pub type CmpOpLtE = crate::generic::CmpOpLtE; -pub type CmpopGt = crate::generic::CmpopGt; +pub type CmpOpGt = crate::generic::CmpOpGt; -pub type CmpopGtE = crate::generic::CmpopGtE; +pub type CmpOpGtE = crate::generic::CmpOpGtE; -pub type CmpopIs = crate::generic::CmpopIs; +pub type CmpOpIs = crate::generic::CmpOpIs; -pub type CmpopIsNot = crate::generic::CmpopIsNot; +pub type CmpOpIsNot = crate::generic::CmpOpIsNot; -pub type CmpopIn = crate::generic::CmpopIn; +pub type CmpOpIn = crate::generic::CmpOpIn; -pub type CmpopNotIn = crate::generic::CmpopNotIn; +pub type CmpOpNotIn = crate::generic::CmpOpNotIn; pub type Comprehension = crate::generic::Comprehension; @@ -1070,23 +1070,23 @@ impl LocatedMut for Comprehension { } } -pub type Excepthandler = crate::generic::Excepthandler; +pub type ExceptHandler = crate::generic::ExceptHandler; -pub type ExcepthandlerExceptHandler = crate::generic::ExcepthandlerExceptHandler; +pub type ExceptHandlerExceptHandler = crate::generic::ExceptHandlerExceptHandler; -impl Located for ExcepthandlerExceptHandler { +impl Located for ExceptHandlerExceptHandler { fn range(&self) -> SourceRange { self.range } } -impl LocatedMut for ExcepthandlerExceptHandler { +impl LocatedMut for ExceptHandlerExceptHandler { fn range_mut(&mut self) -> &mut SourceRange { &mut self.range } } -impl Located for Excepthandler { +impl Located for ExceptHandler { fn range(&self) -> SourceRange { match self { Self::ExceptHandler(node) => node.range(), @@ -1094,7 +1094,7 @@ impl Located for Excepthandler { } } -impl LocatedMut for Excepthandler { +impl LocatedMut for ExceptHandler { fn range_mut(&mut self) -> &mut SourceRange { match self { Self::ExceptHandler(node) => node.range_mut(), @@ -1159,16 +1159,16 @@ impl LocatedMut for Alias { } } -pub type Withitem = crate::generic::Withitem; +pub type WithItem = crate::generic::WithItem; #[cfg(feature = "all-nodes-with-ranges")] -impl Located for Withitem { +impl Located for WithItem { fn range(&self) -> SourceRange { self.range } } #[cfg(feature = "all-nodes-with-ranges")] -impl LocatedMut for Withitem { +impl LocatedMut for WithItem { fn range_mut(&mut self) -> &mut SourceRange { &mut self.range } diff --git a/ast/src/gen/ranged.rs b/ast/src/gen/ranged.rs index 3444fd7..c6a2ea3 100644 --- a/ast/src/gen/ranged.rs +++ b/ast/src/gen/ranged.rs @@ -380,12 +380,12 @@ impl Ranged for crate::generic::Comprehension { self.range } } -impl Ranged for crate::generic::ExcepthandlerExceptHandler { +impl Ranged for crate::generic::ExceptHandlerExceptHandler { fn range(&self) -> TextRange { self.range } } -impl Ranged for crate::Excepthandler { +impl Ranged for crate::ExceptHandler { fn range(&self) -> TextRange { match self { Self::ExceptHandler(node) => node.range(), @@ -415,7 +415,7 @@ impl Ranged for crate::generic::Alias { } } #[cfg(feature = "all-nodes-with-ranges")] -impl Ranged for crate::generic::Withitem { +impl Ranged for crate::generic::WithItem { fn range(&self) -> TextRange { self.range } diff --git a/ast/src/gen/visitor.rs b/ast/src/gen/visitor.rs index b7dc628..af5fcab 100644 --- a/ast/src/gen/visitor.rs +++ b/ast/src/gen/visitor.rs @@ -665,38 +665,38 @@ pub trait Visitor { self.generic_visit_expr_context(node) } fn generic_visit_expr_context(&mut self, node: ExprContext) {} - fn visit_boolop(&mut self, node: Boolop) { + fn visit_boolop(&mut self, node: BoolOp) { self.generic_visit_boolop(node) } - fn generic_visit_boolop(&mut self, node: Boolop) {} + fn generic_visit_boolop(&mut self, node: BoolOp) {} fn visit_operator(&mut self, node: Operator) { self.generic_visit_operator(node) } fn generic_visit_operator(&mut self, node: Operator) {} - fn visit_unaryop(&mut self, node: Unaryop) { + fn visit_unaryop(&mut self, node: UnaryOp) { self.generic_visit_unaryop(node) } - fn generic_visit_unaryop(&mut self, node: Unaryop) {} - fn visit_cmpop(&mut self, node: Cmpop) { + fn generic_visit_unaryop(&mut self, node: UnaryOp) {} + fn visit_cmpop(&mut self, node: CmpOp) { self.generic_visit_cmpop(node) } - fn generic_visit_cmpop(&mut self, node: Cmpop) {} + fn generic_visit_cmpop(&mut self, node: CmpOp) {} fn visit_comprehension(&mut self, node: Comprehension) { self.generic_visit_comprehension(node) } fn generic_visit_comprehension(&mut self, node: Comprehension) {} - fn visit_excepthandler(&mut self, node: Excepthandler) { + fn visit_excepthandler(&mut self, node: ExceptHandler) { self.generic_visit_excepthandler(node) } - fn generic_visit_excepthandler(&mut self, node: Excepthandler) { + fn generic_visit_excepthandler(&mut self, node: ExceptHandler) { match node { - Excepthandler::ExceptHandler(data) => self.visit_excepthandler_except_handler(data), + ExceptHandler::ExceptHandler(data) => self.visit_excepthandler_except_handler(data), } } - fn visit_excepthandler_except_handler(&mut self, node: ExcepthandlerExceptHandler) { + fn visit_excepthandler_except_handler(&mut self, node: ExceptHandlerExceptHandler) { self.generic_visit_excepthandler_except_handler(node) } - fn generic_visit_excepthandler_except_handler(&mut self, node: ExcepthandlerExceptHandler) { + fn generic_visit_excepthandler_except_handler(&mut self, node: ExceptHandlerExceptHandler) { if let Some(value) = node.type_ { self.visit_expr(*value); } @@ -720,10 +720,10 @@ pub trait Visitor { self.generic_visit_alias(node) } fn generic_visit_alias(&mut self, node: Alias) {} - fn visit_withitem(&mut self, node: Withitem) { + fn visit_withitem(&mut self, node: WithItem) { self.generic_visit_withitem(node) } - fn generic_visit_withitem(&mut self, node: Withitem) {} + fn generic_visit_withitem(&mut self, node: WithItem) {} fn visit_match_case(&mut self, node: MatchCase) { self.generic_visit_match_case(node) } diff --git a/ast/src/generic.rs b/ast/src/generic.rs index 64498d4..fe0875b 100644 --- a/ast/src/generic.rs +++ b/ast/src/generic.rs @@ -54,19 +54,19 @@ impl Default for EmptyRange { } } -impl Cmpop { +impl CmpOp { pub fn as_str(&self) -> &'static str { match self { - Cmpop::Eq => "==", - Cmpop::NotEq => "!=", - Cmpop::Lt => "<", - Cmpop::LtE => "<=", - Cmpop::Gt => ">", - Cmpop::GtE => ">=", - Cmpop::Is => "is", - Cmpop::IsNot => "is not", - Cmpop::In => "in", - Cmpop::NotIn => "not in", + CmpOp::Eq => "==", + CmpOp::NotEq => "!=", + CmpOp::Lt => "<", + CmpOp::LtE => "<=", + CmpOp::Gt => ">", + CmpOp::GtE => ">=", + CmpOp::Is => "is", + CmpOp::IsNot => "is not", + CmpOp::In => "in", + CmpOp::NotIn => "not in", } } } diff --git a/ast/src/impls.rs b/ast/src/impls.rs index e0c47bc..3c267e8 100644 --- a/ast/src/impls.rs +++ b/ast/src/impls.rs @@ -61,4 +61,4 @@ static_assertions::assert_eq_size!(crate::Stmt, [u8; 136]); #[cfg(target_arch = "x86_64")] static_assertions::assert_eq_size!(crate::Pattern, [u8; 96]); #[cfg(target_arch = "x86_64")] -static_assertions::assert_eq_size!(crate::Excepthandler, [u8; 64]); +static_assertions::assert_eq_size!(crate::ExceptHandler, [u8; 64]); diff --git a/ast/src/lib.rs b/ast/src/lib.rs index b55266c..4e5d371 100644 --- a/ast/src/lib.rs +++ b/ast/src/lib.rs @@ -6,6 +6,14 @@ //! //! [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; diff --git a/ast/src/unparse.rs b/ast/src/unparse.rs index d2b6d3d..95c0ba5 100644 --- a/ast/src/unparse.rs +++ b/ast/src/unparse.rs @@ -1,5 +1,5 @@ use crate::{ - Arg, ArgWithDefault, Arguments, Boolop, Comprehension, Constant, ConversionFlag, Expr, + Arg, ArgWithDefault, Arguments, BoolOp, Comprehension, Constant, ConversionFlag, Expr, Identifier, Operator, PythonArguments, }; use std::fmt; @@ -79,7 +79,7 @@ impl<'a> Unparser<'a> { values, range: _range, }) => { - let (op, prec) = op_prec!(bin, op, Boolop, And("and", AND), Or("or", OR)); + let (op, prec) = op_prec!(bin, op, BoolOp, And("and", AND), Or("or", OR)); group_if!(prec, { let mut first = true; for val in values { @@ -138,7 +138,7 @@ impl<'a> Unparser<'a> { let (op, prec) = op_prec!( un, op, - crate::Unaryop, + crate::UnaryOp, Invert("~", FACTOR), Not("not ", NOT), UAdd("+", FACTOR), diff --git a/parser/src/python.lalrpop b/parser/src/python.lalrpop index 31eefe7..272cf97 100644 --- a/parser/src/python.lalrpop +++ b/parser/src/python.lalrpop @@ -509,7 +509,7 @@ ConstantExpr: ast::Expr = { ConstantAtom, "-" => ast::Expr::UnaryOp( ast::ExprUnaryOp { - op: ast::Unaryop::USub, + op: ast::UnaryOp::USub, operand: Box::new(operand), range: (location..end_location).into() } @@ -875,11 +875,11 @@ TryStatement: ast::Stmt = { }, }; -ExceptStarClause: ast::Excepthandler = { +ExceptStarClause: ast::ExceptHandler = { "except" "*" > ":" => { let end_location = body.last().unwrap().end(); - ast::Excepthandler::ExceptHandler( - ast::ExcepthandlerExceptHandler { + ast::ExceptHandler::ExceptHandler( + ast::ExceptHandlerExceptHandler { type_: Some(Box::new(typ)), name: None, body, @@ -889,8 +889,8 @@ ExceptStarClause: ast::Excepthandler = { }, "except" "*" > "as" )> ":" => { let end_location = body.last().unwrap().end(); - ast::Excepthandler::ExceptHandler( - ast::ExcepthandlerExceptHandler { + ast::ExceptHandler::ExceptHandler( + ast::ExceptHandlerExceptHandler { type_: Some(Box::new(x.0)), name: Some(x.1), body, @@ -901,11 +901,11 @@ ExceptStarClause: ast::Excepthandler = { }; -ExceptClause: ast::Excepthandler = { +ExceptClause: ast::ExceptHandler = { "except" ?> ":" => { let end_location = body.last().unwrap().end(); - ast::Excepthandler::ExceptHandler( - ast::ExcepthandlerExceptHandler { + ast::ExceptHandler::ExceptHandler( + ast::ExceptHandlerExceptHandler { type_: typ.map(Box::new), name: None, body, @@ -915,8 +915,8 @@ ExceptClause: ast::Excepthandler = { }, "except" > "as" )> ":" => { let end_location = body.last().unwrap().end(); - ast::Excepthandler::ExceptHandler( - ast::ExcepthandlerExceptHandler { + ast::ExceptHandler::ExceptHandler( + ast::ExceptHandlerExceptHandler { type_: Some(Box::new(x.0)), name: Some(x.1), body, @@ -938,7 +938,7 @@ WithStatement: ast::Stmt = { }, }; -WithItems: Vec = { +WithItems: Vec = { "(" ","? ")", "(" ",")?> > >)*> ","? ")" => { left.into_iter().flatten().chain([mid]).chain(right).collect() @@ -950,17 +950,17 @@ WithItems: Vec = { }; #[inline] -WithItemsNoAs: Vec = { +WithItemsNoAs: Vec = { >> => { - all.into_iter().map(|context_expr| ast::Withitem { context_expr, optional_vars: None, range: optional_range(location, end_location) }).collect() + all.into_iter().map(|context_expr| ast::WithItem { context_expr, optional_vars: None, range: optional_range(location, end_location) }).collect() }, } -WithItem: ast::Withitem = { - > if Goal != "as" => ast::Withitem { context_expr, optional_vars: None, range: optional_range(location, end_location) }, +WithItem: ast::WithItem = { + > if Goal != "as" => ast::WithItem { context_expr, optional_vars: None, range: optional_range(location, end_location) }, > "as" > => { let optional_vars = Some(Box::new(set_context(vars, ast::ExprContext::Store))); - ast::Withitem { context_expr, optional_vars, range: optional_range(location, end_location) } + ast::WithItem { context_expr, optional_vars, range: optional_range(location, end_location) } }, }; @@ -1212,7 +1212,7 @@ OrTest: ast::Expr = { > "or")+> > => { values.push(last); ast::Expr::BoolOp( - ast::ExprBoolOp { op: ast::Boolop::Or, values, range: (location..end_location).into() } + ast::ExprBoolOp { op: ast::BoolOp::Or, values, range: (location..end_location).into() } ) }, AndTest, @@ -1222,7 +1222,7 @@ AndTest: ast::Expr = { > "and")+> > => { values.push(last); ast::Expr::BoolOp( - ast::ExprBoolOp { op: ast::Boolop::And, values, range: (location..end_location).into() } + ast::ExprBoolOp { op: ast::BoolOp::And, values, range: (location..end_location).into() } ) }, NotTest, @@ -1230,7 +1230,7 @@ AndTest: ast::Expr = { NotTest: ast::Expr = { "not" > => ast::Expr::UnaryOp( - ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not, range: (location..end_location).into() } + ast::ExprUnaryOp { operand: Box::new(e), op: ast::UnaryOp::Not, range: (location..end_location).into() } ), Comparison, }; @@ -1245,17 +1245,17 @@ Comparison: ast::Expr = { Expression, }; -CompOp: ast::Cmpop = { - "==" => ast::Cmpop::Eq, - "!=" => ast::Cmpop::NotEq, - "<" => ast::Cmpop::Lt, - "<=" => ast::Cmpop::LtE, - ">" => ast::Cmpop::Gt, - ">=" => ast::Cmpop::GtE, - "in" => ast::Cmpop::In, - "not" "in" => ast::Cmpop::NotIn, - "is" => ast::Cmpop::Is, - "is" "not" => ast::Cmpop::IsNot, +CompOp: ast::CmpOp = { + "==" => ast::CmpOp::Eq, + "!=" => ast::CmpOp::NotEq, + "<" => ast::CmpOp::Lt, + "<=" => ast::CmpOp::LtE, + ">" => ast::CmpOp::Gt, + ">=" => ast::CmpOp::GtE, + "in" => ast::CmpOp::In, + "not" "in" => ast::CmpOp::NotIn, + "is" => ast::CmpOp::Is, + "is" "not" => ast::CmpOp::IsNot, }; Expression: ast::Expr = { @@ -1325,10 +1325,10 @@ Factor: ast::Expr = { Power, }; -UnaryOp: ast::Unaryop = { - "+" => ast::Unaryop::UAdd, - "-" => ast::Unaryop::USub, - "~" => ast::Unaryop::Invert, +UnaryOp: ast::UnaryOp = { + "+" => ast::UnaryOp::UAdd, + "-" => ast::UnaryOp::USub, + "~" => ast::UnaryOp::Invert, }; Power: ast::Expr = { diff --git a/parser/src/python.rs b/parser/src/python.rs index 29e7922..a0b29e8 100644 --- a/parser/src/python.rs +++ b/parser/src/python.rs @@ -1,5 +1,5 @@ // auto-generated: "lalrpop 0.20.0" -// sha3: b94dbacf01253c4fc4605d489e98f5929504a78e0baa83381e126895ec61cb59 +// sha3: c39f9711066c6f94aaf93d62d86b41efb4242ddcdcbe5b9d35e5a77a14ff22d6 use crate::{ ast::{self as ast, Ranged, bigint::BigInt}, lexer::{LexicalError, LexicalErrorType}, @@ -57,8 +57,8 @@ mod __parse__Top { Variant15(ast::Expr), Variant16(core::option::Option), Variant17(alloc::vec::Vec), - Variant18(ast::Withitem), - Variant19(alloc::vec::Vec), + Variant18(ast::WithItem), + Variant19(alloc::vec::Vec), Variant20((token::Tok, ast::Identifier)), Variant21(alloc::vec::Vec<(token::Tok, ast::Identifier)>), Variant22(alloc::vec::Vec), @@ -77,12 +77,12 @@ mod __parse__Top { Variant35(ast::Stmt), Variant36(alloc::vec::Vec), Variant37((ast::Expr, ast::Identifier)), - Variant38(Vec), - Variant39(core::option::Option>), + Variant38(Vec), + Variant39(core::option::Option>), Variant40((TextSize, (String, StringKind, bool), TextSize)), Variant41(alloc::vec::Vec<(TextSize, (String, StringKind, bool), TextSize)>), - Variant42((ast::Cmpop, ast::Expr)), - Variant43(alloc::vec::Vec<(ast::Cmpop, ast::Expr)>), + Variant42((ast::CmpOp, ast::Expr)), + Variant43(alloc::vec::Vec<(ast::CmpOp, ast::Expr)>), Variant44(ast::Arguments), Variant45(core::option::Option), Variant46(TextSize), @@ -92,7 +92,7 @@ mod __parse__Top { Variant50(Vec), Variant51(Vec), Variant52(core::option::Option>), - Variant53(ast::Cmpop), + Variant53(ast::CmpOp), Variant54(ast::Constant), Variant55((Option>, ast::Expr)), Variant56((ast::Expr, ast::Expr)), @@ -100,8 +100,8 @@ mod __parse__Top { Variant58(core::option::Option>, ast::Expr)>>), Variant59(ast::Arg), Variant60(core::option::Option), - Variant61(ast::Excepthandler), - Variant62(alloc::vec::Vec), + Variant61(ast::ExceptHandler), + Variant62(alloc::vec::Vec), Variant63(core::option::Option<(Option<(TextSize, TextSize, Option)>, ast::Expr)>), Variant64(ast::Alias), Variant65(Vec), @@ -124,7 +124,7 @@ mod __parse__Top { Variant82(core::option::Option>), Variant83(Vec), Variant84(ast::Mod), - Variant85(ast::Unaryop), + Variant85(ast::UnaryOp), } const __ACTION: &[i16] = &[ // State 0 @@ -17004,7 +17004,7 @@ mod __parse__Top { fn __pop_Variant42< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, (ast::Cmpop, ast::Expr), TextSize) + ) -> (TextSize, (ast::CmpOp, ast::Expr), TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant42(__v), __r)) => (__l, __v, __r), @@ -17254,7 +17254,7 @@ mod __parse__Top { fn __pop_Variant38< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, Vec, TextSize) + ) -> (TextSize, Vec, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant38(__v), __r)) => (__l, __v, __r), @@ -17294,7 +17294,7 @@ mod __parse__Top { fn __pop_Variant43< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize) + ) -> (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant43(__v), __r)) => (__l, __v, __r), @@ -17334,7 +17334,7 @@ mod __parse__Top { fn __pop_Variant62< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, alloc::vec::Vec, TextSize) + ) -> (TextSize, alloc::vec::Vec, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant62(__v), __r)) => (__l, __v, __r), @@ -17394,7 +17394,7 @@ mod __parse__Top { fn __pop_Variant19< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, alloc::vec::Vec, TextSize) + ) -> (TextSize, alloc::vec::Vec, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant19(__v), __r)) => (__l, __v, __r), @@ -17454,7 +17454,7 @@ mod __parse__Top { fn __pop_Variant53< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, ast::Cmpop, TextSize) + ) -> (TextSize, ast::CmpOp, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant53(__v), __r)) => (__l, __v, __r), @@ -17484,7 +17484,7 @@ mod __parse__Top { fn __pop_Variant61< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, ast::Excepthandler, TextSize) + ) -> (TextSize, ast::ExceptHandler, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant61(__v), __r)) => (__l, __v, __r), @@ -17584,7 +17584,7 @@ mod __parse__Top { fn __pop_Variant85< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, ast::Unaryop, TextSize) + ) -> (TextSize, ast::UnaryOp, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant85(__v), __r)) => (__l, __v, __r), @@ -17594,7 +17594,7 @@ mod __parse__Top { fn __pop_Variant18< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, ast::Withitem, TextSize) + ) -> (TextSize, ast::WithItem, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant18(__v), __r)) => (__l, __v, __r), @@ -17684,7 +17684,7 @@ mod __parse__Top { fn __pop_Variant39< >( __symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)> - ) -> (TextSize, core::option::Option>, TextSize) + ) -> (TextSize, core::option::Option>, TextSize) { match __symbols.pop() { Some((__l, __Symbol::Variant39(__v), __r)) => (__l, __v, __r), @@ -30090,7 +30090,7 @@ fn __action107< { ast::Expr::UnaryOp( ast::ExprUnaryOp { - op: ast::Unaryop::USub, + op: ast::UnaryOp::USub, operand: Box::new(operand), range: (location..end_location).into() } @@ -30784,7 +30784,7 @@ fn __action144< (_, _, _): (TextSize, token::Tok, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, body, _): (TextSize, ast::Suite, TextSize), - (_, handlers, _): (TextSize, alloc::vec::Vec, TextSize), + (_, handlers, _): (TextSize, alloc::vec::Vec, TextSize), (_, orelse, _): (TextSize, core::option::Option, TextSize), (_, finalbody, _): (TextSize, core::option::Option, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), @@ -30818,7 +30818,7 @@ fn __action145< (_, _, _): (TextSize, token::Tok, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, body, _): (TextSize, ast::Suite, TextSize), - (_, handlers, _): (TextSize, alloc::vec::Vec, TextSize), + (_, handlers, _): (TextSize, alloc::vec::Vec, TextSize), (_, orelse, _): (TextSize, core::option::Option, TextSize), (_, finalbody, _): (TextSize, core::option::Option, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), @@ -30880,12 +30880,12 @@ fn __action147< (_, typ, _): (TextSize, ast::Expr, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, body, _): (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { { let end_location = body.last().unwrap().end(); - ast::Excepthandler::ExceptHandler( - ast::ExcepthandlerExceptHandler { + ast::ExceptHandler::ExceptHandler( + ast::ExceptHandlerExceptHandler { type_: Some(Box::new(typ)), name: None, body, @@ -30904,12 +30904,12 @@ fn __action148< (_, x, _): (TextSize, (ast::Expr, ast::Identifier), TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, body, _): (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { { let end_location = body.last().unwrap().end(); - ast::Excepthandler::ExceptHandler( - ast::ExcepthandlerExceptHandler { + ast::ExceptHandler::ExceptHandler( + ast::ExceptHandlerExceptHandler { type_: Some(Box::new(x.0)), name: Some(x.1), body, @@ -30927,12 +30927,12 @@ fn __action149< (_, typ, _): (TextSize, core::option::Option, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, body, _): (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { { let end_location = body.last().unwrap().end(); - ast::Excepthandler::ExceptHandler( - ast::ExcepthandlerExceptHandler { + ast::ExceptHandler::ExceptHandler( + ast::ExceptHandlerExceptHandler { type_: typ.map(Box::new), name: None, body, @@ -30950,12 +30950,12 @@ fn __action150< (_, x, _): (TextSize, (ast::Expr, ast::Identifier), TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, body, _): (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { { let end_location = body.last().unwrap().end(); - ast::Excepthandler::ExceptHandler( - ast::ExcepthandlerExceptHandler { + ast::ExceptHandler::ExceptHandler( + ast::ExceptHandlerExceptHandler { type_: Some(Box::new(x.0)), name: Some(x.1), body, @@ -30971,7 +30971,7 @@ fn __action151< (_, location, _): (TextSize, TextSize, TextSize), (_, is_async, _): (TextSize, core::option::Option, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), - (_, items, _): (TextSize, Vec, TextSize), + (_, items, _): (TextSize, Vec, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, body, _): (TextSize, ast::Suite, TextSize), ) -> ast::Stmt @@ -30991,10 +30991,10 @@ fn __action151< fn __action152< >( (_, _, _): (TextSize, token::Tok, TextSize), - (_, __0, _): (TextSize, Vec, TextSize), + (_, __0, _): (TextSize, Vec, TextSize), (_, _, _): (TextSize, core::option::Option, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { __0 } @@ -31003,12 +31003,12 @@ fn __action152< fn __action153< >( (_, _, _): (TextSize, token::Tok, TextSize), - (_, left, _): (TextSize, core::option::Option>, TextSize), - (_, mid, _): (TextSize, ast::Withitem, TextSize), - (_, right, _): (TextSize, alloc::vec::Vec, TextSize), + (_, left, _): (TextSize, core::option::Option>, TextSize), + (_, mid, _): (TextSize, ast::WithItem, TextSize), + (_, right, _): (TextSize, alloc::vec::Vec, TextSize), (_, _, _): (TextSize, core::option::Option, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { { left.into_iter().flatten().chain([mid]).chain(right).collect() @@ -31018,8 +31018,8 @@ fn __action153< #[allow(clippy::too_many_arguments)] fn __action154< >( - (_, __0, _): (TextSize, ast::Withitem, TextSize), -) -> Vec + (_, __0, _): (TextSize, ast::WithItem, TextSize), +) -> Vec { vec![__0] } @@ -31027,9 +31027,9 @@ fn __action154< #[allow(clippy::too_many_arguments)] fn __action155< >( - (_, item, _): (TextSize, ast::Withitem, TextSize), - (_, items, _): (TextSize, alloc::vec::Vec, TextSize), -) -> Vec + (_, item, _): (TextSize, ast::WithItem, TextSize), + (_, items, _): (TextSize, alloc::vec::Vec, TextSize), +) -> Vec { { [item].into_iter().chain(items).collect() @@ -31042,10 +31042,10 @@ fn __action156< (_, location, _): (TextSize, TextSize, TextSize), (_, all, _): (TextSize, Vec, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), -) -> Vec +) -> Vec { { - all.into_iter().map(|context_expr| ast::Withitem { context_expr, optional_vars: None, range: optional_range(location, end_location) }).collect() + all.into_iter().map(|context_expr| ast::WithItem { context_expr, optional_vars: None, range: optional_range(location, end_location) }).collect() } } @@ -31311,63 +31311,63 @@ fn __action171< fn __action172< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::Eq + ast::CmpOp::Eq } #[allow(clippy::too_many_arguments)] fn __action173< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::NotEq + ast::CmpOp::NotEq } #[allow(clippy::too_many_arguments)] fn __action174< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::Lt + ast::CmpOp::Lt } #[allow(clippy::too_many_arguments)] fn __action175< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::LtE + ast::CmpOp::LtE } #[allow(clippy::too_many_arguments)] fn __action176< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::Gt + ast::CmpOp::Gt } #[allow(clippy::too_many_arguments)] fn __action177< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::GtE + ast::CmpOp::GtE } #[allow(clippy::too_many_arguments)] fn __action178< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::In + ast::CmpOp::In } #[allow(clippy::too_many_arguments)] @@ -31375,18 +31375,18 @@ fn __action179< >( (_, __0, _): (TextSize, token::Tok, TextSize), (_, __1, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::NotIn + ast::CmpOp::NotIn } #[allow(clippy::too_many_arguments)] fn __action180< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::Is + ast::CmpOp::Is } #[allow(clippy::too_many_arguments)] @@ -31394,9 +31394,9 @@ fn __action181< >( (_, __0, _): (TextSize, token::Tok, TextSize), (_, __1, _): (TextSize, token::Tok, TextSize), -) -> ast::Cmpop +) -> ast::CmpOp { - ast::Cmpop::IsNot + ast::CmpOp::IsNot } #[allow(clippy::too_many_arguments)] @@ -31484,27 +31484,27 @@ fn __action190< fn __action191< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Unaryop +) -> ast::UnaryOp { - ast::Unaryop::UAdd + ast::UnaryOp::UAdd } #[allow(clippy::too_many_arguments)] fn __action192< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Unaryop +) -> ast::UnaryOp { - ast::Unaryop::USub + ast::UnaryOp::USub } #[allow(clippy::too_many_arguments)] fn __action193< >( (_, __0, _): (TextSize, token::Tok, TextSize), -) -> ast::Unaryop +) -> ast::UnaryOp { - ast::Unaryop::Invert + ast::UnaryOp::Invert } #[allow(clippy::too_many_arguments)] @@ -31945,7 +31945,7 @@ fn __action230< { values.push(last); ast::Expr::BoolOp( - ast::ExprBoolOp { op: ast::Boolop::Or, values, range: (location..end_location).into() } + ast::ExprBoolOp { op: ast::BoolOp::Or, values, range: (location..end_location).into() } ) } } @@ -32566,8 +32566,8 @@ fn __action276< #[allow(clippy::too_many_arguments)] fn __action277< >( - (_, __0, _): (TextSize, ast::Withitem, TextSize), -) -> alloc::vec::Vec + (_, __0, _): (TextSize, ast::WithItem, TextSize), +) -> alloc::vec::Vec { alloc::vec![__0] } @@ -32575,9 +32575,9 @@ fn __action277< #[allow(clippy::too_many_arguments)] fn __action278< >( - (_, v, _): (TextSize, alloc::vec::Vec, TextSize), - (_, e, _): (TextSize, ast::Withitem, TextSize), -) -> alloc::vec::Vec + (_, v, _): (TextSize, alloc::vec::Vec, TextSize), + (_, e, _): (TextSize, ast::WithItem, TextSize), +) -> alloc::vec::Vec { { let mut v = v; v.push(e); v } } @@ -32588,9 +32588,9 @@ fn __action279< (_, location, _): (TextSize, TextSize, TextSize), (_, context_expr, _): (TextSize, ast::Expr, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { - ast::Withitem { context_expr, optional_vars: None, range: optional_range(location, end_location) } + ast::WithItem { context_expr, optional_vars: None, range: optional_range(location, end_location) } } #[allow(clippy::too_many_arguments)] @@ -32601,11 +32601,11 @@ fn __action280< (_, _, _): (TextSize, token::Tok, TextSize), (_, vars, _): (TextSize, ast::Expr, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { { let optional_vars = Some(Box::new(set_context(vars, ast::ExprContext::Store))); - ast::Withitem { context_expr, optional_vars, range: optional_range(location, end_location) } + ast::WithItem { context_expr, optional_vars, range: optional_range(location, end_location) } } } @@ -32614,7 +32614,7 @@ fn __action281< >( __lookbehind: &TextSize, __lookahead: &TextSize, -) -> alloc::vec::Vec +) -> alloc::vec::Vec { alloc::vec![] } @@ -32622,8 +32622,8 @@ fn __action281< #[allow(clippy::too_many_arguments)] fn __action282< >( - (_, v, _): (TextSize, alloc::vec::Vec, TextSize), -) -> alloc::vec::Vec + (_, v, _): (TextSize, alloc::vec::Vec, TextSize), +) -> alloc::vec::Vec { v } @@ -32632,8 +32632,8 @@ fn __action282< fn __action283< >( (_, _, _): (TextSize, token::Tok, TextSize), - (_, __0, _): (TextSize, ast::Withitem, TextSize), -) -> ast::Withitem + (_, __0, _): (TextSize, ast::WithItem, TextSize), +) -> ast::WithItem { __0 } @@ -32644,9 +32644,9 @@ fn __action284< (_, location, _): (TextSize, TextSize, TextSize), (_, context_expr, _): (TextSize, ast::Expr, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { - ast::Withitem { context_expr, optional_vars: None, range: optional_range(location, end_location) } + ast::WithItem { context_expr, optional_vars: None, range: optional_range(location, end_location) } } #[allow(clippy::too_many_arguments)] @@ -32657,11 +32657,11 @@ fn __action285< (_, _, _): (TextSize, token::Tok, TextSize), (_, vars, _): (TextSize, ast::Expr, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { { let optional_vars = Some(Box::new(set_context(vars, ast::ExprContext::Store))); - ast::Withitem { context_expr, optional_vars, range: optional_range(location, end_location) } + ast::WithItem { context_expr, optional_vars, range: optional_range(location, end_location) } } } @@ -32673,19 +32673,19 @@ fn __action286< (_, _, _): (TextSize, token::Tok, TextSize), (_, vars, _): (TextSize, ast::Expr, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { { let optional_vars = Some(Box::new(set_context(vars, ast::ExprContext::Store))); - ast::Withitem { context_expr, optional_vars, range: optional_range(location, end_location) } + ast::WithItem { context_expr, optional_vars, range: optional_range(location, end_location) } } } #[allow(clippy::too_many_arguments)] fn __action287< >( - (_, __0, _): (TextSize, Vec, TextSize), -) -> core::option::Option> + (_, __0, _): (TextSize, Vec, TextSize), +) -> core::option::Option> { Some(__0) } @@ -32695,7 +32695,7 @@ fn __action288< >( __lookbehind: &TextSize, __lookahead: &TextSize, -) -> core::option::Option> +) -> core::option::Option> { None } @@ -32703,9 +32703,9 @@ fn __action288< #[allow(clippy::too_many_arguments)] fn __action289< >( - (_, __0, _): (TextSize, Vec, TextSize), + (_, __0, _): (TextSize, Vec, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { __0 } @@ -32743,8 +32743,8 @@ fn __action292< #[allow(clippy::too_many_arguments)] fn __action293< >( - (_, __0, _): (TextSize, ast::Excepthandler, TextSize), -) -> alloc::vec::Vec + (_, __0, _): (TextSize, ast::ExceptHandler, TextSize), +) -> alloc::vec::Vec { alloc::vec![__0] } @@ -32752,9 +32752,9 @@ fn __action293< #[allow(clippy::too_many_arguments)] fn __action294< >( - (_, v, _): (TextSize, alloc::vec::Vec, TextSize), - (_, e, _): (TextSize, ast::Excepthandler, TextSize), -) -> alloc::vec::Vec + (_, v, _): (TextSize, alloc::vec::Vec, TextSize), + (_, e, _): (TextSize, ast::ExceptHandler, TextSize), +) -> alloc::vec::Vec { { let mut v = v; v.push(e); v } } @@ -32792,8 +32792,8 @@ fn __action297< #[allow(clippy::too_many_arguments)] fn __action298< >( - (_, __0, _): (TextSize, ast::Excepthandler, TextSize), -) -> alloc::vec::Vec + (_, __0, _): (TextSize, ast::ExceptHandler, TextSize), +) -> alloc::vec::Vec { alloc::vec![__0] } @@ -32801,9 +32801,9 @@ fn __action298< #[allow(clippy::too_many_arguments)] fn __action299< >( - (_, v, _): (TextSize, alloc::vec::Vec, TextSize), - (_, e, _): (TextSize, ast::Excepthandler, TextSize), -) -> alloc::vec::Vec + (_, v, _): (TextSize, alloc::vec::Vec, TextSize), + (_, e, _): (TextSize, ast::ExceptHandler, TextSize), +) -> alloc::vec::Vec { { let mut v = v; v.push(e); v } } @@ -34074,7 +34074,7 @@ fn __action417< { values.push(last); ast::Expr::BoolOp( - ast::ExprBoolOp { op: ast::Boolop::And, values, range: (location..end_location).into() } + ast::ExprBoolOp { op: ast::BoolOp::And, values, range: (location..end_location).into() } ) } } @@ -34213,7 +34213,7 @@ fn __action431< ) -> ast::Expr { ast::Expr::UnaryOp( - ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not, range: (location..end_location).into() } + ast::ExprUnaryOp { operand: Box::new(e), op: ast::UnaryOp::Not, range: (location..end_location).into() } ) } @@ -34507,7 +34507,7 @@ fn __action459< { values.push(last); ast::Expr::BoolOp( - ast::ExprBoolOp { op: ast::Boolop::Or, values, range: (location..end_location).into() } + ast::ExprBoolOp { op: ast::BoolOp::Or, values, range: (location..end_location).into() } ) } } @@ -34533,7 +34533,7 @@ fn __action461< { values.push(last); ast::Expr::BoolOp( - ast::ExprBoolOp { op: ast::Boolop::And, values, range: (location..end_location).into() } + ast::ExprBoolOp { op: ast::BoolOp::And, values, range: (location..end_location).into() } ) } } @@ -34614,7 +34614,7 @@ fn __action469< >( (_, location, _): (TextSize, TextSize, TextSize), (_, left, _): (TextSize, ast::Expr, TextSize), - (_, comparisons, _): (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize), + (_, comparisons, _): (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), ) -> ast::Expr { @@ -34638,8 +34638,8 @@ fn __action470< #[allow(clippy::too_many_arguments)] fn __action471< >( - (_, __0, _): (TextSize, (ast::Cmpop, ast::Expr), TextSize), -) -> alloc::vec::Vec<(ast::Cmpop, ast::Expr)> + (_, __0, _): (TextSize, (ast::CmpOp, ast::Expr), TextSize), +) -> alloc::vec::Vec<(ast::CmpOp, ast::Expr)> { alloc::vec![__0] } @@ -34647,9 +34647,9 @@ fn __action471< #[allow(clippy::too_many_arguments)] fn __action472< >( - (_, v, _): (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize), - (_, e, _): (TextSize, (ast::Cmpop, ast::Expr), TextSize), -) -> alloc::vec::Vec<(ast::Cmpop, ast::Expr)> + (_, v, _): (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize), + (_, e, _): (TextSize, (ast::CmpOp, ast::Expr), TextSize), +) -> alloc::vec::Vec<(ast::CmpOp, ast::Expr)> { { let mut v = v; v.push(e); v } } @@ -34657,9 +34657,9 @@ fn __action472< #[allow(clippy::too_many_arguments)] fn __action473< >( - (_, __0, _): (TextSize, ast::Cmpop, TextSize), + (_, __0, _): (TextSize, ast::CmpOp, TextSize), (_, __1, _): (TextSize, ast::Expr, TextSize), -) -> (ast::Cmpop, ast::Expr) +) -> (ast::CmpOp, ast::Expr) { (__0, __1) } @@ -34698,7 +34698,7 @@ fn __action476< ) -> ast::Expr { ast::Expr::UnaryOp( - ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not, range: (location..end_location).into() } + ast::ExprUnaryOp { operand: Box::new(e), op: ast::UnaryOp::Not, range: (location..end_location).into() } ) } @@ -34716,7 +34716,7 @@ fn __action478< >( (_, location, _): (TextSize, TextSize, TextSize), (_, left, _): (TextSize, ast::Expr, TextSize), - (_, comparisons, _): (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize), + (_, comparisons, _): (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), ) -> ast::Expr { @@ -34765,7 +34765,7 @@ fn __action481< fn __action482< >( (_, location, _): (TextSize, TextSize, TextSize), - (_, op, _): (TextSize, ast::Unaryop, TextSize), + (_, op, _): (TextSize, ast::UnaryOp, TextSize), (_, e, _): (TextSize, ast::Expr, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), ) -> ast::Expr @@ -35463,7 +35463,7 @@ fn __action534< fn __action535< >( (_, location, _): (TextSize, TextSize, TextSize), - (_, op, _): (TextSize, ast::Unaryop, TextSize), + (_, op, _): (TextSize, ast::UnaryOp, TextSize), (_, e, _): (TextSize, ast::Expr, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize), ) -> ast::Expr @@ -37498,10 +37498,10 @@ fn __action624< fn __action625< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, Vec, TextSize), + __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __2.0; let __end0 = __2.2; @@ -37521,9 +37521,9 @@ fn __action625< fn __action626< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, Vec, TextSize), + __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __1.2; let __end0 = __2.0; @@ -37544,12 +37544,12 @@ fn __action626< fn __action627< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, core::option::Option>, TextSize), - __2: (TextSize, ast::Withitem, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __1: (TextSize, core::option::Option>, TextSize), + __2: (TextSize, ast::WithItem, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __4.0; let __end0 = __4.2; @@ -37571,11 +37571,11 @@ fn __action627< fn __action628< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, core::option::Option>, TextSize), - __2: (TextSize, ast::Withitem, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __1: (TextSize, core::option::Option>, TextSize), + __2: (TextSize, ast::WithItem, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __3.2; let __end0 = __4.0; @@ -37986,7 +37986,7 @@ fn __action643< __0: (TextSize, TextSize, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, token::Tok, TextSize), - __3: (TextSize, Vec, TextSize), + __3: (TextSize, Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, ast::Suite, TextSize), ) -> ast::Stmt @@ -38012,7 +38012,7 @@ fn __action644< >( __0: (TextSize, TextSize, TextSize), __1: (TextSize, token::Tok, TextSize), - __2: (TextSize, Vec, TextSize), + __2: (TextSize, Vec, TextSize), __3: (TextSize, token::Tok, TextSize), __4: (TextSize, ast::Suite, TextSize), ) -> ast::Stmt @@ -40813,7 +40813,7 @@ fn __action755< fn __action756< >( __0: (TextSize, ast::Expr, TextSize), - __1: (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize), + __1: (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize), __2: (TextSize, TextSize, TextSize), ) -> ast::Expr { @@ -40836,7 +40836,7 @@ fn __action756< fn __action757< >( __0: (TextSize, ast::Expr, TextSize), - __1: (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize), + __1: (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize), __2: (TextSize, TextSize, TextSize), ) -> ast::Expr { @@ -40975,7 +40975,7 @@ fn __action763< __1: (TextSize, core::option::Option, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { let __start0 = __0.0; let __end0 = __0.0; @@ -41000,7 +41000,7 @@ fn __action764< __1: (TextSize, (ast::Expr, ast::Identifier), TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { let __start0 = __0.0; let __end0 = __0.0; @@ -41026,7 +41026,7 @@ fn __action765< __2: (TextSize, ast::Expr, TextSize), __3: (TextSize, token::Tok, TextSize), __4: (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { let __start0 = __0.0; let __end0 = __0.0; @@ -41053,7 +41053,7 @@ fn __action766< __2: (TextSize, (ast::Expr, ast::Identifier), TextSize), __3: (TextSize, token::Tok, TextSize), __4: (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { let __start0 = __0.0; let __end0 = __0.0; @@ -41200,7 +41200,7 @@ fn __action771< #[allow(clippy::too_many_arguments)] fn __action772< >( - __0: (TextSize, ast::Unaryop, TextSize), + __0: (TextSize, ast::UnaryOp, TextSize), __1: (TextSize, ast::Expr, TextSize), __2: (TextSize, TextSize, TextSize), ) -> ast::Expr @@ -41223,7 +41223,7 @@ fn __action772< #[allow(clippy::too_many_arguments)] fn __action773< >( - __0: (TextSize, ast::Unaryop, TextSize), + __0: (TextSize, ast::UnaryOp, TextSize), __1: (TextSize, ast::Expr, TextSize), __2: (TextSize, TextSize, TextSize), ) -> ast::Expr @@ -44240,7 +44240,7 @@ fn __action897< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, core::option::Option, TextSize), __5: (TextSize, core::option::Option, TextSize), __6: (TextSize, TextSize, TextSize), @@ -44271,7 +44271,7 @@ fn __action898< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, core::option::Option, TextSize), __5: (TextSize, core::option::Option, TextSize), __6: (TextSize, TextSize, TextSize), @@ -44418,7 +44418,7 @@ fn __action904< >( __0: (TextSize, ast::Expr, TextSize), __1: (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __0.0; let __end0 = __0.0; @@ -44441,7 +44441,7 @@ fn __action905< __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Expr, TextSize), __3: (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __0.0; let __end0 = __0.0; @@ -44466,7 +44466,7 @@ fn __action906< __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Expr, TextSize), __3: (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __0.0; let __end0 = __0.0; @@ -44489,7 +44489,7 @@ fn __action907< >( __0: (TextSize, ast::Expr, TextSize), __1: (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __0.0; let __end0 = __0.0; @@ -44512,7 +44512,7 @@ fn __action908< __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Expr, TextSize), __3: (TextSize, TextSize, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __0.0; let __end0 = __0.0; @@ -44535,7 +44535,7 @@ fn __action909< >( __0: (TextSize, Vec, TextSize), __1: (TextSize, TextSize, TextSize), -) -> Vec +) -> Vec { let __start0 = __0.0; let __end0 = __0.0; @@ -44556,7 +44556,7 @@ fn __action910< >( __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), - __2: (TextSize, Vec, TextSize), + __2: (TextSize, Vec, TextSize), __3: (TextSize, token::Tok, TextSize), __4: (TextSize, ast::Suite, TextSize), ) -> ast::Stmt @@ -44582,7 +44582,7 @@ fn __action910< fn __action911< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, Vec, TextSize), + __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, ast::Suite, TextSize), ) -> ast::Stmt @@ -47738,8 +47738,8 @@ fn __action1038< fn __action1039< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, ast::Withitem, TextSize), -) -> alloc::vec::Vec + __1: (TextSize, ast::WithItem, TextSize), +) -> alloc::vec::Vec { let __start0 = __0.0; let __end0 = __1.2; @@ -47756,10 +47756,10 @@ fn __action1039< #[allow(clippy::too_many_arguments)] fn __action1040< >( - __0: (TextSize, alloc::vec::Vec, TextSize), + __0: (TextSize, alloc::vec::Vec, TextSize), __1: (TextSize, token::Tok, TextSize), - __2: (TextSize, ast::Withitem, TextSize), -) -> alloc::vec::Vec + __2: (TextSize, ast::WithItem, TextSize), +) -> alloc::vec::Vec { let __start0 = __1.0; let __end0 = __2.2; @@ -47778,11 +47778,11 @@ fn __action1040< fn __action1041< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, core::option::Option>, TextSize), - __2: (TextSize, ast::Withitem, TextSize), + __1: (TextSize, core::option::Option>, TextSize), + __2: (TextSize, ast::WithItem, TextSize), __3: (TextSize, token::Tok, TextSize), __4: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __2.2; let __end0 = __3.0; @@ -47805,12 +47805,12 @@ fn __action1041< fn __action1042< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, core::option::Option>, TextSize), - __2: (TextSize, ast::Withitem, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __1: (TextSize, core::option::Option>, TextSize), + __2: (TextSize, ast::WithItem, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __3.0; let __end0 = __3.2; @@ -47832,10 +47832,10 @@ fn __action1042< fn __action1043< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, core::option::Option>, TextSize), - __2: (TextSize, ast::Withitem, TextSize), + __1: (TextSize, core::option::Option>, TextSize), + __2: (TextSize, ast::WithItem, TextSize), __3: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __2.2; let __end0 = __3.0; @@ -47857,11 +47857,11 @@ fn __action1043< fn __action1044< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, core::option::Option>, TextSize), - __2: (TextSize, ast::Withitem, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __1: (TextSize, core::option::Option>, TextSize), + __2: (TextSize, ast::WithItem, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __3.0; let __end0 = __3.2; @@ -48633,7 +48633,7 @@ fn __action1076< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -48666,7 +48666,7 @@ fn __action1077< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, core::option::Option, TextSize), __5: (TextSize, TextSize, TextSize), ) -> ast::Stmt @@ -48695,7 +48695,7 @@ fn __action1078< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -48728,7 +48728,7 @@ fn __action1079< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, core::option::Option, TextSize), __5: (TextSize, TextSize, TextSize), ) -> ast::Stmt @@ -48859,7 +48859,7 @@ fn __action1084< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -48896,7 +48896,7 @@ fn __action1085< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -48929,7 +48929,7 @@ fn __action1086< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -48960,7 +48960,7 @@ fn __action1087< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, TextSize, TextSize), ) -> ast::Stmt { @@ -48987,7 +48987,7 @@ fn __action1088< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -49024,7 +49024,7 @@ fn __action1089< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -49057,7 +49057,7 @@ fn __action1090< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -49088,7 +49088,7 @@ fn __action1091< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, TextSize, TextSize), ) -> ast::Stmt { @@ -50456,7 +50456,7 @@ fn __action1148< __3: (TextSize, ast::Identifier, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { let __start0 = __1.0; let __end0 = __3.2; @@ -50484,7 +50484,7 @@ fn __action1149< __4: (TextSize, ast::Identifier, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { let __start0 = __2.0; let __end0 = __4.2; @@ -52471,7 +52471,7 @@ fn __action1231< fn __action1232< >( __0: (TextSize, ast::Expr, TextSize), - __1: (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize), + __1: (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize), ) -> ast::Expr { let __start0 = __1.2; @@ -52492,7 +52492,7 @@ fn __action1232< fn __action1233< >( __0: (TextSize, ast::Expr, TextSize), - __1: (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize), + __1: (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize), ) -> ast::Expr { let __start0 = __1.2; @@ -52730,7 +52730,7 @@ fn __action1243< #[allow(clippy::too_many_arguments)] fn __action1244< >( - __0: (TextSize, ast::Unaryop, TextSize), + __0: (TextSize, ast::UnaryOp, TextSize), __1: (TextSize, ast::Expr, TextSize), ) -> ast::Expr { @@ -52751,7 +52751,7 @@ fn __action1244< #[allow(clippy::too_many_arguments)] fn __action1245< >( - __0: (TextSize, ast::Unaryop, TextSize), + __0: (TextSize, ast::UnaryOp, TextSize), __1: (TextSize, ast::Expr, TextSize), ) -> ast::Expr { @@ -56619,7 +56619,7 @@ fn __action1410< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -56656,7 +56656,7 @@ fn __action1411< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -56687,7 +56687,7 @@ fn __action1412< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -56718,7 +56718,7 @@ fn __action1413< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), ) -> ast::Stmt { let __start0 = __3.2; @@ -56743,7 +56743,7 @@ fn __action1414< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -56780,7 +56780,7 @@ fn __action1415< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -56811,7 +56811,7 @@ fn __action1416< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, ast::Suite, TextSize), @@ -56842,7 +56842,7 @@ fn __action1417< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), - __3: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, alloc::vec::Vec, TextSize), ) -> ast::Stmt { let __start0 = __3.2; @@ -56945,7 +56945,7 @@ fn __action1421< fn __action1422< >( __0: (TextSize, ast::Expr, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __0.2; let __end0 = __0.2; @@ -56966,7 +56966,7 @@ fn __action1423< __0: (TextSize, ast::Expr, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Expr, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __2.2; let __end0 = __2.2; @@ -56989,7 +56989,7 @@ fn __action1424< __0: (TextSize, ast::Expr, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Expr, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __2.2; let __end0 = __2.2; @@ -57010,7 +57010,7 @@ fn __action1424< fn __action1425< >( __0: (TextSize, ast::Expr, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __0.2; let __end0 = __0.2; @@ -57031,7 +57031,7 @@ fn __action1426< __0: (TextSize, ast::Expr, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Expr, TextSize), -) -> ast::Withitem +) -> ast::WithItem { let __start0 = __2.2; let __end0 = __2.2; @@ -57052,7 +57052,7 @@ fn __action1426< fn __action1427< >( __0: (TextSize, Vec, TextSize), -) -> Vec +) -> Vec { let __start0 = __0.2; let __end0 = __0.2; @@ -57162,7 +57162,7 @@ fn __action1432< >( __0: (TextSize, Vec, TextSize), __1: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __0.0; let __end0 = __0.2; @@ -57183,7 +57183,7 @@ fn __action1433< __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __1.0; let __end0 = __1.2; @@ -57205,7 +57205,7 @@ fn __action1434< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __1.0; let __end0 = __1.2; @@ -57225,7 +57225,7 @@ fn __action1435< >( __0: (TextSize, Vec, TextSize), __1: (TextSize, token::Tok, TextSize), -) -> core::option::Option> +) -> core::option::Option> { let __start0 = __0.0; let __end0 = __1.2; @@ -57245,10 +57245,10 @@ fn __action1436< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), - __3: (TextSize, ast::Withitem, TextSize), + __3: (TextSize, ast::WithItem, TextSize), __4: (TextSize, token::Tok, TextSize), __5: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __1.0; let __end0 = __2.2; @@ -57270,10 +57270,10 @@ fn __action1436< fn __action1437< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, ast::Withitem, TextSize), + __1: (TextSize, ast::WithItem, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __0.2; let __end0 = __1.0; @@ -57297,11 +57297,11 @@ fn __action1438< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), - __3: (TextSize, ast::Withitem, TextSize), - __4: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, ast::WithItem, TextSize), + __4: (TextSize, alloc::vec::Vec, TextSize), __5: (TextSize, token::Tok, TextSize), __6: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __1.0; let __end0 = __2.2; @@ -57324,11 +57324,11 @@ fn __action1438< fn __action1439< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, ast::Withitem, TextSize), - __2: (TextSize, alloc::vec::Vec, TextSize), + __1: (TextSize, ast::WithItem, TextSize), + __2: (TextSize, alloc::vec::Vec, TextSize), __3: (TextSize, token::Tok, TextSize), __4: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __0.2; let __end0 = __1.0; @@ -57353,9 +57353,9 @@ fn __action1440< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), - __3: (TextSize, ast::Withitem, TextSize), + __3: (TextSize, ast::WithItem, TextSize), __4: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __1.0; let __end0 = __2.2; @@ -57376,9 +57376,9 @@ fn __action1440< fn __action1441< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, ast::Withitem, TextSize), + __1: (TextSize, ast::WithItem, TextSize), __2: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __0.2; let __end0 = __1.0; @@ -57401,10 +57401,10 @@ fn __action1442< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, Vec, TextSize), __2: (TextSize, token::Tok, TextSize), - __3: (TextSize, ast::Withitem, TextSize), - __4: (TextSize, alloc::vec::Vec, TextSize), + __3: (TextSize, ast::WithItem, TextSize), + __4: (TextSize, alloc::vec::Vec, TextSize), __5: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __1.0; let __end0 = __2.2; @@ -57426,10 +57426,10 @@ fn __action1442< fn __action1443< >( __0: (TextSize, token::Tok, TextSize), - __1: (TextSize, ast::Withitem, TextSize), - __2: (TextSize, alloc::vec::Vec, TextSize), + __1: (TextSize, ast::WithItem, TextSize), + __2: (TextSize, alloc::vec::Vec, TextSize), __3: (TextSize, token::Tok, TextSize), -) -> Vec +) -> Vec { let __start0 = __0.2; let __end0 = __1.0; @@ -57486,9 +57486,9 @@ fn __action1445< #[allow(clippy::too_many_arguments)] fn __action1446< >( - __0: (TextSize, ast::Cmpop, TextSize), + __0: (TextSize, ast::CmpOp, TextSize), __1: (TextSize, ast::Expr, TextSize), -) -> alloc::vec::Vec<(ast::Cmpop, ast::Expr)> +) -> alloc::vec::Vec<(ast::CmpOp, ast::Expr)> { let __start0 = __0.0; let __end0 = __1.2; @@ -57505,10 +57505,10 @@ fn __action1446< #[allow(clippy::too_many_arguments)] fn __action1447< >( - __0: (TextSize, alloc::vec::Vec<(ast::Cmpop, ast::Expr)>, TextSize), - __1: (TextSize, ast::Cmpop, TextSize), + __0: (TextSize, alloc::vec::Vec<(ast::CmpOp, ast::Expr)>, TextSize), + __1: (TextSize, ast::CmpOp, TextSize), __2: (TextSize, ast::Expr, TextSize), -) -> alloc::vec::Vec<(ast::Cmpop, ast::Expr)> +) -> alloc::vec::Vec<(ast::CmpOp, ast::Expr)> { let __start0 = __1.0; let __end0 = __2.2; @@ -62420,7 +62420,7 @@ fn __action1636< __1: (TextSize, ast::Expr, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { let __start0 = __1.0; let __end0 = __1.2; @@ -62442,7 +62442,7 @@ fn __action1637< __0: (TextSize, token::Tok, TextSize), __1: (TextSize, token::Tok, TextSize), __2: (TextSize, ast::Suite, TextSize), -) -> ast::Excepthandler +) -> ast::ExceptHandler { let __start0 = __0.2; let __end0 = __1.0; diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap index 0997c4d..328a4c4 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap @@ -7,7 +7,7 @@ expression: parse_ast StmtWith { range: 0..17, items: [ - Withitem { + WithItem { range: 5..11, context_expr: Constant( ExprConstant { diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__try.snap b/parser/src/snapshots/rustpython_parser__parser__tests__try.snap index 55ee202..467e34f 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__try.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__try.snap @@ -44,7 +44,7 @@ expression: parse_ast ], handlers: [ ExceptHandler( - ExcepthandlerExceptHandler { + ExceptHandlerExceptHandler { range: 29..82, type_: Some( Name( @@ -138,7 +138,7 @@ expression: parse_ast }, ), ExceptHandler( - ExcepthandlerExceptHandler { + ExceptHandlerExceptHandler { range: 83..134, type_: Some( Name( diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__try_star.snap b/parser/src/snapshots/rustpython_parser__parser__tests__try_star.snap index 5d4700f..b5925f6 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__try_star.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__try_star.snap @@ -156,7 +156,7 @@ expression: parse_ast ], handlers: [ ExceptHandler( - ExcepthandlerExceptHandler { + ExceptHandlerExceptHandler { range: 99..180, type_: Some( Name( @@ -284,7 +284,7 @@ expression: parse_ast }, ), ExceptHandler( - ExcepthandlerExceptHandler { + ExceptHandlerExceptHandler { range: 181..260, type_: Some( Name( diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__with_statement.snap b/parser/src/snapshots/rustpython_parser__parser__tests__with_statement.snap index 1e5b738..d59ac12 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__with_statement.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__with_statement.snap @@ -1,13 +1,13 @@ --- source: parser/src/parser.rs -expression: "parse_program(source, \"\").unwrap()" +expression: "ast::Suite::parse(source, \"\").unwrap()" --- [ With( StmtWith { range: 0..12, items: [ - Withitem { + WithItem { range: 5..6, context_expr: Constant( ExprConstant { @@ -35,7 +35,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 13..30, items: [ - Withitem { + WithItem { range: 18..24, context_expr: Constant( ExprConstant { @@ -73,7 +73,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 31..46, items: [ - Withitem { + WithItem { range: 36..37, context_expr: Constant( ExprConstant { @@ -86,7 +86,7 @@ expression: "parse_program(source, \"\").unwrap()" ), optional_vars: None, }, - Withitem { + WithItem { range: 39..40, context_expr: Constant( ExprConstant { @@ -114,7 +114,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 47..72, items: [ - Withitem { + WithItem { range: 52..58, context_expr: Constant( ExprConstant { @@ -137,7 +137,7 @@ expression: "parse_program(source, \"\").unwrap()" ), ), }, - Withitem { + WithItem { range: 60..66, context_expr: Constant( ExprConstant { @@ -175,7 +175,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 73..97, items: [ - Withitem { + WithItem { range: 78..91, context_expr: IfExp( ExprIfExp { @@ -226,7 +226,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 98..127, items: [ - Withitem { + WithItem { range: 103..121, context_expr: IfExp( ExprIfExp { @@ -287,7 +287,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 128..141, items: [ - Withitem { + WithItem { range: 133..135, context_expr: Tuple( ExprTuple { @@ -313,7 +313,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 142..160, items: [ - Withitem { + WithItem { range: 147..154, context_expr: Tuple( ExprTuple { @@ -349,7 +349,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 161..175, items: [ - Withitem { + WithItem { range: 167..168, context_expr: Constant( ExprConstant { @@ -377,7 +377,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 176..195, items: [ - Withitem { + WithItem { range: 181..189, context_expr: Constant( ExprConstant { @@ -415,7 +415,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 196..211, items: [ - Withitem { + WithItem { range: 202..203, context_expr: Constant( ExprConstant { @@ -443,7 +443,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 212..232, items: [ - Withitem { + WithItem { range: 217..226, context_expr: Tuple( ExprTuple { @@ -489,7 +489,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 233..250, items: [ - Withitem { + WithItem { range: 239..243, context_expr: Constant( ExprConstant { @@ -502,7 +502,7 @@ expression: "parse_program(source, \"\").unwrap()" ), optional_vars: None, }, - Withitem { + WithItem { range: 239..243, context_expr: Constant( ExprConstant { @@ -530,7 +530,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 251..273, items: [ - Withitem { + WithItem { range: 256..267, context_expr: Tuple( ExprTuple { @@ -585,7 +585,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 274..290, items: [ - Withitem { + WithItem { range: 279..284, context_expr: Tuple( ExprTuple { @@ -627,7 +627,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 291..312, items: [ - Withitem { + WithItem { range: 296..306, context_expr: Tuple( ExprTuple { @@ -679,7 +679,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 313..331, items: [ - Withitem { + WithItem { range: 318..325, context_expr: Tuple( ExprTuple { @@ -730,7 +730,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 332..355, items: [ - Withitem { + WithItem { range: 337..349, context_expr: Tuple( ExprTuple { @@ -791,7 +791,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 356..375, items: [ - Withitem { + WithItem { range: 361..369, context_expr: NamedExpr( ExprNamedExpr { @@ -833,7 +833,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 376..400, items: [ - Withitem { + WithItem { range: 381..394, context_expr: NamedExpr( ExprNamedExpr { @@ -885,7 +885,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 401..428, items: [ - Withitem { + WithItem { range: 406..422, context_expr: Tuple( ExprTuple { @@ -958,7 +958,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 429..461, items: [ - Withitem { + WithItem { range: 434..455, context_expr: Tuple( ExprTuple { @@ -1041,7 +1041,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 462..481, items: [ - Withitem { + WithItem { range: 468..474, context_expr: Constant( ExprConstant { @@ -1079,7 +1079,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 482..502, items: [ - Withitem { + WithItem { range: 488..494, context_expr: Constant( ExprConstant { @@ -1117,7 +1117,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 503..530, items: [ - Withitem { + WithItem { range: 509..515, context_expr: Constant( ExprConstant { @@ -1140,7 +1140,7 @@ expression: "parse_program(source, \"\").unwrap()" ), ), }, - Withitem { + WithItem { range: 517..523, context_expr: Constant( ExprConstant { @@ -1178,7 +1178,7 @@ expression: "parse_program(source, \"\").unwrap()" StmtWith { range: 531..559, items: [ - Withitem { + WithItem { range: 537..543, context_expr: Constant( ExprConstant { @@ -1201,7 +1201,7 @@ expression: "parse_program(source, \"\").unwrap()" ), ), }, - Withitem { + WithItem { range: 545..551, context_expr: Constant( ExprConstant {