mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-07 21:25:31 +00:00
Rename unconventional nodes (#74)
This commit is contained in:
parent
5270020423
commit
69d27d924c
19 changed files with 2407 additions and 2302 deletions
|
@ -520,7 +520,7 @@ impl PyNode for ast::ExprContextDel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PyNode for ast::Boolop {
|
impl PyNode for ast::BoolOp {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
|
||||||
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
|
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]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let cell = match &self {
|
let cell = match &self {
|
||||||
ast::Boolop::And => ast::BoolopAnd::py_type_cache(),
|
ast::BoolOp::And => ast::BoolOpAnd::py_type_cache(),
|
||||||
ast::Boolop::Or => ast::BoolopOr::py_type_cache(),
|
ast::BoolOp::Or => ast::BoolOpOr::py_type_cache(),
|
||||||
};
|
};
|
||||||
Ok(Py::<PyAny>::as_ref(&cell.get().unwrap().1, py))
|
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]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let cell = match &self {
|
let cell = match &self {
|
||||||
ast::Unaryop::Invert => ast::UnaryopInvert::py_type_cache(),
|
ast::UnaryOp::Invert => ast::UnaryOpInvert::py_type_cache(),
|
||||||
ast::Unaryop::Not => ast::UnaryopNot::py_type_cache(),
|
ast::UnaryOp::Not => ast::UnaryOpNot::py_type_cache(),
|
||||||
ast::Unaryop::UAdd => ast::UnaryopUAdd::py_type_cache(),
|
ast::UnaryOp::UAdd => ast::UnaryOpUAdd::py_type_cache(),
|
||||||
ast::Unaryop::USub => ast::UnaryopUSub::py_type_cache(),
|
ast::UnaryOp::USub => ast::UnaryOpUSub::py_type_cache(),
|
||||||
};
|
};
|
||||||
Ok(Py::<PyAny>::as_ref(&cell.get().unwrap().1, py))
|
Ok(Py::<PyAny>::as_ref(&cell.get().unwrap().1, py))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyAst for ast::Cmpop {
|
impl ToPyAst for ast::CmpOp {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let cell = match &self {
|
let cell = match &self {
|
||||||
ast::Cmpop::Eq => ast::CmpopEq::py_type_cache(),
|
ast::CmpOp::Eq => ast::CmpOpEq::py_type_cache(),
|
||||||
ast::Cmpop::NotEq => ast::CmpopNotEq::py_type_cache(),
|
ast::CmpOp::NotEq => ast::CmpOpNotEq::py_type_cache(),
|
||||||
ast::Cmpop::Lt => ast::CmpopLt::py_type_cache(),
|
ast::CmpOp::Lt => ast::CmpOpLt::py_type_cache(),
|
||||||
ast::Cmpop::LtE => ast::CmpopLtE::py_type_cache(),
|
ast::CmpOp::LtE => ast::CmpOpLtE::py_type_cache(),
|
||||||
ast::Cmpop::Gt => ast::CmpopGt::py_type_cache(),
|
ast::CmpOp::Gt => ast::CmpOpGt::py_type_cache(),
|
||||||
ast::Cmpop::GtE => ast::CmpopGtE::py_type_cache(),
|
ast::CmpOp::GtE => ast::CmpOpGtE::py_type_cache(),
|
||||||
ast::Cmpop::Is => ast::CmpopIs::py_type_cache(),
|
ast::CmpOp::Is => ast::CmpOpIs::py_type_cache(),
|
||||||
ast::Cmpop::IsNot => ast::CmpopIsNot::py_type_cache(),
|
ast::CmpOp::IsNot => ast::CmpOpIsNot::py_type_cache(),
|
||||||
ast::Cmpop::In => ast::CmpopIn::py_type_cache(),
|
ast::CmpOp::In => ast::CmpOpIn::py_type_cache(),
|
||||||
ast::Cmpop::NotIn => ast::CmpopNotIn::py_type_cache(),
|
ast::CmpOp::NotIn => ast::CmpOpNotIn::py_type_cache(),
|
||||||
};
|
};
|
||||||
Ok(Py::<PyAny>::as_ref(&cell.get().unwrap().1, py))
|
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]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let instance = match &self {
|
let instance = match &self {
|
||||||
ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?,
|
ast::ExceptHandler::ExceptHandler(cons) => cons.to_py_ast(py)?,
|
||||||
};
|
};
|
||||||
Ok(instance)
|
Ok(instance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyAst for ast::ExcepthandlerExceptHandler<TextRange> {
|
impl ToPyAst for ast::ExceptHandlerExceptHandler<TextRange> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let cache = Self::py_type_cache().get().unwrap();
|
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]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let cache = Self::py_type_cache().get().unwrap();
|
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]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let instance = match &self {
|
let instance = match &self {
|
||||||
ast::Excepthandler::ExceptHandler(cons) => cons.to_py_ast(py)?,
|
ast::ExceptHandler::ExceptHandler(cons) => cons.to_py_ast(py)?,
|
||||||
};
|
};
|
||||||
Ok(instance)
|
Ok(instance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyAst for ast::ExcepthandlerExceptHandler<SourceRange> {
|
impl ToPyAst for ast::ExceptHandlerExceptHandler<SourceRange> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let cache = Self::py_type_cache().get().unwrap();
|
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]
|
#[inline]
|
||||||
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
|
||||||
let cache = Self::py_type_cache().get().unwrap();
|
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::ExprContextLoad>(ast_module)?;
|
||||||
cache_py_type::<ast::ExprContextStore>(ast_module)?;
|
cache_py_type::<ast::ExprContextStore>(ast_module)?;
|
||||||
cache_py_type::<ast::ExprContextDel>(ast_module)?;
|
cache_py_type::<ast::ExprContextDel>(ast_module)?;
|
||||||
cache_py_type::<ast::Boolop>(ast_module)?;
|
cache_py_type::<ast::BoolOp>(ast_module)?;
|
||||||
cache_py_type::<ast::BoolopAnd>(ast_module)?;
|
cache_py_type::<ast::BoolOpAnd>(ast_module)?;
|
||||||
cache_py_type::<ast::BoolopOr>(ast_module)?;
|
cache_py_type::<ast::BoolOpOr>(ast_module)?;
|
||||||
cache_py_type::<ast::Operator>(ast_module)?;
|
cache_py_type::<ast::Operator>(ast_module)?;
|
||||||
cache_py_type::<ast::OperatorAdd>(ast_module)?;
|
cache_py_type::<ast::OperatorAdd>(ast_module)?;
|
||||||
cache_py_type::<ast::OperatorSub>(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::OperatorBitXor>(ast_module)?;
|
||||||
cache_py_type::<ast::OperatorBitAnd>(ast_module)?;
|
cache_py_type::<ast::OperatorBitAnd>(ast_module)?;
|
||||||
cache_py_type::<ast::OperatorFloorDiv>(ast_module)?;
|
cache_py_type::<ast::OperatorFloorDiv>(ast_module)?;
|
||||||
cache_py_type::<ast::Unaryop>(ast_module)?;
|
cache_py_type::<ast::UnaryOp>(ast_module)?;
|
||||||
cache_py_type::<ast::UnaryopInvert>(ast_module)?;
|
cache_py_type::<ast::UnaryOpInvert>(ast_module)?;
|
||||||
cache_py_type::<ast::UnaryopNot>(ast_module)?;
|
cache_py_type::<ast::UnaryOpNot>(ast_module)?;
|
||||||
cache_py_type::<ast::UnaryopUAdd>(ast_module)?;
|
cache_py_type::<ast::UnaryOpUAdd>(ast_module)?;
|
||||||
cache_py_type::<ast::UnaryopUSub>(ast_module)?;
|
cache_py_type::<ast::UnaryOpUSub>(ast_module)?;
|
||||||
cache_py_type::<ast::Cmpop>(ast_module)?;
|
cache_py_type::<ast::CmpOp>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopEq>(ast_module)?;
|
cache_py_type::<ast::CmpOpEq>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopNotEq>(ast_module)?;
|
cache_py_type::<ast::CmpOpNotEq>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopLt>(ast_module)?;
|
cache_py_type::<ast::CmpOpLt>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopLtE>(ast_module)?;
|
cache_py_type::<ast::CmpOpLtE>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopGt>(ast_module)?;
|
cache_py_type::<ast::CmpOpGt>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopGtE>(ast_module)?;
|
cache_py_type::<ast::CmpOpGtE>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopIs>(ast_module)?;
|
cache_py_type::<ast::CmpOpIs>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopIsNot>(ast_module)?;
|
cache_py_type::<ast::CmpOpIsNot>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopIn>(ast_module)?;
|
cache_py_type::<ast::CmpOpIn>(ast_module)?;
|
||||||
cache_py_type::<ast::CmpopNotIn>(ast_module)?;
|
cache_py_type::<ast::CmpOpNotIn>(ast_module)?;
|
||||||
cache_py_type::<ast::Comprehension>(ast_module)?;
|
cache_py_type::<ast::Comprehension>(ast_module)?;
|
||||||
cache_py_type::<ast::Excepthandler>(ast_module)?;
|
cache_py_type::<ast::ExceptHandler>(ast_module)?;
|
||||||
cache_py_type::<ast::ExcepthandlerExceptHandler>(ast_module)?;
|
cache_py_type::<ast::ExceptHandlerExceptHandler>(ast_module)?;
|
||||||
cache_py_type::<ast::PythonArguments>(ast_module)?;
|
cache_py_type::<ast::PythonArguments>(ast_module)?;
|
||||||
cache_py_type::<ast::Arg>(ast_module)?;
|
cache_py_type::<ast::Arg>(ast_module)?;
|
||||||
cache_py_type::<ast::Keyword>(ast_module)?;
|
cache_py_type::<ast::Keyword>(ast_module)?;
|
||||||
cache_py_type::<ast::Alias>(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::MatchCase>(ast_module)?;
|
||||||
cache_py_type::<ast::Pattern>(ast_module)?;
|
cache_py_type::<ast::Pattern>(ast_module)?;
|
||||||
cache_py_type::<ast::PatternMatchValue>(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)]
|
#[pyclass(module="rustpython_ast.located", name="_boolop", extends=super::Ast, frozen, subclass)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Boolop;
|
pub struct BoolOp;
|
||||||
|
|
||||||
impl From<&'static ast::Boolop> for Boolop {
|
impl From<&'static ast::BoolOp> for BoolOp {
|
||||||
fn from(_node: &'static ast::Boolop) -> Self {
|
fn from(_node: &'static ast::BoolOp) -> Self {
|
||||||
Boolop
|
BoolOp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Boolop {
|
impl BoolOp {
|
||||||
#[new]
|
#[new]
|
||||||
fn new() -> PyClassInitializer<Self> {
|
fn new() -> PyClassInitializer<Self> {
|
||||||
PyClassInitializer::from(Ast).add_subclass(Self)
|
PyClassInitializer::from(Ast).add_subclass(Self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ToPyObject for Boolop {
|
impl ToPyObject for BoolOp {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = Self::new();
|
let initializer = Self::new();
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_And", extends=Boolop)]
|
#[pyclass(module="rustpython_ast.located", name="_And", extends=BoolOp)]
|
||||||
pub struct BoolopAnd;
|
pub struct BoolOpAnd;
|
||||||
|
|
||||||
impl ToPyObject for BoolopAnd {
|
impl ToPyObject for BoolOpAnd {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Boolop)
|
.add_subclass(BoolOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_Or", extends=Boolop)]
|
#[pyclass(module="rustpython_ast.located", name="_Or", extends=BoolOp)]
|
||||||
pub struct BoolopOr;
|
pub struct BoolOpOr;
|
||||||
|
|
||||||
impl ToPyObject for BoolopOr {
|
impl ToPyObject for BoolOpOr {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Boolop)
|
.add_subclass(BoolOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
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)]
|
#[pyclass(module="rustpython_ast.located", name="_unaryop", extends=super::Ast, frozen, subclass)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Unaryop;
|
pub struct UnaryOp;
|
||||||
|
|
||||||
impl From<&'static ast::Unaryop> for Unaryop {
|
impl From<&'static ast::UnaryOp> for UnaryOp {
|
||||||
fn from(_node: &'static ast::Unaryop) -> Self {
|
fn from(_node: &'static ast::UnaryOp) -> Self {
|
||||||
Unaryop
|
UnaryOp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Unaryop {
|
impl UnaryOp {
|
||||||
#[new]
|
#[new]
|
||||||
fn new() -> PyClassInitializer<Self> {
|
fn new() -> PyClassInitializer<Self> {
|
||||||
PyClassInitializer::from(Ast).add_subclass(Self)
|
PyClassInitializer::from(Ast).add_subclass(Self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ToPyObject for Unaryop {
|
impl ToPyObject for UnaryOp {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = Self::new();
|
let initializer = Self::new();
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_Invert", extends=Unaryop)]
|
#[pyclass(module="rustpython_ast.located", name="_Invert", extends=UnaryOp)]
|
||||||
pub struct UnaryopInvert;
|
pub struct UnaryOpInvert;
|
||||||
|
|
||||||
impl ToPyObject for UnaryopInvert {
|
impl ToPyObject for UnaryOpInvert {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Unaryop)
|
.add_subclass(UnaryOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_Not", extends=Unaryop)]
|
#[pyclass(module="rustpython_ast.located", name="_Not", extends=UnaryOp)]
|
||||||
pub struct UnaryopNot;
|
pub struct UnaryOpNot;
|
||||||
|
|
||||||
impl ToPyObject for UnaryopNot {
|
impl ToPyObject for UnaryOpNot {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Unaryop)
|
.add_subclass(UnaryOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_UAdd", extends=Unaryop)]
|
#[pyclass(module="rustpython_ast.located", name="_UAdd", extends=UnaryOp)]
|
||||||
pub struct UnaryopUAdd;
|
pub struct UnaryOpUAdd;
|
||||||
|
|
||||||
impl ToPyObject for UnaryopUAdd {
|
impl ToPyObject for UnaryOpUAdd {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Unaryop)
|
.add_subclass(UnaryOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_USub", extends=Unaryop)]
|
#[pyclass(module="rustpython_ast.located", name="_USub", extends=UnaryOp)]
|
||||||
pub struct UnaryopUSub;
|
pub struct UnaryOpUSub;
|
||||||
|
|
||||||
impl ToPyObject for UnaryopUSub {
|
impl ToPyObject for UnaryOpUSub {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Unaryop)
|
.add_subclass(UnaryOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
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)]
|
#[pyclass(module="rustpython_ast.located", name="_cmpop", extends=super::Ast, frozen, subclass)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Cmpop;
|
pub struct CmpOp;
|
||||||
|
|
||||||
impl From<&'static ast::Cmpop> for Cmpop {
|
impl From<&'static ast::CmpOp> for CmpOp {
|
||||||
fn from(_node: &'static ast::Cmpop) -> Self {
|
fn from(_node: &'static ast::CmpOp) -> Self {
|
||||||
Cmpop
|
CmpOp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Cmpop {
|
impl CmpOp {
|
||||||
#[new]
|
#[new]
|
||||||
fn new() -> PyClassInitializer<Self> {
|
fn new() -> PyClassInitializer<Self> {
|
||||||
PyClassInitializer::from(Ast).add_subclass(Self)
|
PyClassInitializer::from(Ast).add_subclass(Self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ToPyObject for Cmpop {
|
impl ToPyObject for CmpOp {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = Self::new();
|
let initializer = Self::new();
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_Eq", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_Eq", extends=CmpOp)]
|
||||||
pub struct CmpopEq;
|
pub struct CmpOpEq;
|
||||||
|
|
||||||
impl ToPyObject for CmpopEq {
|
impl ToPyObject for CmpOpEq {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_NotEq", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_NotEq", extends=CmpOp)]
|
||||||
pub struct CmpopNotEq;
|
pub struct CmpOpNotEq;
|
||||||
|
|
||||||
impl ToPyObject for CmpopNotEq {
|
impl ToPyObject for CmpOpNotEq {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_Lt", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_Lt", extends=CmpOp)]
|
||||||
pub struct CmpopLt;
|
pub struct CmpOpLt;
|
||||||
|
|
||||||
impl ToPyObject for CmpopLt {
|
impl ToPyObject for CmpOpLt {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_LtE", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_LtE", extends=CmpOp)]
|
||||||
pub struct CmpopLtE;
|
pub struct CmpOpLtE;
|
||||||
|
|
||||||
impl ToPyObject for CmpopLtE {
|
impl ToPyObject for CmpOpLtE {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_Gt", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_Gt", extends=CmpOp)]
|
||||||
pub struct CmpopGt;
|
pub struct CmpOpGt;
|
||||||
|
|
||||||
impl ToPyObject for CmpopGt {
|
impl ToPyObject for CmpOpGt {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_GtE", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_GtE", extends=CmpOp)]
|
||||||
pub struct CmpopGtE;
|
pub struct CmpOpGtE;
|
||||||
|
|
||||||
impl ToPyObject for CmpopGtE {
|
impl ToPyObject for CmpOpGtE {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_Is", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_Is", extends=CmpOp)]
|
||||||
pub struct CmpopIs;
|
pub struct CmpOpIs;
|
||||||
|
|
||||||
impl ToPyObject for CmpopIs {
|
impl ToPyObject for CmpOpIs {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_IsNot", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_IsNot", extends=CmpOp)]
|
||||||
pub struct CmpopIsNot;
|
pub struct CmpOpIsNot;
|
||||||
|
|
||||||
impl ToPyObject for CmpopIsNot {
|
impl ToPyObject for CmpOpIsNot {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_In", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_In", extends=CmpOp)]
|
||||||
pub struct CmpopIn;
|
pub struct CmpOpIn;
|
||||||
|
|
||||||
impl ToPyObject for CmpopIn {
|
impl ToPyObject for CmpOpIn {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.located", name="_NotIn", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.located", name="_NotIn", extends=CmpOp)]
|
||||||
pub struct CmpopNotIn;
|
pub struct CmpOpNotIn;
|
||||||
|
|
||||||
impl ToPyObject for CmpopNotIn {
|
impl ToPyObject for CmpOpNotIn {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
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)]
|
#[pyclass(module="rustpython_ast.located", name="_excepthandler", extends=super::Ast, frozen, subclass)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Excepthandler;
|
pub struct ExceptHandler;
|
||||||
|
|
||||||
impl From<&'static ast::Excepthandler<SourceRange>> for Excepthandler {
|
impl From<&'static ast::ExceptHandler<SourceRange>> for ExceptHandler {
|
||||||
fn from(_node: &'static ast::Excepthandler<SourceRange>) -> Self {
|
fn from(_node: &'static ast::ExceptHandler<SourceRange>) -> Self {
|
||||||
Excepthandler
|
ExceptHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Excepthandler {
|
impl ExceptHandler {
|
||||||
#[new]
|
#[new]
|
||||||
fn new() -> PyClassInitializer<Self> {
|
fn new() -> PyClassInitializer<Self> {
|
||||||
PyClassInitializer::from(Ast).add_subclass(Self)
|
PyClassInitializer::from(Ast).add_subclass(Self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ToPyObject for Excepthandler {
|
impl ToPyObject for ExceptHandler {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = Self::new();
|
let initializer = Self::new();
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::Excepthandler<SourceRange> {
|
impl ToPyWrapper for ast::ExceptHandler<SourceRange> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
match &self {
|
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)]
|
#[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 {
|
impl From<&'static ast::ExceptHandlerExceptHandler<SourceRange>> for ExceptHandlerExceptHandler {
|
||||||
fn from(node: &'static ast::ExcepthandlerExceptHandler<SourceRange>) -> Self {
|
fn from(node: &'static ast::ExceptHandlerExceptHandler<SourceRange>) -> Self {
|
||||||
ExcepthandlerExceptHandler(node)
|
ExceptHandlerExceptHandler(node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyObject for ExcepthandlerExceptHandler {
|
impl ToPyObject for ExceptHandlerExceptHandler {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Excepthandler)
|
.add_subclass(ExceptHandler)
|
||||||
.add_subclass(self.clone());
|
.add_subclass(self.clone());
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::ExcepthandlerExceptHandler<SourceRange> {
|
impl ToPyWrapper for ast::ExceptHandlerExceptHandler<SourceRange> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
Ok(ExcepthandlerExceptHandler(self).to_object(py))
|
Ok(ExceptHandlerExceptHandler(self).to_object(py))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl ExcepthandlerExceptHandler {
|
impl ExceptHandlerExceptHandler {
|
||||||
#[getter]
|
#[getter]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_type(&self, py: Python) -> PyResult<PyObject> {
|
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)]
|
#[pyclass(module="rustpython_ast.located", name="_withitem", extends=super::Ast, frozen)]
|
||||||
#[derive(Clone, Debug)]
|
#[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 {
|
impl From<&'static ast::WithItem<SourceRange>> for WithItem {
|
||||||
fn from(node: &'static ast::Withitem<SourceRange>) -> Self {
|
fn from(node: &'static ast::WithItem<SourceRange>) -> Self {
|
||||||
Withitem(node)
|
WithItem(node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyObject for Withitem {
|
impl ToPyObject for WithItem {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone());
|
let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone());
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::Withitem<SourceRange> {
|
impl ToPyWrapper for ast::WithItem<SourceRange> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
Ok(Withitem(self).to_object(py))
|
Ok(WithItem(self).to_object(py))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Withitem {
|
impl WithItem {
|
||||||
#[getter]
|
#[getter]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_context_expr(&self, py: Python) -> PyResult<PyObject> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
match &self {
|
match &self {
|
||||||
Self::And => Ok(BoolopAnd.to_object(py)),
|
Self::And => Ok(BoolOpAnd.to_object(py)),
|
||||||
Self::Or => Ok(BoolopOr.to_object(py)),
|
Self::Or => Ok(BoolOpOr.to_object(py)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::BoolopAnd {
|
impl ToPyWrapper for ast::BoolOpAnd {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
match &self {
|
match &self {
|
||||||
Self::Invert => Ok(UnaryopInvert.to_object(py)),
|
Self::Invert => Ok(UnaryOpInvert.to_object(py)),
|
||||||
Self::Not => Ok(UnaryopNot.to_object(py)),
|
Self::Not => Ok(UnaryOpNot.to_object(py)),
|
||||||
Self::UAdd => Ok(UnaryopUAdd.to_object(py)),
|
Self::UAdd => Ok(UnaryOpUAdd.to_object(py)),
|
||||||
Self::USub => Ok(UnaryopUSub.to_object(py)),
|
Self::USub => Ok(UnaryOpUSub.to_object(py)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::UnaryopInvert {
|
impl ToPyWrapper for ast::UnaryOpInvert {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
match &self {
|
match &self {
|
||||||
Self::Eq => Ok(CmpopEq.to_object(py)),
|
Self::Eq => Ok(CmpOpEq.to_object(py)),
|
||||||
Self::NotEq => Ok(CmpopNotEq.to_object(py)),
|
Self::NotEq => Ok(CmpOpNotEq.to_object(py)),
|
||||||
Self::Lt => Ok(CmpopLt.to_object(py)),
|
Self::Lt => Ok(CmpOpLt.to_object(py)),
|
||||||
Self::LtE => Ok(CmpopLtE.to_object(py)),
|
Self::LtE => Ok(CmpOpLtE.to_object(py)),
|
||||||
Self::Gt => Ok(CmpopGt.to_object(py)),
|
Self::Gt => Ok(CmpOpGt.to_object(py)),
|
||||||
Self::GtE => Ok(CmpopGtE.to_object(py)),
|
Self::GtE => Ok(CmpOpGtE.to_object(py)),
|
||||||
Self::Is => Ok(CmpopIs.to_object(py)),
|
Self::Is => Ok(CmpOpIs.to_object(py)),
|
||||||
Self::IsNot => Ok(CmpopIsNot.to_object(py)),
|
Self::IsNot => Ok(CmpOpIsNot.to_object(py)),
|
||||||
Self::In => Ok(CmpopIn.to_object(py)),
|
Self::In => Ok(CmpOpIn.to_object(py)),
|
||||||
Self::NotIn => Ok(CmpopNotIn.to_object(py)),
|
Self::NotIn => Ok(CmpOpNotIn.to_object(py)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::CmpopEq {
|
impl ToPyWrapper for ast::CmpOpEq {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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]
|
#[inline]
|
||||||
fn to_py_wrapper(&self, py: Python) -> PyResult<Py<PyAny>> {
|
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::<ExprContextLoad, ast::ExprContextLoad>(py, m)?;
|
||||||
super::init_type::<ExprContextStore, ast::ExprContextStore>(py, m)?;
|
super::init_type::<ExprContextStore, ast::ExprContextStore>(py, m)?;
|
||||||
super::init_type::<ExprContextDel, ast::ExprContextDel>(py, m)?;
|
super::init_type::<ExprContextDel, ast::ExprContextDel>(py, m)?;
|
||||||
super::init_type::<Boolop, ast::Boolop>(py, m)?;
|
super::init_type::<BoolOp, ast::BoolOp>(py, m)?;
|
||||||
super::init_type::<BoolopAnd, ast::BoolopAnd>(py, m)?;
|
super::init_type::<BoolOpAnd, ast::BoolOpAnd>(py, m)?;
|
||||||
super::init_type::<BoolopOr, ast::BoolopOr>(py, m)?;
|
super::init_type::<BoolOpOr, ast::BoolOpOr>(py, m)?;
|
||||||
super::init_type::<Operator, ast::Operator>(py, m)?;
|
super::init_type::<Operator, ast::Operator>(py, m)?;
|
||||||
super::init_type::<OperatorAdd, ast::OperatorAdd>(py, m)?;
|
super::init_type::<OperatorAdd, ast::OperatorAdd>(py, m)?;
|
||||||
super::init_type::<OperatorSub, ast::OperatorSub>(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::<OperatorBitXor, ast::OperatorBitXor>(py, m)?;
|
||||||
super::init_type::<OperatorBitAnd, ast::OperatorBitAnd>(py, m)?;
|
super::init_type::<OperatorBitAnd, ast::OperatorBitAnd>(py, m)?;
|
||||||
super::init_type::<OperatorFloorDiv, ast::OperatorFloorDiv>(py, m)?;
|
super::init_type::<OperatorFloorDiv, ast::OperatorFloorDiv>(py, m)?;
|
||||||
super::init_type::<Unaryop, ast::Unaryop>(py, m)?;
|
super::init_type::<UnaryOp, ast::UnaryOp>(py, m)?;
|
||||||
super::init_type::<UnaryopInvert, ast::UnaryopInvert>(py, m)?;
|
super::init_type::<UnaryOpInvert, ast::UnaryOpInvert>(py, m)?;
|
||||||
super::init_type::<UnaryopNot, ast::UnaryopNot>(py, m)?;
|
super::init_type::<UnaryOpNot, ast::UnaryOpNot>(py, m)?;
|
||||||
super::init_type::<UnaryopUAdd, ast::UnaryopUAdd>(py, m)?;
|
super::init_type::<UnaryOpUAdd, ast::UnaryOpUAdd>(py, m)?;
|
||||||
super::init_type::<UnaryopUSub, ast::UnaryopUSub>(py, m)?;
|
super::init_type::<UnaryOpUSub, ast::UnaryOpUSub>(py, m)?;
|
||||||
super::init_type::<Cmpop, ast::Cmpop>(py, m)?;
|
super::init_type::<CmpOp, ast::CmpOp>(py, m)?;
|
||||||
super::init_type::<CmpopEq, ast::CmpopEq>(py, m)?;
|
super::init_type::<CmpOpEq, ast::CmpOpEq>(py, m)?;
|
||||||
super::init_type::<CmpopNotEq, ast::CmpopNotEq>(py, m)?;
|
super::init_type::<CmpOpNotEq, ast::CmpOpNotEq>(py, m)?;
|
||||||
super::init_type::<CmpopLt, ast::CmpopLt>(py, m)?;
|
super::init_type::<CmpOpLt, ast::CmpOpLt>(py, m)?;
|
||||||
super::init_type::<CmpopLtE, ast::CmpopLtE>(py, m)?;
|
super::init_type::<CmpOpLtE, ast::CmpOpLtE>(py, m)?;
|
||||||
super::init_type::<CmpopGt, ast::CmpopGt>(py, m)?;
|
super::init_type::<CmpOpGt, ast::CmpOpGt>(py, m)?;
|
||||||
super::init_type::<CmpopGtE, ast::CmpopGtE>(py, m)?;
|
super::init_type::<CmpOpGtE, ast::CmpOpGtE>(py, m)?;
|
||||||
super::init_type::<CmpopIs, ast::CmpopIs>(py, m)?;
|
super::init_type::<CmpOpIs, ast::CmpOpIs>(py, m)?;
|
||||||
super::init_type::<CmpopIsNot, ast::CmpopIsNot>(py, m)?;
|
super::init_type::<CmpOpIsNot, ast::CmpOpIsNot>(py, m)?;
|
||||||
super::init_type::<CmpopIn, ast::CmpopIn>(py, m)?;
|
super::init_type::<CmpOpIn, ast::CmpOpIn>(py, m)?;
|
||||||
super::init_type::<CmpopNotIn, ast::CmpopNotIn>(py, m)?;
|
super::init_type::<CmpOpNotIn, ast::CmpOpNotIn>(py, m)?;
|
||||||
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
|
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
|
||||||
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
|
super::init_type::<ExceptHandler, ast::ExceptHandler>(py, m)?;
|
||||||
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
|
super::init_type::<ExceptHandlerExceptHandler, ast::ExceptHandlerExceptHandler>(py, m)?;
|
||||||
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
|
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
|
||||||
super::init_type::<Arg, ast::Arg>(py, m)?;
|
super::init_type::<Arg, ast::Arg>(py, m)?;
|
||||||
super::init_type::<Keyword, ast::Keyword>(py, m)?;
|
super::init_type::<Keyword, ast::Keyword>(py, m)?;
|
||||||
super::init_type::<Alias, ast::Alias>(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::<MatchCase, ast::MatchCase>(py, m)?;
|
||||||
super::init_type::<Pattern, ast::Pattern>(py, m)?;
|
super::init_type::<Pattern, ast::Pattern>(py, m)?;
|
||||||
super::init_type::<PatternMatchValue, ast::PatternMatchValue>(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)]
|
#[pyclass(module="rustpython_ast.ranged", name="_boolop", extends=super::Ast, frozen, subclass)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Boolop;
|
pub struct BoolOp;
|
||||||
|
|
||||||
impl From<&'static ast::Boolop> for Boolop {
|
impl From<&'static ast::BoolOp> for BoolOp {
|
||||||
fn from(_node: &'static ast::Boolop) -> Self {
|
fn from(_node: &'static ast::BoolOp) -> Self {
|
||||||
Boolop
|
BoolOp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Boolop {
|
impl BoolOp {
|
||||||
#[new]
|
#[new]
|
||||||
fn new() -> PyClassInitializer<Self> {
|
fn new() -> PyClassInitializer<Self> {
|
||||||
PyClassInitializer::from(Ast).add_subclass(Self)
|
PyClassInitializer::from(Ast).add_subclass(Self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ToPyObject for Boolop {
|
impl ToPyObject for BoolOp {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = Self::new();
|
let initializer = Self::new();
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_And", extends=Boolop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_And", extends=BoolOp)]
|
||||||
pub struct BoolopAnd;
|
pub struct BoolOpAnd;
|
||||||
|
|
||||||
impl ToPyObject for BoolopAnd {
|
impl ToPyObject for BoolOpAnd {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Boolop)
|
.add_subclass(BoolOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_Or", extends=Boolop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_Or", extends=BoolOp)]
|
||||||
pub struct BoolopOr;
|
pub struct BoolOpOr;
|
||||||
|
|
||||||
impl ToPyObject for BoolopOr {
|
impl ToPyObject for BoolOpOr {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Boolop)
|
.add_subclass(BoolOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
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)]
|
#[pyclass(module="rustpython_ast.ranged", name="_unaryop", extends=super::Ast, frozen, subclass)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Unaryop;
|
pub struct UnaryOp;
|
||||||
|
|
||||||
impl From<&'static ast::Unaryop> for Unaryop {
|
impl From<&'static ast::UnaryOp> for UnaryOp {
|
||||||
fn from(_node: &'static ast::Unaryop) -> Self {
|
fn from(_node: &'static ast::UnaryOp) -> Self {
|
||||||
Unaryop
|
UnaryOp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Unaryop {
|
impl UnaryOp {
|
||||||
#[new]
|
#[new]
|
||||||
fn new() -> PyClassInitializer<Self> {
|
fn new() -> PyClassInitializer<Self> {
|
||||||
PyClassInitializer::from(Ast).add_subclass(Self)
|
PyClassInitializer::from(Ast).add_subclass(Self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ToPyObject for Unaryop {
|
impl ToPyObject for UnaryOp {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = Self::new();
|
let initializer = Self::new();
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_Invert", extends=Unaryop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_Invert", extends=UnaryOp)]
|
||||||
pub struct UnaryopInvert;
|
pub struct UnaryOpInvert;
|
||||||
|
|
||||||
impl ToPyObject for UnaryopInvert {
|
impl ToPyObject for UnaryOpInvert {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Unaryop)
|
.add_subclass(UnaryOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_Not", extends=Unaryop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_Not", extends=UnaryOp)]
|
||||||
pub struct UnaryopNot;
|
pub struct UnaryOpNot;
|
||||||
|
|
||||||
impl ToPyObject for UnaryopNot {
|
impl ToPyObject for UnaryOpNot {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Unaryop)
|
.add_subclass(UnaryOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_UAdd", extends=Unaryop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_UAdd", extends=UnaryOp)]
|
||||||
pub struct UnaryopUAdd;
|
pub struct UnaryOpUAdd;
|
||||||
|
|
||||||
impl ToPyObject for UnaryopUAdd {
|
impl ToPyObject for UnaryOpUAdd {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Unaryop)
|
.add_subclass(UnaryOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_USub", extends=Unaryop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_USub", extends=UnaryOp)]
|
||||||
pub struct UnaryopUSub;
|
pub struct UnaryOpUSub;
|
||||||
|
|
||||||
impl ToPyObject for UnaryopUSub {
|
impl ToPyObject for UnaryOpUSub {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Unaryop)
|
.add_subclass(UnaryOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
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)]
|
#[pyclass(module="rustpython_ast.ranged", name="_cmpop", extends=super::Ast, frozen, subclass)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Cmpop;
|
pub struct CmpOp;
|
||||||
|
|
||||||
impl From<&'static ast::Cmpop> for Cmpop {
|
impl From<&'static ast::CmpOp> for CmpOp {
|
||||||
fn from(_node: &'static ast::Cmpop) -> Self {
|
fn from(_node: &'static ast::CmpOp) -> Self {
|
||||||
Cmpop
|
CmpOp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Cmpop {
|
impl CmpOp {
|
||||||
#[new]
|
#[new]
|
||||||
fn new() -> PyClassInitializer<Self> {
|
fn new() -> PyClassInitializer<Self> {
|
||||||
PyClassInitializer::from(Ast).add_subclass(Self)
|
PyClassInitializer::from(Ast).add_subclass(Self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ToPyObject for Cmpop {
|
impl ToPyObject for CmpOp {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = Self::new();
|
let initializer = Self::new();
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_Eq", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_Eq", extends=CmpOp)]
|
||||||
pub struct CmpopEq;
|
pub struct CmpOpEq;
|
||||||
|
|
||||||
impl ToPyObject for CmpopEq {
|
impl ToPyObject for CmpOpEq {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_NotEq", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_NotEq", extends=CmpOp)]
|
||||||
pub struct CmpopNotEq;
|
pub struct CmpOpNotEq;
|
||||||
|
|
||||||
impl ToPyObject for CmpopNotEq {
|
impl ToPyObject for CmpOpNotEq {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_Lt", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_Lt", extends=CmpOp)]
|
||||||
pub struct CmpopLt;
|
pub struct CmpOpLt;
|
||||||
|
|
||||||
impl ToPyObject for CmpopLt {
|
impl ToPyObject for CmpOpLt {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_LtE", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_LtE", extends=CmpOp)]
|
||||||
pub struct CmpopLtE;
|
pub struct CmpOpLtE;
|
||||||
|
|
||||||
impl ToPyObject for CmpopLtE {
|
impl ToPyObject for CmpOpLtE {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_Gt", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_Gt", extends=CmpOp)]
|
||||||
pub struct CmpopGt;
|
pub struct CmpOpGt;
|
||||||
|
|
||||||
impl ToPyObject for CmpopGt {
|
impl ToPyObject for CmpOpGt {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_GtE", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_GtE", extends=CmpOp)]
|
||||||
pub struct CmpopGtE;
|
pub struct CmpOpGtE;
|
||||||
|
|
||||||
impl ToPyObject for CmpopGtE {
|
impl ToPyObject for CmpOpGtE {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_Is", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_Is", extends=CmpOp)]
|
||||||
pub struct CmpopIs;
|
pub struct CmpOpIs;
|
||||||
|
|
||||||
impl ToPyObject for CmpopIs {
|
impl ToPyObject for CmpOpIs {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_IsNot", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_IsNot", extends=CmpOp)]
|
||||||
pub struct CmpopIsNot;
|
pub struct CmpOpIsNot;
|
||||||
|
|
||||||
impl ToPyObject for CmpopIsNot {
|
impl ToPyObject for CmpOpIsNot {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_In", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_In", extends=CmpOp)]
|
||||||
pub struct CmpopIn;
|
pub struct CmpOpIn;
|
||||||
|
|
||||||
impl ToPyObject for CmpopIn {
|
impl ToPyObject for CmpOpIn {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass(module="rustpython_ast.ranged", name="_NotIn", extends=Cmpop)]
|
#[pyclass(module="rustpython_ast.ranged", name="_NotIn", extends=CmpOp)]
|
||||||
pub struct CmpopNotIn;
|
pub struct CmpOpNotIn;
|
||||||
|
|
||||||
impl ToPyObject for CmpopNotIn {
|
impl ToPyObject for CmpOpNotIn {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Cmpop)
|
.add_subclass(CmpOp)
|
||||||
.add_subclass(Self);
|
.add_subclass(Self);
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
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)]
|
#[pyclass(module="rustpython_ast.ranged", name="_excepthandler", extends=super::Ast, frozen, subclass)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Excepthandler;
|
pub struct ExceptHandler;
|
||||||
|
|
||||||
impl From<&'static ast::Excepthandler<TextRange>> for Excepthandler {
|
impl From<&'static ast::ExceptHandler<TextRange>> for ExceptHandler {
|
||||||
fn from(_node: &'static ast::Excepthandler<TextRange>) -> Self {
|
fn from(_node: &'static ast::ExceptHandler<TextRange>) -> Self {
|
||||||
Excepthandler
|
ExceptHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Excepthandler {
|
impl ExceptHandler {
|
||||||
#[new]
|
#[new]
|
||||||
fn new() -> PyClassInitializer<Self> {
|
fn new() -> PyClassInitializer<Self> {
|
||||||
PyClassInitializer::from(Ast).add_subclass(Self)
|
PyClassInitializer::from(Ast).add_subclass(Self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ToPyObject for Excepthandler {
|
impl ToPyObject for ExceptHandler {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = Self::new();
|
let initializer = Self::new();
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::Excepthandler<TextRange> {
|
impl ToPyWrapper for ast::ExceptHandler<TextRange> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
match &self {
|
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)]
|
#[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 {
|
impl From<&'static ast::ExceptHandlerExceptHandler<TextRange>> for ExceptHandlerExceptHandler {
|
||||||
fn from(node: &'static ast::ExcepthandlerExceptHandler<TextRange>) -> Self {
|
fn from(node: &'static ast::ExceptHandlerExceptHandler<TextRange>) -> Self {
|
||||||
ExcepthandlerExceptHandler(node)
|
ExceptHandlerExceptHandler(node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyObject for ExcepthandlerExceptHandler {
|
impl ToPyObject for ExceptHandlerExceptHandler {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast)
|
let initializer = PyClassInitializer::from(Ast)
|
||||||
.add_subclass(Excepthandler)
|
.add_subclass(ExceptHandler)
|
||||||
.add_subclass(self.clone());
|
.add_subclass(self.clone());
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::ExcepthandlerExceptHandler<TextRange> {
|
impl ToPyWrapper for ast::ExceptHandlerExceptHandler<TextRange> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
Ok(ExcepthandlerExceptHandler(self).to_object(py))
|
Ok(ExceptHandlerExceptHandler(self).to_object(py))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl ExcepthandlerExceptHandler {
|
impl ExceptHandlerExceptHandler {
|
||||||
#[getter]
|
#[getter]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_type(&self, py: Python) -> PyResult<PyObject> {
|
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)]
|
#[pyclass(module="rustpython_ast.ranged", name="_withitem", extends=super::Ast, frozen)]
|
||||||
#[derive(Clone, Debug)]
|
#[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 {
|
impl From<&'static ast::WithItem<TextRange>> for WithItem {
|
||||||
fn from(node: &'static ast::Withitem<TextRange>) -> Self {
|
fn from(node: &'static ast::WithItem<TextRange>) -> Self {
|
||||||
Withitem(node)
|
WithItem(node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyObject for Withitem {
|
impl ToPyObject for WithItem {
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone());
|
let initializer = PyClassInitializer::from(Ast).add_subclass(self.clone());
|
||||||
Py::new(py, initializer).unwrap().into_py(py)
|
Py::new(py, initializer).unwrap().into_py(py)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyWrapper for ast::Withitem<TextRange> {
|
impl ToPyWrapper for ast::WithItem<TextRange> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
Ok(Withitem(self).to_object(py))
|
Ok(WithItem(self).to_object(py))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Withitem {
|
impl WithItem {
|
||||||
#[getter]
|
#[getter]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_context_expr(&self, py: Python) -> PyResult<PyObject> {
|
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::<ExprContextLoad, ast::ExprContextLoad>(py, m)?;
|
||||||
super::init_type::<ExprContextStore, ast::ExprContextStore>(py, m)?;
|
super::init_type::<ExprContextStore, ast::ExprContextStore>(py, m)?;
|
||||||
super::init_type::<ExprContextDel, ast::ExprContextDel>(py, m)?;
|
super::init_type::<ExprContextDel, ast::ExprContextDel>(py, m)?;
|
||||||
super::init_type::<Boolop, ast::Boolop>(py, m)?;
|
super::init_type::<BoolOp, ast::BoolOp>(py, m)?;
|
||||||
super::init_type::<BoolopAnd, ast::BoolopAnd>(py, m)?;
|
super::init_type::<BoolOpAnd, ast::BoolOpAnd>(py, m)?;
|
||||||
super::init_type::<BoolopOr, ast::BoolopOr>(py, m)?;
|
super::init_type::<BoolOpOr, ast::BoolOpOr>(py, m)?;
|
||||||
super::init_type::<Operator, ast::Operator>(py, m)?;
|
super::init_type::<Operator, ast::Operator>(py, m)?;
|
||||||
super::init_type::<OperatorAdd, ast::OperatorAdd>(py, m)?;
|
super::init_type::<OperatorAdd, ast::OperatorAdd>(py, m)?;
|
||||||
super::init_type::<OperatorSub, ast::OperatorSub>(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::<OperatorBitXor, ast::OperatorBitXor>(py, m)?;
|
||||||
super::init_type::<OperatorBitAnd, ast::OperatorBitAnd>(py, m)?;
|
super::init_type::<OperatorBitAnd, ast::OperatorBitAnd>(py, m)?;
|
||||||
super::init_type::<OperatorFloorDiv, ast::OperatorFloorDiv>(py, m)?;
|
super::init_type::<OperatorFloorDiv, ast::OperatorFloorDiv>(py, m)?;
|
||||||
super::init_type::<Unaryop, ast::Unaryop>(py, m)?;
|
super::init_type::<UnaryOp, ast::UnaryOp>(py, m)?;
|
||||||
super::init_type::<UnaryopInvert, ast::UnaryopInvert>(py, m)?;
|
super::init_type::<UnaryOpInvert, ast::UnaryOpInvert>(py, m)?;
|
||||||
super::init_type::<UnaryopNot, ast::UnaryopNot>(py, m)?;
|
super::init_type::<UnaryOpNot, ast::UnaryOpNot>(py, m)?;
|
||||||
super::init_type::<UnaryopUAdd, ast::UnaryopUAdd>(py, m)?;
|
super::init_type::<UnaryOpUAdd, ast::UnaryOpUAdd>(py, m)?;
|
||||||
super::init_type::<UnaryopUSub, ast::UnaryopUSub>(py, m)?;
|
super::init_type::<UnaryOpUSub, ast::UnaryOpUSub>(py, m)?;
|
||||||
super::init_type::<Cmpop, ast::Cmpop>(py, m)?;
|
super::init_type::<CmpOp, ast::CmpOp>(py, m)?;
|
||||||
super::init_type::<CmpopEq, ast::CmpopEq>(py, m)?;
|
super::init_type::<CmpOpEq, ast::CmpOpEq>(py, m)?;
|
||||||
super::init_type::<CmpopNotEq, ast::CmpopNotEq>(py, m)?;
|
super::init_type::<CmpOpNotEq, ast::CmpOpNotEq>(py, m)?;
|
||||||
super::init_type::<CmpopLt, ast::CmpopLt>(py, m)?;
|
super::init_type::<CmpOpLt, ast::CmpOpLt>(py, m)?;
|
||||||
super::init_type::<CmpopLtE, ast::CmpopLtE>(py, m)?;
|
super::init_type::<CmpOpLtE, ast::CmpOpLtE>(py, m)?;
|
||||||
super::init_type::<CmpopGt, ast::CmpopGt>(py, m)?;
|
super::init_type::<CmpOpGt, ast::CmpOpGt>(py, m)?;
|
||||||
super::init_type::<CmpopGtE, ast::CmpopGtE>(py, m)?;
|
super::init_type::<CmpOpGtE, ast::CmpOpGtE>(py, m)?;
|
||||||
super::init_type::<CmpopIs, ast::CmpopIs>(py, m)?;
|
super::init_type::<CmpOpIs, ast::CmpOpIs>(py, m)?;
|
||||||
super::init_type::<CmpopIsNot, ast::CmpopIsNot>(py, m)?;
|
super::init_type::<CmpOpIsNot, ast::CmpOpIsNot>(py, m)?;
|
||||||
super::init_type::<CmpopIn, ast::CmpopIn>(py, m)?;
|
super::init_type::<CmpOpIn, ast::CmpOpIn>(py, m)?;
|
||||||
super::init_type::<CmpopNotIn, ast::CmpopNotIn>(py, m)?;
|
super::init_type::<CmpOpNotIn, ast::CmpOpNotIn>(py, m)?;
|
||||||
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
|
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
|
||||||
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
|
super::init_type::<ExceptHandler, ast::ExceptHandler>(py, m)?;
|
||||||
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
|
super::init_type::<ExceptHandlerExceptHandler, ast::ExceptHandlerExceptHandler>(py, m)?;
|
||||||
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
|
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
|
||||||
super::init_type::<Arg, ast::Arg>(py, m)?;
|
super::init_type::<Arg, ast::Arg>(py, m)?;
|
||||||
super::init_type::<Keyword, ast::Keyword>(py, m)?;
|
super::init_type::<Keyword, ast::Keyword>(py, m)?;
|
||||||
super::init_type::<Alias, ast::Alias>(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::<MatchCase, ast::MatchCase>(py, m)?;
|
||||||
super::init_type::<Pattern, ast::Pattern>(py, m)?;
|
super::init_type::<Pattern, ast::Pattern>(py, m)?;
|
||||||
super::init_type::<PatternMatchValue, ast::PatternMatchValue>(py, m)?;
|
super::init_type::<PatternMatchValue, ast::PatternMatchValue>(py, m)?;
|
||||||
|
|
|
@ -31,6 +31,14 @@ BUILTIN_INT_NAMES = {
|
||||||
"conversion": "ConversionFlag",
|
"conversion": "ConversionFlag",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RENAME_MAP = {
|
||||||
|
"cmpop": "cmp_op",
|
||||||
|
"unaryop": "unary_op",
|
||||||
|
"boolop": "bool_op",
|
||||||
|
"excepthandler": "except_handler",
|
||||||
|
"withitem": "with_item",
|
||||||
|
}
|
||||||
|
|
||||||
RUST_KEYWORDS = {
|
RUST_KEYWORDS = {
|
||||||
"if",
|
"if",
|
||||||
"while",
|
"while",
|
||||||
|
@ -124,6 +132,7 @@ def rust_type_name(name):
|
||||||
|
|
||||||
This function special cases the default types provided by asdl.
|
This function special cases the default types provided by asdl.
|
||||||
"""
|
"""
|
||||||
|
name = RENAME_MAP.get(name, name)
|
||||||
if name in asdl.builtin_types:
|
if name in asdl.builtin_types:
|
||||||
builtin = BUILTIN_TYPE_NAMES[name]
|
builtin = BUILTIN_TYPE_NAMES[name]
|
||||||
return builtin
|
return builtin
|
||||||
|
@ -444,7 +453,9 @@ class StructVisitor(EmitVisitor):
|
||||||
def visitType(self, type, depth=0):
|
def visitType(self, type, depth=0):
|
||||||
if hasattr(type, "doc"):
|
if hasattr(type, "doc"):
|
||||||
doc = "/// " + type.doc.replace("\n", "\n/// ") + "\n"
|
doc = "/// " + type.doc.replace("\n", "\n/// ") + "\n"
|
||||||
self.emit(doc, depth)
|
else:
|
||||||
|
doc = f"/// See also [{type.name}](https://docs.python.org/3/library/ast.html#ast.{type.name})"
|
||||||
|
self.emit(doc, depth)
|
||||||
self.visit(type.value, type, depth)
|
self.visit(type.value, type, depth)
|
||||||
|
|
||||||
def visitSum(self, sum, type, depth):
|
def visitSum(self, sum, type, depth):
|
||||||
|
@ -525,11 +536,6 @@ class StructVisitor(EmitVisitor):
|
||||||
def sum_with_constructors(self, sum, type, depth):
|
def sum_with_constructors(self, sum, type, depth):
|
||||||
type_info = self.type_info[type.name]
|
type_info = self.type_info[type.name]
|
||||||
rust_name = rust_type_name(type.name)
|
rust_name = rust_type_name(type.name)
|
||||||
# all the attributes right now are for location, so if it has attrs we
|
|
||||||
# can just wrap it in Attributed<>
|
|
||||||
|
|
||||||
for t in sum.types:
|
|
||||||
self.sum_subtype_struct(type_info, t, rust_name, depth)
|
|
||||||
|
|
||||||
self.emit_attrs(depth)
|
self.emit_attrs(depth)
|
||||||
self.emit("#[derive(is_macro::Is)]", depth)
|
self.emit("#[derive(is_macro::Is)]", depth)
|
||||||
|
@ -545,7 +551,12 @@ class StructVisitor(EmitVisitor):
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
self.emit("", depth)
|
self.emit("", depth)
|
||||||
|
|
||||||
|
for t in sum.types:
|
||||||
|
self.sum_subtype_struct(type_info, t, rust_name, depth)
|
||||||
|
|
||||||
|
|
||||||
def sum_subtype_struct(self, sum_type_info, t, rust_name, depth):
|
def sum_subtype_struct(self, sum_type_info, t, rust_name, depth):
|
||||||
|
self.emit(f"""/// See also [{t.name}](https://docs.python.org/3/library/ast.html#ast.{t.name})""", depth)
|
||||||
self.emit_attrs(depth)
|
self.emit_attrs(depth)
|
||||||
payload_name = f"{rust_name}{t.name}"
|
payload_name = f"{rust_name}{t.name}"
|
||||||
self.emit(f"pub struct {payload_name}<R = TextRange> {{", depth)
|
self.emit(f"pub struct {payload_name}<R = TextRange> {{", depth)
|
||||||
|
|
|
@ -390,16 +390,16 @@ pub trait Fold<U> {
|
||||||
fn fold_expr_context(&mut self, node: ExprContext) -> Result<ExprContext, Self::Error> {
|
fn fold_expr_context(&mut self, node: ExprContext) -> Result<ExprContext, Self::Error> {
|
||||||
fold_expr_context(self, node)
|
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)
|
fold_boolop(self, node)
|
||||||
}
|
}
|
||||||
fn fold_operator(&mut self, node: Operator) -> Result<Operator, Self::Error> {
|
fn fold_operator(&mut self, node: Operator) -> Result<Operator, Self::Error> {
|
||||||
fold_operator(self, node)
|
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)
|
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)
|
fold_cmpop(self, node)
|
||||||
}
|
}
|
||||||
fn fold_comprehension(
|
fn fold_comprehension(
|
||||||
|
@ -410,14 +410,14 @@ pub trait Fold<U> {
|
||||||
}
|
}
|
||||||
fn fold_excepthandler(
|
fn fold_excepthandler(
|
||||||
&mut self,
|
&mut self,
|
||||||
node: Excepthandler<U>,
|
node: ExceptHandler<U>,
|
||||||
) -> Result<Excepthandler<Self::TargetU>, Self::Error> {
|
) -> Result<ExceptHandler<Self::TargetU>, Self::Error> {
|
||||||
fold_excepthandler(self, node)
|
fold_excepthandler(self, node)
|
||||||
}
|
}
|
||||||
fn fold_excepthandler_except_handler(
|
fn fold_excepthandler_except_handler(
|
||||||
&mut self,
|
&mut self,
|
||||||
node: ExcepthandlerExceptHandler<U>,
|
node: ExceptHandlerExceptHandler<U>,
|
||||||
) -> Result<ExcepthandlerExceptHandler<Self::TargetU>, Self::Error> {
|
) -> Result<ExceptHandlerExceptHandler<Self::TargetU>, Self::Error> {
|
||||||
fold_excepthandler_except_handler(self, node)
|
fold_excepthandler_except_handler(self, node)
|
||||||
}
|
}
|
||||||
fn fold_arguments(
|
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> {
|
fn fold_alias(&mut self, node: Alias<U>) -> Result<Alias<Self::TargetU>, Self::Error> {
|
||||||
fold_alias(self, node)
|
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)
|
fold_withitem(self, node)
|
||||||
}
|
}
|
||||||
fn fold_match_case(
|
fn fold_match_case(
|
||||||
|
@ -2210,8 +2210,8 @@ pub fn fold_expr_context<U, F: Fold<U> + ?Sized>(
|
||||||
) -> Result<ExprContext, F::Error> {
|
) -> Result<ExprContext, F::Error> {
|
||||||
Ok(node)
|
Ok(node)
|
||||||
}
|
}
|
||||||
impl<T, U> Foldable<T, U> for Boolop {
|
impl<T, U> Foldable<T, U> for BoolOp {
|
||||||
type Mapped = Boolop;
|
type Mapped = BoolOp;
|
||||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||||
self,
|
self,
|
||||||
folder: &mut F,
|
folder: &mut F,
|
||||||
|
@ -2221,8 +2221,8 @@ impl<T, U> Foldable<T, U> for Boolop {
|
||||||
}
|
}
|
||||||
pub fn fold_boolop<U, F: Fold<U> + ?Sized>(
|
pub fn fold_boolop<U, F: Fold<U> + ?Sized>(
|
||||||
#[allow(unused)] folder: &mut F,
|
#[allow(unused)] folder: &mut F,
|
||||||
node: Boolop,
|
node: BoolOp,
|
||||||
) -> Result<Boolop, F::Error> {
|
) -> Result<BoolOp, F::Error> {
|
||||||
Ok(node)
|
Ok(node)
|
||||||
}
|
}
|
||||||
impl<T, U> Foldable<T, U> for Operator {
|
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> {
|
) -> Result<Operator, F::Error> {
|
||||||
Ok(node)
|
Ok(node)
|
||||||
}
|
}
|
||||||
impl<T, U> Foldable<T, U> for Unaryop {
|
impl<T, U> Foldable<T, U> for UnaryOp {
|
||||||
type Mapped = Unaryop;
|
type Mapped = UnaryOp;
|
||||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||||
self,
|
self,
|
||||||
folder: &mut F,
|
folder: &mut F,
|
||||||
|
@ -2251,12 +2251,12 @@ impl<T, U> Foldable<T, U> for Unaryop {
|
||||||
}
|
}
|
||||||
pub fn fold_unaryop<U, F: Fold<U> + ?Sized>(
|
pub fn fold_unaryop<U, F: Fold<U> + ?Sized>(
|
||||||
#[allow(unused)] folder: &mut F,
|
#[allow(unused)] folder: &mut F,
|
||||||
node: Unaryop,
|
node: UnaryOp,
|
||||||
) -> Result<Unaryop, F::Error> {
|
) -> Result<UnaryOp, F::Error> {
|
||||||
Ok(node)
|
Ok(node)
|
||||||
}
|
}
|
||||||
impl<T, U> Foldable<T, U> for Cmpop {
|
impl<T, U> Foldable<T, U> for CmpOp {
|
||||||
type Mapped = Cmpop;
|
type Mapped = CmpOp;
|
||||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||||
self,
|
self,
|
||||||
folder: &mut F,
|
folder: &mut F,
|
||||||
|
@ -2266,8 +2266,8 @@ impl<T, U> Foldable<T, U> for Cmpop {
|
||||||
}
|
}
|
||||||
pub fn fold_cmpop<U, F: Fold<U> + ?Sized>(
|
pub fn fold_cmpop<U, F: Fold<U> + ?Sized>(
|
||||||
#[allow(unused)] folder: &mut F,
|
#[allow(unused)] folder: &mut F,
|
||||||
node: Cmpop,
|
node: CmpOp,
|
||||||
) -> Result<Cmpop, F::Error> {
|
) -> Result<CmpOp, F::Error> {
|
||||||
Ok(node)
|
Ok(node)
|
||||||
}
|
}
|
||||||
impl<T, U> Foldable<T, U> for Comprehension<T> {
|
impl<T, U> Foldable<T, U> for Comprehension<T> {
|
||||||
|
@ -2304,8 +2304,8 @@ pub fn fold_comprehension<U, F: Fold<U> + ?Sized>(
|
||||||
range,
|
range,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
impl<T, U> Foldable<T, U> for Excepthandler<T> {
|
impl<T, U> Foldable<T, U> for ExceptHandler<T> {
|
||||||
type Mapped = Excepthandler<U>;
|
type Mapped = ExceptHandler<U>;
|
||||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||||
self,
|
self,
|
||||||
folder: &mut F,
|
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>(
|
pub fn fold_excepthandler<U, F: Fold<U> + ?Sized>(
|
||||||
#[allow(unused)] folder: &mut F,
|
#[allow(unused)] folder: &mut F,
|
||||||
node: Excepthandler<U>,
|
node: ExceptHandler<U>,
|
||||||
) -> Result<Excepthandler<F::TargetU>, F::Error> {
|
) -> Result<ExceptHandler<F::TargetU>, F::Error> {
|
||||||
let folded = match node {
|
let folded = match node {
|
||||||
Excepthandler::ExceptHandler(cons) => {
|
ExceptHandler::ExceptHandler(cons) => {
|
||||||
Excepthandler::ExceptHandler(Foldable::fold(cons, folder)?)
|
ExceptHandler::ExceptHandler(Foldable::fold(cons, folder)?)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ok(folded)
|
Ok(folded)
|
||||||
}
|
}
|
||||||
impl<T, U> Foldable<T, U> for ExcepthandlerExceptHandler<T> {
|
impl<T, U> Foldable<T, U> for ExceptHandlerExceptHandler<T> {
|
||||||
type Mapped = ExcepthandlerExceptHandler<U>;
|
type Mapped = ExceptHandlerExceptHandler<U>;
|
||||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||||
self,
|
self,
|
||||||
folder: &mut F,
|
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>(
|
pub fn fold_excepthandler_except_handler<U, F: Fold<U> + ?Sized>(
|
||||||
#[allow(unused)] folder: &mut F,
|
#[allow(unused)] folder: &mut F,
|
||||||
node: ExcepthandlerExceptHandler<U>,
|
node: ExceptHandlerExceptHandler<U>,
|
||||||
) -> Result<ExcepthandlerExceptHandler<F::TargetU>, F::Error> {
|
) -> Result<ExceptHandlerExceptHandler<F::TargetU>, F::Error> {
|
||||||
let ExcepthandlerExceptHandler {
|
let ExceptHandlerExceptHandler {
|
||||||
type_,
|
type_,
|
||||||
name,
|
name,
|
||||||
body,
|
body,
|
||||||
|
@ -2349,7 +2349,7 @@ pub fn fold_excepthandler_except_handler<U, F: Fold<U> + ?Sized>(
|
||||||
let name = Foldable::fold(name, folder)?;
|
let name = Foldable::fold(name, folder)?;
|
||||||
let body = Foldable::fold(body, folder)?;
|
let body = Foldable::fold(body, folder)?;
|
||||||
let range = folder.map_user(range, context)?;
|
let range = folder.map_user(range, context)?;
|
||||||
Ok(ExcepthandlerExceptHandler {
|
Ok(ExceptHandlerExceptHandler {
|
||||||
type_,
|
type_,
|
||||||
name,
|
name,
|
||||||
body,
|
body,
|
||||||
|
@ -2472,8 +2472,8 @@ pub fn fold_alias<U, F: Fold<U> + ?Sized>(
|
||||||
range,
|
range,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
impl<T, U> Foldable<T, U> for Withitem<T> {
|
impl<T, U> Foldable<T, U> for WithItem<T> {
|
||||||
type Mapped = Withitem<U>;
|
type Mapped = WithItem<U>;
|
||||||
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
fn fold<F: Fold<T, TargetU = U> + ?Sized>(
|
||||||
self,
|
self,
|
||||||
folder: &mut F,
|
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>(
|
pub fn fold_withitem<U, F: Fold<U> + ?Sized>(
|
||||||
#[allow(unused)] folder: &mut F,
|
#[allow(unused)] folder: &mut F,
|
||||||
node: Withitem<U>,
|
node: WithItem<U>,
|
||||||
) -> Result<Withitem<F::TargetU>, F::Error> {
|
) -> Result<WithItem<F::TargetU>, F::Error> {
|
||||||
let Withitem {
|
let WithItem {
|
||||||
context_expr,
|
context_expr,
|
||||||
optional_vars,
|
optional_vars,
|
||||||
range,
|
range,
|
||||||
|
@ -2494,7 +2494,7 @@ pub fn fold_withitem<U, F: Fold<U> + ?Sized>(
|
||||||
let context_expr = Foldable::fold(context_expr, folder)?;
|
let context_expr = Foldable::fold(context_expr, folder)?;
|
||||||
let optional_vars = Foldable::fold(optional_vars, folder)?;
|
let optional_vars = Foldable::fold(optional_vars, folder)?;
|
||||||
let range = folder.map_user_cfg(range, context)?;
|
let range = folder.map_user_cfg(range, context)?;
|
||||||
Ok(Withitem {
|
Ok(WithItem {
|
||||||
context_expr,
|
context_expr,
|
||||||
optional_vars,
|
optional_vars,
|
||||||
range,
|
range,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -989,11 +989,11 @@ pub type ExprContextStore = crate::generic::ExprContextStore;
|
||||||
|
|
||||||
pub type ExprContextDel = crate::generic::ExprContextDel;
|
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;
|
pub type Operator = crate::generic::Operator;
|
||||||
|
|
||||||
|
@ -1023,37 +1023,37 @@ pub type OperatorBitAnd = crate::generic::OperatorBitAnd;
|
||||||
|
|
||||||
pub type OperatorFloorDiv = crate::generic::OperatorFloorDiv;
|
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>;
|
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 {
|
fn range(&self) -> SourceRange {
|
||||||
self.range
|
self.range
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LocatedMut for ExcepthandlerExceptHandler {
|
impl LocatedMut for ExceptHandlerExceptHandler {
|
||||||
fn range_mut(&mut self) -> &mut SourceRange {
|
fn range_mut(&mut self) -> &mut SourceRange {
|
||||||
&mut self.range
|
&mut self.range
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Located for Excepthandler {
|
impl Located for ExceptHandler {
|
||||||
fn range(&self) -> SourceRange {
|
fn range(&self) -> SourceRange {
|
||||||
match self {
|
match self {
|
||||||
Self::ExceptHandler(node) => node.range(),
|
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 {
|
fn range_mut(&mut self) -> &mut SourceRange {
|
||||||
match self {
|
match self {
|
||||||
Self::ExceptHandler(node) => node.range_mut(),
|
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")]
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
impl Located for Withitem {
|
impl Located for WithItem {
|
||||||
fn range(&self) -> SourceRange {
|
fn range(&self) -> SourceRange {
|
||||||
self.range
|
self.range
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "all-nodes-with-ranges")]
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
impl LocatedMut for Withitem {
|
impl LocatedMut for WithItem {
|
||||||
fn range_mut(&mut self) -> &mut SourceRange {
|
fn range_mut(&mut self) -> &mut SourceRange {
|
||||||
&mut self.range
|
&mut self.range
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,12 +380,12 @@ impl Ranged for crate::generic::Comprehension<TextRange> {
|
||||||
self.range
|
self.range
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Ranged for crate::generic::ExcepthandlerExceptHandler<TextRange> {
|
impl Ranged for crate::generic::ExceptHandlerExceptHandler<TextRange> {
|
||||||
fn range(&self) -> TextRange {
|
fn range(&self) -> TextRange {
|
||||||
self.range
|
self.range
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Ranged for crate::Excepthandler {
|
impl Ranged for crate::ExceptHandler {
|
||||||
fn range(&self) -> TextRange {
|
fn range(&self) -> TextRange {
|
||||||
match self {
|
match self {
|
||||||
Self::ExceptHandler(node) => node.range(),
|
Self::ExceptHandler(node) => node.range(),
|
||||||
|
@ -415,7 +415,7 @@ impl Ranged for crate::generic::Alias<TextRange> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "all-nodes-with-ranges")]
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
impl Ranged for crate::generic::Withitem<TextRange> {
|
impl Ranged for crate::generic::WithItem<TextRange> {
|
||||||
fn range(&self) -> TextRange {
|
fn range(&self) -> TextRange {
|
||||||
self.range
|
self.range
|
||||||
}
|
}
|
||||||
|
|
|
@ -665,38 +665,38 @@ pub trait Visitor<R = crate::text_size::TextRange> {
|
||||||
self.generic_visit_expr_context(node)
|
self.generic_visit_expr_context(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_context(&mut self, node: ExprContext) {}
|
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)
|
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) {
|
fn visit_operator(&mut self, node: Operator) {
|
||||||
self.generic_visit_operator(node)
|
self.generic_visit_operator(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_operator(&mut self, node: Operator) {}
|
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)
|
self.generic_visit_unaryop(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_unaryop(&mut self, node: Unaryop) {}
|
fn generic_visit_unaryop(&mut self, node: UnaryOp) {}
|
||||||
fn visit_cmpop(&mut self, node: Cmpop) {
|
fn visit_cmpop(&mut self, node: CmpOp) {
|
||||||
self.generic_visit_cmpop(node)
|
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>) {
|
fn visit_comprehension(&mut self, node: Comprehension<R>) {
|
||||||
self.generic_visit_comprehension(node)
|
self.generic_visit_comprehension(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_comprehension(&mut self, node: Comprehension<R>) {}
|
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)
|
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 {
|
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)
|
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_ {
|
if let Some(value) = node.type_ {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
|
@ -720,10 +720,10 @@ pub trait Visitor<R = crate::text_size::TextRange> {
|
||||||
self.generic_visit_alias(node)
|
self.generic_visit_alias(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_alias(&mut self, node: Alias<R>) {}
|
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)
|
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>) {
|
fn visit_match_case(&mut self, node: MatchCase<R>) {
|
||||||
self.generic_visit_match_case(node)
|
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 {
|
pub fn as_str(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Cmpop::Eq => "==",
|
CmpOp::Eq => "==",
|
||||||
Cmpop::NotEq => "!=",
|
CmpOp::NotEq => "!=",
|
||||||
Cmpop::Lt => "<",
|
CmpOp::Lt => "<",
|
||||||
Cmpop::LtE => "<=",
|
CmpOp::LtE => "<=",
|
||||||
Cmpop::Gt => ">",
|
CmpOp::Gt => ">",
|
||||||
Cmpop::GtE => ">=",
|
CmpOp::GtE => ">=",
|
||||||
Cmpop::Is => "is",
|
CmpOp::Is => "is",
|
||||||
Cmpop::IsNot => "is not",
|
CmpOp::IsNot => "is not",
|
||||||
Cmpop::In => "in",
|
CmpOp::In => "in",
|
||||||
Cmpop::NotIn => "not in",
|
CmpOp::NotIn => "not in",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,4 +61,4 @@ static_assertions::assert_eq_size!(crate::Stmt, [u8; 136]);
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
static_assertions::assert_eq_size!(crate::Pattern, [u8; 96]);
|
static_assertions::assert_eq_size!(crate::Pattern, [u8; 96]);
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
static_assertions::assert_eq_size!(crate::Excepthandler, [u8; 64]);
|
static_assertions::assert_eq_size!(crate::ExceptHandler, [u8; 64]);
|
||||||
|
|
|
@ -6,6 +6,14 @@
|
||||||
//!
|
//!
|
||||||
//! [PythonArguments] is replaced by [Arguments]. The new [Arguments] type representation uses a new type
|
//! [PythonArguments] is replaced by [Arguments]. The new [Arguments] type representation uses a new type
|
||||||
//! [ArgWithDefault] to represent arguments with default values. See each type documentation for more details.
|
//! [ArgWithDefault] to represent arguments with default values. See each type documentation for more details.
|
||||||
|
//!
|
||||||
|
//! A few top-level sum types are renamed to human friendly names.
|
||||||
|
//! [CmpOp] refers `cmpop`
|
||||||
|
//! [UnaryOp] refers `unaryop`
|
||||||
|
//! [BoolOp] refers `boolop`
|
||||||
|
//! [WithItem] refers `withitem`
|
||||||
|
//! [ExceptHandler] refers `excepthandler`
|
||||||
|
//!
|
||||||
|
|
||||||
mod builtin;
|
mod builtin;
|
||||||
mod generic;
|
mod generic;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
Arg, ArgWithDefault, Arguments, Boolop, Comprehension, Constant, ConversionFlag, Expr,
|
Arg, ArgWithDefault, Arguments, BoolOp, Comprehension, Constant, ConversionFlag, Expr,
|
||||||
Identifier, Operator, PythonArguments,
|
Identifier, Operator, PythonArguments,
|
||||||
};
|
};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -79,7 +79,7 @@ impl<'a> Unparser<'a> {
|
||||||
values,
|
values,
|
||||||
range: _range,
|
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, {
|
group_if!(prec, {
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
for val in values {
|
for val in values {
|
||||||
|
@ -138,7 +138,7 @@ impl<'a> Unparser<'a> {
|
||||||
let (op, prec) = op_prec!(
|
let (op, prec) = op_prec!(
|
||||||
un,
|
un,
|
||||||
op,
|
op,
|
||||||
crate::Unaryop,
|
crate::UnaryOp,
|
||||||
Invert("~", FACTOR),
|
Invert("~", FACTOR),
|
||||||
Not("not ", NOT),
|
Not("not ", NOT),
|
||||||
UAdd("+", FACTOR),
|
UAdd("+", FACTOR),
|
||||||
|
|
|
@ -509,7 +509,7 @@ ConstantExpr: ast::Expr = {
|
||||||
ConstantAtom,
|
ConstantAtom,
|
||||||
<location:@L> "-" <operand:ConstantAtom> <end_location:@R> => ast::Expr::UnaryOp(
|
<location:@L> "-" <operand:ConstantAtom> <end_location:@R> => ast::Expr::UnaryOp(
|
||||||
ast::ExprUnaryOp {
|
ast::ExprUnaryOp {
|
||||||
op: ast::Unaryop::USub,
|
op: ast::UnaryOp::USub,
|
||||||
operand: Box::new(operand),
|
operand: Box::new(operand),
|
||||||
range: (location..end_location).into()
|
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> => {
|
<location:@L> "except" "*" <typ:Test<"all">> ":" <body:Suite> => {
|
||||||
let end_location = body.last().unwrap().end();
|
let end_location = body.last().unwrap().end();
|
||||||
ast::Excepthandler::ExceptHandler(
|
ast::ExceptHandler::ExceptHandler(
|
||||||
ast::ExcepthandlerExceptHandler {
|
ast::ExceptHandlerExceptHandler {
|
||||||
type_: Some(Box::new(typ)),
|
type_: Some(Box::new(typ)),
|
||||||
name: None,
|
name: None,
|
||||||
body,
|
body,
|
||||||
|
@ -889,8 +889,8 @@ ExceptStarClause: ast::Excepthandler = {
|
||||||
},
|
},
|
||||||
<location:@L> "except" "*" <x:(<Test<"all">> "as" <Identifier>)> ":" <body:Suite> => {
|
<location:@L> "except" "*" <x:(<Test<"all">> "as" <Identifier>)> ":" <body:Suite> => {
|
||||||
let end_location = body.last().unwrap().end();
|
let end_location = body.last().unwrap().end();
|
||||||
ast::Excepthandler::ExceptHandler(
|
ast::ExceptHandler::ExceptHandler(
|
||||||
ast::ExcepthandlerExceptHandler {
|
ast::ExceptHandlerExceptHandler {
|
||||||
type_: Some(Box::new(x.0)),
|
type_: Some(Box::new(x.0)),
|
||||||
name: Some(x.1),
|
name: Some(x.1),
|
||||||
body,
|
body,
|
||||||
|
@ -901,11 +901,11 @@ ExceptStarClause: ast::Excepthandler = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ExceptClause: ast::Excepthandler = {
|
ExceptClause: ast::ExceptHandler = {
|
||||||
<location:@L> "except" <typ:Test<"all">?> ":" <body:Suite> => {
|
<location:@L> "except" <typ:Test<"all">?> ":" <body:Suite> => {
|
||||||
let end_location = body.last().unwrap().end();
|
let end_location = body.last().unwrap().end();
|
||||||
ast::Excepthandler::ExceptHandler(
|
ast::ExceptHandler::ExceptHandler(
|
||||||
ast::ExcepthandlerExceptHandler {
|
ast::ExceptHandlerExceptHandler {
|
||||||
type_: typ.map(Box::new),
|
type_: typ.map(Box::new),
|
||||||
name: None,
|
name: None,
|
||||||
body,
|
body,
|
||||||
|
@ -915,8 +915,8 @@ ExceptClause: ast::Excepthandler = {
|
||||||
},
|
},
|
||||||
<location:@L> "except" <x:(<Test<"all">> "as" <Identifier>)> ":" <body:Suite> => {
|
<location:@L> "except" <x:(<Test<"all">> "as" <Identifier>)> ":" <body:Suite> => {
|
||||||
let end_location = body.last().unwrap().end();
|
let end_location = body.last().unwrap().end();
|
||||||
ast::Excepthandler::ExceptHandler(
|
ast::ExceptHandler::ExceptHandler(
|
||||||
ast::ExcepthandlerExceptHandler {
|
ast::ExceptHandlerExceptHandler {
|
||||||
type_: Some(Box::new(x.0)),
|
type_: Some(Box::new(x.0)),
|
||||||
name: Some(x.1),
|
name: Some(x.1),
|
||||||
body,
|
body,
|
||||||
|
@ -938,7 +938,7 @@ WithStatement: ast::Stmt = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
WithItems: Vec<ast::Withitem> = {
|
WithItems: Vec<ast::WithItem> = {
|
||||||
"(" <WithItemsNoAs> ","? ")",
|
"(" <WithItemsNoAs> ","? ")",
|
||||||
"(" <left:(<WithItemsNoAs> ",")?> <mid:WithItem<"as">> <right:("," <WithItem<"all">>)*> ","? ")" => {
|
"(" <left:(<WithItemsNoAs> ",")?> <mid:WithItem<"as">> <right:("," <WithItem<"all">>)*> ","? ")" => {
|
||||||
left.into_iter().flatten().chain([mid]).chain(right).collect()
|
left.into_iter().flatten().chain([mid]).chain(right).collect()
|
||||||
|
@ -950,17 +950,17 @@ WithItems: Vec<ast::Withitem> = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
WithItemsNoAs: Vec<ast::Withitem> = {
|
WithItemsNoAs: Vec<ast::WithItem> = {
|
||||||
<location:@L> <all:OneOrMore<Test<"all">>> <end_location:@R> => {
|
<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 = {
|
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<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> => {
|
<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)));
|
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> => {
|
<location:@L> <mut values:(<AndTest<"all">> "or")+> <last: AndTest<"all">> <end_location:@R> => {
|
||||||
values.push(last);
|
values.push(last);
|
||||||
ast::Expr::BoolOp(
|
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>,
|
AndTest<Goal>,
|
||||||
|
@ -1222,7 +1222,7 @@ AndTest<Goal>: ast::Expr = {
|
||||||
<location:@L> <mut values:(<NotTest<"all">> "and")+> <last:NotTest<"all">> <end_location:@R> => {
|
<location:@L> <mut values:(<NotTest<"all">> "and")+> <last:NotTest<"all">> <end_location:@R> => {
|
||||||
values.push(last);
|
values.push(last);
|
||||||
ast::Expr::BoolOp(
|
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>,
|
NotTest<Goal>,
|
||||||
|
@ -1230,7 +1230,7 @@ AndTest<Goal>: ast::Expr = {
|
||||||
|
|
||||||
NotTest<Goal>: ast::Expr = {
|
NotTest<Goal>: ast::Expr = {
|
||||||
<location:@L> "not" <e:NotTest<"all">> <end_location:@R> => ast::Expr::UnaryOp(
|
<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>,
|
Comparison<Goal>,
|
||||||
};
|
};
|
||||||
|
@ -1245,17 +1245,17 @@ Comparison<Goal>: ast::Expr = {
|
||||||
Expression<Goal>,
|
Expression<Goal>,
|
||||||
};
|
};
|
||||||
|
|
||||||
CompOp: ast::Cmpop = {
|
CompOp: ast::CmpOp = {
|
||||||
"==" => ast::Cmpop::Eq,
|
"==" => ast::CmpOp::Eq,
|
||||||
"!=" => ast::Cmpop::NotEq,
|
"!=" => ast::CmpOp::NotEq,
|
||||||
"<" => ast::Cmpop::Lt,
|
"<" => ast::CmpOp::Lt,
|
||||||
"<=" => ast::Cmpop::LtE,
|
"<=" => ast::CmpOp::LtE,
|
||||||
">" => ast::Cmpop::Gt,
|
">" => ast::CmpOp::Gt,
|
||||||
">=" => ast::Cmpop::GtE,
|
">=" => ast::CmpOp::GtE,
|
||||||
"in" => ast::Cmpop::In,
|
"in" => ast::CmpOp::In,
|
||||||
"not" "in" => ast::Cmpop::NotIn,
|
"not" "in" => ast::CmpOp::NotIn,
|
||||||
"is" => ast::Cmpop::Is,
|
"is" => ast::CmpOp::Is,
|
||||||
"is" "not" => ast::Cmpop::IsNot,
|
"is" "not" => ast::CmpOp::IsNot,
|
||||||
};
|
};
|
||||||
|
|
||||||
Expression<Goal>: ast::Expr = {
|
Expression<Goal>: ast::Expr = {
|
||||||
|
@ -1325,10 +1325,10 @@ Factor<Goal>: ast::Expr = {
|
||||||
Power<Goal>,
|
Power<Goal>,
|
||||||
};
|
};
|
||||||
|
|
||||||
UnaryOp: ast::Unaryop = {
|
UnaryOp: ast::UnaryOp = {
|
||||||
"+" => ast::Unaryop::UAdd,
|
"+" => ast::UnaryOp::UAdd,
|
||||||
"-" => ast::Unaryop::USub,
|
"-" => ast::UnaryOp::USub,
|
||||||
"~" => ast::Unaryop::Invert,
|
"~" => ast::UnaryOp::Invert,
|
||||||
};
|
};
|
||||||
|
|
||||||
Power<Goal>: ast::Expr = {
|
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 {
|
StmtWith {
|
||||||
range: 0..17,
|
range: 0..17,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 5..11,
|
range: 5..11,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
|
|
@ -44,7 +44,7 @@ expression: parse_ast
|
||||||
],
|
],
|
||||||
handlers: [
|
handlers: [
|
||||||
ExceptHandler(
|
ExceptHandler(
|
||||||
ExcepthandlerExceptHandler {
|
ExceptHandlerExceptHandler {
|
||||||
range: 29..82,
|
range: 29..82,
|
||||||
type_: Some(
|
type_: Some(
|
||||||
Name(
|
Name(
|
||||||
|
@ -138,7 +138,7 @@ expression: parse_ast
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ExceptHandler(
|
ExceptHandler(
|
||||||
ExcepthandlerExceptHandler {
|
ExceptHandlerExceptHandler {
|
||||||
range: 83..134,
|
range: 83..134,
|
||||||
type_: Some(
|
type_: Some(
|
||||||
Name(
|
Name(
|
||||||
|
|
|
@ -156,7 +156,7 @@ expression: parse_ast
|
||||||
],
|
],
|
||||||
handlers: [
|
handlers: [
|
||||||
ExceptHandler(
|
ExceptHandler(
|
||||||
ExcepthandlerExceptHandler {
|
ExceptHandlerExceptHandler {
|
||||||
range: 99..180,
|
range: 99..180,
|
||||||
type_: Some(
|
type_: Some(
|
||||||
Name(
|
Name(
|
||||||
|
@ -284,7 +284,7 @@ expression: parse_ast
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ExceptHandler(
|
ExceptHandler(
|
||||||
ExcepthandlerExceptHandler {
|
ExceptHandlerExceptHandler {
|
||||||
range: 181..260,
|
range: 181..260,
|
||||||
type_: Some(
|
type_: Some(
|
||||||
Name(
|
Name(
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: "parse_program(source, \"<test>\").unwrap()"
|
expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
With(
|
With(
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 0..12,
|
range: 0..12,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 5..6,
|
range: 5..6,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -35,7 +35,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 13..30,
|
range: 13..30,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 18..24,
|
range: 18..24,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -73,7 +73,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 31..46,
|
range: 31..46,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 36..37,
|
range: 36..37,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -86,7 +86,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
),
|
),
|
||||||
optional_vars: None,
|
optional_vars: None,
|
||||||
},
|
},
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 39..40,
|
range: 39..40,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -114,7 +114,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 47..72,
|
range: 47..72,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 52..58,
|
range: 52..58,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -137,7 +137,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 60..66,
|
range: 60..66,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -175,7 +175,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 73..97,
|
range: 73..97,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 78..91,
|
range: 78..91,
|
||||||
context_expr: IfExp(
|
context_expr: IfExp(
|
||||||
ExprIfExp {
|
ExprIfExp {
|
||||||
|
@ -226,7 +226,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 98..127,
|
range: 98..127,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 103..121,
|
range: 103..121,
|
||||||
context_expr: IfExp(
|
context_expr: IfExp(
|
||||||
ExprIfExp {
|
ExprIfExp {
|
||||||
|
@ -287,7 +287,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 128..141,
|
range: 128..141,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 133..135,
|
range: 133..135,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -313,7 +313,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 142..160,
|
range: 142..160,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 147..154,
|
range: 147..154,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -349,7 +349,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 161..175,
|
range: 161..175,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 167..168,
|
range: 167..168,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -377,7 +377,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 176..195,
|
range: 176..195,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 181..189,
|
range: 181..189,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -415,7 +415,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 196..211,
|
range: 196..211,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 202..203,
|
range: 202..203,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -443,7 +443,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 212..232,
|
range: 212..232,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 217..226,
|
range: 217..226,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -489,7 +489,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 233..250,
|
range: 233..250,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 239..243,
|
range: 239..243,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -502,7 +502,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
),
|
),
|
||||||
optional_vars: None,
|
optional_vars: None,
|
||||||
},
|
},
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 239..243,
|
range: 239..243,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -530,7 +530,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 251..273,
|
range: 251..273,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 256..267,
|
range: 256..267,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -585,7 +585,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 274..290,
|
range: 274..290,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 279..284,
|
range: 279..284,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -627,7 +627,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 291..312,
|
range: 291..312,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 296..306,
|
range: 296..306,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -679,7 +679,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 313..331,
|
range: 313..331,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 318..325,
|
range: 318..325,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -730,7 +730,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 332..355,
|
range: 332..355,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 337..349,
|
range: 337..349,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -791,7 +791,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 356..375,
|
range: 356..375,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 361..369,
|
range: 361..369,
|
||||||
context_expr: NamedExpr(
|
context_expr: NamedExpr(
|
||||||
ExprNamedExpr {
|
ExprNamedExpr {
|
||||||
|
@ -833,7 +833,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 376..400,
|
range: 376..400,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 381..394,
|
range: 381..394,
|
||||||
context_expr: NamedExpr(
|
context_expr: NamedExpr(
|
||||||
ExprNamedExpr {
|
ExprNamedExpr {
|
||||||
|
@ -885,7 +885,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 401..428,
|
range: 401..428,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 406..422,
|
range: 406..422,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -958,7 +958,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 429..461,
|
range: 429..461,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 434..455,
|
range: 434..455,
|
||||||
context_expr: Tuple(
|
context_expr: Tuple(
|
||||||
ExprTuple {
|
ExprTuple {
|
||||||
|
@ -1041,7 +1041,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 462..481,
|
range: 462..481,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 468..474,
|
range: 468..474,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -1079,7 +1079,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 482..502,
|
range: 482..502,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 488..494,
|
range: 488..494,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -1117,7 +1117,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 503..530,
|
range: 503..530,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 509..515,
|
range: 509..515,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -1140,7 +1140,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 517..523,
|
range: 517..523,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -1178,7 +1178,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
StmtWith {
|
StmtWith {
|
||||||
range: 531..559,
|
range: 531..559,
|
||||||
items: [
|
items: [
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 537..543,
|
range: 537..543,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
@ -1201,7 +1201,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Withitem {
|
WithItem {
|
||||||
range: 545..551,
|
range: 545..551,
|
||||||
context_expr: Constant(
|
context_expr: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue