mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-08 05:35:22 +00:00
Rename unconventional nodes
This commit is contained in:
parent
edcfcb4a74
commit
6b038b867a
18 changed files with 1057 additions and 1048 deletions
|
@ -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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
||||
|
@ -792,7 +792,7 @@ impl<R> PyNode for ast::Comprehension<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R> PyNode for ast::Excepthandler<R> {
|
||||
impl<R> PyNode for ast::ExceptHandler<R> {
|
||||
#[inline]
|
||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
||||
|
@ -800,7 +800,7 @@ impl<R> PyNode for ast::Excepthandler<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R> PyNode for ast::ExcepthandlerExceptHandler<R> {
|
||||
impl<R> PyNode for ast::ExceptHandlerExceptHandler<R> {
|
||||
#[inline]
|
||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
||||
|
@ -840,7 +840,7 @@ impl<R> PyNode for ast::Alias<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R> PyNode for ast::Withitem<R> {
|
||||
impl<R> PyNode for ast::WithItem<R> {
|
||||
#[inline]
|
||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = 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::<PyAny>::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::<PyAny>::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::<PyAny>::as_ref(&cell.get().unwrap().1, py))
|
||||
}
|
||||
|
@ -2256,17 +2256,17 @@ impl ToPyAst for ast::Comprehension<TextRange> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToPyAst for ast::Excepthandler<TextRange> {
|
||||
impl ToPyAst for ast::ExceptHandler<TextRange> {
|
||||
#[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<TextRange> {
|
||||
impl ToPyAst for ast::ExceptHandlerExceptHandler<TextRange> {
|
||||
#[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<TextRange> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToPyAst for ast::Withitem<TextRange> {
|
||||
impl ToPyAst for ast::WithItem<TextRange> {
|
||||
#[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<SourceRange> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToPyAst for ast::Excepthandler<SourceRange> {
|
||||
impl ToPyAst for ast::ExceptHandler<SourceRange> {
|
||||
#[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<SourceRange> {
|
||||
impl ToPyAst for ast::ExceptHandlerExceptHandler<SourceRange> {
|
||||
#[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<SourceRange> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToPyAst for ast::Withitem<SourceRange> {
|
||||
impl ToPyAst for ast::WithItem<SourceRange> {
|
||||
#[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::ExprContextLoad>(ast_module)?;
|
||||
cache_py_type::<ast::ExprContextStore>(ast_module)?;
|
||||
cache_py_type::<ast::ExprContextDel>(ast_module)?;
|
||||
cache_py_type::<ast::Boolop>(ast_module)?;
|
||||
cache_py_type::<ast::BoolopAnd>(ast_module)?;
|
||||
cache_py_type::<ast::BoolopOr>(ast_module)?;
|
||||
cache_py_type::<ast::BoolOp>(ast_module)?;
|
||||
cache_py_type::<ast::BoolOpAnd>(ast_module)?;
|
||||
cache_py_type::<ast::BoolOpOr>(ast_module)?;
|
||||
cache_py_type::<ast::Operator>(ast_module)?;
|
||||
cache_py_type::<ast::OperatorAdd>(ast_module)?;
|
||||
cache_py_type::<ast::OperatorSub>(ast_module)?;
|
||||
|
@ -4801,30 +4801,30 @@ fn init_types(py: Python) -> PyResult<()> {
|
|||
cache_py_type::<ast::OperatorBitXor>(ast_module)?;
|
||||
cache_py_type::<ast::OperatorBitAnd>(ast_module)?;
|
||||
cache_py_type::<ast::OperatorFloorDiv>(ast_module)?;
|
||||
cache_py_type::<ast::Unaryop>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryopInvert>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryopNot>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryopUAdd>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryopUSub>(ast_module)?;
|
||||
cache_py_type::<ast::Cmpop>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopEq>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopNotEq>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopLt>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopLtE>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopGt>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopGtE>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopIs>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopIsNot>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopIn>(ast_module)?;
|
||||
cache_py_type::<ast::CmpopNotIn>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryOp>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryOpInvert>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryOpNot>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryOpUAdd>(ast_module)?;
|
||||
cache_py_type::<ast::UnaryOpUSub>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOp>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpEq>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpNotEq>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpLt>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpLtE>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpGt>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpGtE>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpIs>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpIsNot>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpIn>(ast_module)?;
|
||||
cache_py_type::<ast::CmpOpNotIn>(ast_module)?;
|
||||
cache_py_type::<ast::Comprehension>(ast_module)?;
|
||||
cache_py_type::<ast::Excepthandler>(ast_module)?;
|
||||
cache_py_type::<ast::ExcepthandlerExceptHandler>(ast_module)?;
|
||||
cache_py_type::<ast::ExceptHandler>(ast_module)?;
|
||||
cache_py_type::<ast::ExceptHandlerExceptHandler>(ast_module)?;
|
||||
cache_py_type::<ast::PythonArguments>(ast_module)?;
|
||||
cache_py_type::<ast::Arg>(ast_module)?;
|
||||
cache_py_type::<ast::Keyword>(ast_module)?;
|
||||
cache_py_type::<ast::Alias>(ast_module)?;
|
||||
cache_py_type::<ast::Withitem>(ast_module)?;
|
||||
cache_py_type::<ast::WithItem>(ast_module)?;
|
||||
cache_py_type::<ast::MatchCase>(ast_module)?;
|
||||
cache_py_type::<ast::Pattern>(ast_module)?;
|
||||
cache_py_type::<ast::PatternMatchValue>(ast_module)?;
|
||||
|
|
|
@ -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<Self> {
|
||||
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<Self> {
|
||||
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<Self> {
|
||||
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<SourceRange>> for Excepthandler {
|
||||
fn from(_node: &'static ast::Excepthandler<SourceRange>) -> Self {
|
||||
Excepthandler
|
||||
impl From<&'static ast::ExceptHandler<SourceRange>> for ExceptHandler {
|
||||
fn from(_node: &'static ast::ExceptHandler<SourceRange>) -> Self {
|
||||
ExceptHandler
|
||||
}
|
||||
}
|
||||
|
||||
#[pymethods]
|
||||
impl Excepthandler {
|
||||
impl ExceptHandler {
|
||||
#[new]
|
||||
fn new() -> PyClassInitializer<Self> {
|
||||
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<SourceRange> {
|
||||
impl ToPyWrapper for ast::ExceptHandler<SourceRange> {
|
||||
#[inline]
|
||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||
match &self {
|
||||
|
@ -3240,34 +3240,34 @@ impl ToPyWrapper for ast::Excepthandler<SourceRange> {
|
|||
}
|
||||
}
|
||||
|
||||
#[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<SourceRange>);
|
||||
pub struct ExceptHandlerExceptHandler(pub &'static ast::ExceptHandlerExceptHandler<SourceRange>);
|
||||
|
||||
impl From<&'static ast::ExcepthandlerExceptHandler<SourceRange>> for ExcepthandlerExceptHandler {
|
||||
fn from(node: &'static ast::ExcepthandlerExceptHandler<SourceRange>) -> Self {
|
||||
ExcepthandlerExceptHandler(node)
|
||||
impl From<&'static ast::ExceptHandlerExceptHandler<SourceRange>> for ExceptHandlerExceptHandler {
|
||||
fn from(node: &'static ast::ExceptHandlerExceptHandler<SourceRange>) -> 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<SourceRange> {
|
||||
impl ToPyWrapper for ast::ExceptHandlerExceptHandler<SourceRange> {
|
||||
#[inline]
|
||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||
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<PyObject> {
|
||||
|
@ -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<SourceRange>);
|
||||
pub struct WithItem(pub &'static ast::WithItem<SourceRange>);
|
||||
|
||||
impl From<&'static ast::Withitem<SourceRange>> for Withitem {
|
||||
fn from(node: &'static ast::Withitem<SourceRange>) -> Self {
|
||||
Withitem(node)
|
||||
impl From<&'static ast::WithItem<SourceRange>> for WithItem {
|
||||
fn from(node: &'static ast::WithItem<SourceRange>) -> 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<SourceRange> {
|
||||
impl ToPyWrapper for ast::WithItem<SourceRange> {
|
||||
#[inline]
|
||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||
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<PyObject> {
|
||||
|
@ -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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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<Py<PyAny>> {
|
||||
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::<ExprContextLoad, ast::ExprContextLoad>(py, m)?;
|
||||
super::init_type::<ExprContextStore, ast::ExprContextStore>(py, m)?;
|
||||
super::init_type::<ExprContextDel, ast::ExprContextDel>(py, m)?;
|
||||
super::init_type::<Boolop, ast::Boolop>(py, m)?;
|
||||
super::init_type::<BoolopAnd, ast::BoolopAnd>(py, m)?;
|
||||
super::init_type::<BoolopOr, ast::BoolopOr>(py, m)?;
|
||||
super::init_type::<BoolOp, ast::BoolOp>(py, m)?;
|
||||
super::init_type::<BoolOpAnd, ast::BoolOpAnd>(py, m)?;
|
||||
super::init_type::<BoolOpOr, ast::BoolOpOr>(py, m)?;
|
||||
super::init_type::<Operator, ast::Operator>(py, m)?;
|
||||
super::init_type::<OperatorAdd, ast::OperatorAdd>(py, m)?;
|
||||
super::init_type::<OperatorSub, ast::OperatorSub>(py, m)?;
|
||||
|
@ -4373,30 +4373,30 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
|
|||
super::init_type::<OperatorBitXor, ast::OperatorBitXor>(py, m)?;
|
||||
super::init_type::<OperatorBitAnd, ast::OperatorBitAnd>(py, m)?;
|
||||
super::init_type::<OperatorFloorDiv, ast::OperatorFloorDiv>(py, m)?;
|
||||
super::init_type::<Unaryop, ast::Unaryop>(py, m)?;
|
||||
super::init_type::<UnaryopInvert, ast::UnaryopInvert>(py, m)?;
|
||||
super::init_type::<UnaryopNot, ast::UnaryopNot>(py, m)?;
|
||||
super::init_type::<UnaryopUAdd, ast::UnaryopUAdd>(py, m)?;
|
||||
super::init_type::<UnaryopUSub, ast::UnaryopUSub>(py, m)?;
|
||||
super::init_type::<Cmpop, ast::Cmpop>(py, m)?;
|
||||
super::init_type::<CmpopEq, ast::CmpopEq>(py, m)?;
|
||||
super::init_type::<CmpopNotEq, ast::CmpopNotEq>(py, m)?;
|
||||
super::init_type::<CmpopLt, ast::CmpopLt>(py, m)?;
|
||||
super::init_type::<CmpopLtE, ast::CmpopLtE>(py, m)?;
|
||||
super::init_type::<CmpopGt, ast::CmpopGt>(py, m)?;
|
||||
super::init_type::<CmpopGtE, ast::CmpopGtE>(py, m)?;
|
||||
super::init_type::<CmpopIs, ast::CmpopIs>(py, m)?;
|
||||
super::init_type::<CmpopIsNot, ast::CmpopIsNot>(py, m)?;
|
||||
super::init_type::<CmpopIn, ast::CmpopIn>(py, m)?;
|
||||
super::init_type::<CmpopNotIn, ast::CmpopNotIn>(py, m)?;
|
||||
super::init_type::<UnaryOp, ast::UnaryOp>(py, m)?;
|
||||
super::init_type::<UnaryOpInvert, ast::UnaryOpInvert>(py, m)?;
|
||||
super::init_type::<UnaryOpNot, ast::UnaryOpNot>(py, m)?;
|
||||
super::init_type::<UnaryOpUAdd, ast::UnaryOpUAdd>(py, m)?;
|
||||
super::init_type::<UnaryOpUSub, ast::UnaryOpUSub>(py, m)?;
|
||||
super::init_type::<CmpOp, ast::CmpOp>(py, m)?;
|
||||
super::init_type::<CmpOpEq, ast::CmpOpEq>(py, m)?;
|
||||
super::init_type::<CmpOpNotEq, ast::CmpOpNotEq>(py, m)?;
|
||||
super::init_type::<CmpOpLt, ast::CmpOpLt>(py, m)?;
|
||||
super::init_type::<CmpOpLtE, ast::CmpOpLtE>(py, m)?;
|
||||
super::init_type::<CmpOpGt, ast::CmpOpGt>(py, m)?;
|
||||
super::init_type::<CmpOpGtE, ast::CmpOpGtE>(py, m)?;
|
||||
super::init_type::<CmpOpIs, ast::CmpOpIs>(py, m)?;
|
||||
super::init_type::<CmpOpIsNot, ast::CmpOpIsNot>(py, m)?;
|
||||
super::init_type::<CmpOpIn, ast::CmpOpIn>(py, m)?;
|
||||
super::init_type::<CmpOpNotIn, ast::CmpOpNotIn>(py, m)?;
|
||||
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
|
||||
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
|
||||
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
|
||||
super::init_type::<ExceptHandler, ast::ExceptHandler>(py, m)?;
|
||||
super::init_type::<ExceptHandlerExceptHandler, ast::ExceptHandlerExceptHandler>(py, m)?;
|
||||
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
|
||||
super::init_type::<Arg, ast::Arg>(py, m)?;
|
||||
super::init_type::<Keyword, ast::Keyword>(py, m)?;
|
||||
super::init_type::<Alias, ast::Alias>(py, m)?;
|
||||
super::init_type::<Withitem, ast::Withitem>(py, m)?;
|
||||
super::init_type::<WithItem, ast::WithItem>(py, m)?;
|
||||
super::init_type::<MatchCase, ast::MatchCase>(py, m)?;
|
||||
super::init_type::<Pattern, ast::Pattern>(py, m)?;
|
||||
super::init_type::<PatternMatchValue, ast::PatternMatchValue>(py, m)?;
|
||||
|
|
|
@ -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<Self> {
|
||||
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<Self> {
|
||||
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<Self> {
|
||||
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<TextRange>> for Excepthandler {
|
||||
fn from(_node: &'static ast::Excepthandler<TextRange>) -> Self {
|
||||
Excepthandler
|
||||
impl From<&'static ast::ExceptHandler<TextRange>> for ExceptHandler {
|
||||
fn from(_node: &'static ast::ExceptHandler<TextRange>) -> Self {
|
||||
ExceptHandler
|
||||
}
|
||||
}
|
||||
|
||||
#[pymethods]
|
||||
impl Excepthandler {
|
||||
impl ExceptHandler {
|
||||
#[new]
|
||||
fn new() -> PyClassInitializer<Self> {
|
||||
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<TextRange> {
|
||||
impl ToPyWrapper for ast::ExceptHandler<TextRange> {
|
||||
#[inline]
|
||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||
match &self {
|
||||
|
@ -3240,34 +3240,34 @@ impl ToPyWrapper for ast::Excepthandler<TextRange> {
|
|||
}
|
||||
}
|
||||
|
||||
#[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<TextRange>);
|
||||
pub struct ExceptHandlerExceptHandler(pub &'static ast::ExceptHandlerExceptHandler<TextRange>);
|
||||
|
||||
impl From<&'static ast::ExcepthandlerExceptHandler<TextRange>> for ExcepthandlerExceptHandler {
|
||||
fn from(node: &'static ast::ExcepthandlerExceptHandler<TextRange>) -> Self {
|
||||
ExcepthandlerExceptHandler(node)
|
||||
impl From<&'static ast::ExceptHandlerExceptHandler<TextRange>> for ExceptHandlerExceptHandler {
|
||||
fn from(node: &'static ast::ExceptHandlerExceptHandler<TextRange>) -> 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<TextRange> {
|
||||
impl ToPyWrapper for ast::ExceptHandlerExceptHandler<TextRange> {
|
||||
#[inline]
|
||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||
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<PyObject> {
|
||||
|
@ -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<TextRange>);
|
||||
pub struct WithItem(pub &'static ast::WithItem<TextRange>);
|
||||
|
||||
impl From<&'static ast::Withitem<TextRange>> for Withitem {
|
||||
fn from(node: &'static ast::Withitem<TextRange>) -> Self {
|
||||
Withitem(node)
|
||||
impl From<&'static ast::WithItem<TextRange>> for WithItem {
|
||||
fn from(node: &'static ast::WithItem<TextRange>) -> 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<TextRange> {
|
||||
impl ToPyWrapper for ast::WithItem<TextRange> {
|
||||
#[inline]
|
||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||
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<PyObject> {
|
||||
|
@ -4060,9 +4060,9 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
|
|||
super::init_type::<ExprContextLoad, ast::ExprContextLoad>(py, m)?;
|
||||
super::init_type::<ExprContextStore, ast::ExprContextStore>(py, m)?;
|
||||
super::init_type::<ExprContextDel, ast::ExprContextDel>(py, m)?;
|
||||
super::init_type::<Boolop, ast::Boolop>(py, m)?;
|
||||
super::init_type::<BoolopAnd, ast::BoolopAnd>(py, m)?;
|
||||
super::init_type::<BoolopOr, ast::BoolopOr>(py, m)?;
|
||||
super::init_type::<BoolOp, ast::BoolOp>(py, m)?;
|
||||
super::init_type::<BoolOpAnd, ast::BoolOpAnd>(py, m)?;
|
||||
super::init_type::<BoolOpOr, ast::BoolOpOr>(py, m)?;
|
||||
super::init_type::<Operator, ast::Operator>(py, m)?;
|
||||
super::init_type::<OperatorAdd, ast::OperatorAdd>(py, m)?;
|
||||
super::init_type::<OperatorSub, ast::OperatorSub>(py, m)?;
|
||||
|
@ -4077,30 +4077,30 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
|
|||
super::init_type::<OperatorBitXor, ast::OperatorBitXor>(py, m)?;
|
||||
super::init_type::<OperatorBitAnd, ast::OperatorBitAnd>(py, m)?;
|
||||
super::init_type::<OperatorFloorDiv, ast::OperatorFloorDiv>(py, m)?;
|
||||
super::init_type::<Unaryop, ast::Unaryop>(py, m)?;
|
||||
super::init_type::<UnaryopInvert, ast::UnaryopInvert>(py, m)?;
|
||||
super::init_type::<UnaryopNot, ast::UnaryopNot>(py, m)?;
|
||||
super::init_type::<UnaryopUAdd, ast::UnaryopUAdd>(py, m)?;
|
||||
super::init_type::<UnaryopUSub, ast::UnaryopUSub>(py, m)?;
|
||||
super::init_type::<Cmpop, ast::Cmpop>(py, m)?;
|
||||
super::init_type::<CmpopEq, ast::CmpopEq>(py, m)?;
|
||||
super::init_type::<CmpopNotEq, ast::CmpopNotEq>(py, m)?;
|
||||
super::init_type::<CmpopLt, ast::CmpopLt>(py, m)?;
|
||||
super::init_type::<CmpopLtE, ast::CmpopLtE>(py, m)?;
|
||||
super::init_type::<CmpopGt, ast::CmpopGt>(py, m)?;
|
||||
super::init_type::<CmpopGtE, ast::CmpopGtE>(py, m)?;
|
||||
super::init_type::<CmpopIs, ast::CmpopIs>(py, m)?;
|
||||
super::init_type::<CmpopIsNot, ast::CmpopIsNot>(py, m)?;
|
||||
super::init_type::<CmpopIn, ast::CmpopIn>(py, m)?;
|
||||
super::init_type::<CmpopNotIn, ast::CmpopNotIn>(py, m)?;
|
||||
super::init_type::<UnaryOp, ast::UnaryOp>(py, m)?;
|
||||
super::init_type::<UnaryOpInvert, ast::UnaryOpInvert>(py, m)?;
|
||||
super::init_type::<UnaryOpNot, ast::UnaryOpNot>(py, m)?;
|
||||
super::init_type::<UnaryOpUAdd, ast::UnaryOpUAdd>(py, m)?;
|
||||
super::init_type::<UnaryOpUSub, ast::UnaryOpUSub>(py, m)?;
|
||||
super::init_type::<CmpOp, ast::CmpOp>(py, m)?;
|
||||
super::init_type::<CmpOpEq, ast::CmpOpEq>(py, m)?;
|
||||
super::init_type::<CmpOpNotEq, ast::CmpOpNotEq>(py, m)?;
|
||||
super::init_type::<CmpOpLt, ast::CmpOpLt>(py, m)?;
|
||||
super::init_type::<CmpOpLtE, ast::CmpOpLtE>(py, m)?;
|
||||
super::init_type::<CmpOpGt, ast::CmpOpGt>(py, m)?;
|
||||
super::init_type::<CmpOpGtE, ast::CmpOpGtE>(py, m)?;
|
||||
super::init_type::<CmpOpIs, ast::CmpOpIs>(py, m)?;
|
||||
super::init_type::<CmpOpIsNot, ast::CmpOpIsNot>(py, m)?;
|
||||
super::init_type::<CmpOpIn, ast::CmpOpIn>(py, m)?;
|
||||
super::init_type::<CmpOpNotIn, ast::CmpOpNotIn>(py, m)?;
|
||||
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
|
||||
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
|
||||
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
|
||||
super::init_type::<ExceptHandler, ast::ExceptHandler>(py, m)?;
|
||||
super::init_type::<ExceptHandlerExceptHandler, ast::ExceptHandlerExceptHandler>(py, m)?;
|
||||
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
|
||||
super::init_type::<Arg, ast::Arg>(py, m)?;
|
||||
super::init_type::<Keyword, ast::Keyword>(py, m)?;
|
||||
super::init_type::<Alias, ast::Alias>(py, m)?;
|
||||
super::init_type::<Withitem, ast::Withitem>(py, m)?;
|
||||
super::init_type::<WithItem, ast::WithItem>(py, m)?;
|
||||
super::init_type::<MatchCase, ast::MatchCase>(py, m)?;
|
||||
super::init_type::<Pattern, ast::Pattern>(py, m)?;
|
||||
super::init_type::<PatternMatchValue, ast::PatternMatchValue>(py, m)?;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -390,16 +390,16 @@ pub trait Fold<U> {
|
|||
fn fold_expr_context(&mut self, node: ExprContext) -> Result<ExprContext, Self::Error> {
|
||||
fold_expr_context(self, node)
|
||||
}
|
||||
fn fold_boolop(&mut self, node: Boolop) -> Result<Boolop, Self::Error> {
|
||||
fn fold_boolop(&mut self, node: BoolOp) -> Result<BoolOp, Self::Error> {
|
||||
fold_boolop(self, node)
|
||||
}
|
||||
fn fold_operator(&mut self, node: Operator) -> Result<Operator, Self::Error> {
|
||||
fold_operator(self, node)
|
||||
}
|
||||
fn fold_unaryop(&mut self, node: Unaryop) -> Result<Unaryop, Self::Error> {
|
||||
fn fold_unaryop(&mut self, node: UnaryOp) -> Result<UnaryOp, Self::Error> {
|
||||
fold_unaryop(self, node)
|
||||
}
|
||||
fn fold_cmpop(&mut self, node: Cmpop) -> Result<Cmpop, Self::Error> {
|
||||
fn fold_cmpop(&mut self, node: CmpOp) -> Result<CmpOp, Self::Error> {
|
||||
fold_cmpop(self, node)
|
||||
}
|
||||
fn fold_comprehension(
|
||||
|
@ -410,14 +410,14 @@ pub trait Fold<U> {
|
|||
}
|
||||
fn fold_excepthandler(
|
||||
&mut self,
|
||||
node: Excepthandler<U>,
|
||||
) -> Result<Excepthandler<Self::TargetU>, Self::Error> {
|
||||
node: ExceptHandler<U>,
|
||||
) -> Result<ExceptHandler<Self::TargetU>, Self::Error> {
|
||||
fold_excepthandler(self, node)
|
||||
}
|
||||
fn fold_excepthandler_except_handler(
|
||||
&mut self,
|
||||
node: ExcepthandlerExceptHandler<U>,
|
||||
) -> Result<ExcepthandlerExceptHandler<Self::TargetU>, Self::Error> {
|
||||
node: ExceptHandlerExceptHandler<U>,
|
||||
) -> Result<ExceptHandlerExceptHandler<Self::TargetU>, Self::Error> {
|
||||
fold_excepthandler_except_handler(self, node)
|
||||
}
|
||||
fn fold_arguments(
|
||||
|
@ -435,7 +435,7 @@ pub trait Fold<U> {
|
|||
fn fold_alias(&mut self, node: Alias<U>) -> Result<Alias<Self::TargetU>, Self::Error> {
|
||||
fold_alias(self, node)
|
||||
}
|
||||
fn fold_withitem(&mut self, node: Withitem<U>) -> Result<Withitem<Self::TargetU>, Self::Error> {
|
||||
fn fold_withitem(&mut self, node: WithItem<U>) -> Result<WithItem<Self::TargetU>, Self::Error> {
|
||||
fold_withitem(self, node)
|
||||
}
|
||||
fn fold_match_case(
|
||||
|
@ -2210,8 +2210,8 @@ pub fn fold_expr_context<U, F: Fold<U> + ?Sized>(
|
|||
) -> Result<ExprContext, F::Error> {
|
||||
Ok(node)
|
||||
}
|
||||
impl<T, U> Foldable<T, U> for Boolop {
|
||||
type Mapped = Boolop;
|
||||
impl<T, U> Foldable<T, U> for BoolOp {
|
||||
type Mapped = BoolOp;
|
||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||
self,
|
||||
folder: &mut F,
|
||||
|
@ -2221,8 +2221,8 @@ impl<T, U> Foldable<T, U> for Boolop {
|
|||
}
|
||||
pub fn fold_boolop<U, F: Fold<U> + ?Sized>(
|
||||
#[allow(unused)] folder: &mut F,
|
||||
node: Boolop,
|
||||
) -> Result<Boolop, F::Error> {
|
||||
node: BoolOp,
|
||||
) -> Result<BoolOp, F::Error> {
|
||||
Ok(node)
|
||||
}
|
||||
impl<T, U> Foldable<T, U> for Operator {
|
||||
|
@ -2240,8 +2240,8 @@ pub fn fold_operator<U, F: Fold<U> + ?Sized>(
|
|||
) -> Result<Operator, F::Error> {
|
||||
Ok(node)
|
||||
}
|
||||
impl<T, U> Foldable<T, U> for Unaryop {
|
||||
type Mapped = Unaryop;
|
||||
impl<T, U> Foldable<T, U> for UnaryOp {
|
||||
type Mapped = UnaryOp;
|
||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||
self,
|
||||
folder: &mut F,
|
||||
|
@ -2251,12 +2251,12 @@ impl<T, U> Foldable<T, U> for Unaryop {
|
|||
}
|
||||
pub fn fold_unaryop<U, F: Fold<U> + ?Sized>(
|
||||
#[allow(unused)] folder: &mut F,
|
||||
node: Unaryop,
|
||||
) -> Result<Unaryop, F::Error> {
|
||||
node: UnaryOp,
|
||||
) -> Result<UnaryOp, F::Error> {
|
||||
Ok(node)
|
||||
}
|
||||
impl<T, U> Foldable<T, U> for Cmpop {
|
||||
type Mapped = Cmpop;
|
||||
impl<T, U> Foldable<T, U> for CmpOp {
|
||||
type Mapped = CmpOp;
|
||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||
self,
|
||||
folder: &mut F,
|
||||
|
@ -2266,8 +2266,8 @@ impl<T, U> Foldable<T, U> for Cmpop {
|
|||
}
|
||||
pub fn fold_cmpop<U, F: Fold<U> + ?Sized>(
|
||||
#[allow(unused)] folder: &mut F,
|
||||
node: Cmpop,
|
||||
) -> Result<Cmpop, F::Error> {
|
||||
node: CmpOp,
|
||||
) -> Result<CmpOp, F::Error> {
|
||||
Ok(node)
|
||||
}
|
||||
impl<T, U> Foldable<T, U> for Comprehension<T> {
|
||||
|
@ -2304,8 +2304,8 @@ pub fn fold_comprehension<U, F: Fold<U> + ?Sized>(
|
|||
range,
|
||||
})
|
||||
}
|
||||
impl<T, U> Foldable<T, U> for Excepthandler<T> {
|
||||
type Mapped = Excepthandler<U>;
|
||||
impl<T, U> Foldable<T, U> for ExceptHandler<T> {
|
||||
type Mapped = ExceptHandler<U>;
|
||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||
self,
|
||||
folder: &mut F,
|
||||
|
@ -2315,17 +2315,17 @@ impl<T, U> Foldable<T, U> for Excepthandler<T> {
|
|||
}
|
||||
pub fn fold_excepthandler<U, F: Fold<U> + ?Sized>(
|
||||
#[allow(unused)] folder: &mut F,
|
||||
node: Excepthandler<U>,
|
||||
) -> Result<Excepthandler<F::TargetU>, F::Error> {
|
||||
node: ExceptHandler<U>,
|
||||
) -> Result<ExceptHandler<F::TargetU>, 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<T, U> Foldable<T, U> for ExcepthandlerExceptHandler<T> {
|
||||
type Mapped = ExcepthandlerExceptHandler<U>;
|
||||
impl<T, U> Foldable<T, U> for ExceptHandlerExceptHandler<T> {
|
||||
type Mapped = ExceptHandlerExceptHandler<U>;
|
||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||
self,
|
||||
folder: &mut F,
|
||||
|
@ -2335,9 +2335,9 @@ impl<T, U> Foldable<T, U> for ExcepthandlerExceptHandler<T> {
|
|||
}
|
||||
pub fn fold_excepthandler_except_handler<U, F: Fold<U> + ?Sized>(
|
||||
#[allow(unused)] folder: &mut F,
|
||||
node: ExcepthandlerExceptHandler<U>,
|
||||
) -> Result<ExcepthandlerExceptHandler<F::TargetU>, F::Error> {
|
||||
let ExcepthandlerExceptHandler {
|
||||
node: ExceptHandlerExceptHandler<U>,
|
||||
) -> Result<ExceptHandlerExceptHandler<F::TargetU>, F::Error> {
|
||||
let ExceptHandlerExceptHandler {
|
||||
type_,
|
||||
name,
|
||||
body,
|
||||
|
@ -2349,7 +2349,7 @@ pub fn fold_excepthandler_except_handler<U, F: Fold<U> + ?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<U, F: Fold<U> + ?Sized>(
|
|||
range,
|
||||
})
|
||||
}
|
||||
impl<T, U> Foldable<T, U> for Withitem<T> {
|
||||
type Mapped = Withitem<U>;
|
||||
impl<T, U> Foldable<T, U> for WithItem<T> {
|
||||
type Mapped = WithItem<U>;
|
||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||
self,
|
||||
folder: &mut F,
|
||||
|
@ -2483,9 +2483,9 @@ impl<T, U> Foldable<T, U> for Withitem<T> {
|
|||
}
|
||||
pub fn fold_withitem<U, F: Fold<U> + ?Sized>(
|
||||
#[allow(unused)] folder: &mut F,
|
||||
node: Withitem<U>,
|
||||
) -> Result<Withitem<F::TargetU>, F::Error> {
|
||||
let Withitem {
|
||||
node: WithItem<U>,
|
||||
) -> Result<WithItem<F::TargetU>, F::Error> {
|
||||
let WithItem {
|
||||
context_expr,
|
||||
optional_vars,
|
||||
range,
|
||||
|
@ -2494,7 +2494,7 @@ pub fn fold_withitem<U, F: Fold<U> + ?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,
|
||||
|
|
|
@ -9,17 +9,17 @@ pub enum Ast<R = TextRange> {
|
|||
Stmt(Stmt<R>),
|
||||
Expr(Expr<R>),
|
||||
ExprContext(ExprContext),
|
||||
Boolop(Boolop),
|
||||
BoolOp(BoolOp),
|
||||
Operator(Operator),
|
||||
Unaryop(Unaryop),
|
||||
Cmpop(Cmpop),
|
||||
UnaryOp(UnaryOp),
|
||||
CmpOp(CmpOp),
|
||||
Comprehension(Comprehension<R>),
|
||||
Excepthandler(Excepthandler<R>),
|
||||
ExceptHandler(ExceptHandler<R>),
|
||||
Arguments(Arguments<R>),
|
||||
Arg(Arg<R>),
|
||||
Keyword(Keyword<R>),
|
||||
Alias(Alias<R>),
|
||||
Withitem(Withitem<R>),
|
||||
WithItem(WithItem<R>),
|
||||
MatchCase(MatchCase<R>),
|
||||
Pattern(Pattern<R>),
|
||||
TypeIgnore(TypeIgnore<R>),
|
||||
|
@ -53,9 +53,9 @@ impl<R> From<ExprContext> for Ast<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R> From<Boolop> for Ast<R> {
|
||||
fn from(node: Boolop) -> Self {
|
||||
Ast::Boolop(node)
|
||||
impl<R> From<BoolOp> for Ast<R> {
|
||||
fn from(node: BoolOp) -> Self {
|
||||
Ast::BoolOp(node)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,15 +65,15 @@ impl<R> From<Operator> for Ast<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R> From<Unaryop> for Ast<R> {
|
||||
fn from(node: Unaryop) -> Self {
|
||||
Ast::Unaryop(node)
|
||||
impl<R> From<UnaryOp> for Ast<R> {
|
||||
fn from(node: UnaryOp) -> Self {
|
||||
Ast::UnaryOp(node)
|
||||
}
|
||||
}
|
||||
|
||||
impl<R> From<Cmpop> for Ast<R> {
|
||||
fn from(node: Cmpop) -> Self {
|
||||
Ast::Cmpop(node)
|
||||
impl<R> From<CmpOp> for Ast<R> {
|
||||
fn from(node: CmpOp) -> Self {
|
||||
Ast::CmpOp(node)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,9 @@ impl<R> From<Comprehension<R>> for Ast<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R> From<Excepthandler<R>> for Ast<R> {
|
||||
fn from(node: Excepthandler<R>) -> Self {
|
||||
Ast::Excepthandler(node)
|
||||
impl<R> From<ExceptHandler<R>> for Ast<R> {
|
||||
fn from(node: ExceptHandler<R>) -> Self {
|
||||
Ast::ExceptHandler(node)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,9 +113,9 @@ impl<R> From<Alias<R>> for Ast<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R> From<Withitem<R>> for Ast<R> {
|
||||
fn from(node: Withitem<R>) -> Self {
|
||||
Ast::Withitem(node)
|
||||
impl<R> From<WithItem<R>> for Ast<R> {
|
||||
fn from(node: WithItem<R>) -> Self {
|
||||
Ast::WithItem(node)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -541,7 +541,7 @@ impl<R> From<StmtIf<R>> for Ast<R> {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct StmtWith<R = TextRange> {
|
||||
pub range: R,
|
||||
pub items: Vec<Withitem<R>>,
|
||||
pub items: Vec<WithItem<R>>,
|
||||
pub body: Vec<Stmt<R>>,
|
||||
pub type_comment: Option<String>,
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ impl<R> From<StmtWith<R>> for Ast<R> {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct StmtAsyncWith<R = TextRange> {
|
||||
pub range: R,
|
||||
pub items: Vec<Withitem<R>>,
|
||||
pub items: Vec<WithItem<R>>,
|
||||
pub body: Vec<Stmt<R>>,
|
||||
pub type_comment: Option<String>,
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ impl<R> From<StmtRaise<R>> for Ast<R> {
|
|||
pub struct StmtTry<R = TextRange> {
|
||||
pub range: R,
|
||||
pub body: Vec<Stmt<R>>,
|
||||
pub handlers: Vec<Excepthandler<R>>,
|
||||
pub handlers: Vec<ExceptHandler<R>>,
|
||||
pub orelse: Vec<Stmt<R>>,
|
||||
pub finalbody: Vec<Stmt<R>>,
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ impl<R> From<StmtTry<R>> for Ast<R> {
|
|||
pub struct StmtTryStar<R = TextRange> {
|
||||
pub range: R,
|
||||
pub body: Vec<Stmt<R>>,
|
||||
pub handlers: Vec<Excepthandler<R>>,
|
||||
pub handlers: Vec<ExceptHandler<R>>,
|
||||
pub orelse: Vec<Stmt<R>>,
|
||||
pub finalbody: Vec<Stmt<R>>,
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ impl<R> Node for Stmt<R> {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ExprBoolOp<R = TextRange> {
|
||||
pub range: R,
|
||||
pub op: Boolop,
|
||||
pub op: BoolOp,
|
||||
pub values: Vec<Expr<R>>,
|
||||
}
|
||||
|
||||
|
@ -998,7 +998,7 @@ impl<R> From<ExprBinOp<R>> for Ast<R> {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ExprUnaryOp<R = TextRange> {
|
||||
pub range: R,
|
||||
pub op: Unaryop,
|
||||
pub op: UnaryOp,
|
||||
pub operand: Box<Expr<R>>,
|
||||
}
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ impl<R> From<ExprYieldFrom<R>> for Ast<R> {
|
|||
pub struct ExprCompare<R = TextRange> {
|
||||
pub range: R,
|
||||
pub left: Box<Expr<R>>,
|
||||
pub ops: Vec<Cmpop>,
|
||||
pub ops: Vec<CmpOp>,
|
||||
pub comparators: Vec<Expr<R>>,
|
||||
}
|
||||
|
||||
|
@ -1693,73 +1693,73 @@ impl Node for ExprContext {
|
|||
}
|
||||
|
||||
#[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<BoolopAnd> {
|
||||
pub const fn and(&self) -> Option<BoolOpAnd> {
|
||||
match self {
|
||||
Boolop::And => Some(BoolopAnd),
|
||||
BoolOp::And => Some(BoolOpAnd),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn or(&self) -> Option<BoolopOr> {
|
||||
pub const fn or(&self) -> Option<BoolOpOr> {
|
||||
match self {
|
||||
Boolop::Or => Some(BoolopOr),
|
||||
BoolOp::Or => Some(BoolOpOr),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BoolopAnd;
|
||||
impl From<BoolopAnd> for Boolop {
|
||||
fn from(_: BoolopAnd) -> Self {
|
||||
Boolop::And
|
||||
pub struct BoolOpAnd;
|
||||
impl From<BoolOpAnd> for BoolOp {
|
||||
fn from(_: BoolOpAnd) -> Self {
|
||||
BoolOp::And
|
||||
}
|
||||
}
|
||||
impl<R> From<BoolopAnd> for Ast<R> {
|
||||
fn from(_: BoolopAnd) -> Self {
|
||||
Boolop::And.into()
|
||||
impl<R> From<BoolOpAnd> for Ast<R> {
|
||||
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<Boolop> for BoolopAnd {
|
||||
impl std::cmp::PartialEq<BoolOp> 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<BoolopOr> for Boolop {
|
||||
fn from(_: BoolopOr) -> Self {
|
||||
Boolop::Or
|
||||
pub struct BoolOpOr;
|
||||
impl From<BoolOpOr> for BoolOp {
|
||||
fn from(_: BoolOpOr) -> Self {
|
||||
BoolOp::Or
|
||||
}
|
||||
}
|
||||
impl<R> From<BoolopOr> for Ast<R> {
|
||||
fn from(_: BoolopOr) -> Self {
|
||||
Boolop::Or.into()
|
||||
impl<R> From<BoolOpOr> for Ast<R> {
|
||||
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<Boolop> for BoolopOr {
|
||||
impl std::cmp::PartialEq<BoolOp> 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] = &[];
|
||||
}
|
||||
|
@ -2178,141 +2178,141 @@ impl Node for Operator {
|
|||
}
|
||||
|
||||
#[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<UnaryopInvert> {
|
||||
pub const fn invert(&self) -> Option<UnaryOpInvert> {
|
||||
match self {
|
||||
Unaryop::Invert => Some(UnaryopInvert),
|
||||
UnaryOp::Invert => Some(UnaryOpInvert),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn not(&self) -> Option<UnaryopNot> {
|
||||
pub const fn not(&self) -> Option<UnaryOpNot> {
|
||||
match self {
|
||||
Unaryop::Not => Some(UnaryopNot),
|
||||
UnaryOp::Not => Some(UnaryOpNot),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn u_add(&self) -> Option<UnaryopUAdd> {
|
||||
pub const fn u_add(&self) -> Option<UnaryOpUAdd> {
|
||||
match self {
|
||||
Unaryop::UAdd => Some(UnaryopUAdd),
|
||||
UnaryOp::UAdd => Some(UnaryOpUAdd),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn u_sub(&self) -> Option<UnaryopUSub> {
|
||||
pub const fn u_sub(&self) -> Option<UnaryOpUSub> {
|
||||
match self {
|
||||
Unaryop::USub => Some(UnaryopUSub),
|
||||
UnaryOp::USub => Some(UnaryOpUSub),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct UnaryopInvert;
|
||||
impl From<UnaryopInvert> for Unaryop {
|
||||
fn from(_: UnaryopInvert) -> Self {
|
||||
Unaryop::Invert
|
||||
pub struct UnaryOpInvert;
|
||||
impl From<UnaryOpInvert> for UnaryOp {
|
||||
fn from(_: UnaryOpInvert) -> Self {
|
||||
UnaryOp::Invert
|
||||
}
|
||||
}
|
||||
impl<R> From<UnaryopInvert> for Ast<R> {
|
||||
fn from(_: UnaryopInvert) -> Self {
|
||||
Unaryop::Invert.into()
|
||||
impl<R> From<UnaryOpInvert> for Ast<R> {
|
||||
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<Unaryop> for UnaryopInvert {
|
||||
impl std::cmp::PartialEq<UnaryOp> 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<UnaryopNot> for Unaryop {
|
||||
fn from(_: UnaryopNot) -> Self {
|
||||
Unaryop::Not
|
||||
pub struct UnaryOpNot;
|
||||
impl From<UnaryOpNot> for UnaryOp {
|
||||
fn from(_: UnaryOpNot) -> Self {
|
||||
UnaryOp::Not
|
||||
}
|
||||
}
|
||||
impl<R> From<UnaryopNot> for Ast<R> {
|
||||
fn from(_: UnaryopNot) -> Self {
|
||||
Unaryop::Not.into()
|
||||
impl<R> From<UnaryOpNot> for Ast<R> {
|
||||
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<Unaryop> for UnaryopNot {
|
||||
impl std::cmp::PartialEq<UnaryOp> 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<UnaryopUAdd> for Unaryop {
|
||||
fn from(_: UnaryopUAdd) -> Self {
|
||||
Unaryop::UAdd
|
||||
pub struct UnaryOpUAdd;
|
||||
impl From<UnaryOpUAdd> for UnaryOp {
|
||||
fn from(_: UnaryOpUAdd) -> Self {
|
||||
UnaryOp::UAdd
|
||||
}
|
||||
}
|
||||
impl<R> From<UnaryopUAdd> for Ast<R> {
|
||||
fn from(_: UnaryopUAdd) -> Self {
|
||||
Unaryop::UAdd.into()
|
||||
impl<R> From<UnaryOpUAdd> for Ast<R> {
|
||||
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<Unaryop> for UnaryopUAdd {
|
||||
impl std::cmp::PartialEq<UnaryOp> 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<UnaryopUSub> for Unaryop {
|
||||
fn from(_: UnaryopUSub) -> Self {
|
||||
Unaryop::USub
|
||||
pub struct UnaryOpUSub;
|
||||
impl From<UnaryOpUSub> for UnaryOp {
|
||||
fn from(_: UnaryOpUSub) -> Self {
|
||||
UnaryOp::USub
|
||||
}
|
||||
}
|
||||
impl<R> From<UnaryopUSub> for Ast<R> {
|
||||
fn from(_: UnaryopUSub) -> Self {
|
||||
Unaryop::USub.into()
|
||||
impl<R> From<UnaryOpUSub> for Ast<R> {
|
||||
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<Unaryop> for UnaryopUSub {
|
||||
impl std::cmp::PartialEq<UnaryOp> 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] = &[];
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, is_macro::Is, Copy, Hash, Eq)]
|
||||
pub enum Cmpop {
|
||||
pub enum CmpOp {
|
||||
Eq,
|
||||
NotEq,
|
||||
Lt,
|
||||
|
@ -2324,309 +2324,309 @@ pub enum Cmpop {
|
|||
In,
|
||||
NotIn,
|
||||
}
|
||||
impl Cmpop {
|
||||
impl CmpOp {
|
||||
#[inline]
|
||||
pub const fn cmpop_eq(&self) -> Option<CmpopEq> {
|
||||
pub const fn cmp_op_eq(&self) -> Option<CmpOpEq> {
|
||||
match self {
|
||||
Cmpop::Eq => Some(CmpopEq),
|
||||
CmpOp::Eq => Some(CmpOpEq),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_not_eq(&self) -> Option<CmpopNotEq> {
|
||||
pub const fn cmp_op_not_eq(&self) -> Option<CmpOpNotEq> {
|
||||
match self {
|
||||
Cmpop::NotEq => Some(CmpopNotEq),
|
||||
CmpOp::NotEq => Some(CmpOpNotEq),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_lt(&self) -> Option<CmpopLt> {
|
||||
pub const fn cmp_op_lt(&self) -> Option<CmpOpLt> {
|
||||
match self {
|
||||
Cmpop::Lt => Some(CmpopLt),
|
||||
CmpOp::Lt => Some(CmpOpLt),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_lt_e(&self) -> Option<CmpopLtE> {
|
||||
pub const fn cmp_op_lt_e(&self) -> Option<CmpOpLtE> {
|
||||
match self {
|
||||
Cmpop::LtE => Some(CmpopLtE),
|
||||
CmpOp::LtE => Some(CmpOpLtE),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_gt(&self) -> Option<CmpopGt> {
|
||||
pub const fn cmp_op_gt(&self) -> Option<CmpOpGt> {
|
||||
match self {
|
||||
Cmpop::Gt => Some(CmpopGt),
|
||||
CmpOp::Gt => Some(CmpOpGt),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_gt_e(&self) -> Option<CmpopGtE> {
|
||||
pub const fn cmp_op_gt_e(&self) -> Option<CmpOpGtE> {
|
||||
match self {
|
||||
Cmpop::GtE => Some(CmpopGtE),
|
||||
CmpOp::GtE => Some(CmpOpGtE),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_is(&self) -> Option<CmpopIs> {
|
||||
pub const fn cmp_op_is(&self) -> Option<CmpOpIs> {
|
||||
match self {
|
||||
Cmpop::Is => Some(CmpopIs),
|
||||
CmpOp::Is => Some(CmpOpIs),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_is_not(&self) -> Option<CmpopIsNot> {
|
||||
pub const fn cmp_op_is_not(&self) -> Option<CmpOpIsNot> {
|
||||
match self {
|
||||
Cmpop::IsNot => Some(CmpopIsNot),
|
||||
CmpOp::IsNot => Some(CmpOpIsNot),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_in(&self) -> Option<CmpopIn> {
|
||||
pub const fn cmp_op_in(&self) -> Option<CmpOpIn> {
|
||||
match self {
|
||||
Cmpop::In => Some(CmpopIn),
|
||||
CmpOp::In => Some(CmpOpIn),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn cmpop_not_in(&self) -> Option<CmpopNotIn> {
|
||||
pub const fn cmp_op_not_in(&self) -> Option<CmpOpNotIn> {
|
||||
match self {
|
||||
Cmpop::NotIn => Some(CmpopNotIn),
|
||||
CmpOp::NotIn => Some(CmpOpNotIn),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CmpopEq;
|
||||
impl From<CmpopEq> for Cmpop {
|
||||
fn from(_: CmpopEq) -> Self {
|
||||
Cmpop::Eq
|
||||
pub struct CmpOpEq;
|
||||
impl From<CmpOpEq> for CmpOp {
|
||||
fn from(_: CmpOpEq) -> Self {
|
||||
CmpOp::Eq
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopEq> for Ast<R> {
|
||||
fn from(_: CmpopEq) -> Self {
|
||||
Cmpop::Eq.into()
|
||||
impl<R> From<CmpOpEq> for Ast<R> {
|
||||
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<Cmpop> for CmpopEq {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopNotEq> for Cmpop {
|
||||
fn from(_: CmpopNotEq) -> Self {
|
||||
Cmpop::NotEq
|
||||
pub struct CmpOpNotEq;
|
||||
impl From<CmpOpNotEq> for CmpOp {
|
||||
fn from(_: CmpOpNotEq) -> Self {
|
||||
CmpOp::NotEq
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopNotEq> for Ast<R> {
|
||||
fn from(_: CmpopNotEq) -> Self {
|
||||
Cmpop::NotEq.into()
|
||||
impl<R> From<CmpOpNotEq> for Ast<R> {
|
||||
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<Cmpop> for CmpopNotEq {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopLt> for Cmpop {
|
||||
fn from(_: CmpopLt) -> Self {
|
||||
Cmpop::Lt
|
||||
pub struct CmpOpLt;
|
||||
impl From<CmpOpLt> for CmpOp {
|
||||
fn from(_: CmpOpLt) -> Self {
|
||||
CmpOp::Lt
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopLt> for Ast<R> {
|
||||
fn from(_: CmpopLt) -> Self {
|
||||
Cmpop::Lt.into()
|
||||
impl<R> From<CmpOpLt> for Ast<R> {
|
||||
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<Cmpop> for CmpopLt {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopLtE> for Cmpop {
|
||||
fn from(_: CmpopLtE) -> Self {
|
||||
Cmpop::LtE
|
||||
pub struct CmpOpLtE;
|
||||
impl From<CmpOpLtE> for CmpOp {
|
||||
fn from(_: CmpOpLtE) -> Self {
|
||||
CmpOp::LtE
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopLtE> for Ast<R> {
|
||||
fn from(_: CmpopLtE) -> Self {
|
||||
Cmpop::LtE.into()
|
||||
impl<R> From<CmpOpLtE> for Ast<R> {
|
||||
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<Cmpop> for CmpopLtE {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopGt> for Cmpop {
|
||||
fn from(_: CmpopGt) -> Self {
|
||||
Cmpop::Gt
|
||||
pub struct CmpOpGt;
|
||||
impl From<CmpOpGt> for CmpOp {
|
||||
fn from(_: CmpOpGt) -> Self {
|
||||
CmpOp::Gt
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopGt> for Ast<R> {
|
||||
fn from(_: CmpopGt) -> Self {
|
||||
Cmpop::Gt.into()
|
||||
impl<R> From<CmpOpGt> for Ast<R> {
|
||||
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<Cmpop> for CmpopGt {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopGtE> for Cmpop {
|
||||
fn from(_: CmpopGtE) -> Self {
|
||||
Cmpop::GtE
|
||||
pub struct CmpOpGtE;
|
||||
impl From<CmpOpGtE> for CmpOp {
|
||||
fn from(_: CmpOpGtE) -> Self {
|
||||
CmpOp::GtE
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopGtE> for Ast<R> {
|
||||
fn from(_: CmpopGtE) -> Self {
|
||||
Cmpop::GtE.into()
|
||||
impl<R> From<CmpOpGtE> for Ast<R> {
|
||||
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<Cmpop> for CmpopGtE {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopIs> for Cmpop {
|
||||
fn from(_: CmpopIs) -> Self {
|
||||
Cmpop::Is
|
||||
pub struct CmpOpIs;
|
||||
impl From<CmpOpIs> for CmpOp {
|
||||
fn from(_: CmpOpIs) -> Self {
|
||||
CmpOp::Is
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopIs> for Ast<R> {
|
||||
fn from(_: CmpopIs) -> Self {
|
||||
Cmpop::Is.into()
|
||||
impl<R> From<CmpOpIs> for Ast<R> {
|
||||
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<Cmpop> for CmpopIs {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopIsNot> for Cmpop {
|
||||
fn from(_: CmpopIsNot) -> Self {
|
||||
Cmpop::IsNot
|
||||
pub struct CmpOpIsNot;
|
||||
impl From<CmpOpIsNot> for CmpOp {
|
||||
fn from(_: CmpOpIsNot) -> Self {
|
||||
CmpOp::IsNot
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopIsNot> for Ast<R> {
|
||||
fn from(_: CmpopIsNot) -> Self {
|
||||
Cmpop::IsNot.into()
|
||||
impl<R> From<CmpOpIsNot> for Ast<R> {
|
||||
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<Cmpop> for CmpopIsNot {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopIn> for Cmpop {
|
||||
fn from(_: CmpopIn) -> Self {
|
||||
Cmpop::In
|
||||
pub struct CmpOpIn;
|
||||
impl From<CmpOpIn> for CmpOp {
|
||||
fn from(_: CmpOpIn) -> Self {
|
||||
CmpOp::In
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopIn> for Ast<R> {
|
||||
fn from(_: CmpopIn) -> Self {
|
||||
Cmpop::In.into()
|
||||
impl<R> From<CmpOpIn> for Ast<R> {
|
||||
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<Cmpop> for CmpopIn {
|
||||
impl std::cmp::PartialEq<CmpOp> 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<CmpopNotIn> for Cmpop {
|
||||
fn from(_: CmpopNotIn) -> Self {
|
||||
Cmpop::NotIn
|
||||
pub struct CmpOpNotIn;
|
||||
impl From<CmpOpNotIn> for CmpOp {
|
||||
fn from(_: CmpOpNotIn) -> Self {
|
||||
CmpOp::NotIn
|
||||
}
|
||||
}
|
||||
impl<R> From<CmpopNotIn> for Ast<R> {
|
||||
fn from(_: CmpopNotIn) -> Self {
|
||||
Cmpop::NotIn.into()
|
||||
impl<R> From<CmpOpNotIn> for Ast<R> {
|
||||
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<Cmpop> for CmpopNotIn {
|
||||
impl std::cmp::PartialEq<CmpOp> 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] = &[];
|
||||
}
|
||||
|
@ -2646,34 +2646,34 @@ impl<R> Node for Comprehension<R> {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ExcepthandlerExceptHandler<R = TextRange> {
|
||||
pub struct ExceptHandlerExceptHandler<R = TextRange> {
|
||||
pub range: R,
|
||||
pub type_: Option<Box<Expr<R>>>,
|
||||
pub name: Option<Identifier>,
|
||||
pub body: Vec<Stmt<R>>,
|
||||
}
|
||||
|
||||
impl<R> Node for ExcepthandlerExceptHandler<R> {
|
||||
impl<R> Node for ExceptHandlerExceptHandler<R> {
|
||||
const NAME: &'static str = "ExceptHandler";
|
||||
const FIELD_NAMES: &'static [&'static str] = &["type", "name", "body"];
|
||||
}
|
||||
impl<R> From<ExcepthandlerExceptHandler<R>> for Excepthandler<R> {
|
||||
fn from(payload: ExcepthandlerExceptHandler<R>) -> Self {
|
||||
Excepthandler::ExceptHandler(payload)
|
||||
impl<R> From<ExceptHandlerExceptHandler<R>> for ExceptHandler<R> {
|
||||
fn from(payload: ExceptHandlerExceptHandler<R>) -> Self {
|
||||
ExceptHandler::ExceptHandler(payload)
|
||||
}
|
||||
}
|
||||
impl<R> From<ExcepthandlerExceptHandler<R>> for Ast<R> {
|
||||
fn from(payload: ExcepthandlerExceptHandler<R>) -> Self {
|
||||
Excepthandler::from(payload).into()
|
||||
impl<R> From<ExceptHandlerExceptHandler<R>> for Ast<R> {
|
||||
fn from(payload: ExceptHandlerExceptHandler<R>) -> Self {
|
||||
ExceptHandler::from(payload).into()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, is_macro::Is)]
|
||||
pub enum Excepthandler<R = TextRange> {
|
||||
ExceptHandler(ExcepthandlerExceptHandler<R>),
|
||||
pub enum ExceptHandler<R = TextRange> {
|
||||
ExceptHandler(ExceptHandlerExceptHandler<R>),
|
||||
}
|
||||
|
||||
impl<R> Node for Excepthandler<R> {
|
||||
impl<R> Node for ExceptHandler<R> {
|
||||
const NAME: &'static str = "excepthandler";
|
||||
const FIELD_NAMES: &'static [&'static str] = &[];
|
||||
}
|
||||
|
@ -2741,13 +2741,13 @@ impl<R> Node for Alias<R> {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Withitem<R = TextRange> {
|
||||
pub struct WithItem<R = TextRange> {
|
||||
pub range: OptionalRange<R>,
|
||||
pub context_expr: Expr<R>,
|
||||
pub optional_vars: Option<Box<Expr<R>>>,
|
||||
}
|
||||
|
||||
impl<R> Node for Withitem<R> {
|
||||
impl<R> Node for WithItem<R> {
|
||||
const NAME: &'static str = "withitem";
|
||||
const FIELD_NAMES: &'static [&'static str] = &["context_expr", "optional_vars"];
|
||||
}
|
||||
|
|
|
@ -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<SourceRange>;
|
||||
|
||||
|
@ -1070,23 +1070,23 @@ impl LocatedMut for Comprehension {
|
|||
}
|
||||
}
|
||||
|
||||
pub type Excepthandler = crate::generic::Excepthandler<SourceRange>;
|
||||
pub type ExceptHandler = crate::generic::ExceptHandler<SourceRange>;
|
||||
|
||||
pub type ExcepthandlerExceptHandler = crate::generic::ExcepthandlerExceptHandler<SourceRange>;
|
||||
pub type ExceptHandlerExceptHandler = crate::generic::ExceptHandlerExceptHandler<SourceRange>;
|
||||
|
||||
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<SourceRange>;
|
||||
pub type WithItem = crate::generic::WithItem<SourceRange>;
|
||||
|
||||
#[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
|
||||
}
|
||||
|
|
|
@ -380,12 +380,12 @@ impl Ranged for crate::generic::Comprehension<TextRange> {
|
|||
self.range
|
||||
}
|
||||
}
|
||||
impl Ranged for crate::generic::ExcepthandlerExceptHandler<TextRange> {
|
||||
impl Ranged for crate::generic::ExceptHandlerExceptHandler<TextRange> {
|
||||
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<TextRange> {
|
|||
}
|
||||
}
|
||||
#[cfg(feature = "all-nodes-with-ranges")]
|
||||
impl Ranged for crate::generic::Withitem<TextRange> {
|
||||
impl Ranged for crate::generic::WithItem<TextRange> {
|
||||
fn range(&self) -> TextRange {
|
||||
self.range
|
||||
}
|
||||
|
|
|
@ -665,38 +665,38 @@ pub trait Visitor<R = crate::text_size::TextRange> {
|
|||
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<R>) {
|
||||
self.generic_visit_comprehension(node)
|
||||
}
|
||||
fn generic_visit_comprehension(&mut self, node: Comprehension<R>) {}
|
||||
fn visit_excepthandler(&mut self, node: Excepthandler<R>) {
|
||||
fn visit_excepthandler(&mut self, node: ExceptHandler<R>) {
|
||||
self.generic_visit_excepthandler(node)
|
||||
}
|
||||
fn generic_visit_excepthandler(&mut self, node: Excepthandler<R>) {
|
||||
fn generic_visit_excepthandler(&mut self, node: ExceptHandler<R>) {
|
||||
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<R>) {
|
||||
fn visit_excepthandler_except_handler(&mut self, node: ExceptHandlerExceptHandler<R>) {
|
||||
self.generic_visit_excepthandler_except_handler(node)
|
||||
}
|
||||
fn generic_visit_excepthandler_except_handler(&mut self, node: ExcepthandlerExceptHandler<R>) {
|
||||
fn generic_visit_excepthandler_except_handler(&mut self, node: ExceptHandlerExceptHandler<R>) {
|
||||
if let Some(value) = node.type_ {
|
||||
self.visit_expr(*value);
|
||||
}
|
||||
|
@ -720,10 +720,10 @@ pub trait Visitor<R = crate::text_size::TextRange> {
|
|||
self.generic_visit_alias(node)
|
||||
}
|
||||
fn generic_visit_alias(&mut self, node: Alias<R>) {}
|
||||
fn visit_withitem(&mut self, node: Withitem<R>) {
|
||||
fn visit_withitem(&mut self, node: WithItem<R>) {
|
||||
self.generic_visit_withitem(node)
|
||||
}
|
||||
fn generic_visit_withitem(&mut self, node: Withitem<R>) {}
|
||||
fn generic_visit_withitem(&mut self, node: WithItem<R>) {}
|
||||
fn visit_match_case(&mut self, node: MatchCase<R>) {
|
||||
self.generic_visit_match_case(node)
|
||||
}
|
||||
|
|
|
@ -54,19 +54,19 @@ impl<R> Default for EmptyRange<R> {
|
|||
}
|
||||
}
|
||||
|
||||
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",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -509,7 +509,7 @@ ConstantExpr: ast::Expr = {
|
|||
ConstantAtom,
|
||||
<location:@L> "-" <operand:ConstantAtom> <end_location:@R> => 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 = {
|
||||
<location:@L> "except" "*" <typ:Test<"all">> ":" <body:Suite> => {
|
||||
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 = {
|
|||
},
|
||||
<location:@L> "except" "*" <x:(<Test<"all">> "as" <Identifier>)> ":" <body:Suite> => {
|
||||
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 = {
|
||||
<location:@L> "except" <typ:Test<"all">?> ":" <body:Suite> => {
|
||||
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 = {
|
|||
},
|
||||
<location:@L> "except" <x:(<Test<"all">> "as" <Identifier>)> ":" <body:Suite> => {
|
||||
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<ast::Withitem> = {
|
||||
WithItems: Vec<ast::WithItem> = {
|
||||
"(" <WithItemsNoAs> ","? ")",
|
||||
"(" <left:(<WithItemsNoAs> ",")?> <mid:WithItem<"as">> <right:("," <WithItem<"all">>)*> ","? ")" => {
|
||||
left.into_iter().flatten().chain([mid]).chain(right).collect()
|
||||
|
@ -950,17 +950,17 @@ WithItems: Vec<ast::Withitem> = {
|
|||
};
|
||||
|
||||
#[inline]
|
||||
WithItemsNoAs: Vec<ast::Withitem> = {
|
||||
WithItemsNoAs: Vec<ast::WithItem> = {
|
||||
<location:@L> <all:OneOrMore<Test<"all">>> <end_location:@R> => {
|
||||
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<Goal>: ast::Withitem = {
|
||||
<location:@L> <context_expr: Test<Goal>> <end_location:@R> if Goal != "as" => ast::Withitem { context_expr, optional_vars: None, range: optional_range(location, end_location) },
|
||||
WithItem<Goal>: ast::WithItem = {
|
||||
<location:@L> <context_expr: Test<Goal>> <end_location:@R> if Goal != "as" => ast::WithItem { context_expr, optional_vars: None, range: optional_range(location, end_location) },
|
||||
<location:@L> <context_expr:Test<"all">> "as" <vars:Expression<"all">> <end_location:@R> => {
|
||||
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<Goal>: ast::Expr = {
|
|||
<location:@L> <mut values:(<AndTest<"all">> "or")+> <last: AndTest<"all">> <end_location:@R> => {
|
||||
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<Goal>,
|
||||
|
@ -1222,7 +1222,7 @@ AndTest<Goal>: ast::Expr = {
|
|||
<location:@L> <mut values:(<NotTest<"all">> "and")+> <last:NotTest<"all">> <end_location:@R> => {
|
||||
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<Goal>,
|
||||
|
@ -1230,7 +1230,7 @@ AndTest<Goal>: ast::Expr = {
|
|||
|
||||
NotTest<Goal>: ast::Expr = {
|
||||
<location:@L> "not" <e:NotTest<"all">> <end_location:@R> => 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<Goal>,
|
||||
};
|
||||
|
@ -1245,17 +1245,17 @@ Comparison<Goal>: ast::Expr = {
|
|||
Expression<Goal>,
|
||||
};
|
||||
|
||||
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<Goal>: ast::Expr = {
|
||||
|
@ -1325,10 +1325,10 @@ Factor<Goal>: ast::Expr = {
|
|||
Power<Goal>,
|
||||
};
|
||||
|
||||
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<Goal>: ast::Expr = {
|
||||
|
|
484
parser/src/python.rs
generated
484
parser/src/python.rs
generated
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,7 @@ expression: parse_ast
|
|||
StmtWith {
|
||||
range: 0..17,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 5..11,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
expression: "parse_program(source, \"<test>\").unwrap()"
|
||||
expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
||||
---
|
||||
[
|
||||
With(
|
||||
StmtWith {
|
||||
range: 0..12,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 5..6,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -35,7 +35,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 13..30,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 18..24,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -73,7 +73,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 31..46,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 36..37,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -86,7 +86,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
),
|
||||
optional_vars: None,
|
||||
},
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 39..40,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -114,7 +114,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 47..72,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 52..58,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -137,7 +137,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
),
|
||||
),
|
||||
},
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 60..66,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -175,7 +175,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 73..97,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 78..91,
|
||||
context_expr: IfExp(
|
||||
ExprIfExp {
|
||||
|
@ -226,7 +226,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 98..127,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 103..121,
|
||||
context_expr: IfExp(
|
||||
ExprIfExp {
|
||||
|
@ -287,7 +287,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 128..141,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 133..135,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -313,7 +313,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 142..160,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 147..154,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -349,7 +349,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 161..175,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 167..168,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -377,7 +377,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 176..195,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 181..189,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -415,7 +415,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 196..211,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 202..203,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -443,7 +443,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 212..232,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 217..226,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -489,7 +489,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 233..250,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 239..243,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -502,7 +502,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
),
|
||||
optional_vars: None,
|
||||
},
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 239..243,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -530,7 +530,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 251..273,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 256..267,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -585,7 +585,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 274..290,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 279..284,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -627,7 +627,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 291..312,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 296..306,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -679,7 +679,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 313..331,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 318..325,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -730,7 +730,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 332..355,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 337..349,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -791,7 +791,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 356..375,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 361..369,
|
||||
context_expr: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
|
@ -833,7 +833,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 376..400,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 381..394,
|
||||
context_expr: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
|
@ -885,7 +885,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 401..428,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 406..422,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -958,7 +958,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 429..461,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 434..455,
|
||||
context_expr: Tuple(
|
||||
ExprTuple {
|
||||
|
@ -1041,7 +1041,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 462..481,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 468..474,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -1079,7 +1079,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 482..502,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 488..494,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -1117,7 +1117,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 503..530,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 509..515,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -1140,7 +1140,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
),
|
||||
),
|
||||
},
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 517..523,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -1178,7 +1178,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
StmtWith {
|
||||
range: 531..559,
|
||||
items: [
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 537..543,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
@ -1201,7 +1201,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
),
|
||||
),
|
||||
},
|
||||
Withitem {
|
||||
WithItem {
|
||||
range: 545..551,
|
||||
context_expr: Constant(
|
||||
ExprConstant {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue