mirror of https://github.com/astral-sh/ruff
Move `range` from `Attributed` to `Node`s (#22)
* Move `range` from `Attributed` to `Node`s * No Attributed + custom for Range PoC * Generate all located variants, generate enum implementations * Implement `Copy` on simple enums * Move `Suite` to `ranged` and `located` * Update tests --------- Co-authored-by: Jeong YunWon <jeong@youknowone.org>
This commit is contained in:
parent
a983f4383f
commit
192379cede
|
|
@ -17,7 +17,7 @@ members = [
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
rustpython-ast = { path = "ast", default-features = false }
|
rustpython-ast = { path = "ast", default-features = false }
|
||||||
rustpython-parser-core = { path = "core", default-features = false }
|
rustpython-parser-core = { path = "core", features = [] }
|
||||||
rustpython-literal = { path = "literal" }
|
rustpython-literal = { path = "literal" }
|
||||||
|
|
||||||
ahash = "0.7.6"
|
ahash = "0.7.6"
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ location = ["fold", "rustpython-parser-core/location"]
|
||||||
fold = []
|
fold = []
|
||||||
unparse = ["rustpython-literal"]
|
unparse = ["rustpython-literal"]
|
||||||
visitor = []
|
visitor = []
|
||||||
|
all-nodes-with-ranges = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustpython-parser-core = { workspace = true }
|
rustpython-parser-core = { workspace = true }
|
||||||
|
|
@ -21,3 +22,4 @@ rustpython-literal = { workspace = true, optional = true }
|
||||||
|
|
||||||
is-macro = { workspace = true }
|
is-macro = { workspace = true }
|
||||||
num-bigint = { workspace = true }
|
num-bigint = { workspace = true }
|
||||||
|
static_assertions = "1.1.0"
|
||||||
|
|
|
||||||
403
ast/asdl_rs.py
403
ast/asdl_rs.py
|
|
@ -1,6 +1,6 @@
|
||||||
# spell-checker:words dfn dfns
|
# spell-checker:words dfn dfns
|
||||||
|
|
||||||
#! /usr/bin/env python
|
# ! /usr/bin/env python
|
||||||
"""Generate Rust code from an ASDL description."""
|
"""Generate Rust code from an ASDL description."""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -84,6 +84,7 @@ class TypeInfo:
|
||||||
enum_name: Optional[str]
|
enum_name: Optional[str]
|
||||||
has_user_data: Optional[bool]
|
has_user_data: Optional[bool]
|
||||||
has_attributes: bool
|
has_attributes: bool
|
||||||
|
is_simple: bool
|
||||||
empty_field: bool
|
empty_field: bool
|
||||||
children: set
|
children: set
|
||||||
boxed: bool
|
boxed: bool
|
||||||
|
|
@ -95,6 +96,7 @@ class TypeInfo:
|
||||||
self.enum_name = None
|
self.enum_name = None
|
||||||
self.has_user_data = None
|
self.has_user_data = None
|
||||||
self.has_attributes = False
|
self.has_attributes = False
|
||||||
|
self.is_simple = False
|
||||||
self.empty_field = False
|
self.empty_field = False
|
||||||
self.children = set()
|
self.children = set()
|
||||||
self.boxed = False
|
self.boxed = False
|
||||||
|
|
@ -104,6 +106,14 @@ class TypeInfo:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<TypeInfo: {self.name}>"
|
return f"<TypeInfo: {self.name}>"
|
||||||
|
|
||||||
|
def no_cfg(self, typeinfo):
|
||||||
|
if self.product:
|
||||||
|
return self.has_attributes
|
||||||
|
elif self.enum_name:
|
||||||
|
return typeinfo[self.enum_name].has_attributes
|
||||||
|
else:
|
||||||
|
return self.has_attributes
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def rust_name(self):
|
def rust_name(self):
|
||||||
return rust_type_name(self.name)
|
return rust_type_name(self.name)
|
||||||
|
|
@ -124,19 +134,6 @@ class TypeInfo:
|
||||||
name = rust_type_name(self.enum_name) + rust_name
|
name = rust_type_name(self.enum_name) + rust_name
|
||||||
return name
|
return name
|
||||||
|
|
||||||
@property
|
|
||||||
def rust_suffix(self):
|
|
||||||
if self.product:
|
|
||||||
if self.has_attributes:
|
|
||||||
return "Data"
|
|
||||||
else:
|
|
||||||
return ""
|
|
||||||
else:
|
|
||||||
if self.has_attributes:
|
|
||||||
return "Kind"
|
|
||||||
else:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def determine_user_data(self, type_info, stack):
|
def determine_user_data(self, type_info, stack):
|
||||||
if self.name in stack:
|
if self.name in stack:
|
||||||
return None
|
return None
|
||||||
|
|
@ -160,7 +157,8 @@ class TypeInfoMixin:
|
||||||
return self.type_info[typ].has_user_data
|
return self.type_info[typ].has_user_data
|
||||||
|
|
||||||
def apply_generics(self, typ, *generics):
|
def apply_generics(self, typ, *generics):
|
||||||
if self.has_user_data(typ):
|
needs_generics = not self.type_info[typ].is_simple
|
||||||
|
if needs_generics:
|
||||||
return [f"<{g}>" for g in generics]
|
return [f"<{g}>" for g in generics]
|
||||||
else:
|
else:
|
||||||
return ["" for g in generics]
|
return ["" for g in generics]
|
||||||
|
|
@ -208,6 +206,7 @@ class FindUserDataTypesVisitor(asdl.VisitorBase):
|
||||||
info = self.type_info[name]
|
info = self.type_info[name]
|
||||||
if is_simple(sum):
|
if is_simple(sum):
|
||||||
info.has_user_data = False
|
info.has_user_data = False
|
||||||
|
info.is_simple = True
|
||||||
else:
|
else:
|
||||||
for t in sum.types:
|
for t in sum.types:
|
||||||
t_info = TypeInfo(t.name)
|
t_info = TypeInfo(t.name)
|
||||||
|
|
@ -218,7 +217,7 @@ class FindUserDataTypesVisitor(asdl.VisitorBase):
|
||||||
if len(sum.types) > 1:
|
if len(sum.types) > 1:
|
||||||
info.boxed = True
|
info.boxed = True
|
||||||
if sum.attributes:
|
if sum.attributes:
|
||||||
# attributes means located, which has the `custom: U` field
|
# attributes means located, which has the `range: R` field
|
||||||
info.has_user_data = True
|
info.has_user_data = True
|
||||||
info.has_attributes = True
|
info.has_attributes = True
|
||||||
|
|
||||||
|
|
@ -228,7 +227,7 @@ class FindUserDataTypesVisitor(asdl.VisitorBase):
|
||||||
def visitProduct(self, product, name):
|
def visitProduct(self, product, name):
|
||||||
info = self.type_info[name]
|
info = self.type_info[name]
|
||||||
if product.attributes:
|
if product.attributes:
|
||||||
# attributes means located, which has the `custom: U` field
|
# attributes means located, which has the `range: R` field
|
||||||
info.has_user_data = True
|
info.has_user_data = True
|
||||||
info.has_attributes = True
|
info.has_attributes = True
|
||||||
info.has_expr = product_has_expr(product)
|
info.has_expr = product_has_expr(product)
|
||||||
|
|
@ -277,10 +276,16 @@ class StructVisitor(EmitVisitor):
|
||||||
def emit_attrs(self, depth):
|
def emit_attrs(self, depth):
|
||||||
self.emit("#[derive(Clone, Debug, PartialEq)]", depth)
|
self.emit("#[derive(Clone, Debug, PartialEq)]", depth)
|
||||||
|
|
||||||
|
def emit_range(self, has_attributes, depth):
|
||||||
|
if has_attributes:
|
||||||
|
self.emit("pub range: R,", depth + 1)
|
||||||
|
else:
|
||||||
|
self.emit("pub range: crate::ranged::OptionalRange<R>,", depth + 1)
|
||||||
|
|
||||||
def simple_sum(self, sum, name, depth):
|
def simple_sum(self, sum, name, depth):
|
||||||
rust_name = rust_type_name(name)
|
rust_name = rust_type_name(name)
|
||||||
self.emit_attrs(depth)
|
self.emit_attrs(depth)
|
||||||
self.emit("#[derive(is_macro::Is)]", depth)
|
self.emit("#[derive(is_macro::Is, Copy, Hash, Eq)]", depth)
|
||||||
self.emit(f"pub enum {rust_name} {{", depth)
|
self.emit(f"pub enum {rust_name} {{", depth)
|
||||||
for variant in sum.types:
|
for variant in sum.types:
|
||||||
self.emit(f"{variant.name},", depth + 1)
|
self.emit(f"{variant.name},", depth + 1)
|
||||||
|
|
@ -289,20 +294,16 @@ class StructVisitor(EmitVisitor):
|
||||||
|
|
||||||
def sum_with_constructors(self, sum, name, depth):
|
def sum_with_constructors(self, sum, name, depth):
|
||||||
type_info = self.type_info[name]
|
type_info = self.type_info[name]
|
||||||
suffix = type_info.rust_suffix
|
|
||||||
rust_name = rust_type_name(name)
|
rust_name = rust_type_name(name)
|
||||||
# all the attributes right now are for location, so if it has attrs we
|
# all the attributes right now are for location, so if it has attrs we
|
||||||
# can just wrap it in Attributed<>
|
# can just wrap it in Attributed<>
|
||||||
|
|
||||||
for t in sum.types:
|
for t in sum.types:
|
||||||
if not t.fields:
|
|
||||||
continue
|
|
||||||
self.sum_subtype_struct(type_info, t, rust_name, depth)
|
self.sum_subtype_struct(type_info, t, rust_name, depth)
|
||||||
|
|
||||||
generics, generics_applied = self.apply_generics(name, "U = ()", "U")
|
|
||||||
self.emit_attrs(depth)
|
self.emit_attrs(depth)
|
||||||
self.emit("#[derive(is_macro::Is)]", depth)
|
self.emit("#[derive(is_macro::Is)]", depth)
|
||||||
self.emit(f"pub enum {rust_name}{suffix}{generics} {{", depth)
|
self.emit(f"pub enum {rust_name}<R = TextRange> {{", depth)
|
||||||
needs_escape = any(rust_field_name(t.name) in RUST_KEYWORDS for t in sum.types)
|
needs_escape = any(rust_field_name(t.name) in RUST_KEYWORDS for t in sum.types)
|
||||||
for t in sum.types:
|
for t in sum.types:
|
||||||
if needs_escape:
|
if needs_escape:
|
||||||
|
|
@ -310,35 +311,29 @@ class StructVisitor(EmitVisitor):
|
||||||
f'#[is(name = "{rust_field_name(t.name)}_{rust_name.lower()}")]',
|
f'#[is(name = "{rust_field_name(t.name)}_{rust_name.lower()}")]',
|
||||||
depth + 1,
|
depth + 1,
|
||||||
)
|
)
|
||||||
if t.fields:
|
self.emit(f"{t.name}({rust_name}{t.name}<R>),", depth + 1)
|
||||||
(t_generics_applied,) = self.apply_generics(t.name, "U")
|
|
||||||
self.emit(
|
|
||||||
f"{t.name}({rust_name}{t.name}{t_generics_applied}),", depth + 1
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
self.emit(f"{t.name},", depth + 1)
|
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
if type_info.has_attributes:
|
|
||||||
self.emit(
|
|
||||||
f"pub type {rust_name}<U = ()> = Attributed<{rust_name}{suffix}{generics_applied}, U>;",
|
|
||||||
depth,
|
|
||||||
)
|
|
||||||
self.emit("", depth)
|
self.emit("", 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_attrs(depth)
|
self.emit_attrs(depth)
|
||||||
generics, generics_applied = self.apply_generics(t.name, "U = ()", "U")
|
|
||||||
payload_name = f"{rust_name}{t.name}"
|
payload_name = f"{rust_name}{t.name}"
|
||||||
self.emit(f"pub struct {payload_name}{generics} {{", depth)
|
self.emit(f"pub struct {payload_name}<R = TextRange> {{", depth)
|
||||||
|
self.emit_range(sum_type_info.has_attributes, depth)
|
||||||
for f in t.fields:
|
for f in t.fields:
|
||||||
self.visit(f, sum_type_info, "pub ", depth + 1, t.name)
|
self.visit(f, sum_type_info, "pub ", depth + 1, t.name)
|
||||||
|
|
||||||
|
assert sum_type_info.has_attributes == self.type_info[t.name].no_cfg(
|
||||||
|
self.type_info
|
||||||
|
)
|
||||||
|
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
self.emit(
|
self.emit(
|
||||||
textwrap.dedent(
|
textwrap.dedent(
|
||||||
f"""
|
f"""
|
||||||
impl{generics_applied} From<{payload_name}{generics_applied}> for {rust_name}{sum_type_info.rust_suffix}{generics_applied} {{
|
impl<R> From<{payload_name}<R>> for {rust_name}<R> {{
|
||||||
fn from(payload: {payload_name}{generics_applied}) -> Self {{
|
fn from(payload: {payload_name}<R>) -> Self {{
|
||||||
{rust_name}{sum_type_info.rust_suffix}::{t.name}(payload)
|
{rust_name}::{t.name}(payload)
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
"""
|
"""
|
||||||
|
|
@ -346,6 +341,8 @@ class StructVisitor(EmitVisitor):
|
||||||
depth,
|
depth,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.emit("", depth)
|
||||||
|
|
||||||
def visitConstructor(self, cons, parent, depth):
|
def visitConstructor(self, cons, parent, depth):
|
||||||
if cons.fields:
|
if cons.fields:
|
||||||
self.emit(f"{cons.name} {{", depth)
|
self.emit(f"{cons.name} {{", depth)
|
||||||
|
|
@ -358,21 +355,21 @@ class StructVisitor(EmitVisitor):
|
||||||
def visitField(self, field, parent, vis, depth, constructor=None):
|
def visitField(self, field, parent, vis, depth, constructor=None):
|
||||||
typ = rust_type_name(field.type)
|
typ = rust_type_name(field.type)
|
||||||
field_type = self.type_info.get(field.type)
|
field_type = self.type_info.get(field.type)
|
||||||
if field_type and field_type.has_user_data:
|
if field_type and not field_type.is_simple:
|
||||||
typ = f"{typ}<U>"
|
typ = f"{typ}<R>"
|
||||||
# don't box if we're doing Vec<T>, but do box if we're doing Vec<Option<Box<T>>>
|
# don't box if we're doing Vec<T>, but do box if we're doing Vec<Option<Box<T>>>
|
||||||
if (
|
if (
|
||||||
field_type
|
field_type
|
||||||
and field_type.boxed
|
and field_type.boxed
|
||||||
and (not (parent.product or field.seq) or field.opt)
|
and (not (parent.product or field.seq) or field.opt)
|
||||||
):
|
):
|
||||||
typ = f"Box<{typ}>"
|
typ = f"Box<{typ}>"
|
||||||
if field.opt or (
|
if field.opt or (
|
||||||
# When a dictionary literal contains dictionary unpacking (e.g., `{**d}`),
|
# When a dictionary literal contains dictionary unpacking (e.g., `{**d}`),
|
||||||
# the expression to be unpacked goes in `values` with a `None` at the corresponding
|
# the expression to be unpacked goes in `values` with a `None` at the corresponding
|
||||||
# position in `keys`. To handle this, the type of `keys` needs to be `Option<Vec<T>>`.
|
# position in `keys`. To handle this, the type of `keys` needs to be `Option<Vec<T>>`.
|
||||||
constructor == "Dict"
|
constructor == "Dict"
|
||||||
and field.name == "keys"
|
and field.name == "keys"
|
||||||
):
|
):
|
||||||
typ = f"Option<{typ}>"
|
typ = f"Option<{typ}>"
|
||||||
if field.seq:
|
if field.seq:
|
||||||
|
|
@ -384,28 +381,15 @@ class StructVisitor(EmitVisitor):
|
||||||
|
|
||||||
def visitProduct(self, product, name, depth):
|
def visitProduct(self, product, name, depth):
|
||||||
type_info = self.type_info[name]
|
type_info = self.type_info[name]
|
||||||
generics, generics_applied = self.apply_generics(name, "U = ()", "U")
|
product_name = rust_type_name(name)
|
||||||
data_name = rust_name = rust_type_name(name)
|
|
||||||
if product.attributes:
|
|
||||||
data_name = rust_name + "Data"
|
|
||||||
self.emit_attrs(depth)
|
self.emit_attrs(depth)
|
||||||
has_expr = product_has_expr(product)
|
|
||||||
if has_expr:
|
self.emit(f"pub struct {product_name}<R = TextRange> {{", depth)
|
||||||
data_def = f"{data_name}{generics}"
|
|
||||||
else:
|
|
||||||
data_def = data_name
|
|
||||||
self.emit(f"pub struct {data_def} {{", depth)
|
|
||||||
for f in product.fields:
|
for f in product.fields:
|
||||||
self.visit(f, type_info, "pub ", depth + 1)
|
self.visit(f, type_info, "pub ", depth + 1)
|
||||||
|
assert bool(product.attributes) == type_info.no_cfg(self.type_info)
|
||||||
|
self.emit_range(product.attributes, depth + 1)
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
if product.attributes:
|
|
||||||
# attributes should just be location info
|
|
||||||
if not has_expr:
|
|
||||||
generics_applied = ""
|
|
||||||
self.emit(
|
|
||||||
f"pub type {rust_name}<U = ()> = Attributed<{data_name}{generics_applied}, U>;",
|
|
||||||
depth,
|
|
||||||
)
|
|
||||||
self.emit("", depth)
|
self.emit("", depth)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -414,16 +398,18 @@ class FoldTraitDefVisitor(EmitVisitor):
|
||||||
self.emit("pub trait Fold<U> {", depth)
|
self.emit("pub trait Fold<U> {", depth)
|
||||||
self.emit("type TargetU;", depth + 1)
|
self.emit("type TargetU;", depth + 1)
|
||||||
self.emit("type Error;", depth + 1)
|
self.emit("type Error;", depth + 1)
|
||||||
self.emit(
|
|
||||||
"fn map_user(&mut self, user: U) -> Result<Self::TargetU, Self::Error>;",
|
|
||||||
depth + 1,
|
|
||||||
)
|
|
||||||
self.emit(
|
self.emit(
|
||||||
"""
|
"""
|
||||||
fn map_attributed<T>(&mut self, attributed: Attributed<T, U>) -> Result<Attributed<T, Self::TargetU>, Self::Error> {
|
fn map_user(&mut self, user: U) -> Result<Self::TargetU, Self::Error>;
|
||||||
let custom = self.map_user(attributed.custom)?;
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
Ok(Attributed { range: attributed.range, custom, node: attributed.node })
|
fn map_user_cfg(&mut self, user: U) -> Result<Self::TargetU, Self::Error> {
|
||||||
}""",
|
self.map_user(user)
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
|
fn map_user_cfg(&mut self, _user: crate::EmptyRange<U>) -> Result<crate::EmptyRange<Self::TargetU>, Self::Error> {
|
||||||
|
Ok(crate::EmptyRange::default())
|
||||||
|
}
|
||||||
|
""",
|
||||||
depth + 1,
|
depth + 1,
|
||||||
)
|
)
|
||||||
self.emit(
|
self.emit(
|
||||||
|
|
@ -451,15 +437,6 @@ class FoldTraitDefVisitor(EmitVisitor):
|
||||||
|
|
||||||
class FoldImplVisitor(EmitVisitor):
|
class FoldImplVisitor(EmitVisitor):
|
||||||
def visitModule(self, mod, depth):
|
def visitModule(self, mod, depth):
|
||||||
self.emit(
|
|
||||||
"fn fold_attributed<U, F: Fold<U> + ?Sized, T, MT>(folder: &mut F, node: Attributed<T, U>, f: impl FnOnce(&mut F, T) -> Result<MT, F::Error>) -> Result<Attributed<MT, F::TargetU>, F::Error> {",
|
|
||||||
depth,
|
|
||||||
)
|
|
||||||
self.emit(
|
|
||||||
"let node = folder.map_attributed(node)?; Ok(Attributed { custom: node.custom, range: node.range, node: f(folder, node.node)? })",
|
|
||||||
depth + 1,
|
|
||||||
)
|
|
||||||
self.emit("}", depth)
|
|
||||||
for dfn in mod.dfns:
|
for dfn in mod.dfns:
|
||||||
self.visit(dfn, depth)
|
self.visit(dfn, depth)
|
||||||
|
|
||||||
|
|
@ -472,6 +449,7 @@ class FoldImplVisitor(EmitVisitor):
|
||||||
name, "T", "U", "F::TargetU"
|
name, "T", "U", "F::TargetU"
|
||||||
)
|
)
|
||||||
enum_name = rust_type_name(name)
|
enum_name = rust_type_name(name)
|
||||||
|
simple = is_simple(sum)
|
||||||
|
|
||||||
self.emit(f"impl<T, U> Foldable<T, U> for {enum_name}{apply_t} {{", depth)
|
self.emit(f"impl<T, U> Foldable<T, U> for {enum_name}{apply_t} {{", depth)
|
||||||
self.emit(f"type Mapped = {enum_name}{apply_u};", depth + 1)
|
self.emit(f"type Mapped = {enum_name}{apply_u};", depth + 1)
|
||||||
|
|
@ -487,25 +465,29 @@ class FoldImplVisitor(EmitVisitor):
|
||||||
f"pub fn fold_{name}<U, F: Fold<U> + ?Sized>(#[allow(unused)] folder: &mut F, node: {enum_name}{apply_u}) -> Result<{enum_name}{apply_target_u}, F::Error> {{",
|
f"pub fn fold_{name}<U, F: Fold<U> + ?Sized>(#[allow(unused)] folder: &mut F, node: {enum_name}{apply_u}) -> Result<{enum_name}{apply_target_u}, F::Error> {{",
|
||||||
depth,
|
depth,
|
||||||
)
|
)
|
||||||
if type_info.has_attributes:
|
|
||||||
self.emit("fold_attributed(folder, node, |folder, node| {", depth)
|
if simple:
|
||||||
|
self.emit("Ok(node) }", depth + 1)
|
||||||
|
return
|
||||||
|
|
||||||
self.emit("match node {", depth + 1)
|
self.emit("match node {", depth + 1)
|
||||||
for cons in sum.types:
|
for cons in sum.types:
|
||||||
fields_pattern = self.make_pattern(
|
fields_pattern = self.make_pattern(enum_name, cons.name, cons.fields)
|
||||||
enum_name, type_info.rust_suffix, cons.name, cons.fields
|
|
||||||
)
|
|
||||||
self.emit(
|
self.emit(
|
||||||
f"{fields_pattern[0]} {{ {fields_pattern[1]} }} {fields_pattern[2]} => {{",
|
f"{fields_pattern[0]} {{ {fields_pattern[1]}}} {fields_pattern[2]} => {{",
|
||||||
depth + 2,
|
depth + 2,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
map_user_suffix = "" if type_info.has_attributes else "_cfg"
|
||||||
|
self.emit(
|
||||||
|
f"let range = folder.map_user{map_user_suffix}(range)?;", depth + 3
|
||||||
|
)
|
||||||
|
|
||||||
self.gen_construction(
|
self.gen_construction(
|
||||||
fields_pattern[0], cons.fields, fields_pattern[2], depth + 3
|
fields_pattern[0], cons.fields, fields_pattern[2], depth + 3
|
||||||
)
|
)
|
||||||
self.emit("}", depth + 2)
|
self.emit("}", depth + 2)
|
||||||
self.emit("}", depth + 1)
|
self.emit("}", depth + 1)
|
||||||
if type_info.has_attributes:
|
|
||||||
self.emit("})", depth)
|
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
|
|
||||||
def visitProduct(self, product, name, depth):
|
def visitProduct(self, product, name, depth):
|
||||||
|
|
@ -529,27 +511,26 @@ class FoldImplVisitor(EmitVisitor):
|
||||||
f"pub fn fold_{name}<U, F: Fold<U> + ?Sized>(#[allow(unused)] folder: &mut F, node: {struct_name}{apply_u}) -> Result<{struct_name}{apply_target_u}, F::Error> {{",
|
f"pub fn fold_{name}<U, F: Fold<U> + ?Sized>(#[allow(unused)] folder: &mut F, node: {struct_name}{apply_u}) -> Result<{struct_name}{apply_target_u}, F::Error> {{",
|
||||||
depth,
|
depth,
|
||||||
)
|
)
|
||||||
if has_attributes:
|
|
||||||
self.emit("fold_attributed(folder, node, |folder, node| {", depth)
|
fields_pattern = self.make_pattern(struct_name, struct_name, product.fields)
|
||||||
rust_name = struct_name + "Data"
|
self.emit(f"let {struct_name} {{ {fields_pattern[1]} }} = node;", depth + 1)
|
||||||
else:
|
|
||||||
rust_name = struct_name
|
map_user_suffix = "" if has_attributes else "_cfg"
|
||||||
fields_pattern = self.make_pattern(rust_name, struct_name, None, product.fields)
|
self.emit(f"let range = folder.map_user{map_user_suffix}(range)?;", depth + 3)
|
||||||
self.emit(f"let {rust_name} {{ {fields_pattern[1]} }} = node;", depth + 1)
|
|
||||||
self.gen_construction(rust_name, product.fields, "", depth + 1)
|
self.gen_construction(struct_name, product.fields, "", depth + 1)
|
||||||
if has_attributes:
|
|
||||||
self.emit("})", depth)
|
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
|
|
||||||
def make_pattern(self, rust_name, suffix, fieldname, fields):
|
def make_pattern(self, rust_name, fieldname: str, fields):
|
||||||
if fields:
|
header = f"{rust_name}::{fieldname}({rust_name}{fieldname}"
|
||||||
header = f"{rust_name}{suffix}::{fieldname}({rust_name}{fieldname}"
|
footer = ")"
|
||||||
footer = ")"
|
|
||||||
else:
|
|
||||||
header = f"{rust_name}{suffix}::{fieldname}"
|
|
||||||
footer = ""
|
|
||||||
|
|
||||||
body = ",".join(rust_field(f.name) for f in fields)
|
body = ",".join(rust_field(f.name) for f in fields)
|
||||||
|
if body:
|
||||||
|
body += ","
|
||||||
|
body += "range"
|
||||||
|
|
||||||
return header, body, footer
|
return header, body, footer
|
||||||
|
|
||||||
def gen_construction(self, header, fields, footer, depth):
|
def gen_construction(self, header, fields, footer, depth):
|
||||||
|
|
@ -557,6 +538,8 @@ class FoldImplVisitor(EmitVisitor):
|
||||||
for field in fields:
|
for field in fields:
|
||||||
name = rust_field(field.name)
|
name = rust_field(field.name)
|
||||||
self.emit(f"{name}: Foldable::fold({name}, folder)?,", depth + 1)
|
self.emit(f"{name}: Foldable::fold({name}, folder)?,", depth + 1)
|
||||||
|
self.emit("range,", depth + 1)
|
||||||
|
|
||||||
self.emit(f"}}{footer})", depth)
|
self.emit(f"}}{footer})", depth)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -584,7 +567,7 @@ class VisitorTraitDefVisitor(StructVisitor):
|
||||||
return rust_type_name(name)
|
return rust_type_name(name)
|
||||||
|
|
||||||
def visitModule(self, mod, depth):
|
def visitModule(self, mod, depth):
|
||||||
self.emit("pub trait Visitor<U=()> {", depth)
|
self.emit("pub trait Visitor<R=crate::text_size::TextRange> {", depth)
|
||||||
|
|
||||||
for dfn in mod.dfns:
|
for dfn in mod.dfns:
|
||||||
self.visit(dfn, depth + 1)
|
self.visit(dfn, depth + 1)
|
||||||
|
|
@ -595,16 +578,14 @@ class VisitorTraitDefVisitor(StructVisitor):
|
||||||
|
|
||||||
def emit_visitor(self, nodename, depth, has_node=True):
|
def emit_visitor(self, nodename, depth, has_node=True):
|
||||||
type_info = self.type_info[nodename]
|
type_info = self.type_info[nodename]
|
||||||
if has_node:
|
node_type = type_info.rust_sum_name
|
||||||
node_type = type_info.rust_sum_name
|
generic, = self.apply_generics(nodename, "R")
|
||||||
node_value = "node"
|
|
||||||
else:
|
|
||||||
node_type = "()"
|
|
||||||
node_value = "()"
|
|
||||||
self.emit(
|
self.emit(
|
||||||
f"fn visit_{type_info.sum_name}(&mut self, node: {node_type}) {{", depth
|
f"fn visit_{type_info.sum_name}(&mut self, node: {node_type}{generic}) {{", depth
|
||||||
)
|
)
|
||||||
self.emit(f"self.generic_visit_{type_info.sum_name}({node_value})", depth + 1)
|
if has_node:
|
||||||
|
self.emit(f"self.generic_visit_{type_info.sum_name}(node)", depth + 1)
|
||||||
|
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
|
|
||||||
def emit_generic_visitor_signature(self, nodename, depth, has_node=True):
|
def emit_generic_visitor_signature(self, nodename, depth, has_node=True):
|
||||||
|
|
@ -613,8 +594,9 @@ class VisitorTraitDefVisitor(StructVisitor):
|
||||||
node_type = type_info.rust_sum_name
|
node_type = type_info.rust_sum_name
|
||||||
else:
|
else:
|
||||||
node_type = "()"
|
node_type = "()"
|
||||||
|
generic, = self.apply_generics(nodename, "R")
|
||||||
self.emit(
|
self.emit(
|
||||||
f"fn generic_visit_{type_info.sum_name}(&mut self, node: {node_type}) {{",
|
f"fn generic_visit_{type_info.sum_name}(&mut self, node: {node_type}{generic}) {{",
|
||||||
depth,
|
depth,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -628,16 +610,15 @@ class VisitorTraitDefVisitor(StructVisitor):
|
||||||
|
|
||||||
def visit_match_for_type(self, nodename, rust_name, type_, depth):
|
def visit_match_for_type(self, nodename, rust_name, type_, depth):
|
||||||
self.emit(f"{rust_name}::{type_.name}", depth)
|
self.emit(f"{rust_name}::{type_.name}", depth)
|
||||||
if type_.fields:
|
self.emit("(data)", depth)
|
||||||
self.emit("(data)", depth)
|
self.emit(f"=> self.visit_{nodename}_{type_.name}(data),", depth)
|
||||||
data = "data"
|
|
||||||
else:
|
|
||||||
data = "()"
|
|
||||||
self.emit(f"=> self.visit_{nodename}_{type_.name}({data}),", depth)
|
|
||||||
|
|
||||||
def visit_sum_type(self, name, type_, depth):
|
def visit_sum_type(self, name, type_, depth):
|
||||||
self.emit_visitor(type_.name, depth, has_node=type_.fields)
|
self.emit_visitor(type_.name, depth, has_node=type_.fields)
|
||||||
self.emit_generic_visitor_signature(type_.name, depth, has_node=type_.fields)
|
if not type_.fields:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.emit_generic_visitor_signature(type_.name, depth, has_node=True)
|
||||||
for f in type_.fields:
|
for f in type_.fields:
|
||||||
fieldname = rust_field(f.name)
|
fieldname = rust_field(f.name)
|
||||||
field_type = self.type_info.get(f.type)
|
field_type = self.type_info.get(f.type)
|
||||||
|
|
@ -669,15 +650,13 @@ class VisitorTraitDefVisitor(StructVisitor):
|
||||||
if not sum.attributes:
|
if not sum.attributes:
|
||||||
return
|
return
|
||||||
|
|
||||||
rust_name = enum_name = rust_type_name(name)
|
enum_name = rust_type_name(name)
|
||||||
if sum.attributes:
|
|
||||||
rust_name = enum_name + "Kind"
|
|
||||||
self.emit_visitor(name, depth)
|
self.emit_visitor(name, depth)
|
||||||
self.emit_generic_visitor_signature(name, depth)
|
self.emit_generic_visitor_signature(name, depth)
|
||||||
depth += 1
|
depth += 1
|
||||||
self.emit("match node.node {", depth)
|
self.emit("match node {", depth)
|
||||||
for t in sum.types:
|
for t in sum.types:
|
||||||
self.visit_match_for_type(name, rust_name, t, depth + 1)
|
self.visit_match_for_type(name, enum_name, t, depth + 1)
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
depth -= 1
|
depth -= 1
|
||||||
self.emit("}", depth)
|
self.emit("}", depth)
|
||||||
|
|
@ -838,8 +817,6 @@ class TraitImplVisitor(EmitVisitor):
|
||||||
|
|
||||||
def visitProduct(self, product, name, depth):
|
def visitProduct(self, product, name, depth):
|
||||||
struct_name = rust_type_name(name)
|
struct_name = rust_type_name(name)
|
||||||
if product.attributes:
|
|
||||||
struct_name += "Data"
|
|
||||||
|
|
||||||
self.emit(f"impl NamedNode for ast::located::{struct_name} {{", depth)
|
self.emit(f"impl NamedNode for ast::located::{struct_name} {{", depth)
|
||||||
self.emit(f"const NAME: &'static str = {json.dumps(name)};", depth + 1)
|
self.emit(f"const NAME: &'static str = {json.dumps(name)};", depth + 1)
|
||||||
|
|
@ -945,6 +922,124 @@ class TraitImplVisitor(EmitVisitor):
|
||||||
return f"Node::ast_from_object(_vm, get_node_field(_vm, &_object, {name}, {json.dumps(typename)})?)?"
|
return f"Node::ast_from_object(_vm, get_node_field(_vm, &_object, {name}, {json.dumps(typename)})?)?"
|
||||||
|
|
||||||
|
|
||||||
|
class RangedDefVisitor(EmitVisitor):
|
||||||
|
def visitModule(self, mod):
|
||||||
|
for dfn in mod.dfns:
|
||||||
|
self.visit(dfn)
|
||||||
|
|
||||||
|
def visitType(self, type, depth=0):
|
||||||
|
self.visit(type.value, type.name, depth)
|
||||||
|
|
||||||
|
def visitSum(self, sum, name, depth):
|
||||||
|
info = self.type_info[name]
|
||||||
|
|
||||||
|
if info.is_simple:
|
||||||
|
return
|
||||||
|
|
||||||
|
sum_match_arms = ""
|
||||||
|
|
||||||
|
for ty in sum.types:
|
||||||
|
variant_info = self.type_info[ty.name]
|
||||||
|
sum_match_arms += f" Self::{variant_info.rust_name}(node) => node.range(),"
|
||||||
|
self.emit_ranged_impl(variant_info)
|
||||||
|
|
||||||
|
if not info.no_cfg(self.type_info):
|
||||||
|
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', 0)
|
||||||
|
|
||||||
|
self.emit(f"""
|
||||||
|
impl Ranged for crate::{info.rust_sum_name} {{
|
||||||
|
fn range(&self) -> TextRange {{
|
||||||
|
match self {{
|
||||||
|
{sum_match_arms}
|
||||||
|
}}
|
||||||
|
}}
|
||||||
|
}}
|
||||||
|
""".lstrip(), 0)
|
||||||
|
|
||||||
|
def visitProduct(self, product, name, depth):
|
||||||
|
info = self.type_info[name]
|
||||||
|
|
||||||
|
self.emit_ranged_impl(info)
|
||||||
|
|
||||||
|
def emit_ranged_impl(self, info):
|
||||||
|
if not info.no_cfg(self.type_info):
|
||||||
|
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', 0)
|
||||||
|
|
||||||
|
self.file.write(
|
||||||
|
f"""
|
||||||
|
impl Ranged for crate::generic::{info.rust_sum_name}::<TextRange> {{
|
||||||
|
fn range(&self) -> TextRange {{
|
||||||
|
self.range
|
||||||
|
}}
|
||||||
|
}}
|
||||||
|
""".strip()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class LocatedDefVisitor(EmitVisitor):
|
||||||
|
def visitModule(self, mod):
|
||||||
|
for dfn in mod.dfns:
|
||||||
|
self.visit(dfn)
|
||||||
|
|
||||||
|
def visitType(self, type, depth=0):
|
||||||
|
self.visit(type.value, type.name, depth)
|
||||||
|
|
||||||
|
def visitSum(self, sum, name, depth):
|
||||||
|
info = self.type_info[name]
|
||||||
|
|
||||||
|
self.emit_type_alias(info)
|
||||||
|
|
||||||
|
if info.is_simple:
|
||||||
|
return
|
||||||
|
|
||||||
|
sum_match_arms = ""
|
||||||
|
|
||||||
|
for ty in sum.types:
|
||||||
|
variant_info = self.type_info[ty.name]
|
||||||
|
sum_match_arms += f" Self::{variant_info.rust_name}(node) => node.range(),"
|
||||||
|
self.emit_type_alias(variant_info)
|
||||||
|
self.emit_located_impl(variant_info)
|
||||||
|
|
||||||
|
if not info.no_cfg(self.type_info):
|
||||||
|
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', 0)
|
||||||
|
|
||||||
|
self.emit(f"""
|
||||||
|
impl Located for {info.rust_sum_name} {{
|
||||||
|
fn range(&self) -> SourceRange {{
|
||||||
|
match self {{
|
||||||
|
{sum_match_arms}
|
||||||
|
}}
|
||||||
|
}}
|
||||||
|
}}
|
||||||
|
""".lstrip(), 0)
|
||||||
|
|
||||||
|
def visitProduct(self, product, name, depth):
|
||||||
|
info = self.type_info[name]
|
||||||
|
|
||||||
|
self.emit_type_alias(info)
|
||||||
|
self.emit_located_impl(info)
|
||||||
|
|
||||||
|
def emit_type_alias(self, info):
|
||||||
|
generics = "" if info.is_simple else "::<SourceRange>"
|
||||||
|
|
||||||
|
self.emit(f"pub type {info.rust_sum_name} = crate::generic::{info.rust_sum_name}{generics};", 0)
|
||||||
|
self.emit("", 0)
|
||||||
|
|
||||||
|
def emit_located_impl(self, info):
|
||||||
|
if not info.no_cfg(self.type_info):
|
||||||
|
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', 0)
|
||||||
|
|
||||||
|
self.emit(
|
||||||
|
f"""
|
||||||
|
impl Located for {info.rust_sum_name} {{
|
||||||
|
fn range(&self) -> SourceRange {{
|
||||||
|
self.range
|
||||||
|
}}
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
, 0)
|
||||||
|
|
||||||
|
|
||||||
class ChainOfVisitors:
|
class ChainOfVisitors:
|
||||||
def __init__(self, *visitors):
|
def __init__(self, *visitors):
|
||||||
self.visitors = visitors
|
self.visitors = visitors
|
||||||
|
|
@ -956,6 +1051,7 @@ class ChainOfVisitors:
|
||||||
|
|
||||||
|
|
||||||
def write_ast_def(mod, type_info, f):
|
def write_ast_def(mod, type_info, f):
|
||||||
|
f.write("use crate::text_size::TextRange;")
|
||||||
StructVisitor(f, type_info).visit(mod)
|
StructVisitor(f, type_info).visit(mod)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -967,32 +1063,12 @@ def write_visitor_def(mod, type_info, f):
|
||||||
VisitorModuleVisitor(f, type_info).visit(mod)
|
VisitorModuleVisitor(f, type_info).visit(mod)
|
||||||
|
|
||||||
|
|
||||||
def write_located_def(mod, type_info, f):
|
def write_ranged_def(mod, type_info, f):
|
||||||
f.write(
|
RangedDefVisitor(f, type_info).visit(mod)
|
||||||
textwrap.dedent(
|
|
||||||
"""
|
|
||||||
use rustpython_parser_core::source_code::SourceRange;
|
|
||||||
|
|
||||||
pub type Located<T> = super::generic::Attributed<T, SourceRange>;
|
|
||||||
"""
|
def write_located_def(mod, type_info, f):
|
||||||
)
|
LocatedDefVisitor(f, type_info).visit(mod)
|
||||||
)
|
|
||||||
for info in type_info.values():
|
|
||||||
if info.empty_field:
|
|
||||||
continue
|
|
||||||
if info.has_user_data:
|
|
||||||
generics = "::<SourceRange>"
|
|
||||||
else:
|
|
||||||
generics = ""
|
|
||||||
f.write(
|
|
||||||
f"pub type {info.rust_sum_name} = super::generic::{info.rust_sum_name}{generics};\n"
|
|
||||||
)
|
|
||||||
if info.rust_suffix:
|
|
||||||
if info.rust_suffix == "Data" and not info.has_expr:
|
|
||||||
generics = ""
|
|
||||||
f.write(
|
|
||||||
f"pub type {info.rust_sum_name}{info.rust_suffix} = super::generic::{info.rust_sum_name}{info.rust_suffix}{generics};\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def write_ast_mod(mod, type_info, f):
|
def write_ast_mod(mod, type_info, f):
|
||||||
|
|
@ -1016,10 +1092,10 @@ def write_ast_mod(mod, type_info, f):
|
||||||
|
|
||||||
|
|
||||||
def main(
|
def main(
|
||||||
input_filename,
|
input_filename,
|
||||||
ast_dir,
|
ast_dir,
|
||||||
module_filename,
|
module_filename,
|
||||||
dump_module=False,
|
dump_module=False,
|
||||||
):
|
):
|
||||||
auto_gen_msg = AUTO_GEN_MESSAGE.format("/".join(Path(__file__).parts[-2:]))
|
auto_gen_msg = AUTO_GEN_MESSAGE.format("/".join(Path(__file__).parts[-2:]))
|
||||||
mod = asdl.parse(input_filename)
|
mod = asdl.parse(input_filename)
|
||||||
|
|
@ -1035,6 +1111,7 @@ def main(
|
||||||
for filename, write in [
|
for filename, write in [
|
||||||
("generic", write_ast_def),
|
("generic", write_ast_def),
|
||||||
("fold", write_fold_def),
|
("fold", write_fold_def),
|
||||||
|
("ranged", write_ranged_def),
|
||||||
("located", write_located_def),
|
("located", write_located_def),
|
||||||
("visitor", write_visitor_def),
|
("visitor", write_visitor_def),
|
||||||
]:
|
]:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
//! `builtin_types` in asdl.py and Attributed
|
//! `builtin_types` in asdl.py and Attributed
|
||||||
|
|
||||||
use num_bigint::BigInt;
|
use num_bigint::BigInt;
|
||||||
use rustpython_parser_core::text_size::{TextRange, TextSize};
|
|
||||||
|
|
||||||
pub type String = std::string::String;
|
pub type String = std::string::String;
|
||||||
|
|
||||||
|
|
@ -205,64 +204,6 @@ impl std::fmt::Display for Constant {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
|
||||||
pub struct Attributed<T, U = ()> {
|
|
||||||
pub range: TextRange,
|
|
||||||
pub custom: U,
|
|
||||||
pub node: T,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T, U> Attributed<T, U> {
|
|
||||||
/// Returns the node
|
|
||||||
#[inline]
|
|
||||||
pub fn node(&self) -> &T {
|
|
||||||
&self.node
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the `range` of the node. The range offsets are absolute to the start of the document.
|
|
||||||
#[inline]
|
|
||||||
pub const fn range(&self) -> TextRange {
|
|
||||||
self.range
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the absolute start position of the node from the beginning of the document.
|
|
||||||
#[inline]
|
|
||||||
pub const fn start(&self) -> TextSize {
|
|
||||||
self.range.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the absolute position at which the node ends in the source document.
|
|
||||||
#[inline]
|
|
||||||
pub const fn end(&self) -> TextSize {
|
|
||||||
self.range.end()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Attributed<T, ()> {
|
|
||||||
/// Creates a new node that spans the position specified by `range`.
|
|
||||||
pub fn new(range: impl Into<TextRange>, node: impl Into<T>) -> Self {
|
|
||||||
Self {
|
|
||||||
range: range.into(),
|
|
||||||
custom: (),
|
|
||||||
node: node.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Consumes self and returns the node.
|
|
||||||
#[inline]
|
|
||||||
pub fn into_node(self) -> T {
|
|
||||||
self.node
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T, U> std::ops::Deref for Attributed<T, U> {
|
|
||||||
type Target = T;
|
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
|
||||||
&self.node
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
||||||
1067
ast/src/gen/fold.rs
1067
ast/src/gen/fold.rs
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,95 +1,753 @@
|
||||||
// File automatically generated by ast/asdl_rs.py.
|
// File automatically generated by ast/asdl_rs.py.
|
||||||
|
|
||||||
use rustpython_parser_core::source_code::SourceRange;
|
pub type Mod = crate::generic::Mod<SourceRange>;
|
||||||
|
|
||||||
pub type Located<T> = super::generic::Attributed<T, SourceRange>;
|
pub type ModModule = crate::generic::ModModule<SourceRange>;
|
||||||
pub type Mod = super::generic::Mod<SourceRange>;
|
|
||||||
pub type ModModule = super::generic::ModModule<SourceRange>;
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
pub type ModInteractive = super::generic::ModInteractive<SourceRange>;
|
|
||||||
pub type ModExpression = super::generic::ModExpression<SourceRange>;
|
impl Located for ModModule {
|
||||||
pub type ModFunctionType = super::generic::ModFunctionType<SourceRange>;
|
fn range(&self) -> SourceRange {
|
||||||
pub type Stmt = super::generic::Stmt<SourceRange>;
|
self.range
|
||||||
pub type StmtKind = super::generic::StmtKind<SourceRange>;
|
}
|
||||||
pub type StmtFunctionDef = super::generic::StmtFunctionDef<SourceRange>;
|
}
|
||||||
pub type StmtAsyncFunctionDef = super::generic::StmtAsyncFunctionDef<SourceRange>;
|
|
||||||
pub type StmtClassDef = super::generic::StmtClassDef<SourceRange>;
|
pub type ModInteractive = crate::generic::ModInteractive<SourceRange>;
|
||||||
pub type StmtReturn = super::generic::StmtReturn<SourceRange>;
|
|
||||||
pub type StmtDelete = super::generic::StmtDelete<SourceRange>;
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
pub type StmtAssign = super::generic::StmtAssign<SourceRange>;
|
|
||||||
pub type StmtAugAssign = super::generic::StmtAugAssign<SourceRange>;
|
impl Located for ModInteractive {
|
||||||
pub type StmtAnnAssign = super::generic::StmtAnnAssign<SourceRange>;
|
fn range(&self) -> SourceRange {
|
||||||
pub type StmtFor = super::generic::StmtFor<SourceRange>;
|
self.range
|
||||||
pub type StmtAsyncFor = super::generic::StmtAsyncFor<SourceRange>;
|
}
|
||||||
pub type StmtWhile = super::generic::StmtWhile<SourceRange>;
|
}
|
||||||
pub type StmtIf = super::generic::StmtIf<SourceRange>;
|
|
||||||
pub type StmtWith = super::generic::StmtWith<SourceRange>;
|
pub type ModExpression = crate::generic::ModExpression<SourceRange>;
|
||||||
pub type StmtAsyncWith = super::generic::StmtAsyncWith<SourceRange>;
|
|
||||||
pub type StmtMatch = super::generic::StmtMatch<SourceRange>;
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
pub type StmtRaise = super::generic::StmtRaise<SourceRange>;
|
|
||||||
pub type StmtTry = super::generic::StmtTry<SourceRange>;
|
impl Located for ModExpression {
|
||||||
pub type StmtTryStar = super::generic::StmtTryStar<SourceRange>;
|
fn range(&self) -> SourceRange {
|
||||||
pub type StmtAssert = super::generic::StmtAssert<SourceRange>;
|
self.range
|
||||||
pub type StmtImport = super::generic::StmtImport<SourceRange>;
|
}
|
||||||
pub type StmtImportFrom = super::generic::StmtImportFrom<SourceRange>;
|
}
|
||||||
pub type StmtGlobal = super::generic::StmtGlobal;
|
|
||||||
pub type StmtNonlocal = super::generic::StmtNonlocal;
|
pub type ModFunctionType = crate::generic::ModFunctionType<SourceRange>;
|
||||||
pub type StmtExpr = super::generic::StmtExpr<SourceRange>;
|
|
||||||
pub type Expr = super::generic::Expr<SourceRange>;
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
pub type ExprKind = super::generic::ExprKind<SourceRange>;
|
|
||||||
pub type ExprBoolOp = super::generic::ExprBoolOp<SourceRange>;
|
impl Located for ModFunctionType {
|
||||||
pub type ExprNamedExpr = super::generic::ExprNamedExpr<SourceRange>;
|
fn range(&self) -> SourceRange {
|
||||||
pub type ExprBinOp = super::generic::ExprBinOp<SourceRange>;
|
self.range
|
||||||
pub type ExprUnaryOp = super::generic::ExprUnaryOp<SourceRange>;
|
}
|
||||||
pub type ExprLambda = super::generic::ExprLambda<SourceRange>;
|
}
|
||||||
pub type ExprIfExp = super::generic::ExprIfExp<SourceRange>;
|
|
||||||
pub type ExprDict = super::generic::ExprDict<SourceRange>;
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
pub type ExprSet = super::generic::ExprSet<SourceRange>;
|
impl Located for Mod {
|
||||||
pub type ExprListComp = super::generic::ExprListComp<SourceRange>;
|
fn range(&self) -> SourceRange {
|
||||||
pub type ExprSetComp = super::generic::ExprSetComp<SourceRange>;
|
match self {
|
||||||
pub type ExprDictComp = super::generic::ExprDictComp<SourceRange>;
|
Self::Module(node) => node.range(),
|
||||||
pub type ExprGeneratorExp = super::generic::ExprGeneratorExp<SourceRange>;
|
Self::Interactive(node) => node.range(),
|
||||||
pub type ExprAwait = super::generic::ExprAwait<SourceRange>;
|
Self::Expression(node) => node.range(),
|
||||||
pub type ExprYield = super::generic::ExprYield<SourceRange>;
|
Self::FunctionType(node) => node.range(),
|
||||||
pub type ExprYieldFrom = super::generic::ExprYieldFrom<SourceRange>;
|
}
|
||||||
pub type ExprCompare = super::generic::ExprCompare<SourceRange>;
|
}
|
||||||
pub type ExprCall = super::generic::ExprCall<SourceRange>;
|
}
|
||||||
pub type ExprFormattedValue = super::generic::ExprFormattedValue<SourceRange>;
|
|
||||||
pub type ExprJoinedStr = super::generic::ExprJoinedStr<SourceRange>;
|
pub type Stmt = crate::generic::Stmt<SourceRange>;
|
||||||
pub type ExprConstant = super::generic::ExprConstant;
|
|
||||||
pub type ExprAttribute = super::generic::ExprAttribute<SourceRange>;
|
pub type StmtFunctionDef = crate::generic::StmtFunctionDef<SourceRange>;
|
||||||
pub type ExprSubscript = super::generic::ExprSubscript<SourceRange>;
|
|
||||||
pub type ExprStarred = super::generic::ExprStarred<SourceRange>;
|
impl Located for StmtFunctionDef {
|
||||||
pub type ExprName = super::generic::ExprName;
|
fn range(&self) -> SourceRange {
|
||||||
pub type ExprList = super::generic::ExprList<SourceRange>;
|
self.range
|
||||||
pub type ExprTuple = super::generic::ExprTuple<SourceRange>;
|
}
|
||||||
pub type ExprSlice = super::generic::ExprSlice<SourceRange>;
|
}
|
||||||
pub type ExprContext = super::generic::ExprContext;
|
|
||||||
pub type Boolop = super::generic::Boolop;
|
pub type StmtAsyncFunctionDef = crate::generic::StmtAsyncFunctionDef<SourceRange>;
|
||||||
pub type Operator = super::generic::Operator;
|
|
||||||
pub type Unaryop = super::generic::Unaryop;
|
impl Located for StmtAsyncFunctionDef {
|
||||||
pub type Cmpop = super::generic::Cmpop;
|
fn range(&self) -> SourceRange {
|
||||||
pub type Comprehension = super::generic::Comprehension<SourceRange>;
|
self.range
|
||||||
pub type Excepthandler = super::generic::Excepthandler<SourceRange>;
|
}
|
||||||
pub type ExcepthandlerKind = super::generic::ExcepthandlerKind<SourceRange>;
|
}
|
||||||
pub type ExcepthandlerExceptHandler = super::generic::ExcepthandlerExceptHandler<SourceRange>;
|
|
||||||
pub type Arguments = super::generic::Arguments<SourceRange>;
|
pub type StmtClassDef = crate::generic::StmtClassDef<SourceRange>;
|
||||||
pub type Arg = super::generic::Arg<SourceRange>;
|
|
||||||
pub type ArgData = super::generic::ArgData<SourceRange>;
|
impl Located for StmtClassDef {
|
||||||
pub type Keyword = super::generic::Keyword<SourceRange>;
|
fn range(&self) -> SourceRange {
|
||||||
pub type KeywordData = super::generic::KeywordData<SourceRange>;
|
self.range
|
||||||
pub type Alias = super::generic::Alias<SourceRange>;
|
}
|
||||||
pub type AliasData = super::generic::AliasData;
|
}
|
||||||
pub type Withitem = super::generic::Withitem<SourceRange>;
|
|
||||||
pub type MatchCase = super::generic::MatchCase<SourceRange>;
|
pub type StmtReturn = crate::generic::StmtReturn<SourceRange>;
|
||||||
pub type Pattern = super::generic::Pattern<SourceRange>;
|
|
||||||
pub type PatternKind = super::generic::PatternKind<SourceRange>;
|
impl Located for StmtReturn {
|
||||||
pub type PatternMatchValue = super::generic::PatternMatchValue<SourceRange>;
|
fn range(&self) -> SourceRange {
|
||||||
pub type PatternMatchSingleton = super::generic::PatternMatchSingleton;
|
self.range
|
||||||
pub type PatternMatchSequence = super::generic::PatternMatchSequence<SourceRange>;
|
}
|
||||||
pub type PatternMatchMapping = super::generic::PatternMatchMapping<SourceRange>;
|
}
|
||||||
pub type PatternMatchClass = super::generic::PatternMatchClass<SourceRange>;
|
|
||||||
pub type PatternMatchStar = super::generic::PatternMatchStar;
|
pub type StmtDelete = crate::generic::StmtDelete<SourceRange>;
|
||||||
pub type PatternMatchAs = super::generic::PatternMatchAs<SourceRange>;
|
|
||||||
pub type PatternMatchOr = super::generic::PatternMatchOr<SourceRange>;
|
impl Located for StmtDelete {
|
||||||
pub type TypeIgnore = super::generic::TypeIgnore;
|
fn range(&self) -> SourceRange {
|
||||||
pub type TypeIgnoreTypeIgnore = super::generic::TypeIgnoreTypeIgnore;
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtAssign = crate::generic::StmtAssign<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtAssign {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtAugAssign = crate::generic::StmtAugAssign<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtAugAssign {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtAnnAssign = crate::generic::StmtAnnAssign<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtAnnAssign {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtFor = crate::generic::StmtFor<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtFor {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtAsyncFor = crate::generic::StmtAsyncFor<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtAsyncFor {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtWhile = crate::generic::StmtWhile<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtWhile {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtIf = crate::generic::StmtIf<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtIf {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtWith = crate::generic::StmtWith<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtWith {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtAsyncWith = crate::generic::StmtAsyncWith<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtAsyncWith {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtMatch = crate::generic::StmtMatch<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtMatch {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtRaise = crate::generic::StmtRaise<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtRaise {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtTry = crate::generic::StmtTry<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtTry {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtTryStar = crate::generic::StmtTryStar<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtTryStar {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtAssert = crate::generic::StmtAssert<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtAssert {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtImport = crate::generic::StmtImport<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtImport {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtImportFrom = crate::generic::StmtImportFrom<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtImportFrom {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtGlobal = crate::generic::StmtGlobal<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtGlobal {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtNonlocal = crate::generic::StmtNonlocal<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtNonlocal {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtExpr = crate::generic::StmtExpr<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtExpr {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtPass = crate::generic::StmtPass<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtPass {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtBreak = crate::generic::StmtBreak<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtBreak {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type StmtContinue = crate::generic::StmtContinue<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for StmtContinue {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Located for Stmt {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
match self {
|
||||||
|
Self::FunctionDef(node) => node.range(),
|
||||||
|
Self::AsyncFunctionDef(node) => node.range(),
|
||||||
|
Self::ClassDef(node) => node.range(),
|
||||||
|
Self::Return(node) => node.range(),
|
||||||
|
Self::Delete(node) => node.range(),
|
||||||
|
Self::Assign(node) => node.range(),
|
||||||
|
Self::AugAssign(node) => node.range(),
|
||||||
|
Self::AnnAssign(node) => node.range(),
|
||||||
|
Self::For(node) => node.range(),
|
||||||
|
Self::AsyncFor(node) => node.range(),
|
||||||
|
Self::While(node) => node.range(),
|
||||||
|
Self::If(node) => node.range(),
|
||||||
|
Self::With(node) => node.range(),
|
||||||
|
Self::AsyncWith(node) => node.range(),
|
||||||
|
Self::Match(node) => node.range(),
|
||||||
|
Self::Raise(node) => node.range(),
|
||||||
|
Self::Try(node) => node.range(),
|
||||||
|
Self::TryStar(node) => node.range(),
|
||||||
|
Self::Assert(node) => node.range(),
|
||||||
|
Self::Import(node) => node.range(),
|
||||||
|
Self::ImportFrom(node) => node.range(),
|
||||||
|
Self::Global(node) => node.range(),
|
||||||
|
Self::Nonlocal(node) => node.range(),
|
||||||
|
Self::Expr(node) => node.range(),
|
||||||
|
Self::Pass(node) => node.range(),
|
||||||
|
Self::Break(node) => node.range(),
|
||||||
|
Self::Continue(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Expr = crate::generic::Expr<SourceRange>;
|
||||||
|
|
||||||
|
pub type ExprBoolOp = crate::generic::ExprBoolOp<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprBoolOp {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprNamedExpr = crate::generic::ExprNamedExpr<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprNamedExpr {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprBinOp = crate::generic::ExprBinOp<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprBinOp {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprUnaryOp = crate::generic::ExprUnaryOp<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprUnaryOp {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprLambda = crate::generic::ExprLambda<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprLambda {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprIfExp = crate::generic::ExprIfExp<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprIfExp {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprDict = crate::generic::ExprDict<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprDict {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprSet = crate::generic::ExprSet<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprSet {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprListComp = crate::generic::ExprListComp<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprListComp {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprSetComp = crate::generic::ExprSetComp<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprSetComp {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprDictComp = crate::generic::ExprDictComp<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprDictComp {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprGeneratorExp = crate::generic::ExprGeneratorExp<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprGeneratorExp {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprAwait = crate::generic::ExprAwait<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprAwait {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprYield = crate::generic::ExprYield<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprYield {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprYieldFrom = crate::generic::ExprYieldFrom<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprYieldFrom {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprCompare = crate::generic::ExprCompare<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprCompare {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprCall = crate::generic::ExprCall<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprCall {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprFormattedValue = crate::generic::ExprFormattedValue<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprFormattedValue {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprJoinedStr = crate::generic::ExprJoinedStr<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprJoinedStr {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprConstant = crate::generic::ExprConstant<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprConstant {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprAttribute = crate::generic::ExprAttribute<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprAttribute {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprSubscript = crate::generic::ExprSubscript<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprSubscript {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprStarred = crate::generic::ExprStarred<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprStarred {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprName = crate::generic::ExprName<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprName {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprList = crate::generic::ExprList<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprList {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprTuple = crate::generic::ExprTuple<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprTuple {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprSlice = crate::generic::ExprSlice<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExprSlice {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Located for Expr {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
match self {
|
||||||
|
Self::BoolOp(node) => node.range(),
|
||||||
|
Self::NamedExpr(node) => node.range(),
|
||||||
|
Self::BinOp(node) => node.range(),
|
||||||
|
Self::UnaryOp(node) => node.range(),
|
||||||
|
Self::Lambda(node) => node.range(),
|
||||||
|
Self::IfExp(node) => node.range(),
|
||||||
|
Self::Dict(node) => node.range(),
|
||||||
|
Self::Set(node) => node.range(),
|
||||||
|
Self::ListComp(node) => node.range(),
|
||||||
|
Self::SetComp(node) => node.range(),
|
||||||
|
Self::DictComp(node) => node.range(),
|
||||||
|
Self::GeneratorExp(node) => node.range(),
|
||||||
|
Self::Await(node) => node.range(),
|
||||||
|
Self::Yield(node) => node.range(),
|
||||||
|
Self::YieldFrom(node) => node.range(),
|
||||||
|
Self::Compare(node) => node.range(),
|
||||||
|
Self::Call(node) => node.range(),
|
||||||
|
Self::FormattedValue(node) => node.range(),
|
||||||
|
Self::JoinedStr(node) => node.range(),
|
||||||
|
Self::Constant(node) => node.range(),
|
||||||
|
Self::Attribute(node) => node.range(),
|
||||||
|
Self::Subscript(node) => node.range(),
|
||||||
|
Self::Starred(node) => node.range(),
|
||||||
|
Self::Name(node) => node.range(),
|
||||||
|
Self::List(node) => node.range(),
|
||||||
|
Self::Tuple(node) => node.range(),
|
||||||
|
Self::Slice(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ExprContext = crate::generic::ExprContext;
|
||||||
|
|
||||||
|
pub type Boolop = crate::generic::Boolop;
|
||||||
|
|
||||||
|
pub type Operator = crate::generic::Operator;
|
||||||
|
|
||||||
|
pub type Unaryop = crate::generic::Unaryop;
|
||||||
|
|
||||||
|
pub type Cmpop = crate::generic::Cmpop;
|
||||||
|
|
||||||
|
pub type Comprehension = crate::generic::Comprehension<SourceRange>;
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
|
||||||
|
impl Located for Comprehension {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Excepthandler = crate::generic::Excepthandler<SourceRange>;
|
||||||
|
|
||||||
|
pub type ExcepthandlerExceptHandler = crate::generic::ExcepthandlerExceptHandler<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for ExcepthandlerExceptHandler {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Located for Excepthandler {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
match self {
|
||||||
|
Self::ExceptHandler(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Arguments = crate::generic::Arguments<SourceRange>;
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
|
||||||
|
impl Located for Arguments {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Arg = crate::generic::Arg<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for Arg {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Keyword = crate::generic::Keyword<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for Keyword {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Alias = crate::generic::Alias<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for Alias {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Withitem = crate::generic::Withitem<SourceRange>;
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
|
||||||
|
impl Located for Withitem {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type MatchCase = crate::generic::MatchCase<SourceRange>;
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
|
||||||
|
impl Located for MatchCase {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Pattern = crate::generic::Pattern<SourceRange>;
|
||||||
|
|
||||||
|
pub type PatternMatchValue = crate::generic::PatternMatchValue<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for PatternMatchValue {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type PatternMatchSingleton = crate::generic::PatternMatchSingleton<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for PatternMatchSingleton {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type PatternMatchSequence = crate::generic::PatternMatchSequence<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for PatternMatchSequence {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type PatternMatchMapping = crate::generic::PatternMatchMapping<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for PatternMatchMapping {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type PatternMatchClass = crate::generic::PatternMatchClass<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for PatternMatchClass {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type PatternMatchStar = crate::generic::PatternMatchStar<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for PatternMatchStar {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type PatternMatchAs = crate::generic::PatternMatchAs<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for PatternMatchAs {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type PatternMatchOr = crate::generic::PatternMatchOr<SourceRange>;
|
||||||
|
|
||||||
|
impl Located for PatternMatchOr {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Located for Pattern {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
match self {
|
||||||
|
Self::MatchValue(node) => node.range(),
|
||||||
|
Self::MatchSingleton(node) => node.range(),
|
||||||
|
Self::MatchSequence(node) => node.range(),
|
||||||
|
Self::MatchMapping(node) => node.range(),
|
||||||
|
Self::MatchClass(node) => node.range(),
|
||||||
|
Self::MatchStar(node) => node.range(),
|
||||||
|
Self::MatchAs(node) => node.range(),
|
||||||
|
Self::MatchOr(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type TypeIgnore = crate::generic::TypeIgnore<SourceRange>;
|
||||||
|
|
||||||
|
pub type TypeIgnoreTypeIgnore = crate::generic::TypeIgnoreTypeIgnore<SourceRange>;
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
|
||||||
|
impl Located for TypeIgnoreTypeIgnore {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Located for TypeIgnore {
|
||||||
|
fn range(&self) -> SourceRange {
|
||||||
|
match self {
|
||||||
|
Self::TypeIgnore(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,497 @@
|
||||||
|
// File automatically generated by ast/asdl_rs.py.
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::ModModule<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::ModInteractive<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::ModExpression<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::ModFunctionType<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::Mod {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
match self {
|
||||||
|
Self::Module(node) => node.range(),
|
||||||
|
Self::Interactive(node) => node.range(),
|
||||||
|
Self::Expression(node) => node.range(),
|
||||||
|
Self::FunctionType(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ranged for crate::generic::StmtFunctionDef<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtAsyncFunctionDef<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtClassDef<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtReturn<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtDelete<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtAssign<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtAugAssign<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtAnnAssign<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtFor<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtAsyncFor<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtWhile<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtIf<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtWith<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtAsyncWith<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtMatch<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtRaise<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtTry<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtTryStar<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtAssert<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtImport<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtImportFrom<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtGlobal<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtNonlocal<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtExpr<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtPass<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtBreak<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::StmtContinue<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::Stmt {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
match self {
|
||||||
|
Self::FunctionDef(node) => node.range(),
|
||||||
|
Self::AsyncFunctionDef(node) => node.range(),
|
||||||
|
Self::ClassDef(node) => node.range(),
|
||||||
|
Self::Return(node) => node.range(),
|
||||||
|
Self::Delete(node) => node.range(),
|
||||||
|
Self::Assign(node) => node.range(),
|
||||||
|
Self::AugAssign(node) => node.range(),
|
||||||
|
Self::AnnAssign(node) => node.range(),
|
||||||
|
Self::For(node) => node.range(),
|
||||||
|
Self::AsyncFor(node) => node.range(),
|
||||||
|
Self::While(node) => node.range(),
|
||||||
|
Self::If(node) => node.range(),
|
||||||
|
Self::With(node) => node.range(),
|
||||||
|
Self::AsyncWith(node) => node.range(),
|
||||||
|
Self::Match(node) => node.range(),
|
||||||
|
Self::Raise(node) => node.range(),
|
||||||
|
Self::Try(node) => node.range(),
|
||||||
|
Self::TryStar(node) => node.range(),
|
||||||
|
Self::Assert(node) => node.range(),
|
||||||
|
Self::Import(node) => node.range(),
|
||||||
|
Self::ImportFrom(node) => node.range(),
|
||||||
|
Self::Global(node) => node.range(),
|
||||||
|
Self::Nonlocal(node) => node.range(),
|
||||||
|
Self::Expr(node) => node.range(),
|
||||||
|
Self::Pass(node) => node.range(),
|
||||||
|
Self::Break(node) => node.range(),
|
||||||
|
Self::Continue(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ranged for crate::generic::ExprBoolOp<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprNamedExpr<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprBinOp<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprUnaryOp<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprLambda<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprIfExp<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprDict<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprSet<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprListComp<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprSetComp<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprDictComp<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprGeneratorExp<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprAwait<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprYield<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprYieldFrom<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprCompare<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprCall<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprFormattedValue<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprJoinedStr<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprConstant<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprAttribute<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprSubscript<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprStarred<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprName<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprList<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprTuple<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExprSlice<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::Expr {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
match self {
|
||||||
|
Self::BoolOp(node) => node.range(),
|
||||||
|
Self::NamedExpr(node) => node.range(),
|
||||||
|
Self::BinOp(node) => node.range(),
|
||||||
|
Self::UnaryOp(node) => node.range(),
|
||||||
|
Self::Lambda(node) => node.range(),
|
||||||
|
Self::IfExp(node) => node.range(),
|
||||||
|
Self::Dict(node) => node.range(),
|
||||||
|
Self::Set(node) => node.range(),
|
||||||
|
Self::ListComp(node) => node.range(),
|
||||||
|
Self::SetComp(node) => node.range(),
|
||||||
|
Self::DictComp(node) => node.range(),
|
||||||
|
Self::GeneratorExp(node) => node.range(),
|
||||||
|
Self::Await(node) => node.range(),
|
||||||
|
Self::Yield(node) => node.range(),
|
||||||
|
Self::YieldFrom(node) => node.range(),
|
||||||
|
Self::Compare(node) => node.range(),
|
||||||
|
Self::Call(node) => node.range(),
|
||||||
|
Self::FormattedValue(node) => node.range(),
|
||||||
|
Self::JoinedStr(node) => node.range(),
|
||||||
|
Self::Constant(node) => node.range(),
|
||||||
|
Self::Attribute(node) => node.range(),
|
||||||
|
Self::Subscript(node) => node.range(),
|
||||||
|
Self::Starred(node) => node.range(),
|
||||||
|
Self::Name(node) => node.range(),
|
||||||
|
Self::List(node) => node.range(),
|
||||||
|
Self::Tuple(node) => node.range(),
|
||||||
|
Self::Slice(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::Comprehension<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::ExcepthandlerExceptHandler<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::Excepthandler {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
match self {
|
||||||
|
Self::ExceptHandler(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::Arguments<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::Arg<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::Keyword<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::Alias<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::Withitem<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::MatchCase<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::PatternMatchValue<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::PatternMatchSingleton<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::PatternMatchSequence<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::PatternMatchMapping<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::PatternMatchClass<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::PatternMatchStar<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::PatternMatchAs<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::generic::PatternMatchOr<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Ranged for crate::Pattern {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
match self {
|
||||||
|
Self::MatchValue(node) => node.range(),
|
||||||
|
Self::MatchSingleton(node) => node.range(),
|
||||||
|
Self::MatchSequence(node) => node.range(),
|
||||||
|
Self::MatchMapping(node) => node.range(),
|
||||||
|
Self::MatchClass(node) => node.range(),
|
||||||
|
Self::MatchStar(node) => node.range(),
|
||||||
|
Self::MatchAs(node) => node.range(),
|
||||||
|
Self::MatchOr(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::generic::TypeIgnoreTypeIgnore<TextRange> {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
self.range
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
impl Ranged for crate::TypeIgnore {
|
||||||
|
fn range(&self) -> TextRange {
|
||||||
|
match self {
|
||||||
|
Self::TypeIgnore(node) => node.range(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,45 +1,45 @@
|
||||||
// File automatically generated by ast/asdl_rs.py.
|
// File automatically generated by ast/asdl_rs.py.
|
||||||
|
|
||||||
#[allow(unused_variables, non_snake_case)]
|
#[allow(unused_variables, non_snake_case)]
|
||||||
pub trait Visitor<U = ()> {
|
pub trait Visitor<R = crate::text_size::TextRange> {
|
||||||
fn visit_stmt(&mut self, node: Stmt) {
|
fn visit_stmt(&mut self, node: Stmt<R>) {
|
||||||
self.generic_visit_stmt(node)
|
self.generic_visit_stmt(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt(&mut self, node: Stmt) {
|
fn generic_visit_stmt(&mut self, node: Stmt<R>) {
|
||||||
match node.node {
|
match node {
|
||||||
StmtKind::FunctionDef(data) => self.visit_stmt_FunctionDef(data),
|
Stmt::FunctionDef(data) => self.visit_stmt_FunctionDef(data),
|
||||||
StmtKind::AsyncFunctionDef(data) => self.visit_stmt_AsyncFunctionDef(data),
|
Stmt::AsyncFunctionDef(data) => self.visit_stmt_AsyncFunctionDef(data),
|
||||||
StmtKind::ClassDef(data) => self.visit_stmt_ClassDef(data),
|
Stmt::ClassDef(data) => self.visit_stmt_ClassDef(data),
|
||||||
StmtKind::Return(data) => self.visit_stmt_Return(data),
|
Stmt::Return(data) => self.visit_stmt_Return(data),
|
||||||
StmtKind::Delete(data) => self.visit_stmt_Delete(data),
|
Stmt::Delete(data) => self.visit_stmt_Delete(data),
|
||||||
StmtKind::Assign(data) => self.visit_stmt_Assign(data),
|
Stmt::Assign(data) => self.visit_stmt_Assign(data),
|
||||||
StmtKind::AugAssign(data) => self.visit_stmt_AugAssign(data),
|
Stmt::AugAssign(data) => self.visit_stmt_AugAssign(data),
|
||||||
StmtKind::AnnAssign(data) => self.visit_stmt_AnnAssign(data),
|
Stmt::AnnAssign(data) => self.visit_stmt_AnnAssign(data),
|
||||||
StmtKind::For(data) => self.visit_stmt_For(data),
|
Stmt::For(data) => self.visit_stmt_For(data),
|
||||||
StmtKind::AsyncFor(data) => self.visit_stmt_AsyncFor(data),
|
Stmt::AsyncFor(data) => self.visit_stmt_AsyncFor(data),
|
||||||
StmtKind::While(data) => self.visit_stmt_While(data),
|
Stmt::While(data) => self.visit_stmt_While(data),
|
||||||
StmtKind::If(data) => self.visit_stmt_If(data),
|
Stmt::If(data) => self.visit_stmt_If(data),
|
||||||
StmtKind::With(data) => self.visit_stmt_With(data),
|
Stmt::With(data) => self.visit_stmt_With(data),
|
||||||
StmtKind::AsyncWith(data) => self.visit_stmt_AsyncWith(data),
|
Stmt::AsyncWith(data) => self.visit_stmt_AsyncWith(data),
|
||||||
StmtKind::Match(data) => self.visit_stmt_Match(data),
|
Stmt::Match(data) => self.visit_stmt_Match(data),
|
||||||
StmtKind::Raise(data) => self.visit_stmt_Raise(data),
|
Stmt::Raise(data) => self.visit_stmt_Raise(data),
|
||||||
StmtKind::Try(data) => self.visit_stmt_Try(data),
|
Stmt::Try(data) => self.visit_stmt_Try(data),
|
||||||
StmtKind::TryStar(data) => self.visit_stmt_TryStar(data),
|
Stmt::TryStar(data) => self.visit_stmt_TryStar(data),
|
||||||
StmtKind::Assert(data) => self.visit_stmt_Assert(data),
|
Stmt::Assert(data) => self.visit_stmt_Assert(data),
|
||||||
StmtKind::Import(data) => self.visit_stmt_Import(data),
|
Stmt::Import(data) => self.visit_stmt_Import(data),
|
||||||
StmtKind::ImportFrom(data) => self.visit_stmt_ImportFrom(data),
|
Stmt::ImportFrom(data) => self.visit_stmt_ImportFrom(data),
|
||||||
StmtKind::Global(data) => self.visit_stmt_Global(data),
|
Stmt::Global(data) => self.visit_stmt_Global(data),
|
||||||
StmtKind::Nonlocal(data) => self.visit_stmt_Nonlocal(data),
|
Stmt::Nonlocal(data) => self.visit_stmt_Nonlocal(data),
|
||||||
StmtKind::Expr(data) => self.visit_stmt_Expr(data),
|
Stmt::Expr(data) => self.visit_stmt_Expr(data),
|
||||||
StmtKind::Pass => self.visit_stmt_Pass(()),
|
Stmt::Pass(data) => self.visit_stmt_Pass(data),
|
||||||
StmtKind::Break => self.visit_stmt_Break(()),
|
Stmt::Break(data) => self.visit_stmt_Break(data),
|
||||||
StmtKind::Continue => self.visit_stmt_Continue(()),
|
Stmt::Continue(data) => self.visit_stmt_Continue(data),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_FunctionDef(&mut self, node: StmtFunctionDef) {
|
fn visit_stmt_FunctionDef(&mut self, node: StmtFunctionDef<R>) {
|
||||||
self.generic_visit_stmt_FunctionDef(node)
|
self.generic_visit_stmt_FunctionDef(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_FunctionDef(&mut self, node: StmtFunctionDef) {
|
fn generic_visit_stmt_FunctionDef(&mut self, node: StmtFunctionDef<R>) {
|
||||||
{
|
{
|
||||||
let value = node.args;
|
let value = node.args;
|
||||||
self.visit_arguments(*value);
|
self.visit_arguments(*value);
|
||||||
|
|
@ -54,10 +54,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_AsyncFunctionDef(&mut self, node: StmtAsyncFunctionDef) {
|
fn visit_stmt_AsyncFunctionDef(&mut self, node: StmtAsyncFunctionDef<R>) {
|
||||||
self.generic_visit_stmt_AsyncFunctionDef(node)
|
self.generic_visit_stmt_AsyncFunctionDef(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_AsyncFunctionDef(&mut self, node: StmtAsyncFunctionDef) {
|
fn generic_visit_stmt_AsyncFunctionDef(&mut self, node: StmtAsyncFunctionDef<R>) {
|
||||||
{
|
{
|
||||||
let value = node.args;
|
let value = node.args;
|
||||||
self.visit_arguments(*value);
|
self.visit_arguments(*value);
|
||||||
|
|
@ -72,10 +72,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_ClassDef(&mut self, node: StmtClassDef) {
|
fn visit_stmt_ClassDef(&mut self, node: StmtClassDef<R>) {
|
||||||
self.generic_visit_stmt_ClassDef(node)
|
self.generic_visit_stmt_ClassDef(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_ClassDef(&mut self, node: StmtClassDef) {
|
fn generic_visit_stmt_ClassDef(&mut self, node: StmtClassDef<R>) {
|
||||||
for value in node.bases {
|
for value in node.bases {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
|
|
@ -89,26 +89,26 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Return(&mut self, node: StmtReturn) {
|
fn visit_stmt_Return(&mut self, node: StmtReturn<R>) {
|
||||||
self.generic_visit_stmt_Return(node)
|
self.generic_visit_stmt_Return(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Return(&mut self, node: StmtReturn) {
|
fn generic_visit_stmt_Return(&mut self, node: StmtReturn<R>) {
|
||||||
if let Some(value) = node.value {
|
if let Some(value) = node.value {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Delete(&mut self, node: StmtDelete) {
|
fn visit_stmt_Delete(&mut self, node: StmtDelete<R>) {
|
||||||
self.generic_visit_stmt_Delete(node)
|
self.generic_visit_stmt_Delete(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Delete(&mut self, node: StmtDelete) {
|
fn generic_visit_stmt_Delete(&mut self, node: StmtDelete<R>) {
|
||||||
for value in node.targets {
|
for value in node.targets {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Assign(&mut self, node: StmtAssign) {
|
fn visit_stmt_Assign(&mut self, node: StmtAssign<R>) {
|
||||||
self.generic_visit_stmt_Assign(node)
|
self.generic_visit_stmt_Assign(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Assign(&mut self, node: StmtAssign) {
|
fn generic_visit_stmt_Assign(&mut self, node: StmtAssign<R>) {
|
||||||
for value in node.targets {
|
for value in node.targets {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
|
|
@ -117,10 +117,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_AugAssign(&mut self, node: StmtAugAssign) {
|
fn visit_stmt_AugAssign(&mut self, node: StmtAugAssign<R>) {
|
||||||
self.generic_visit_stmt_AugAssign(node)
|
self.generic_visit_stmt_AugAssign(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_AugAssign(&mut self, node: StmtAugAssign) {
|
fn generic_visit_stmt_AugAssign(&mut self, node: StmtAugAssign<R>) {
|
||||||
{
|
{
|
||||||
let value = node.target;
|
let value = node.target;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -130,10 +130,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_AnnAssign(&mut self, node: StmtAnnAssign) {
|
fn visit_stmt_AnnAssign(&mut self, node: StmtAnnAssign<R>) {
|
||||||
self.generic_visit_stmt_AnnAssign(node)
|
self.generic_visit_stmt_AnnAssign(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_AnnAssign(&mut self, node: StmtAnnAssign) {
|
fn generic_visit_stmt_AnnAssign(&mut self, node: StmtAnnAssign<R>) {
|
||||||
{
|
{
|
||||||
let value = node.target;
|
let value = node.target;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -146,10 +146,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_For(&mut self, node: StmtFor) {
|
fn visit_stmt_For(&mut self, node: StmtFor<R>) {
|
||||||
self.generic_visit_stmt_For(node)
|
self.generic_visit_stmt_For(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_For(&mut self, node: StmtFor) {
|
fn generic_visit_stmt_For(&mut self, node: StmtFor<R>) {
|
||||||
{
|
{
|
||||||
let value = node.target;
|
let value = node.target;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -165,10 +165,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_AsyncFor(&mut self, node: StmtAsyncFor) {
|
fn visit_stmt_AsyncFor(&mut self, node: StmtAsyncFor<R>) {
|
||||||
self.generic_visit_stmt_AsyncFor(node)
|
self.generic_visit_stmt_AsyncFor(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_AsyncFor(&mut self, node: StmtAsyncFor) {
|
fn generic_visit_stmt_AsyncFor(&mut self, node: StmtAsyncFor<R>) {
|
||||||
{
|
{
|
||||||
let value = node.target;
|
let value = node.target;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -184,10 +184,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_While(&mut self, node: StmtWhile) {
|
fn visit_stmt_While(&mut self, node: StmtWhile<R>) {
|
||||||
self.generic_visit_stmt_While(node)
|
self.generic_visit_stmt_While(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_While(&mut self, node: StmtWhile) {
|
fn generic_visit_stmt_While(&mut self, node: StmtWhile<R>) {
|
||||||
{
|
{
|
||||||
let value = node.test;
|
let value = node.test;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -199,10 +199,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_If(&mut self, node: StmtIf) {
|
fn visit_stmt_If(&mut self, node: StmtIf<R>) {
|
||||||
self.generic_visit_stmt_If(node)
|
self.generic_visit_stmt_If(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_If(&mut self, node: StmtIf) {
|
fn generic_visit_stmt_If(&mut self, node: StmtIf<R>) {
|
||||||
{
|
{
|
||||||
let value = node.test;
|
let value = node.test;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -214,10 +214,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_With(&mut self, node: StmtWith) {
|
fn visit_stmt_With(&mut self, node: StmtWith<R>) {
|
||||||
self.generic_visit_stmt_With(node)
|
self.generic_visit_stmt_With(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_With(&mut self, node: StmtWith) {
|
fn generic_visit_stmt_With(&mut self, node: StmtWith<R>) {
|
||||||
for value in node.items {
|
for value in node.items {
|
||||||
self.visit_withitem(value);
|
self.visit_withitem(value);
|
||||||
}
|
}
|
||||||
|
|
@ -225,10 +225,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_AsyncWith(&mut self, node: StmtAsyncWith) {
|
fn visit_stmt_AsyncWith(&mut self, node: StmtAsyncWith<R>) {
|
||||||
self.generic_visit_stmt_AsyncWith(node)
|
self.generic_visit_stmt_AsyncWith(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_AsyncWith(&mut self, node: StmtAsyncWith) {
|
fn generic_visit_stmt_AsyncWith(&mut self, node: StmtAsyncWith<R>) {
|
||||||
for value in node.items {
|
for value in node.items {
|
||||||
self.visit_withitem(value);
|
self.visit_withitem(value);
|
||||||
}
|
}
|
||||||
|
|
@ -236,10 +236,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Match(&mut self, node: StmtMatch) {
|
fn visit_stmt_Match(&mut self, node: StmtMatch<R>) {
|
||||||
self.generic_visit_stmt_Match(node)
|
self.generic_visit_stmt_Match(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Match(&mut self, node: StmtMatch) {
|
fn generic_visit_stmt_Match(&mut self, node: StmtMatch<R>) {
|
||||||
{
|
{
|
||||||
let value = node.subject;
|
let value = node.subject;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -248,10 +248,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_match_case(value);
|
self.visit_match_case(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Raise(&mut self, node: StmtRaise) {
|
fn visit_stmt_Raise(&mut self, node: StmtRaise<R>) {
|
||||||
self.generic_visit_stmt_Raise(node)
|
self.generic_visit_stmt_Raise(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Raise(&mut self, node: StmtRaise) {
|
fn generic_visit_stmt_Raise(&mut self, node: StmtRaise<R>) {
|
||||||
if let Some(value) = node.exc {
|
if let Some(value) = node.exc {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
|
|
@ -259,10 +259,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Try(&mut self, node: StmtTry) {
|
fn visit_stmt_Try(&mut self, node: StmtTry<R>) {
|
||||||
self.generic_visit_stmt_Try(node)
|
self.generic_visit_stmt_Try(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Try(&mut self, node: StmtTry) {
|
fn generic_visit_stmt_Try(&mut self, node: StmtTry<R>) {
|
||||||
for value in node.body {
|
for value in node.body {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
|
|
@ -276,10 +276,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_TryStar(&mut self, node: StmtTryStar) {
|
fn visit_stmt_TryStar(&mut self, node: StmtTryStar<R>) {
|
||||||
self.generic_visit_stmt_TryStar(node)
|
self.generic_visit_stmt_TryStar(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_TryStar(&mut self, node: StmtTryStar) {
|
fn generic_visit_stmt_TryStar(&mut self, node: StmtTryStar<R>) {
|
||||||
for value in node.body {
|
for value in node.body {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
|
|
@ -293,10 +293,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Assert(&mut self, node: StmtAssert) {
|
fn visit_stmt_Assert(&mut self, node: StmtAssert<R>) {
|
||||||
self.generic_visit_stmt_Assert(node)
|
self.generic_visit_stmt_Assert(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Assert(&mut self, node: StmtAssert) {
|
fn generic_visit_stmt_Assert(&mut self, node: StmtAssert<R>) {
|
||||||
{
|
{
|
||||||
let value = node.test;
|
let value = node.test;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -305,97 +305,88 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Import(&mut self, node: StmtImport) {
|
fn visit_stmt_Import(&mut self, node: StmtImport<R>) {
|
||||||
self.generic_visit_stmt_Import(node)
|
self.generic_visit_stmt_Import(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Import(&mut self, node: StmtImport) {
|
fn generic_visit_stmt_Import(&mut self, node: StmtImport<R>) {
|
||||||
for value in node.names {
|
for value in node.names {
|
||||||
self.visit_alias(value);
|
self.visit_alias(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_ImportFrom(&mut self, node: StmtImportFrom) {
|
fn visit_stmt_ImportFrom(&mut self, node: StmtImportFrom<R>) {
|
||||||
self.generic_visit_stmt_ImportFrom(node)
|
self.generic_visit_stmt_ImportFrom(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_ImportFrom(&mut self, node: StmtImportFrom) {
|
fn generic_visit_stmt_ImportFrom(&mut self, node: StmtImportFrom<R>) {
|
||||||
for value in node.names {
|
for value in node.names {
|
||||||
self.visit_alias(value);
|
self.visit_alias(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Global(&mut self, node: StmtGlobal) {
|
fn visit_stmt_Global(&mut self, node: StmtGlobal<R>) {
|
||||||
self.generic_visit_stmt_Global(node)
|
self.generic_visit_stmt_Global(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Global(&mut self, node: StmtGlobal) {}
|
fn generic_visit_stmt_Global(&mut self, node: StmtGlobal<R>) {}
|
||||||
fn visit_stmt_Nonlocal(&mut self, node: StmtNonlocal) {
|
fn visit_stmt_Nonlocal(&mut self, node: StmtNonlocal<R>) {
|
||||||
self.generic_visit_stmt_Nonlocal(node)
|
self.generic_visit_stmt_Nonlocal(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Nonlocal(&mut self, node: StmtNonlocal) {}
|
fn generic_visit_stmt_Nonlocal(&mut self, node: StmtNonlocal<R>) {}
|
||||||
fn visit_stmt_Expr(&mut self, node: StmtExpr) {
|
fn visit_stmt_Expr(&mut self, node: StmtExpr<R>) {
|
||||||
self.generic_visit_stmt_Expr(node)
|
self.generic_visit_stmt_Expr(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_stmt_Expr(&mut self, node: StmtExpr) {
|
fn generic_visit_stmt_Expr(&mut self, node: StmtExpr<R>) {
|
||||||
{
|
{
|
||||||
let value = node.value;
|
let value = node.value;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_stmt_Pass(&mut self, node: ()) {
|
fn visit_stmt_Pass(&mut self, node: StmtPass<R>) {}
|
||||||
self.generic_visit_stmt_Pass(())
|
fn visit_stmt_Break(&mut self, node: StmtBreak<R>) {}
|
||||||
}
|
fn visit_stmt_Continue(&mut self, node: StmtContinue<R>) {}
|
||||||
fn generic_visit_stmt_Pass(&mut self, node: ()) {}
|
fn visit_expr(&mut self, node: Expr<R>) {
|
||||||
fn visit_stmt_Break(&mut self, node: ()) {
|
|
||||||
self.generic_visit_stmt_Break(())
|
|
||||||
}
|
|
||||||
fn generic_visit_stmt_Break(&mut self, node: ()) {}
|
|
||||||
fn visit_stmt_Continue(&mut self, node: ()) {
|
|
||||||
self.generic_visit_stmt_Continue(())
|
|
||||||
}
|
|
||||||
fn generic_visit_stmt_Continue(&mut self, node: ()) {}
|
|
||||||
fn visit_expr(&mut self, node: Expr) {
|
|
||||||
self.generic_visit_expr(node)
|
self.generic_visit_expr(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr(&mut self, node: Expr) {
|
fn generic_visit_expr(&mut self, node: Expr<R>) {
|
||||||
match node.node {
|
match node {
|
||||||
ExprKind::BoolOp(data) => self.visit_expr_BoolOp(data),
|
Expr::BoolOp(data) => self.visit_expr_BoolOp(data),
|
||||||
ExprKind::NamedExpr(data) => self.visit_expr_NamedExpr(data),
|
Expr::NamedExpr(data) => self.visit_expr_NamedExpr(data),
|
||||||
ExprKind::BinOp(data) => self.visit_expr_BinOp(data),
|
Expr::BinOp(data) => self.visit_expr_BinOp(data),
|
||||||
ExprKind::UnaryOp(data) => self.visit_expr_UnaryOp(data),
|
Expr::UnaryOp(data) => self.visit_expr_UnaryOp(data),
|
||||||
ExprKind::Lambda(data) => self.visit_expr_Lambda(data),
|
Expr::Lambda(data) => self.visit_expr_Lambda(data),
|
||||||
ExprKind::IfExp(data) => self.visit_expr_IfExp(data),
|
Expr::IfExp(data) => self.visit_expr_IfExp(data),
|
||||||
ExprKind::Dict(data) => self.visit_expr_Dict(data),
|
Expr::Dict(data) => self.visit_expr_Dict(data),
|
||||||
ExprKind::Set(data) => self.visit_expr_Set(data),
|
Expr::Set(data) => self.visit_expr_Set(data),
|
||||||
ExprKind::ListComp(data) => self.visit_expr_ListComp(data),
|
Expr::ListComp(data) => self.visit_expr_ListComp(data),
|
||||||
ExprKind::SetComp(data) => self.visit_expr_SetComp(data),
|
Expr::SetComp(data) => self.visit_expr_SetComp(data),
|
||||||
ExprKind::DictComp(data) => self.visit_expr_DictComp(data),
|
Expr::DictComp(data) => self.visit_expr_DictComp(data),
|
||||||
ExprKind::GeneratorExp(data) => self.visit_expr_GeneratorExp(data),
|
Expr::GeneratorExp(data) => self.visit_expr_GeneratorExp(data),
|
||||||
ExprKind::Await(data) => self.visit_expr_Await(data),
|
Expr::Await(data) => self.visit_expr_Await(data),
|
||||||
ExprKind::Yield(data) => self.visit_expr_Yield(data),
|
Expr::Yield(data) => self.visit_expr_Yield(data),
|
||||||
ExprKind::YieldFrom(data) => self.visit_expr_YieldFrom(data),
|
Expr::YieldFrom(data) => self.visit_expr_YieldFrom(data),
|
||||||
ExprKind::Compare(data) => self.visit_expr_Compare(data),
|
Expr::Compare(data) => self.visit_expr_Compare(data),
|
||||||
ExprKind::Call(data) => self.visit_expr_Call(data),
|
Expr::Call(data) => self.visit_expr_Call(data),
|
||||||
ExprKind::FormattedValue(data) => self.visit_expr_FormattedValue(data),
|
Expr::FormattedValue(data) => self.visit_expr_FormattedValue(data),
|
||||||
ExprKind::JoinedStr(data) => self.visit_expr_JoinedStr(data),
|
Expr::JoinedStr(data) => self.visit_expr_JoinedStr(data),
|
||||||
ExprKind::Constant(data) => self.visit_expr_Constant(data),
|
Expr::Constant(data) => self.visit_expr_Constant(data),
|
||||||
ExprKind::Attribute(data) => self.visit_expr_Attribute(data),
|
Expr::Attribute(data) => self.visit_expr_Attribute(data),
|
||||||
ExprKind::Subscript(data) => self.visit_expr_Subscript(data),
|
Expr::Subscript(data) => self.visit_expr_Subscript(data),
|
||||||
ExprKind::Starred(data) => self.visit_expr_Starred(data),
|
Expr::Starred(data) => self.visit_expr_Starred(data),
|
||||||
ExprKind::Name(data) => self.visit_expr_Name(data),
|
Expr::Name(data) => self.visit_expr_Name(data),
|
||||||
ExprKind::List(data) => self.visit_expr_List(data),
|
Expr::List(data) => self.visit_expr_List(data),
|
||||||
ExprKind::Tuple(data) => self.visit_expr_Tuple(data),
|
Expr::Tuple(data) => self.visit_expr_Tuple(data),
|
||||||
ExprKind::Slice(data) => self.visit_expr_Slice(data),
|
Expr::Slice(data) => self.visit_expr_Slice(data),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_BoolOp(&mut self, node: ExprBoolOp) {
|
fn visit_expr_BoolOp(&mut self, node: ExprBoolOp<R>) {
|
||||||
self.generic_visit_expr_BoolOp(node)
|
self.generic_visit_expr_BoolOp(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_BoolOp(&mut self, node: ExprBoolOp) {
|
fn generic_visit_expr_BoolOp(&mut self, node: ExprBoolOp<R>) {
|
||||||
for value in node.values {
|
for value in node.values {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_NamedExpr(&mut self, node: ExprNamedExpr) {
|
fn visit_expr_NamedExpr(&mut self, node: ExprNamedExpr<R>) {
|
||||||
self.generic_visit_expr_NamedExpr(node)
|
self.generic_visit_expr_NamedExpr(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_NamedExpr(&mut self, node: ExprNamedExpr) {
|
fn generic_visit_expr_NamedExpr(&mut self, node: ExprNamedExpr<R>) {
|
||||||
{
|
{
|
||||||
let value = node.target;
|
let value = node.target;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -405,10 +396,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_BinOp(&mut self, node: ExprBinOp) {
|
fn visit_expr_BinOp(&mut self, node: ExprBinOp<R>) {
|
||||||
self.generic_visit_expr_BinOp(node)
|
self.generic_visit_expr_BinOp(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_BinOp(&mut self, node: ExprBinOp) {
|
fn generic_visit_expr_BinOp(&mut self, node: ExprBinOp<R>) {
|
||||||
{
|
{
|
||||||
let value = node.left;
|
let value = node.left;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -418,19 +409,19 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_UnaryOp(&mut self, node: ExprUnaryOp) {
|
fn visit_expr_UnaryOp(&mut self, node: ExprUnaryOp<R>) {
|
||||||
self.generic_visit_expr_UnaryOp(node)
|
self.generic_visit_expr_UnaryOp(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_UnaryOp(&mut self, node: ExprUnaryOp) {
|
fn generic_visit_expr_UnaryOp(&mut self, node: ExprUnaryOp<R>) {
|
||||||
{
|
{
|
||||||
let value = node.operand;
|
let value = node.operand;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Lambda(&mut self, node: ExprLambda) {
|
fn visit_expr_Lambda(&mut self, node: ExprLambda<R>) {
|
||||||
self.generic_visit_expr_Lambda(node)
|
self.generic_visit_expr_Lambda(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Lambda(&mut self, node: ExprLambda) {
|
fn generic_visit_expr_Lambda(&mut self, node: ExprLambda<R>) {
|
||||||
{
|
{
|
||||||
let value = node.args;
|
let value = node.args;
|
||||||
self.visit_arguments(*value);
|
self.visit_arguments(*value);
|
||||||
|
|
@ -440,10 +431,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_IfExp(&mut self, node: ExprIfExp) {
|
fn visit_expr_IfExp(&mut self, node: ExprIfExp<R>) {
|
||||||
self.generic_visit_expr_IfExp(node)
|
self.generic_visit_expr_IfExp(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_IfExp(&mut self, node: ExprIfExp) {
|
fn generic_visit_expr_IfExp(&mut self, node: ExprIfExp<R>) {
|
||||||
{
|
{
|
||||||
let value = node.test;
|
let value = node.test;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -457,10 +448,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Dict(&mut self, node: ExprDict) {
|
fn visit_expr_Dict(&mut self, node: ExprDict<R>) {
|
||||||
self.generic_visit_expr_Dict(node)
|
self.generic_visit_expr_Dict(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Dict(&mut self, node: ExprDict) {
|
fn generic_visit_expr_Dict(&mut self, node: ExprDict<R>) {
|
||||||
for value in node.keys.into_iter().flatten() {
|
for value in node.keys.into_iter().flatten() {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
|
|
@ -468,18 +459,18 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Set(&mut self, node: ExprSet) {
|
fn visit_expr_Set(&mut self, node: ExprSet<R>) {
|
||||||
self.generic_visit_expr_Set(node)
|
self.generic_visit_expr_Set(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Set(&mut self, node: ExprSet) {
|
fn generic_visit_expr_Set(&mut self, node: ExprSet<R>) {
|
||||||
for value in node.elts {
|
for value in node.elts {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_ListComp(&mut self, node: ExprListComp) {
|
fn visit_expr_ListComp(&mut self, node: ExprListComp<R>) {
|
||||||
self.generic_visit_expr_ListComp(node)
|
self.generic_visit_expr_ListComp(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_ListComp(&mut self, node: ExprListComp) {
|
fn generic_visit_expr_ListComp(&mut self, node: ExprListComp<R>) {
|
||||||
{
|
{
|
||||||
let value = node.elt;
|
let value = node.elt;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -488,10 +479,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_comprehension(value);
|
self.visit_comprehension(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_SetComp(&mut self, node: ExprSetComp) {
|
fn visit_expr_SetComp(&mut self, node: ExprSetComp<R>) {
|
||||||
self.generic_visit_expr_SetComp(node)
|
self.generic_visit_expr_SetComp(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_SetComp(&mut self, node: ExprSetComp) {
|
fn generic_visit_expr_SetComp(&mut self, node: ExprSetComp<R>) {
|
||||||
{
|
{
|
||||||
let value = node.elt;
|
let value = node.elt;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -500,10 +491,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_comprehension(value);
|
self.visit_comprehension(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_DictComp(&mut self, node: ExprDictComp) {
|
fn visit_expr_DictComp(&mut self, node: ExprDictComp<R>) {
|
||||||
self.generic_visit_expr_DictComp(node)
|
self.generic_visit_expr_DictComp(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_DictComp(&mut self, node: ExprDictComp) {
|
fn generic_visit_expr_DictComp(&mut self, node: ExprDictComp<R>) {
|
||||||
{
|
{
|
||||||
let value = node.key;
|
let value = node.key;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -516,10 +507,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_comprehension(value);
|
self.visit_comprehension(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_GeneratorExp(&mut self, node: ExprGeneratorExp) {
|
fn visit_expr_GeneratorExp(&mut self, node: ExprGeneratorExp<R>) {
|
||||||
self.generic_visit_expr_GeneratorExp(node)
|
self.generic_visit_expr_GeneratorExp(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_GeneratorExp(&mut self, node: ExprGeneratorExp) {
|
fn generic_visit_expr_GeneratorExp(&mut self, node: ExprGeneratorExp<R>) {
|
||||||
{
|
{
|
||||||
let value = node.elt;
|
let value = node.elt;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -528,36 +519,36 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_comprehension(value);
|
self.visit_comprehension(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Await(&mut self, node: ExprAwait) {
|
fn visit_expr_Await(&mut self, node: ExprAwait<R>) {
|
||||||
self.generic_visit_expr_Await(node)
|
self.generic_visit_expr_Await(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Await(&mut self, node: ExprAwait) {
|
fn generic_visit_expr_Await(&mut self, node: ExprAwait<R>) {
|
||||||
{
|
{
|
||||||
let value = node.value;
|
let value = node.value;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Yield(&mut self, node: ExprYield) {
|
fn visit_expr_Yield(&mut self, node: ExprYield<R>) {
|
||||||
self.generic_visit_expr_Yield(node)
|
self.generic_visit_expr_Yield(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Yield(&mut self, node: ExprYield) {
|
fn generic_visit_expr_Yield(&mut self, node: ExprYield<R>) {
|
||||||
if let Some(value) = node.value {
|
if let Some(value) = node.value {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_YieldFrom(&mut self, node: ExprYieldFrom) {
|
fn visit_expr_YieldFrom(&mut self, node: ExprYieldFrom<R>) {
|
||||||
self.generic_visit_expr_YieldFrom(node)
|
self.generic_visit_expr_YieldFrom(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_YieldFrom(&mut self, node: ExprYieldFrom) {
|
fn generic_visit_expr_YieldFrom(&mut self, node: ExprYieldFrom<R>) {
|
||||||
{
|
{
|
||||||
let value = node.value;
|
let value = node.value;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Compare(&mut self, node: ExprCompare) {
|
fn visit_expr_Compare(&mut self, node: ExprCompare<R>) {
|
||||||
self.generic_visit_expr_Compare(node)
|
self.generic_visit_expr_Compare(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Compare(&mut self, node: ExprCompare) {
|
fn generic_visit_expr_Compare(&mut self, node: ExprCompare<R>) {
|
||||||
{
|
{
|
||||||
let value = node.left;
|
let value = node.left;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -566,10 +557,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Call(&mut self, node: ExprCall) {
|
fn visit_expr_Call(&mut self, node: ExprCall<R>) {
|
||||||
self.generic_visit_expr_Call(node)
|
self.generic_visit_expr_Call(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Call(&mut self, node: ExprCall) {
|
fn generic_visit_expr_Call(&mut self, node: ExprCall<R>) {
|
||||||
{
|
{
|
||||||
let value = node.func;
|
let value = node.func;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -581,10 +572,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_keyword(value);
|
self.visit_keyword(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_FormattedValue(&mut self, node: ExprFormattedValue) {
|
fn visit_expr_FormattedValue(&mut self, node: ExprFormattedValue<R>) {
|
||||||
self.generic_visit_expr_FormattedValue(node)
|
self.generic_visit_expr_FormattedValue(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_FormattedValue(&mut self, node: ExprFormattedValue) {
|
fn generic_visit_expr_FormattedValue(&mut self, node: ExprFormattedValue<R>) {
|
||||||
{
|
{
|
||||||
let value = node.value;
|
let value = node.value;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -593,31 +584,31 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_JoinedStr(&mut self, node: ExprJoinedStr) {
|
fn visit_expr_JoinedStr(&mut self, node: ExprJoinedStr<R>) {
|
||||||
self.generic_visit_expr_JoinedStr(node)
|
self.generic_visit_expr_JoinedStr(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_JoinedStr(&mut self, node: ExprJoinedStr) {
|
fn generic_visit_expr_JoinedStr(&mut self, node: ExprJoinedStr<R>) {
|
||||||
for value in node.values {
|
for value in node.values {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Constant(&mut self, node: ExprConstant) {
|
fn visit_expr_Constant(&mut self, node: ExprConstant<R>) {
|
||||||
self.generic_visit_expr_Constant(node)
|
self.generic_visit_expr_Constant(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Constant(&mut self, node: ExprConstant) {}
|
fn generic_visit_expr_Constant(&mut self, node: ExprConstant<R>) {}
|
||||||
fn visit_expr_Attribute(&mut self, node: ExprAttribute) {
|
fn visit_expr_Attribute(&mut self, node: ExprAttribute<R>) {
|
||||||
self.generic_visit_expr_Attribute(node)
|
self.generic_visit_expr_Attribute(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Attribute(&mut self, node: ExprAttribute) {
|
fn generic_visit_expr_Attribute(&mut self, node: ExprAttribute<R>) {
|
||||||
{
|
{
|
||||||
let value = node.value;
|
let value = node.value;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Subscript(&mut self, node: ExprSubscript) {
|
fn visit_expr_Subscript(&mut self, node: ExprSubscript<R>) {
|
||||||
self.generic_visit_expr_Subscript(node)
|
self.generic_visit_expr_Subscript(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Subscript(&mut self, node: ExprSubscript) {
|
fn generic_visit_expr_Subscript(&mut self, node: ExprSubscript<R>) {
|
||||||
{
|
{
|
||||||
let value = node.value;
|
let value = node.value;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -627,39 +618,39 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Starred(&mut self, node: ExprStarred) {
|
fn visit_expr_Starred(&mut self, node: ExprStarred<R>) {
|
||||||
self.generic_visit_expr_Starred(node)
|
self.generic_visit_expr_Starred(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Starred(&mut self, node: ExprStarred) {
|
fn generic_visit_expr_Starred(&mut self, node: ExprStarred<R>) {
|
||||||
{
|
{
|
||||||
let value = node.value;
|
let value = node.value;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Name(&mut self, node: ExprName) {
|
fn visit_expr_Name(&mut self, node: ExprName<R>) {
|
||||||
self.generic_visit_expr_Name(node)
|
self.generic_visit_expr_Name(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Name(&mut self, node: ExprName) {}
|
fn generic_visit_expr_Name(&mut self, node: ExprName<R>) {}
|
||||||
fn visit_expr_List(&mut self, node: ExprList) {
|
fn visit_expr_List(&mut self, node: ExprList<R>) {
|
||||||
self.generic_visit_expr_List(node)
|
self.generic_visit_expr_List(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_List(&mut self, node: ExprList) {
|
fn generic_visit_expr_List(&mut self, node: ExprList<R>) {
|
||||||
for value in node.elts {
|
for value in node.elts {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Tuple(&mut self, node: ExprTuple) {
|
fn visit_expr_Tuple(&mut self, node: ExprTuple<R>) {
|
||||||
self.generic_visit_expr_Tuple(node)
|
self.generic_visit_expr_Tuple(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Tuple(&mut self, node: ExprTuple) {
|
fn generic_visit_expr_Tuple(&mut self, node: ExprTuple<R>) {
|
||||||
for value in node.elts {
|
for value in node.elts {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_expr_Slice(&mut self, node: ExprSlice) {
|
fn visit_expr_Slice(&mut self, node: ExprSlice<R>) {
|
||||||
self.generic_visit_expr_Slice(node)
|
self.generic_visit_expr_Slice(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_expr_Slice(&mut self, node: ExprSlice) {
|
fn generic_visit_expr_Slice(&mut self, node: ExprSlice<R>) {
|
||||||
if let Some(value) = node.lower {
|
if let Some(value) = node.lower {
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
|
|
@ -690,22 +681,22 @@ pub trait Visitor<U = ()> {
|
||||||
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) {
|
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) {}
|
fn generic_visit_comprehension(&mut self, node: Comprehension<R>) {}
|
||||||
fn visit_excepthandler(&mut self, node: Excepthandler) {
|
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) {
|
fn generic_visit_excepthandler(&mut self, node: Excepthandler<R>) {
|
||||||
match node.node {
|
match node {
|
||||||
ExcepthandlerKind::ExceptHandler(data) => self.visit_excepthandler_ExceptHandler(data),
|
Excepthandler::ExceptHandler(data) => self.visit_excepthandler_ExceptHandler(data),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_excepthandler_ExceptHandler(&mut self, node: ExcepthandlerExceptHandler) {
|
fn visit_excepthandler_ExceptHandler(&mut self, node: ExcepthandlerExceptHandler<R>) {
|
||||||
self.generic_visit_excepthandler_ExceptHandler(node)
|
self.generic_visit_excepthandler_ExceptHandler(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_excepthandler_ExceptHandler(&mut self, node: ExcepthandlerExceptHandler) {
|
fn generic_visit_excepthandler_ExceptHandler(&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);
|
||||||
}
|
}
|
||||||
|
|
@ -713,70 +704,70 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_stmt(value);
|
self.visit_stmt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_arguments(&mut self, node: Arguments) {
|
fn visit_arguments(&mut self, node: Arguments<R>) {
|
||||||
self.generic_visit_arguments(node)
|
self.generic_visit_arguments(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_arguments(&mut self, node: Arguments) {}
|
fn generic_visit_arguments(&mut self, node: Arguments<R>) {}
|
||||||
fn visit_arg(&mut self, node: Arg) {
|
fn visit_arg(&mut self, node: Arg<R>) {
|
||||||
self.generic_visit_arg(node)
|
self.generic_visit_arg(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_arg(&mut self, node: Arg) {}
|
fn generic_visit_arg(&mut self, node: Arg<R>) {}
|
||||||
fn visit_keyword(&mut self, node: Keyword) {
|
fn visit_keyword(&mut self, node: Keyword<R>) {
|
||||||
self.generic_visit_keyword(node)
|
self.generic_visit_keyword(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_keyword(&mut self, node: Keyword) {}
|
fn generic_visit_keyword(&mut self, node: Keyword<R>) {}
|
||||||
fn visit_alias(&mut self, node: Alias) {
|
fn visit_alias(&mut self, node: Alias<R>) {
|
||||||
self.generic_visit_alias(node)
|
self.generic_visit_alias(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_alias(&mut self, node: Alias) {}
|
fn generic_visit_alias(&mut self, node: Alias<R>) {}
|
||||||
fn visit_withitem(&mut self, node: Withitem) {
|
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) {}
|
fn generic_visit_withitem(&mut self, node: Withitem<R>) {}
|
||||||
fn visit_match_case(&mut self, node: MatchCase) {
|
fn visit_match_case(&mut self, node: MatchCase<R>) {
|
||||||
self.generic_visit_match_case(node)
|
self.generic_visit_match_case(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_match_case(&mut self, node: MatchCase) {}
|
fn generic_visit_match_case(&mut self, node: MatchCase<R>) {}
|
||||||
fn visit_pattern(&mut self, node: Pattern) {
|
fn visit_pattern(&mut self, node: Pattern<R>) {
|
||||||
self.generic_visit_pattern(node)
|
self.generic_visit_pattern(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern(&mut self, node: Pattern) {
|
fn generic_visit_pattern(&mut self, node: Pattern<R>) {
|
||||||
match node.node {
|
match node {
|
||||||
PatternKind::MatchValue(data) => self.visit_pattern_MatchValue(data),
|
Pattern::MatchValue(data) => self.visit_pattern_MatchValue(data),
|
||||||
PatternKind::MatchSingleton(data) => self.visit_pattern_MatchSingleton(data),
|
Pattern::MatchSingleton(data) => self.visit_pattern_MatchSingleton(data),
|
||||||
PatternKind::MatchSequence(data) => self.visit_pattern_MatchSequence(data),
|
Pattern::MatchSequence(data) => self.visit_pattern_MatchSequence(data),
|
||||||
PatternKind::MatchMapping(data) => self.visit_pattern_MatchMapping(data),
|
Pattern::MatchMapping(data) => self.visit_pattern_MatchMapping(data),
|
||||||
PatternKind::MatchClass(data) => self.visit_pattern_MatchClass(data),
|
Pattern::MatchClass(data) => self.visit_pattern_MatchClass(data),
|
||||||
PatternKind::MatchStar(data) => self.visit_pattern_MatchStar(data),
|
Pattern::MatchStar(data) => self.visit_pattern_MatchStar(data),
|
||||||
PatternKind::MatchAs(data) => self.visit_pattern_MatchAs(data),
|
Pattern::MatchAs(data) => self.visit_pattern_MatchAs(data),
|
||||||
PatternKind::MatchOr(data) => self.visit_pattern_MatchOr(data),
|
Pattern::MatchOr(data) => self.visit_pattern_MatchOr(data),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_pattern_MatchValue(&mut self, node: PatternMatchValue) {
|
fn visit_pattern_MatchValue(&mut self, node: PatternMatchValue<R>) {
|
||||||
self.generic_visit_pattern_MatchValue(node)
|
self.generic_visit_pattern_MatchValue(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern_MatchValue(&mut self, node: PatternMatchValue) {
|
fn generic_visit_pattern_MatchValue(&mut self, node: PatternMatchValue<R>) {
|
||||||
{
|
{
|
||||||
let value = node.value;
|
let value = node.value;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_pattern_MatchSingleton(&mut self, node: PatternMatchSingleton) {
|
fn visit_pattern_MatchSingleton(&mut self, node: PatternMatchSingleton<R>) {
|
||||||
self.generic_visit_pattern_MatchSingleton(node)
|
self.generic_visit_pattern_MatchSingleton(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern_MatchSingleton(&mut self, node: PatternMatchSingleton) {}
|
fn generic_visit_pattern_MatchSingleton(&mut self, node: PatternMatchSingleton<R>) {}
|
||||||
fn visit_pattern_MatchSequence(&mut self, node: PatternMatchSequence) {
|
fn visit_pattern_MatchSequence(&mut self, node: PatternMatchSequence<R>) {
|
||||||
self.generic_visit_pattern_MatchSequence(node)
|
self.generic_visit_pattern_MatchSequence(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern_MatchSequence(&mut self, node: PatternMatchSequence) {
|
fn generic_visit_pattern_MatchSequence(&mut self, node: PatternMatchSequence<R>) {
|
||||||
for value in node.patterns {
|
for value in node.patterns {
|
||||||
self.visit_pattern(value);
|
self.visit_pattern(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_pattern_MatchMapping(&mut self, node: PatternMatchMapping) {
|
fn visit_pattern_MatchMapping(&mut self, node: PatternMatchMapping<R>) {
|
||||||
self.generic_visit_pattern_MatchMapping(node)
|
self.generic_visit_pattern_MatchMapping(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern_MatchMapping(&mut self, node: PatternMatchMapping) {
|
fn generic_visit_pattern_MatchMapping(&mut self, node: PatternMatchMapping<R>) {
|
||||||
for value in node.keys {
|
for value in node.keys {
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
}
|
}
|
||||||
|
|
@ -784,10 +775,10 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_pattern(value);
|
self.visit_pattern(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_pattern_MatchClass(&mut self, node: PatternMatchClass) {
|
fn visit_pattern_MatchClass(&mut self, node: PatternMatchClass<R>) {
|
||||||
self.generic_visit_pattern_MatchClass(node)
|
self.generic_visit_pattern_MatchClass(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern_MatchClass(&mut self, node: PatternMatchClass) {
|
fn generic_visit_pattern_MatchClass(&mut self, node: PatternMatchClass<R>) {
|
||||||
{
|
{
|
||||||
let value = node.cls;
|
let value = node.cls;
|
||||||
self.visit_expr(*value);
|
self.visit_expr(*value);
|
||||||
|
|
@ -799,22 +790,22 @@ pub trait Visitor<U = ()> {
|
||||||
self.visit_pattern(value);
|
self.visit_pattern(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_pattern_MatchStar(&mut self, node: PatternMatchStar) {
|
fn visit_pattern_MatchStar(&mut self, node: PatternMatchStar<R>) {
|
||||||
self.generic_visit_pattern_MatchStar(node)
|
self.generic_visit_pattern_MatchStar(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern_MatchStar(&mut self, node: PatternMatchStar) {}
|
fn generic_visit_pattern_MatchStar(&mut self, node: PatternMatchStar<R>) {}
|
||||||
fn visit_pattern_MatchAs(&mut self, node: PatternMatchAs) {
|
fn visit_pattern_MatchAs(&mut self, node: PatternMatchAs<R>) {
|
||||||
self.generic_visit_pattern_MatchAs(node)
|
self.generic_visit_pattern_MatchAs(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern_MatchAs(&mut self, node: PatternMatchAs) {
|
fn generic_visit_pattern_MatchAs(&mut self, node: PatternMatchAs<R>) {
|
||||||
if let Some(value) = node.pattern {
|
if let Some(value) = node.pattern {
|
||||||
self.visit_pattern(*value);
|
self.visit_pattern(*value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn visit_pattern_MatchOr(&mut self, node: PatternMatchOr) {
|
fn visit_pattern_MatchOr(&mut self, node: PatternMatchOr<R>) {
|
||||||
self.generic_visit_pattern_MatchOr(node)
|
self.generic_visit_pattern_MatchOr(node)
|
||||||
}
|
}
|
||||||
fn generic_visit_pattern_MatchOr(&mut self, node: PatternMatchOr) {
|
fn generic_visit_pattern_MatchOr(&mut self, node: PatternMatchOr<R>) {
|
||||||
for value in node.patterns {
|
for value in node.patterns {
|
||||||
self.visit_pattern(value);
|
self.visit_pattern(value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,17 @@
|
||||||
use crate::{Constant, ExprKind};
|
use crate::{Constant, Excepthandler, Expr, Pattern, Stmt};
|
||||||
|
|
||||||
impl<U> ExprKind<U> {
|
impl<R> Expr<R> {
|
||||||
/// Returns a short name for the node suitable for use in error messages.
|
/// Returns a short name for the node suitable for use in error messages.
|
||||||
pub fn python_name(&self) -> &'static str {
|
pub fn python_name(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
ExprKind::BoolOp { .. } | ExprKind::BinOp { .. } | ExprKind::UnaryOp { .. } => {
|
Expr::BoolOp { .. } | Expr::BinOp { .. } | Expr::UnaryOp { .. } => "operator",
|
||||||
"operator"
|
Expr::Subscript { .. } => "subscript",
|
||||||
}
|
Expr::Await { .. } => "await expression",
|
||||||
ExprKind::Subscript { .. } => "subscript",
|
Expr::Yield { .. } | Expr::YieldFrom { .. } => "yield expression",
|
||||||
ExprKind::Await { .. } => "await expression",
|
Expr::Compare { .. } => "comparison",
|
||||||
ExprKind::Yield { .. } | ExprKind::YieldFrom { .. } => "yield expression",
|
Expr::Attribute { .. } => "attribute",
|
||||||
ExprKind::Compare { .. } => "comparison",
|
Expr::Call { .. } => "function call",
|
||||||
ExprKind::Attribute { .. } => "attribute",
|
Expr::Constant(crate::ExprConstant { value, .. }) => match value {
|
||||||
ExprKind::Call { .. } => "function call",
|
|
||||||
ExprKind::Constant(crate::ExprConstant { value, .. }) => match value {
|
|
||||||
Constant::Str(_)
|
Constant::Str(_)
|
||||||
| Constant::Int(_)
|
| Constant::Int(_)
|
||||||
| Constant::Float(_)
|
| Constant::Float(_)
|
||||||
|
|
@ -30,31 +28,37 @@ impl<U> ExprKind<U> {
|
||||||
Constant::None => "None",
|
Constant::None => "None",
|
||||||
Constant::Ellipsis => "ellipsis",
|
Constant::Ellipsis => "ellipsis",
|
||||||
},
|
},
|
||||||
ExprKind::List { .. } => "list",
|
Expr::List { .. } => "list",
|
||||||
ExprKind::Tuple { .. } => "tuple",
|
Expr::Tuple { .. } => "tuple",
|
||||||
ExprKind::Dict { .. } => "dict display",
|
Expr::Dict { .. } => "dict display",
|
||||||
ExprKind::Set { .. } => "set display",
|
Expr::Set { .. } => "set display",
|
||||||
ExprKind::ListComp { .. } => "list comprehension",
|
Expr::ListComp { .. } => "list comprehension",
|
||||||
ExprKind::DictComp { .. } => "dict comprehension",
|
Expr::DictComp { .. } => "dict comprehension",
|
||||||
ExprKind::SetComp { .. } => "set comprehension",
|
Expr::SetComp { .. } => "set comprehension",
|
||||||
ExprKind::GeneratorExp { .. } => "generator expression",
|
Expr::GeneratorExp { .. } => "generator expression",
|
||||||
ExprKind::Starred { .. } => "starred",
|
Expr::Starred { .. } => "starred",
|
||||||
ExprKind::Slice { .. } => "slice",
|
Expr::Slice { .. } => "slice",
|
||||||
ExprKind::JoinedStr(crate::ExprJoinedStr { values }) => {
|
Expr::JoinedStr(crate::ExprJoinedStr { values, .. }) => {
|
||||||
if values
|
if values.iter().any(|e| e.is_joined_str_expr()) {
|
||||||
.iter()
|
|
||||||
.any(|e| matches!(e.node, ExprKind::JoinedStr { .. }))
|
|
||||||
{
|
|
||||||
"f-string expression"
|
"f-string expression"
|
||||||
} else {
|
} else {
|
||||||
"literal"
|
"literal"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExprKind::FormattedValue { .. } => "f-string expression",
|
Expr::FormattedValue { .. } => "f-string expression",
|
||||||
ExprKind::Name { .. } => "name",
|
Expr::Name { .. } => "name",
|
||||||
ExprKind::Lambda { .. } => "lambda",
|
Expr::Lambda { .. } => "lambda",
|
||||||
ExprKind::IfExp { .. } => "conditional expression",
|
Expr::IfExp { .. } => "conditional expression",
|
||||||
ExprKind::NamedExpr { .. } => "named expression",
|
Expr::NamedExpr { .. } => "named expression",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
static_assertions::assert_eq_size!(Expr, [u8; 72]);
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
static_assertions::assert_eq_size!(Stmt, [u8; 136]);
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
static_assertions::assert_eq_size!(Pattern, [u8; 96]);
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
static_assertions::assert_eq_size!(Excepthandler, [u8; 64]);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ mod generic {
|
||||||
include!("gen/generic.rs");
|
include!("gen/generic.rs");
|
||||||
}
|
}
|
||||||
mod impls;
|
mod impls;
|
||||||
|
mod ranged;
|
||||||
#[cfg(feature = "location")]
|
#[cfg(feature = "location")]
|
||||||
mod source_locator;
|
mod source_locator;
|
||||||
#[cfg(feature = "unparse")]
|
#[cfg(feature = "unparse")]
|
||||||
|
|
@ -15,13 +16,13 @@ mod unparse;
|
||||||
|
|
||||||
pub use builtin::*;
|
pub use builtin::*;
|
||||||
pub use generic::*;
|
pub use generic::*;
|
||||||
|
pub use ranged::{EmptyRange, OptionalRange, Ranged, Suite};
|
||||||
pub use rustpython_parser_core::{text_size, ConversionFlag};
|
pub use rustpython_parser_core::{text_size, ConversionFlag};
|
||||||
|
|
||||||
pub type Suite<U = ()> = Vec<Stmt<U>>;
|
|
||||||
|
|
||||||
#[cfg(feature = "fold")]
|
#[cfg(feature = "fold")]
|
||||||
pub mod fold {
|
pub mod fold {
|
||||||
use super::generic::*;
|
use super::generic::*;
|
||||||
|
|
||||||
include!("gen/fold.rs");
|
include!("gen/fold.rs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,9 +34,7 @@ mod visitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "location")]
|
#[cfg(feature = "location")]
|
||||||
pub mod located {
|
pub mod located;
|
||||||
include!("gen/located.rs");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "location")]
|
#[cfg(feature = "location")]
|
||||||
pub use rustpython_parser_core::source_code;
|
pub use rustpython_parser_core::source_code;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
#![allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
use crate::source_code::{SourceLocation, SourceRange};
|
||||||
|
|
||||||
|
pub trait Located {
|
||||||
|
fn range(&self) -> SourceRange;
|
||||||
|
|
||||||
|
fn location(&self) -> SourceLocation {
|
||||||
|
self.range().start
|
||||||
|
}
|
||||||
|
|
||||||
|
fn end_location(&self) -> Option<SourceLocation> {
|
||||||
|
self.range().end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Suite = Vec<Stmt>;
|
||||||
|
|
||||||
|
pub use crate::builtin::*;
|
||||||
|
include!("gen/located.rs");
|
||||||
|
|
@ -20,35 +20,29 @@ impl<U> crate::fold::Fold<U> for ConstantOptimizer {
|
||||||
Ok(user)
|
Ok(user)
|
||||||
}
|
}
|
||||||
fn fold_expr(&mut self, node: crate::Expr<U>) -> Result<crate::Expr<U>, Self::Error> {
|
fn fold_expr(&mut self, node: crate::Expr<U>) -> Result<crate::Expr<U>, Self::Error> {
|
||||||
match node.node {
|
match node {
|
||||||
crate::ExprKind::Tuple(crate::ExprTuple { elts, ctx }) => {
|
crate::Expr::Tuple(crate::ExprTuple { elts, ctx, range }) => {
|
||||||
let elts = elts
|
let elts = elts
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|x| self.fold_expr(x))
|
.map(|x| self.fold_expr(x))
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
let expr = if elts
|
let expr = if elts.iter().all(|e| e.is_constant_expr()) {
|
||||||
.iter()
|
|
||||||
.all(|e| matches!(e.node, crate::ExprKind::Constant { .. }))
|
|
||||||
{
|
|
||||||
let tuple = elts
|
let tuple = elts
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|e| match e.node {
|
.map(|e| match e {
|
||||||
crate::ExprKind::Constant(crate::ExprConstant { value, .. }) => value,
|
crate::Expr::Constant(crate::ExprConstant { value, .. }) => value,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
crate::ExprKind::Constant(crate::ExprConstant {
|
crate::Expr::Constant(crate::ExprConstant {
|
||||||
value: Constant::Tuple(tuple),
|
value: Constant::Tuple(tuple),
|
||||||
kind: None,
|
kind: None,
|
||||||
|
range,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
crate::ExprKind::Tuple(crate::ExprTuple { elts, ctx })
|
crate::Expr::Tuple(crate::ExprTuple { elts, ctx, range })
|
||||||
};
|
};
|
||||||
Ok(crate::Expr {
|
Ok(expr)
|
||||||
node: expr,
|
|
||||||
custom: node.custom,
|
|
||||||
range: node.range,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
_ => crate::fold::fold_expr(self, node),
|
_ => crate::fold::fold_expr(self, node),
|
||||||
}
|
}
|
||||||
|
|
@ -66,95 +60,68 @@ mod tests {
|
||||||
use crate::{fold::Fold, *};
|
use crate::{fold::Fold, *};
|
||||||
|
|
||||||
let range = TextRange::default();
|
let range = TextRange::default();
|
||||||
#[allow(clippy::let_unit_value)]
|
let ast = ExprTuple {
|
||||||
let custom = ();
|
ctx: ExprContext::Load,
|
||||||
let ast = Attributed {
|
elts: vec![
|
||||||
|
ExprConstant {
|
||||||
|
value: BigInt::from(1).into(),
|
||||||
|
kind: None,
|
||||||
|
range,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
ExprConstant {
|
||||||
|
value: BigInt::from(2).into(),
|
||||||
|
kind: None,
|
||||||
|
range,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
ExprTuple {
|
||||||
|
ctx: ExprContext::Load,
|
||||||
|
elts: vec![
|
||||||
|
ExprConstant {
|
||||||
|
value: BigInt::from(3).into(),
|
||||||
|
kind: None,
|
||||||
|
range,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
ExprConstant {
|
||||||
|
value: BigInt::from(4).into(),
|
||||||
|
kind: None,
|
||||||
|
range,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
ExprConstant {
|
||||||
|
value: BigInt::from(5).into(),
|
||||||
|
kind: None,
|
||||||
|
range,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
],
|
||||||
|
range,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
],
|
||||||
range,
|
range,
|
||||||
custom,
|
|
||||||
node: ExprTuple {
|
|
||||||
ctx: ExprContext::Load,
|
|
||||||
elts: vec![
|
|
||||||
Attributed {
|
|
||||||
range,
|
|
||||||
custom,
|
|
||||||
node: ExprConstant {
|
|
||||||
value: BigInt::from(1).into(),
|
|
||||||
kind: None,
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range,
|
|
||||||
custom,
|
|
||||||
node: ExprConstant {
|
|
||||||
value: BigInt::from(2).into(),
|
|
||||||
kind: None,
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range,
|
|
||||||
custom,
|
|
||||||
node: ExprTuple {
|
|
||||||
ctx: ExprContext::Load,
|
|
||||||
elts: vec![
|
|
||||||
Attributed {
|
|
||||||
range,
|
|
||||||
custom,
|
|
||||||
node: ExprConstant {
|
|
||||||
value: BigInt::from(3).into(),
|
|
||||||
kind: None,
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range,
|
|
||||||
custom,
|
|
||||||
node: ExprConstant {
|
|
||||||
value: BigInt::from(4).into(),
|
|
||||||
kind: None,
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range,
|
|
||||||
custom,
|
|
||||||
node: ExprConstant {
|
|
||||||
value: BigInt::from(5).into(),
|
|
||||||
kind: None,
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
};
|
};
|
||||||
let new_ast = ConstantOptimizer::new()
|
let new_ast = ConstantOptimizer::new()
|
||||||
.fold_expr(ast)
|
.fold_expr(ast.into())
|
||||||
.unwrap_or_else(|e| match e {});
|
.unwrap_or_else(|e| match e {});
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
new_ast,
|
new_ast,
|
||||||
Attributed {
|
ExprConstant {
|
||||||
|
value: Constant::Tuple(vec![
|
||||||
|
BigInt::from(1).into(),
|
||||||
|
BigInt::from(2).into(),
|
||||||
|
Constant::Tuple(vec![
|
||||||
|
BigInt::from(3).into(),
|
||||||
|
BigInt::from(4).into(),
|
||||||
|
BigInt::from(5).into(),
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
kind: None,
|
||||||
range,
|
range,
|
||||||
custom,
|
|
||||||
node: ExprConstant {
|
|
||||||
value: Constant::Tuple(vec![
|
|
||||||
BigInt::from(1).into(),
|
|
||||||
BigInt::from(2).into(),
|
|
||||||
Constant::Tuple(vec![
|
|
||||||
BigInt::from(3).into(),
|
|
||||||
BigInt::from(4).into(),
|
|
||||||
BigInt::from(5).into(),
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
kind: None
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
}
|
}
|
||||||
|
.into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
use crate::text_size::{TextRange, TextSize};
|
||||||
|
use std::fmt::{Debug, Display, Formatter};
|
||||||
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
pub use crate::builtin::*;
|
||||||
|
use crate::Stmt;
|
||||||
|
|
||||||
|
pub trait Ranged {
|
||||||
|
fn range(&self) -> TextRange;
|
||||||
|
|
||||||
|
fn start(&self) -> TextSize {
|
||||||
|
self.range().start()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn end(&self) -> TextSize {
|
||||||
|
self.range().end()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Suite<R = TextRange> = Vec<Stmt<R>>;
|
||||||
|
|
||||||
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
|
pub type OptionalRange<R> = R;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
|
pub type OptionalRange<R> = EmptyRange<R>;
|
||||||
|
|
||||||
|
#[derive(Eq, PartialEq, Hash, Copy, Clone)]
|
||||||
|
pub struct EmptyRange<R> {
|
||||||
|
phantom: PhantomData<R>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<R> EmptyRange<R> {
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn new(_start: TextSize, _end: TextSize) -> Self {
|
||||||
|
Self {
|
||||||
|
phantom: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<R> Display for EmptyRange<R> {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
|
f.write_str("()")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<R> Debug for EmptyRange<R> {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
|
Display::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<R> Default for EmptyRange<R> {
|
||||||
|
fn default() -> Self {
|
||||||
|
EmptyRange {
|
||||||
|
phantom: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include!("gen/ranged.rs");
|
||||||
|
|
@ -1,39 +1,15 @@
|
||||||
use crate::builtin::Attributed;
|
use rustpython_parser_core::{
|
||||||
use rustpython_parser_core::source_code::{SourceLocation, SourceLocator, SourceRange};
|
source_code::{SourceLocator, SourceRange},
|
||||||
|
text_size::TextRange,
|
||||||
|
};
|
||||||
|
|
||||||
impl crate::fold::Fold<()> for SourceLocator<'_> {
|
impl crate::fold::Fold<TextRange> for SourceLocator<'_> {
|
||||||
type TargetU = SourceRange;
|
type TargetU = SourceRange;
|
||||||
type Error = std::convert::Infallible;
|
type Error = std::convert::Infallible;
|
||||||
|
|
||||||
#[cold]
|
fn map_user(&mut self, user: TextRange) -> Result<Self::TargetU, Self::Error> {
|
||||||
fn map_user(&mut self, _user: ()) -> Result<Self::TargetU, Self::Error> {
|
let start = self.locate(user.start());
|
||||||
unreachable!("implemented map_attributed");
|
let end = self.locate(user.end());
|
||||||
}
|
Ok((start..end).into())
|
||||||
|
|
||||||
fn map_attributed<T>(
|
|
||||||
&mut self,
|
|
||||||
node: Attributed<T, ()>,
|
|
||||||
) -> Result<Attributed<T, Self::TargetU>, Self::Error> {
|
|
||||||
let start = self.locate(node.range.start());
|
|
||||||
let end = self.locate(node.range.end());
|
|
||||||
Ok(Attributed {
|
|
||||||
range: node.range,
|
|
||||||
custom: (start..end).into(),
|
|
||||||
node: node.node,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Attributed<T, SourceRange> {
|
|
||||||
/// Returns the absolute start position of the node from the beginning of the document.
|
|
||||||
#[inline]
|
|
||||||
pub const fn location(&self) -> SourceLocation {
|
|
||||||
self.custom.start
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the absolute position at which the node ends in the source document.
|
|
||||||
#[inline]
|
|
||||||
pub const fn end_location(&self) -> Option<SourceLocation> {
|
|
||||||
self.custom.end
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
use crate::ConversionFlag;
|
use crate::ConversionFlag;
|
||||||
use crate::{
|
use crate::{Arg, Arguments, Boolop, Cmpop, Comprehension, Constant, Expr, Identifier, Operator};
|
||||||
Arg, Arguments, Boolop, Cmpop, Comprehension, Constant, Expr, ExprKind, Identifier, Operator,
|
|
||||||
};
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
mod precedence {
|
mod precedence {
|
||||||
|
|
@ -73,8 +71,12 @@ impl<'a> Unparser<'a> {
|
||||||
ret
|
ret
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
match &ast.node {
|
match &ast {
|
||||||
ExprKind::BoolOp(crate::ExprBoolOp { op, values }) => {
|
Expr::BoolOp(crate::ExprBoolOp {
|
||||||
|
op,
|
||||||
|
values,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
let (op, prec) = op_prec!(bin, op, Boolop, And("and", AND), Or("or", OR));
|
let (op, prec) = op_prec!(bin, op, Boolop, And("and", AND), Or("or", OR));
|
||||||
group_if!(prec, {
|
group_if!(prec, {
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
|
|
@ -84,14 +86,23 @@ impl<'a> Unparser<'a> {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ExprKind::NamedExpr(crate::ExprNamedExpr { target, value }) => {
|
Expr::NamedExpr(crate::ExprNamedExpr {
|
||||||
|
target,
|
||||||
|
value,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
group_if!(precedence::TUPLE, {
|
group_if!(precedence::TUPLE, {
|
||||||
self.unparse_expr(target, precedence::ATOM)?;
|
self.unparse_expr(target, precedence::ATOM)?;
|
||||||
self.p(" := ")?;
|
self.p(" := ")?;
|
||||||
self.unparse_expr(value, precedence::ATOM)?;
|
self.unparse_expr(value, precedence::ATOM)?;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ExprKind::BinOp(crate::ExprBinOp { left, op, right }) => {
|
Expr::BinOp(crate::ExprBinOp {
|
||||||
|
left,
|
||||||
|
op,
|
||||||
|
right,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
let right_associative = matches!(op, Operator::Pow);
|
let right_associative = matches!(op, Operator::Pow);
|
||||||
let (op, prec) = op_prec!(
|
let (op, prec) = op_prec!(
|
||||||
bin,
|
bin,
|
||||||
|
|
@ -117,7 +128,11 @@ impl<'a> Unparser<'a> {
|
||||||
self.unparse_expr(right, prec + !right_associative as u8)?;
|
self.unparse_expr(right, prec + !right_associative as u8)?;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ExprKind::UnaryOp(crate::ExprUnaryOp { op, operand }) => {
|
Expr::UnaryOp(crate::ExprUnaryOp {
|
||||||
|
op,
|
||||||
|
operand,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
let (op, prec) = op_prec!(
|
let (op, prec) = op_prec!(
|
||||||
un,
|
un,
|
||||||
op,
|
op,
|
||||||
|
|
@ -132,7 +147,11 @@ impl<'a> Unparser<'a> {
|
||||||
self.unparse_expr(operand, prec)?;
|
self.unparse_expr(operand, prec)?;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ExprKind::Lambda(crate::ExprLambda { args, body }) => {
|
Expr::Lambda(crate::ExprLambda {
|
||||||
|
args,
|
||||||
|
body,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
group_if!(precedence::TEST, {
|
group_if!(precedence::TEST, {
|
||||||
let pos = args.args.len() + args.posonlyargs.len();
|
let pos = args.args.len() + args.posonlyargs.len();
|
||||||
self.p(if pos > 0 { "lambda " } else { "lambda" })?;
|
self.p(if pos > 0 { "lambda " } else { "lambda" })?;
|
||||||
|
|
@ -140,7 +159,12 @@ impl<'a> Unparser<'a> {
|
||||||
write!(self, ": {}", **body)?;
|
write!(self, ": {}", **body)?;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ExprKind::IfExp(crate::ExprIfExp { test, body, orelse }) => {
|
Expr::IfExp(crate::ExprIfExp {
|
||||||
|
test,
|
||||||
|
body,
|
||||||
|
orelse,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
group_if!(precedence::TEST, {
|
group_if!(precedence::TEST, {
|
||||||
self.unparse_expr(body, precedence::TEST + 1)?;
|
self.unparse_expr(body, precedence::TEST + 1)?;
|
||||||
self.p(" if ")?;
|
self.p(" if ")?;
|
||||||
|
|
@ -149,7 +173,11 @@ impl<'a> Unparser<'a> {
|
||||||
self.unparse_expr(orelse, precedence::TEST)?;
|
self.unparse_expr(orelse, precedence::TEST)?;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ExprKind::Dict(crate::ExprDict { keys, values }) => {
|
Expr::Dict(crate::ExprDict {
|
||||||
|
keys,
|
||||||
|
values,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
self.p("{")?;
|
self.p("{")?;
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
let (packed, unpacked) = values.split_at(keys.len());
|
let (packed, unpacked) = values.split_at(keys.len());
|
||||||
|
|
@ -167,7 +195,10 @@ impl<'a> Unparser<'a> {
|
||||||
}
|
}
|
||||||
self.p("}")?;
|
self.p("}")?;
|
||||||
}
|
}
|
||||||
ExprKind::Set(crate::ExprSet { elts }) => {
|
Expr::Set(crate::ExprSet {
|
||||||
|
elts,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
self.p("{")?;
|
self.p("{")?;
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
for v in elts {
|
for v in elts {
|
||||||
|
|
@ -176,22 +207,31 @@ impl<'a> Unparser<'a> {
|
||||||
}
|
}
|
||||||
self.p("}")?;
|
self.p("}")?;
|
||||||
}
|
}
|
||||||
ExprKind::ListComp(crate::ExprListComp { elt, generators }) => {
|
Expr::ListComp(crate::ExprListComp {
|
||||||
|
elt,
|
||||||
|
generators,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
self.p("[")?;
|
self.p("[")?;
|
||||||
self.unparse_expr(elt, precedence::TEST)?;
|
self.unparse_expr(elt, precedence::TEST)?;
|
||||||
self.unparse_comp(generators)?;
|
self.unparse_comp(generators)?;
|
||||||
self.p("]")?;
|
self.p("]")?;
|
||||||
}
|
}
|
||||||
ExprKind::SetComp(crate::ExprSetComp { elt, generators }) => {
|
Expr::SetComp(crate::ExprSetComp {
|
||||||
|
elt,
|
||||||
|
generators,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
self.p("{")?;
|
self.p("{")?;
|
||||||
self.unparse_expr(elt, precedence::TEST)?;
|
self.unparse_expr(elt, precedence::TEST)?;
|
||||||
self.unparse_comp(generators)?;
|
self.unparse_comp(generators)?;
|
||||||
self.p("}")?;
|
self.p("}")?;
|
||||||
}
|
}
|
||||||
ExprKind::DictComp(crate::ExprDictComp {
|
Expr::DictComp(crate::ExprDictComp {
|
||||||
key,
|
key,
|
||||||
value,
|
value,
|
||||||
generators,
|
generators,
|
||||||
|
range: _range,
|
||||||
}) => {
|
}) => {
|
||||||
self.p("{")?;
|
self.p("{")?;
|
||||||
self.unparse_expr(key, precedence::TEST)?;
|
self.unparse_expr(key, precedence::TEST)?;
|
||||||
|
|
@ -200,32 +240,46 @@ impl<'a> Unparser<'a> {
|
||||||
self.unparse_comp(generators)?;
|
self.unparse_comp(generators)?;
|
||||||
self.p("}")?;
|
self.p("}")?;
|
||||||
}
|
}
|
||||||
ExprKind::GeneratorExp(crate::ExprGeneratorExp { elt, generators }) => {
|
Expr::GeneratorExp(crate::ExprGeneratorExp {
|
||||||
|
elt,
|
||||||
|
generators,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
self.p("(")?;
|
self.p("(")?;
|
||||||
self.unparse_expr(elt, precedence::TEST)?;
|
self.unparse_expr(elt, precedence::TEST)?;
|
||||||
self.unparse_comp(generators)?;
|
self.unparse_comp(generators)?;
|
||||||
self.p(")")?;
|
self.p(")")?;
|
||||||
}
|
}
|
||||||
ExprKind::Await(crate::ExprAwait { value }) => {
|
Expr::Await(crate::ExprAwait {
|
||||||
|
value,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
group_if!(precedence::AWAIT, {
|
group_if!(precedence::AWAIT, {
|
||||||
self.p("await ")?;
|
self.p("await ")?;
|
||||||
self.unparse_expr(value, precedence::ATOM)?;
|
self.unparse_expr(value, precedence::ATOM)?;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ExprKind::Yield(crate::ExprYield { value }) => {
|
Expr::Yield(crate::ExprYield {
|
||||||
|
value,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
if let Some(value) = value {
|
if let Some(value) = value {
|
||||||
write!(self, "(yield {})", **value)?;
|
write!(self, "(yield {})", **value)?;
|
||||||
} else {
|
} else {
|
||||||
self.p("(yield)")?;
|
self.p("(yield)")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExprKind::YieldFrom(crate::ExprYieldFrom { value }) => {
|
Expr::YieldFrom(crate::ExprYieldFrom {
|
||||||
|
value,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
write!(self, "(yield from {})", **value)?;
|
write!(self, "(yield from {})", **value)?;
|
||||||
}
|
}
|
||||||
ExprKind::Compare(crate::ExprCompare {
|
Expr::Compare(crate::ExprCompare {
|
||||||
left,
|
left,
|
||||||
ops,
|
ops,
|
||||||
comparators,
|
comparators,
|
||||||
|
range: _range,
|
||||||
}) => {
|
}) => {
|
||||||
group_if!(precedence::CMP, {
|
group_if!(precedence::CMP, {
|
||||||
let new_lvl = precedence::CMP + 1;
|
let new_lvl = precedence::CMP + 1;
|
||||||
|
|
@ -248,18 +302,20 @@ impl<'a> Unparser<'a> {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ExprKind::Call(crate::ExprCall {
|
Expr::Call(crate::ExprCall {
|
||||||
func,
|
func,
|
||||||
args,
|
args,
|
||||||
keywords,
|
keywords,
|
||||||
|
range: _range,
|
||||||
}) => {
|
}) => {
|
||||||
self.unparse_expr(func, precedence::ATOM)?;
|
self.unparse_expr(func, precedence::ATOM)?;
|
||||||
self.p("(")?;
|
self.p("(")?;
|
||||||
if let (
|
if let (
|
||||||
[Expr {
|
[Expr::GeneratorExp(crate::ExprGeneratorExp {
|
||||||
node: ExprKind::GeneratorExp(crate::ExprGeneratorExp { elt, generators }),
|
elt,
|
||||||
..
|
generators,
|
||||||
}],
|
range: _range,
|
||||||
|
})],
|
||||||
[],
|
[],
|
||||||
) = (&**args, &**keywords)
|
) = (&**args, &**keywords)
|
||||||
{
|
{
|
||||||
|
|
@ -274,26 +330,32 @@ impl<'a> Unparser<'a> {
|
||||||
}
|
}
|
||||||
for kw in keywords {
|
for kw in keywords {
|
||||||
self.p_delim(&mut first, ", ")?;
|
self.p_delim(&mut first, ", ")?;
|
||||||
if let Some(arg) = &kw.node.arg {
|
if let Some(arg) = &kw.arg {
|
||||||
self.p_id(arg)?;
|
self.p_id(arg)?;
|
||||||
self.p("=")?;
|
self.p("=")?;
|
||||||
} else {
|
} else {
|
||||||
self.p("**")?;
|
self.p("**")?;
|
||||||
}
|
}
|
||||||
self.unparse_expr(&kw.node.value, precedence::TEST)?;
|
self.unparse_expr(&kw.value, precedence::TEST)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.p(")")?;
|
self.p(")")?;
|
||||||
}
|
}
|
||||||
ExprKind::FormattedValue(crate::ExprFormattedValue {
|
Expr::FormattedValue(crate::ExprFormattedValue {
|
||||||
value,
|
value,
|
||||||
conversion,
|
conversion,
|
||||||
format_spec,
|
format_spec,
|
||||||
|
range: _range,
|
||||||
}) => self.unparse_formatted(value, conversion.to_u32(), format_spec.as_deref())?,
|
}) => self.unparse_formatted(value, conversion.to_u32(), format_spec.as_deref())?,
|
||||||
ExprKind::JoinedStr(crate::ExprJoinedStr { values }) => {
|
Expr::JoinedStr(crate::ExprJoinedStr {
|
||||||
self.unparse_joined_str(values, false)?
|
values,
|
||||||
}
|
range: _range,
|
||||||
ExprKind::Constant(crate::ExprConstant { value, kind }) => {
|
}) => self.unparse_joined_str(values, false)?,
|
||||||
|
Expr::Constant(crate::ExprConstant {
|
||||||
|
value,
|
||||||
|
kind,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
if let Some(kind) = kind {
|
if let Some(kind) = kind {
|
||||||
self.p(kind)?;
|
self.p(kind)?;
|
||||||
}
|
}
|
||||||
|
|
@ -309,12 +371,12 @@ impl<'a> Unparser<'a> {
|
||||||
_ => fmt::Display::fmt(value, &mut self.f)?,
|
_ => fmt::Display::fmt(value, &mut self.f)?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExprKind::Attribute(crate::ExprAttribute { value, attr, .. }) => {
|
Expr::Attribute(crate::ExprAttribute { value, attr, .. }) => {
|
||||||
self.unparse_expr(value, precedence::ATOM)?;
|
self.unparse_expr(value, precedence::ATOM)?;
|
||||||
let period = if let ExprKind::Constant(crate::ExprConstant {
|
let period = if let Expr::Constant(crate::ExprConstant {
|
||||||
value: Constant::Int(_),
|
value: Constant::Int(_),
|
||||||
..
|
..
|
||||||
}) = &value.node
|
}) = value.as_ref()
|
||||||
{
|
{
|
||||||
" ."
|
" ."
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -323,14 +385,11 @@ impl<'a> Unparser<'a> {
|
||||||
self.p(period)?;
|
self.p(period)?;
|
||||||
self.p_id(attr)?;
|
self.p_id(attr)?;
|
||||||
}
|
}
|
||||||
ExprKind::Subscript(crate::ExprSubscript { value, slice, .. }) => {
|
Expr::Subscript(crate::ExprSubscript { value, slice, .. }) => {
|
||||||
self.unparse_expr(value, precedence::ATOM)?;
|
self.unparse_expr(value, precedence::ATOM)?;
|
||||||
let mut lvl = precedence::TUPLE;
|
let mut lvl = precedence::TUPLE;
|
||||||
if let ExprKind::Tuple(crate::ExprTuple { elts, .. }) = &slice.node {
|
if let Expr::Tuple(crate::ExprTuple { elts, .. }) = slice.as_ref() {
|
||||||
if elts
|
if elts.iter().any(|expr| expr.is_starred_expr()) {
|
||||||
.iter()
|
|
||||||
.any(|expr| matches!(expr.node, ExprKind::Starred { .. }))
|
|
||||||
{
|
|
||||||
lvl += 1
|
lvl += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -338,12 +397,12 @@ impl<'a> Unparser<'a> {
|
||||||
self.unparse_expr(slice, lvl)?;
|
self.unparse_expr(slice, lvl)?;
|
||||||
self.p("]")?;
|
self.p("]")?;
|
||||||
}
|
}
|
||||||
ExprKind::Starred(crate::ExprStarred { value, .. }) => {
|
Expr::Starred(crate::ExprStarred { value, .. }) => {
|
||||||
self.p("*")?;
|
self.p("*")?;
|
||||||
self.unparse_expr(value, precedence::EXPR)?;
|
self.unparse_expr(value, precedence::EXPR)?;
|
||||||
}
|
}
|
||||||
ExprKind::Name(crate::ExprName { id, .. }) => self.p_id(id)?,
|
Expr::Name(crate::ExprName { id, .. }) => self.p_id(id)?,
|
||||||
ExprKind::List(crate::ExprList { elts, .. }) => {
|
Expr::List(crate::ExprList { elts, .. }) => {
|
||||||
self.p("[")?;
|
self.p("[")?;
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
for elt in elts {
|
for elt in elts {
|
||||||
|
|
@ -352,7 +411,7 @@ impl<'a> Unparser<'a> {
|
||||||
}
|
}
|
||||||
self.p("]")?;
|
self.p("]")?;
|
||||||
}
|
}
|
||||||
ExprKind::Tuple(crate::ExprTuple { elts, .. }) => {
|
Expr::Tuple(crate::ExprTuple { elts, .. }) => {
|
||||||
if elts.is_empty() {
|
if elts.is_empty() {
|
||||||
self.p("()")?;
|
self.p("()")?;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -366,7 +425,12 @@ impl<'a> Unparser<'a> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExprKind::Slice(crate::ExprSlice { lower, upper, step }) => {
|
Expr::Slice(crate::ExprSlice {
|
||||||
|
lower,
|
||||||
|
upper,
|
||||||
|
step,
|
||||||
|
range: _range,
|
||||||
|
}) => {
|
||||||
if let Some(lower) = lower {
|
if let Some(lower) = lower {
|
||||||
self.unparse_expr(lower, precedence::TEST)?;
|
self.unparse_expr(lower, precedence::TEST)?;
|
||||||
}
|
}
|
||||||
|
|
@ -420,8 +484,8 @@ impl<'a> Unparser<'a> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn unparse_arg<U>(&mut self, arg: &Arg<U>) -> fmt::Result {
|
fn unparse_arg<U>(&mut self, arg: &Arg<U>) -> fmt::Result {
|
||||||
self.p_id(&arg.node.arg)?;
|
self.p_id(&arg.arg)?;
|
||||||
if let Some(ann) = &arg.node.annotation {
|
if let Some(ann) = &arg.annotation {
|
||||||
write!(self, ": {}", **ann)?;
|
write!(self, ": {}", **ann)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -487,21 +551,23 @@ impl<'a> Unparser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unparse_fstring_elem<U>(&mut self, expr: &Expr<U>, is_spec: bool) -> fmt::Result {
|
fn unparse_fstring_elem<U>(&mut self, expr: &Expr<U>, is_spec: bool) -> fmt::Result {
|
||||||
match &expr.node {
|
match &expr {
|
||||||
ExprKind::Constant(crate::ExprConstant { value, .. }) => {
|
Expr::Constant(crate::ExprConstant { value, .. }) => {
|
||||||
if let Constant::Str(s) = value {
|
if let Constant::Str(s) = value {
|
||||||
self.unparse_fstring_str(s)
|
self.unparse_fstring_str(s)
|
||||||
} else {
|
} else {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExprKind::JoinedStr(crate::ExprJoinedStr { values }) => {
|
Expr::JoinedStr(crate::ExprJoinedStr {
|
||||||
self.unparse_joined_str(values, is_spec)
|
values,
|
||||||
}
|
range: _range,
|
||||||
ExprKind::FormattedValue(crate::ExprFormattedValue {
|
}) => self.unparse_joined_str(values, is_spec),
|
||||||
|
Expr::FormattedValue(crate::ExprFormattedValue {
|
||||||
value,
|
value,
|
||||||
conversion,
|
conversion,
|
||||||
format_spec,
|
format_spec,
|
||||||
|
range: _range,
|
||||||
}) => self.unparse_formatted(value, conversion.to_u32(), format_spec.as_deref()),
|
}) => self.unparse_formatted(value, conversion.to_u32(), format_spec.as_deref()),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,4 @@ serde = { version = "1.0.133", optional = true, default-features = false, featur
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
location = ["ruff_source_location"]
|
location = ["dep:ruff_source_location"]
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ pub use ruff_source_location::*;
|
||||||
|
|
||||||
pub type LineNumber = OneIndexed;
|
pub type LineNumber = OneIndexed;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct SourceRange {
|
pub struct SourceRange {
|
||||||
pub start: SourceLocation,
|
pub start: SourceLocation,
|
||||||
pub end: Option<SourceLocation>,
|
pub end: Option<SourceLocation>,
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@ edition = "2021"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["location"]
|
default = ["location"]
|
||||||
location = ["rustpython-ast/location"]
|
location = ["rustpython-ast/location", "rustpython-parser-core/location"]
|
||||||
serde = ["dep:serde", "rustpython-parser-core/serde"]
|
serde = ["dep:serde", "rustpython-parser-core/serde"]
|
||||||
|
all-nodes-with-ranges = ["rustpython-ast/all-nodes-with-ranges"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
|
|
@ -37,4 +38,4 @@ rustc-hash = "1.1.0"
|
||||||
serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] }
|
serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = { workspace = true }
|
insta = { workspace = true }
|
||||||
|
|
@ -1,49 +1,48 @@
|
||||||
use crate::ast::{self, Expr, ExprContext, ExprKind};
|
use crate::ast::{self, Expr, ExprContext};
|
||||||
|
|
||||||
pub(crate) fn set_context(expr: Expr, ctx: ExprContext) -> Expr {
|
pub(crate) fn set_context(expr: Expr, ctx: ExprContext) -> Expr {
|
||||||
match expr.node {
|
match expr {
|
||||||
ExprKind::Name(ast::ExprName { id, .. }) => Expr {
|
Expr::Name(ast::ExprName { id, range, .. }) => ast::ExprName { id, ctx, range }.into(),
|
||||||
node: ast::ExprName { id, ctx }.into(),
|
Expr::Tuple(ast::ExprTuple { elts, range, .. }) => ast::ExprTuple {
|
||||||
..expr
|
elts: elts.into_iter().map(|elt| set_context(elt, ctx)).collect(),
|
||||||
},
|
range,
|
||||||
ExprKind::Tuple(ast::ExprTuple { elts, .. }) => Expr {
|
ctx,
|
||||||
node: ast::ExprTuple {
|
}
|
||||||
elts: elts
|
.into(),
|
||||||
.into_iter()
|
|
||||||
.map(|elt| set_context(elt, ctx.clone()))
|
Expr::List(ast::ExprList { elts, range, .. }) => ast::ExprList {
|
||||||
.collect(),
|
elts: elts.into_iter().map(|elt| set_context(elt, ctx)).collect(),
|
||||||
ctx,
|
range,
|
||||||
}
|
ctx,
|
||||||
.into(),
|
}
|
||||||
..expr
|
.into(),
|
||||||
},
|
Expr::Attribute(ast::ExprAttribute {
|
||||||
ExprKind::List(ast::ExprList { elts, .. }) => Expr {
|
value, attr, range, ..
|
||||||
node: ast::ExprList {
|
}) => ast::ExprAttribute {
|
||||||
elts: elts
|
value,
|
||||||
.into_iter()
|
attr,
|
||||||
.map(|elt| set_context(elt, ctx.clone()))
|
range,
|
||||||
.collect(),
|
ctx,
|
||||||
ctx,
|
}
|
||||||
}
|
.into(),
|
||||||
.into(),
|
Expr::Subscript(ast::ExprSubscript {
|
||||||
..expr
|
value,
|
||||||
},
|
slice,
|
||||||
ExprKind::Attribute(ast::ExprAttribute { value, attr, .. }) => Expr {
|
range,
|
||||||
node: ast::ExprAttribute { value, attr, ctx }.into(),
|
..
|
||||||
..expr
|
}) => ast::ExprSubscript {
|
||||||
},
|
value,
|
||||||
ExprKind::Subscript(ast::ExprSubscript { value, slice, .. }) => Expr {
|
slice,
|
||||||
node: ast::ExprSubscript { value, slice, ctx }.into(),
|
range,
|
||||||
..expr
|
ctx,
|
||||||
},
|
}
|
||||||
ExprKind::Starred(ast::ExprStarred { value, .. }) => Expr {
|
.into(),
|
||||||
node: ast::ExprStarred {
|
Expr::Starred(ast::ExprStarred { value, range, .. }) => ast::ExprStarred {
|
||||||
value: Box::new(set_context(*value, ctx.clone())),
|
value: Box::new(set_context(*value, ctx)),
|
||||||
ctx,
|
range,
|
||||||
}
|
ctx,
|
||||||
.into(),
|
}
|
||||||
..expr
|
.into(),
|
||||||
},
|
|
||||||
_ => expr,
|
_ => expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -67,6 +66,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_assign_list() {
|
fn test_assign_list() {
|
||||||
let source = "[x, y] = (1, 2, 3)";
|
let source = "[x, y] = (1, 2, 3)";
|
||||||
let parse_ast = parse_program(source, "<test>").unwrap();
|
let parse_ast = parse_program(source, "<test>").unwrap();
|
||||||
|
|
@ -102,6 +102,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_assign_list_comp() {
|
fn test_assign_list_comp() {
|
||||||
let source = "x = [y for y in (1, 2, 3)]";
|
let source = "x = [y for y in (1, 2, 3)]";
|
||||||
let parse_ast = parse_program(source, "<test>").unwrap();
|
let parse_ast = parse_program(source, "<test>").unwrap();
|
||||||
|
|
@ -109,6 +110,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_assign_set_comp() {
|
fn test_assign_set_comp() {
|
||||||
let source = "x = {y for y in (1, 2, 3)}";
|
let source = "x = {y for y in (1, 2, 3)}";
|
||||||
let parse_ast = parse_program(source, "<test>").unwrap();
|
let parse_ast = parse_program(source, "<test>").unwrap();
|
||||||
|
|
@ -116,6 +118,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_assign_with() {
|
fn test_assign_with() {
|
||||||
let source = "with 1 as x: pass";
|
let source = "with 1 as x: pass";
|
||||||
let parse_ast = parse_program(source, "<test>").unwrap();
|
let parse_ast = parse_program(source, "<test>").unwrap();
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
// Contains functions that perform validation and parsing of arguments and parameters.
|
// Contains functions that perform validation and parsing of arguments and parameters.
|
||||||
// Checks apply both to functions and to lambdas.
|
// Checks apply both to functions and to lambdas.
|
||||||
|
use crate::text_size::TextRange;
|
||||||
use crate::{
|
use crate::{
|
||||||
ast,
|
ast,
|
||||||
lexer::{LexicalError, LexicalErrorType},
|
lexer::{LexicalError, LexicalErrorType},
|
||||||
text_size::TextSize,
|
text_size::TextSize,
|
||||||
};
|
};
|
||||||
use rustc_hash::FxHashSet;
|
use rustc_hash::FxHashSet;
|
||||||
|
use rustpython_ast::Ranged;
|
||||||
|
|
||||||
pub(crate) struct ArgumentList {
|
pub(crate) struct ArgumentList {
|
||||||
pub args: Vec<ast::Expr>,
|
pub args: Vec<ast::Expr>,
|
||||||
|
|
@ -19,7 +21,7 @@ type ParameterDef = (ast::Arg, Option<ast::Expr>);
|
||||||
pub(crate) fn validate_arguments(
|
pub(crate) fn validate_arguments(
|
||||||
arguments: ast::Arguments,
|
arguments: ast::Arguments,
|
||||||
) -> Result<ast::Arguments, LexicalError> {
|
) -> Result<ast::Arguments, LexicalError> {
|
||||||
let mut all_args: Vec<&ast::Attributed<ast::ArgData>> = vec![];
|
let mut all_args: Vec<&ast::Arg> = vec![];
|
||||||
|
|
||||||
all_args.extend(arguments.posonlyargs.iter());
|
all_args.extend(arguments.posonlyargs.iter());
|
||||||
all_args.extend(arguments.args.iter());
|
all_args.extend(arguments.args.iter());
|
||||||
|
|
@ -116,13 +118,11 @@ pub(crate) fn parse_args(func_args: Vec<FunctionArgument>) -> Result<ArgumentLis
|
||||||
double_starred = true;
|
double_starred = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
keywords.push(ast::Keyword::new(
|
keywords.push(ast::Keyword {
|
||||||
start..end,
|
arg: name.map(ast::Identifier::new),
|
||||||
ast::KeywordData {
|
value,
|
||||||
arg: name.map(ast::Identifier::new),
|
range: TextRange::new(start, end),
|
||||||
value,
|
});
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
// Positional arguments mustn't follow keyword arguments.
|
// Positional arguments mustn't follow keyword arguments.
|
||||||
|
|
@ -148,8 +148,8 @@ pub(crate) fn parse_args(func_args: Vec<FunctionArgument>) -> Result<ArgumentLis
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if an expression is a starred expression.
|
// Check if an expression is a starred expression.
|
||||||
fn is_starred(exp: &ast::Expr) -> bool {
|
const fn is_starred(exp: &ast::Expr) -> bool {
|
||||||
matches!(exp.node, ast::ExprKind::Starred { .. })
|
exp.is_starred_expr()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
@ -157,6 +157,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::parser::{parse_program, ParseErrorType};
|
use crate::parser::{parse_program, ParseErrorType};
|
||||||
|
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
macro_rules! function_and_lambda {
|
macro_rules! function_and_lambda {
|
||||||
($($name:ident: $code:expr,)*) => {
|
($($name:ident: $code:expr,)*) => {
|
||||||
$(
|
$(
|
||||||
|
|
@ -169,6 +170,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
function_and_lambda! {
|
function_and_lambda! {
|
||||||
test_function_no_args: "def f(): pass",
|
test_function_no_args: "def f(): pass",
|
||||||
test_function_pos_args: "def f(a, b, c): pass",
|
test_function_pos_args: "def f(a, b, c): pass",
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ use crate::{
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
|
use crate::text_size::TextRange;
|
||||||
pub(super) use lalrpop_util::ParseError as LalrpopError;
|
pub(super) use lalrpop_util::ParseError as LalrpopError;
|
||||||
|
use rustpython_ast::OptionalRange;
|
||||||
|
|
||||||
/// Parse a full Python program usually consisting of multiple lines.
|
/// Parse a full Python program usually consisting of multiple lines.
|
||||||
///
|
///
|
||||||
|
|
@ -95,7 +97,7 @@ pub fn parse_expression_starts_at(
|
||||||
offset: TextSize,
|
offset: TextSize,
|
||||||
) -> Result<ast::Expr, ParseError> {
|
) -> Result<ast::Expr, ParseError> {
|
||||||
parse_starts_at(source, Mode::Expression, path, offset).map(|top| match top {
|
parse_starts_at(source, Mode::Expression, path, offset).map(|top| match top {
|
||||||
ast::Mod::Expression(ast::ModExpression { body }) => *body,
|
ast::Mod::Expression(ast::ModExpression { body, .. }) => *body,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -318,6 +320,11 @@ impl ParseErrorType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub(super) fn optional_range(start: TextSize, end: TextSize) -> OptionalRange<TextRange> {
|
||||||
|
OptionalRange::<TextRange>::new(start, end)
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
@ -371,6 +378,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_parse_lambda() {
|
fn test_parse_lambda() {
|
||||||
let source = "lambda x, y: x * y"; // lambda(x, y): x * y";
|
let source = "lambda x, y: x * y"; // lambda(x, y): x * y";
|
||||||
let parse_ast = parse_program(source, "<test>").unwrap();
|
let parse_ast = parse_program(source, "<test>").unwrap();
|
||||||
|
|
@ -385,6 +393,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_parse_class() {
|
fn test_parse_class() {
|
||||||
let source = "\
|
let source = "\
|
||||||
class Foo(A, B):
|
class Foo(A, B):
|
||||||
|
|
@ -397,6 +406,7 @@ class Foo(A, B):
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_parse_dict_comprehension() {
|
fn test_parse_dict_comprehension() {
|
||||||
let source = "{x1: x2 for y in z}";
|
let source = "{x1: x2 for y in z}";
|
||||||
let parse_ast = parse_expression(source, "<test>").unwrap();
|
let parse_ast = parse_expression(source, "<test>").unwrap();
|
||||||
|
|
@ -404,6 +414,7 @@ class Foo(A, B):
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_parse_list_comprehension() {
|
fn test_parse_list_comprehension() {
|
||||||
let source = "[x for y in z]";
|
let source = "[x for y in z]";
|
||||||
let parse_ast = parse_expression(source, "<test>").unwrap();
|
let parse_ast = parse_expression(source, "<test>").unwrap();
|
||||||
|
|
@ -411,6 +422,7 @@ class Foo(A, B):
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_parse_double_list_comprehension() {
|
fn test_parse_double_list_comprehension() {
|
||||||
let source = "[x for y, y2 in z for a in b if a < 5 if a > 10]";
|
let source = "[x for y, y2 in z for a in b if a < 5 if a > 10]";
|
||||||
let parse_ast = parse_expression(source, "<test>").unwrap();
|
let parse_ast = parse_expression(source, "<test>").unwrap();
|
||||||
|
|
@ -418,6 +430,7 @@ class Foo(A, B):
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_parse_generator_comprehension() {
|
fn test_parse_generator_comprehension() {
|
||||||
let source = "(x for y in z)";
|
let source = "(x for y in z)";
|
||||||
let parse_ast = parse_expression(source, "<test>").unwrap();
|
let parse_ast = parse_expression(source, "<test>").unwrap();
|
||||||
|
|
@ -425,6 +438,7 @@ class Foo(A, B):
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_parse_named_expression_generator_comprehension() {
|
fn test_parse_named_expression_generator_comprehension() {
|
||||||
let source = "(x := y + 1 for y in z)";
|
let source = "(x := y + 1 for y in z)";
|
||||||
let parse_ast = parse_expression(source, "<test>").unwrap();
|
let parse_ast = parse_expression(source, "<test>").unwrap();
|
||||||
|
|
@ -432,6 +446,7 @@ class Foo(A, B):
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_parse_if_else_generator_comprehension() {
|
fn test_parse_if_else_generator_comprehension() {
|
||||||
let source = "(x if y else y for y in z)";
|
let source = "(x if y else y for y in z)";
|
||||||
let parse_ast = parse_expression(source, "<test>").unwrap();
|
let parse_ast = parse_expression(source, "<test>").unwrap();
|
||||||
|
|
@ -460,6 +475,7 @@ class Foo(A, B):
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_with_statement() {
|
fn test_with_statement() {
|
||||||
let source = "\
|
let source = "\
|
||||||
with 0: pass
|
with 0: pass
|
||||||
|
|
@ -529,6 +545,7 @@ array[3:5, *indexes_to_select]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_generator_expression_argument() {
|
fn test_generator_expression_argument() {
|
||||||
let source = r#"' '.join(
|
let source = r#"' '.join(
|
||||||
sql
|
sql
|
||||||
|
|
@ -588,6 +605,7 @@ except* OSError as e:
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_match_as_identifier() {
|
fn test_match_as_identifier() {
|
||||||
let parse_ast = parse_program(
|
let parse_ast = parse_program(
|
||||||
r#"
|
r#"
|
||||||
|
|
@ -620,6 +638,7 @@ print(match(12))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_patma() {
|
fn test_patma() {
|
||||||
let source = r#"# Cases sampled from Lib/test/test_patma.py
|
let source = r#"# Cases sampled from Lib/test/test_patma.py
|
||||||
|
|
||||||
|
|
@ -791,6 +810,7 @@ match w := x,:
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_match() {
|
fn test_match() {
|
||||||
let parse_ast = parse_program(
|
let parse_ast = parse_program(
|
||||||
r#"
|
r#"
|
||||||
|
|
@ -821,6 +841,7 @@ match x:
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "all-nodes-with-ranges"))]
|
||||||
fn test_variadic_generics() {
|
fn test_variadic_generics() {
|
||||||
let parse_ast = parse_program(
|
let parse_ast = parse_program(
|
||||||
r#"
|
r#"
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -3,51 +3,39 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
AnnAssign(
|
||||||
range: 0..10,
|
StmtAnnAssign {
|
||||||
custom: (),
|
range: 0..10,
|
||||||
node: AnnAssign(
|
target: Name(
|
||||||
StmtAnnAssign {
|
ExprName {
|
||||||
target: Attributed {
|
|
||||||
range: 0..1,
|
range: 0..1,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
annotation: Attributed {
|
),
|
||||||
|
annotation: Name(
|
||||||
|
ExprName {
|
||||||
range: 3..6,
|
range: 3..6,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"int",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"int",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
value: Some(
|
),
|
||||||
Attributed {
|
value: Some(
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 9..10,
|
range: 9..10,
|
||||||
custom: (),
|
value: Int(
|
||||||
node: Constant(
|
1,
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
simple: true,
|
),
|
||||||
},
|
simple: true,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,86 +3,65 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..15,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..15,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Attribute(
|
||||||
targets: [
|
ExprAttribute {
|
||||||
Attributed {
|
|
||||||
range: 0..3,
|
range: 0..3,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Attribute(
|
ExprName {
|
||||||
ExprAttribute {
|
range: 0..1,
|
||||||
value: Attributed {
|
id: Identifier(
|
||||||
range: 0..1,
|
"x",
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
attr: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
),
|
||||||
ctx: Store,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
attr: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
value: Attributed {
|
],
|
||||||
|
value: Tuple(
|
||||||
|
ExprTuple {
|
||||||
range: 6..15,
|
range: 6..15,
|
||||||
custom: (),
|
elts: [
|
||||||
node: Tuple(
|
Constant(
|
||||||
ExprTuple {
|
ExprConstant {
|
||||||
elts: [
|
range: 7..8,
|
||||||
Attributed {
|
value: Int(
|
||||||
range: 7..8,
|
1,
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Int(
|
),
|
||||||
1,
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
kind: None,
|
range: 10..11,
|
||||||
},
|
value: Int(
|
||||||
),
|
2,
|
||||||
},
|
),
|
||||||
Attributed {
|
kind: None,
|
||||||
range: 10..11,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
value: Int(
|
range: 13..14,
|
||||||
2,
|
value: Int(
|
||||||
),
|
3,
|
||||||
kind: None,
|
),
|
||||||
},
|
kind: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
Attributed {
|
],
|
||||||
range: 13..14,
|
ctx: Load,
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,80 +3,62 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
For(
|
||||||
range: 0..24,
|
StmtFor {
|
||||||
custom: (),
|
range: 0..24,
|
||||||
node: For(
|
target: Name(
|
||||||
StmtFor {
|
ExprName {
|
||||||
target: Attributed {
|
|
||||||
range: 4..5,
|
range: 4..5,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
iter: Attributed {
|
),
|
||||||
|
iter: Tuple(
|
||||||
|
ExprTuple {
|
||||||
range: 9..18,
|
range: 9..18,
|
||||||
custom: (),
|
elts: [
|
||||||
node: Tuple(
|
Constant(
|
||||||
ExprTuple {
|
ExprConstant {
|
||||||
elts: [
|
range: 10..11,
|
||||||
Attributed {
|
value: Int(
|
||||||
range: 10..11,
|
1,
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Int(
|
),
|
||||||
1,
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
kind: None,
|
range: 13..14,
|
||||||
},
|
value: Int(
|
||||||
),
|
2,
|
||||||
},
|
),
|
||||||
Attributed {
|
kind: None,
|
||||||
range: 13..14,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
value: Int(
|
range: 16..17,
|
||||||
2,
|
value: Int(
|
||||||
),
|
3,
|
||||||
kind: None,
|
),
|
||||||
},
|
kind: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
Attributed {
|
],
|
||||||
range: 16..17,
|
ctx: Load,
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
body: [
|
),
|
||||||
Attributed {
|
body: [
|
||||||
|
Pass(
|
||||||
|
StmtPass {
|
||||||
range: 20..24,
|
range: 20..24,
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
orelse: [],
|
],
|
||||||
type_comment: None,
|
orelse: [],
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,97 +3,73 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..18,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..18,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
List(
|
||||||
targets: [
|
ExprList {
|
||||||
Attributed {
|
|
||||||
range: 0..6,
|
range: 0..6,
|
||||||
custom: (),
|
elts: [
|
||||||
node: List(
|
Name(
|
||||||
ExprList {
|
ExprName {
|
||||||
elts: [
|
range: 1..2,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 1..2,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Store,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"x",
|
Name(
|
||||||
),
|
ExprName {
|
||||||
ctx: Store,
|
range: 4..5,
|
||||||
},
|
id: Identifier(
|
||||||
),
|
"y",
|
||||||
},
|
),
|
||||||
Attributed {
|
ctx: Store,
|
||||||
range: 4..5,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
],
|
||||||
ExprName {
|
ctx: Store,
|
||||||
id: Identifier(
|
},
|
||||||
"y",
|
),
|
||||||
),
|
],
|
||||||
ctx: Store,
|
value: Tuple(
|
||||||
},
|
ExprTuple {
|
||||||
),
|
range: 9..18,
|
||||||
},
|
elts: [
|
||||||
],
|
Constant(
|
||||||
ctx: Store,
|
ExprConstant {
|
||||||
|
range: 10..11,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
Constant(
|
||||||
],
|
ExprConstant {
|
||||||
value: Attributed {
|
range: 13..14,
|
||||||
range: 9..18,
|
value: Int(
|
||||||
custom: (),
|
2,
|
||||||
node: Tuple(
|
),
|
||||||
ExprTuple {
|
kind: None,
|
||||||
elts: [
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 10..11,
|
Constant(
|
||||||
custom: (),
|
ExprConstant {
|
||||||
node: Constant(
|
range: 16..17,
|
||||||
ExprConstant {
|
value: Int(
|
||||||
value: Int(
|
3,
|
||||||
1,
|
),
|
||||||
),
|
kind: None,
|
||||||
kind: None,
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
},
|
ctx: Load,
|
||||||
Attributed {
|
|
||||||
range: 13..14,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 16..17,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,112 +3,86 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..26,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..26,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Name(
|
||||||
targets: [
|
ExprName {
|
||||||
Attributed {
|
|
||||||
range: 0..1,
|
range: 0..1,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
value: Attributed {
|
],
|
||||||
|
value: ListComp(
|
||||||
|
ExprListComp {
|
||||||
range: 4..26,
|
range: 4..26,
|
||||||
custom: (),
|
elt: Name(
|
||||||
node: ListComp(
|
ExprName {
|
||||||
ExprListComp {
|
range: 5..6,
|
||||||
elt: Attributed {
|
id: Identifier(
|
||||||
range: 5..6,
|
"y",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
generators: [
|
|
||||||
Comprehension {
|
|
||||||
target: Attributed {
|
|
||||||
range: 11..12,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
iter: Attributed {
|
|
||||||
range: 16..25,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 17..18,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 20..21,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 23..24,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ifs: [],
|
|
||||||
is_async: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
generators: [
|
||||||
|
Comprehension {
|
||||||
|
target: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 11..12,
|
||||||
|
id: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
iter: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 16..25,
|
||||||
|
elts: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 17..18,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 20..21,
|
||||||
|
value: Int(
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 23..24,
|
||||||
|
value: Int(
|
||||||
|
3,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ifs: [],
|
||||||
|
is_async: false,
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,74 +3,56 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..13,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..13,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Name(
|
||||||
targets: [
|
ExprName {
|
||||||
Attributed {
|
|
||||||
range: 0..1,
|
range: 0..1,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
),
|
||||||
id: Identifier(
|
ctx: Store,
|
||||||
"x",
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
value: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 4..13,
|
||||||
|
elts: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 5..6,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
),
|
),
|
||||||
ctx: Store,
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
Constant(
|
||||||
],
|
ExprConstant {
|
||||||
value: Attributed {
|
range: 8..9,
|
||||||
range: 4..13,
|
value: Int(
|
||||||
custom: (),
|
2,
|
||||||
node: Tuple(
|
),
|
||||||
ExprTuple {
|
kind: None,
|
||||||
elts: [
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 5..6,
|
Constant(
|
||||||
custom: (),
|
ExprConstant {
|
||||||
node: Constant(
|
range: 11..12,
|
||||||
ExprConstant {
|
value: Int(
|
||||||
value: Int(
|
3,
|
||||||
1,
|
),
|
||||||
),
|
kind: None,
|
||||||
kind: None,
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
},
|
ctx: Load,
|
||||||
Attributed {
|
|
||||||
range: 8..9,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 11..12,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,52 +3,40 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
If(
|
||||||
range: 0..14,
|
StmtIf {
|
||||||
custom: (),
|
range: 0..14,
|
||||||
node: If(
|
test: NamedExpr(
|
||||||
StmtIf {
|
ExprNamedExpr {
|
||||||
test: Attributed {
|
|
||||||
range: 3..8,
|
range: 3..8,
|
||||||
custom: (),
|
target: Name(
|
||||||
node: NamedExpr(
|
ExprName {
|
||||||
ExprNamedExpr {
|
range: 3..4,
|
||||||
target: Attributed {
|
id: Identifier(
|
||||||
range: 3..4,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Store,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"x",
|
value: Constant(
|
||||||
),
|
ExprConstant {
|
||||||
ctx: Store,
|
range: 7..8,
|
||||||
},
|
value: Int(
|
||||||
),
|
1,
|
||||||
},
|
),
|
||||||
value: Attributed {
|
kind: None,
|
||||||
range: 7..8,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
body: [
|
),
|
||||||
Attributed {
|
body: [
|
||||||
|
Pass(
|
||||||
|
StmtPass {
|
||||||
range: 10..14,
|
range: 10..14,
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
orelse: [],
|
],
|
||||||
},
|
orelse: [],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,112 +3,86 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..26,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..26,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Name(
|
||||||
targets: [
|
ExprName {
|
||||||
Attributed {
|
|
||||||
range: 0..1,
|
range: 0..1,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
value: Attributed {
|
],
|
||||||
|
value: SetComp(
|
||||||
|
ExprSetComp {
|
||||||
range: 4..26,
|
range: 4..26,
|
||||||
custom: (),
|
elt: Name(
|
||||||
node: SetComp(
|
ExprName {
|
||||||
ExprSetComp {
|
range: 5..6,
|
||||||
elt: Attributed {
|
id: Identifier(
|
||||||
range: 5..6,
|
"y",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
generators: [
|
|
||||||
Comprehension {
|
|
||||||
target: Attributed {
|
|
||||||
range: 11..12,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
iter: Attributed {
|
|
||||||
range: 16..25,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 17..18,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 20..21,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 23..24,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ifs: [],
|
|
||||||
is_async: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
generators: [
|
||||||
|
Comprehension {
|
||||||
|
target: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 11..12,
|
||||||
|
id: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
iter: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 16..25,
|
||||||
|
elts: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 17..18,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 20..21,
|
||||||
|
value: Int(
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 23..24,
|
||||||
|
value: Int(
|
||||||
|
3,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ifs: [],
|
||||||
|
is_async: false,
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,106 +3,79 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..19,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..19,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Tuple(
|
||||||
targets: [
|
ExprTuple {
|
||||||
Attributed {
|
|
||||||
range: 0..7,
|
range: 0..7,
|
||||||
custom: (),
|
elts: [
|
||||||
node: Tuple(
|
Name(
|
||||||
ExprTuple {
|
ExprName {
|
||||||
elts: [
|
range: 1..2,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 1..2,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Store,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"x",
|
Starred(
|
||||||
),
|
ExprStarred {
|
||||||
ctx: Store,
|
range: 4..6,
|
||||||
},
|
value: Name(
|
||||||
),
|
ExprName {
|
||||||
},
|
range: 5..6,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 4..6,
|
"y",
|
||||||
custom: (),
|
),
|
||||||
node: Starred(
|
ctx: Store,
|
||||||
ExprStarred {
|
},
|
||||||
value: Attributed {
|
),
|
||||||
range: 5..6,
|
ctx: Store,
|
||||||
custom: (),
|
},
|
||||||
node: Name(
|
),
|
||||||
ExprName {
|
],
|
||||||
id: Identifier(
|
ctx: Store,
|
||||||
"y",
|
},
|
||||||
),
|
),
|
||||||
ctx: Store,
|
],
|
||||||
},
|
value: Tuple(
|
||||||
),
|
ExprTuple {
|
||||||
},
|
range: 10..19,
|
||||||
ctx: Store,
|
elts: [
|
||||||
},
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
},
|
range: 11..12,
|
||||||
],
|
value: Int(
|
||||||
ctx: Store,
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
Constant(
|
||||||
],
|
ExprConstant {
|
||||||
value: Attributed {
|
range: 14..15,
|
||||||
range: 10..19,
|
value: Int(
|
||||||
custom: (),
|
2,
|
||||||
node: Tuple(
|
),
|
||||||
ExprTuple {
|
kind: None,
|
||||||
elts: [
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 11..12,
|
Constant(
|
||||||
custom: (),
|
ExprConstant {
|
||||||
node: Constant(
|
range: 17..18,
|
||||||
ExprConstant {
|
value: Int(
|
||||||
value: Int(
|
3,
|
||||||
1,
|
),
|
||||||
),
|
kind: None,
|
||||||
kind: None,
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
},
|
ctx: Load,
|
||||||
Attributed {
|
|
||||||
range: 14..15,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 17..18,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,95 +3,71 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..16,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..16,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Subscript(
|
||||||
targets: [
|
ExprSubscript {
|
||||||
Attributed {
|
|
||||||
range: 0..4,
|
range: 0..4,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Subscript(
|
ExprName {
|
||||||
ExprSubscript {
|
range: 0..1,
|
||||||
value: Attributed {
|
id: Identifier(
|
||||||
range: 0..1,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
slice: Attributed {
|
|
||||||
range: 2..3,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Store,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
slice: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 2..3,
|
||||||
|
id: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
value: Attributed {
|
],
|
||||||
|
value: Tuple(
|
||||||
|
ExprTuple {
|
||||||
range: 7..16,
|
range: 7..16,
|
||||||
custom: (),
|
elts: [
|
||||||
node: Tuple(
|
Constant(
|
||||||
ExprTuple {
|
ExprConstant {
|
||||||
elts: [
|
range: 8..9,
|
||||||
Attributed {
|
value: Int(
|
||||||
range: 8..9,
|
1,
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Int(
|
),
|
||||||
1,
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
kind: None,
|
range: 11..12,
|
||||||
},
|
value: Int(
|
||||||
),
|
2,
|
||||||
},
|
),
|
||||||
Attributed {
|
kind: None,
|
||||||
range: 11..12,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
value: Int(
|
range: 14..15,
|
||||||
2,
|
value: Int(
|
||||||
),
|
3,
|
||||||
kind: None,
|
),
|
||||||
},
|
kind: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
Attributed {
|
],
|
||||||
range: 14..15,
|
ctx: Load,
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,97 +3,73 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..18,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..18,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Tuple(
|
||||||
targets: [
|
ExprTuple {
|
||||||
Attributed {
|
|
||||||
range: 0..6,
|
range: 0..6,
|
||||||
custom: (),
|
elts: [
|
||||||
node: Tuple(
|
Name(
|
||||||
ExprTuple {
|
ExprName {
|
||||||
elts: [
|
range: 1..2,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 1..2,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Store,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"x",
|
Name(
|
||||||
),
|
ExprName {
|
||||||
ctx: Store,
|
range: 4..5,
|
||||||
},
|
id: Identifier(
|
||||||
),
|
"y",
|
||||||
},
|
),
|
||||||
Attributed {
|
ctx: Store,
|
||||||
range: 4..5,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
],
|
||||||
ExprName {
|
ctx: Store,
|
||||||
id: Identifier(
|
},
|
||||||
"y",
|
),
|
||||||
),
|
],
|
||||||
ctx: Store,
|
value: Tuple(
|
||||||
},
|
ExprTuple {
|
||||||
),
|
range: 9..18,
|
||||||
},
|
elts: [
|
||||||
],
|
Constant(
|
||||||
ctx: Store,
|
ExprConstant {
|
||||||
|
range: 10..11,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
Constant(
|
||||||
],
|
ExprConstant {
|
||||||
value: Attributed {
|
range: 13..14,
|
||||||
range: 9..18,
|
value: Int(
|
||||||
custom: (),
|
2,
|
||||||
node: Tuple(
|
),
|
||||||
ExprTuple {
|
kind: None,
|
||||||
elts: [
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 10..11,
|
Constant(
|
||||||
custom: (),
|
ExprConstant {
|
||||||
node: Constant(
|
range: 16..17,
|
||||||
ExprConstant {
|
value: Int(
|
||||||
value: Int(
|
3,
|
||||||
1,
|
),
|
||||||
),
|
kind: None,
|
||||||
kind: None,
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
},
|
ctx: Load,
|
||||||
Attributed {
|
|
||||||
range: 13..14,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 16..17,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,50 +3,42 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
With(
|
||||||
range: 0..17,
|
StmtWith {
|
||||||
custom: (),
|
range: 0..17,
|
||||||
node: With(
|
items: [
|
||||||
StmtWith {
|
Withitem {
|
||||||
items: [
|
context_expr: Constant(
|
||||||
Withitem {
|
ExprConstant {
|
||||||
context_expr: Attributed {
|
|
||||||
range: 5..6,
|
range: 5..6,
|
||||||
custom: (),
|
value: Int(
|
||||||
node: Constant(
|
1,
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
optional_vars: Some(
|
),
|
||||||
Attributed {
|
optional_vars: Some(
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
range: 10..11,
|
range: 10..11,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
),
|
||||||
],
|
range: (),
|
||||||
body: [
|
},
|
||||||
Attributed {
|
],
|
||||||
|
body: [
|
||||||
|
Pass(
|
||||||
|
StmtPass {
|
||||||
range: 13..17,
|
range: 13..17,
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
type_comment: None,
|
],
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,84 +3,63 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
AugAssign(
|
||||||
range: 0..16,
|
StmtAugAssign {
|
||||||
custom: (),
|
range: 0..16,
|
||||||
node: AugAssign(
|
target: Attribute(
|
||||||
StmtAugAssign {
|
ExprAttribute {
|
||||||
target: Attributed {
|
|
||||||
range: 0..3,
|
range: 0..3,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Attribute(
|
ExprName {
|
||||||
ExprAttribute {
|
range: 0..1,
|
||||||
value: Attributed {
|
id: Identifier(
|
||||||
range: 0..1,
|
"x",
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
attr: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
),
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
op: Add,
|
|
||||||
value: Attributed {
|
|
||||||
range: 7..16,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 8..9,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 11..12,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 14..15,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
attr: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
op: Add,
|
||||||
},
|
value: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 7..16,
|
||||||
|
elts: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 8..9,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 11..12,
|
||||||
|
value: Int(
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 14..15,
|
||||||
|
value: Int(
|
||||||
|
3,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,37 +3,28 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
AugAssign(
|
||||||
range: 0..6,
|
StmtAugAssign {
|
||||||
custom: (),
|
range: 0..6,
|
||||||
node: AugAssign(
|
target: Name(
|
||||||
StmtAugAssign {
|
ExprName {
|
||||||
target: Attributed {
|
|
||||||
range: 0..1,
|
range: 0..1,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
op: Add,
|
),
|
||||||
value: Attributed {
|
op: Add,
|
||||||
|
value: Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 5..6,
|
range: 5..6,
|
||||||
custom: (),
|
value: Int(
|
||||||
node: Constant(
|
1,
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,93 +3,69 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
AugAssign(
|
||||||
range: 0..17,
|
StmtAugAssign {
|
||||||
custom: (),
|
range: 0..17,
|
||||||
node: AugAssign(
|
target: Subscript(
|
||||||
StmtAugAssign {
|
ExprSubscript {
|
||||||
target: Attributed {
|
|
||||||
range: 0..4,
|
range: 0..4,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Subscript(
|
ExprName {
|
||||||
ExprSubscript {
|
range: 0..1,
|
||||||
value: Attributed {
|
id: Identifier(
|
||||||
range: 0..1,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
slice: Attributed {
|
|
||||||
range: 2..3,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
op: Add,
|
|
||||||
value: Attributed {
|
|
||||||
range: 8..17,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 9..10,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 15..16,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
slice: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 2..3,
|
||||||
|
id: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
op: Add,
|
||||||
},
|
value: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 8..17,
|
||||||
|
elts: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 9..10,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 12..13,
|
||||||
|
value: Int(
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 15..16,
|
||||||
|
value: Int(
|
||||||
|
3,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,38 +3,29 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Delete(
|
||||||
range: 0..7,
|
StmtDelete {
|
||||||
custom: (),
|
range: 0..7,
|
||||||
node: Delete(
|
targets: [
|
||||||
StmtDelete {
|
Attribute(
|
||||||
targets: [
|
ExprAttribute {
|
||||||
Attributed {
|
|
||||||
range: 4..7,
|
range: 4..7,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Attribute(
|
ExprName {
|
||||||
ExprAttribute {
|
range: 4..5,
|
||||||
value: Attributed {
|
id: Identifier(
|
||||||
range: 4..5,
|
"x",
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
attr: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
),
|
||||||
ctx: Del,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
attr: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Del,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,26 +3,20 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Delete(
|
||||||
range: 0..5,
|
StmtDelete {
|
||||||
custom: (),
|
range: 0..5,
|
||||||
node: Delete(
|
targets: [
|
||||||
StmtDelete {
|
Name(
|
||||||
targets: [
|
ExprName {
|
||||||
Attributed {
|
|
||||||
range: 4..5,
|
range: 4..5,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Del,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Del,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,47 +3,35 @@ source: parser/src/context.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Delete(
|
||||||
range: 0..8,
|
StmtDelete {
|
||||||
custom: (),
|
range: 0..8,
|
||||||
node: Delete(
|
targets: [
|
||||||
StmtDelete {
|
Subscript(
|
||||||
targets: [
|
ExprSubscript {
|
||||||
Attributed {
|
|
||||||
range: 4..8,
|
range: 4..8,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Subscript(
|
ExprName {
|
||||||
ExprSubscript {
|
range: 4..5,
|
||||||
value: Attributed {
|
id: Identifier(
|
||||||
range: 4..5,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
slice: Attributed {
|
|
||||||
range: 6..7,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Del,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
slice: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 6..7,
|
||||||
|
id: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Del,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -4,69 +4,58 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..23,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..23,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [],
|
||||||
posonlyargs: [],
|
vararg: None,
|
||||||
args: [],
|
kwonlyargs: [
|
||||||
vararg: None,
|
Arg {
|
||||||
kwonlyargs: [
|
arg: Identifier(
|
||||||
Attributed {
|
"a",
|
||||||
range: 9..10,
|
),
|
||||||
custom: (),
|
annotation: None,
|
||||||
node: ArgData {
|
type_comment: None,
|
||||||
arg: Identifier(
|
range: 9..10,
|
||||||
"a",
|
},
|
||||||
),
|
Arg {
|
||||||
annotation: None,
|
arg: Identifier(
|
||||||
type_comment: None,
|
"b",
|
||||||
},
|
),
|
||||||
},
|
annotation: None,
|
||||||
Attributed {
|
type_comment: None,
|
||||||
range: 12..13,
|
range: 12..13,
|
||||||
custom: (),
|
},
|
||||||
node: ArgData {
|
Arg {
|
||||||
arg: Identifier(
|
arg: Identifier(
|
||||||
"b",
|
"c",
|
||||||
),
|
),
|
||||||
annotation: None,
|
annotation: None,
|
||||||
type_comment: None,
|
type_comment: None,
|
||||||
},
|
range: 15..16,
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 15..16,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 19..23,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
decorator_list: [],
|
kw_defaults: [],
|
||||||
returns: None,
|
kwarg: None,
|
||||||
type_comment: None,
|
defaults: [],
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 19..23,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,94 +4,77 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..29,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..29,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [],
|
||||||
posonlyargs: [],
|
vararg: None,
|
||||||
args: [],
|
kwonlyargs: [
|
||||||
vararg: None,
|
Arg {
|
||||||
kwonlyargs: [
|
arg: Identifier(
|
||||||
Attributed {
|
"a",
|
||||||
range: 9..10,
|
),
|
||||||
custom: (),
|
annotation: None,
|
||||||
node: ArgData {
|
type_comment: None,
|
||||||
arg: Identifier(
|
range: 9..10,
|
||||||
"a",
|
},
|
||||||
),
|
Arg {
|
||||||
annotation: None,
|
arg: Identifier(
|
||||||
type_comment: None,
|
"b",
|
||||||
},
|
),
|
||||||
},
|
annotation: None,
|
||||||
Attributed {
|
type_comment: None,
|
||||||
range: 12..13,
|
range: 12..13,
|
||||||
custom: (),
|
},
|
||||||
node: ArgData {
|
Arg {
|
||||||
arg: Identifier(
|
arg: Identifier(
|
||||||
"b",
|
"c",
|
||||||
),
|
),
|
||||||
annotation: None,
|
annotation: None,
|
||||||
type_comment: None,
|
type_comment: None,
|
||||||
},
|
range: 18..19,
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 18..19,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [
|
|
||||||
Attributed {
|
|
||||||
range: 14..16,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
20,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 20..22,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 25..29,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
decorator_list: [],
|
kw_defaults: [
|
||||||
returns: None,
|
Constant(
|
||||||
type_comment: None,
|
ExprConstant {
|
||||||
|
range: 14..16,
|
||||||
|
value: Int(
|
||||||
|
20,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 20..22,
|
||||||
|
value: Int(
|
||||||
|
30,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 25..29,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,35 +4,33 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..13,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..13,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [],
|
||||||
posonlyargs: [],
|
vararg: None,
|
||||||
args: [],
|
kwonlyargs: [],
|
||||||
vararg: None,
|
kw_defaults: [],
|
||||||
kwonlyargs: [],
|
kwarg: None,
|
||||||
kw_defaults: [],
|
defaults: [],
|
||||||
kwarg: None,
|
range: (),
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 9..13,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
decorator_list: [],
|
|
||||||
returns: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 9..13,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,103 +4,83 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..32,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..32,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [
|
||||||
posonlyargs: [],
|
Arg {
|
||||||
args: [
|
arg: Identifier(
|
||||||
Attributed {
|
"a",
|
||||||
range: 6..7,
|
),
|
||||||
custom: (),
|
annotation: None,
|
||||||
node: ArgData {
|
type_comment: None,
|
||||||
arg: Identifier(
|
range: 6..7,
|
||||||
"a",
|
},
|
||||||
),
|
Arg {
|
||||||
annotation: None,
|
arg: Identifier(
|
||||||
type_comment: None,
|
"b",
|
||||||
},
|
),
|
||||||
},
|
annotation: None,
|
||||||
Attributed {
|
type_comment: None,
|
||||||
range: 9..10,
|
range: 9..10,
|
||||||
custom: (),
|
},
|
||||||
node: ArgData {
|
Arg {
|
||||||
arg: Identifier(
|
arg: Identifier(
|
||||||
"b",
|
"c",
|
||||||
),
|
),
|
||||||
annotation: None,
|
annotation: None,
|
||||||
type_comment: None,
|
type_comment: None,
|
||||||
},
|
range: 12..13,
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [
|
|
||||||
Attributed {
|
|
||||||
range: 18..19,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"d",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 21..22,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 24..25,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"f",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 28..32,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
decorator_list: [],
|
vararg: None,
|
||||||
returns: None,
|
kwonlyargs: [
|
||||||
type_comment: None,
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"d",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 18..19,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 21..22,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"f",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 24..25,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 28..32,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,128 +4,102 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..38,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..38,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [
|
||||||
posonlyargs: [],
|
Arg {
|
||||||
args: [
|
arg: Identifier(
|
||||||
Attributed {
|
"a",
|
||||||
range: 6..7,
|
),
|
||||||
custom: (),
|
annotation: None,
|
||||||
node: ArgData {
|
type_comment: None,
|
||||||
arg: Identifier(
|
range: 6..7,
|
||||||
"a",
|
},
|
||||||
),
|
Arg {
|
||||||
annotation: None,
|
arg: Identifier(
|
||||||
type_comment: None,
|
"b",
|
||||||
},
|
),
|
||||||
},
|
annotation: None,
|
||||||
Attributed {
|
type_comment: None,
|
||||||
range: 9..10,
|
range: 9..10,
|
||||||
custom: (),
|
},
|
||||||
node: ArgData {
|
Arg {
|
||||||
arg: Identifier(
|
arg: Identifier(
|
||||||
"b",
|
"c",
|
||||||
),
|
),
|
||||||
annotation: None,
|
annotation: None,
|
||||||
type_comment: None,
|
type_comment: None,
|
||||||
},
|
range: 12..13,
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [
|
|
||||||
Attributed {
|
|
||||||
range: 18..19,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"d",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 21..22,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 27..28,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"f",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [
|
|
||||||
Attributed {
|
|
||||||
range: 23..25,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
20,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 29..31,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 34..38,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
decorator_list: [],
|
vararg: None,
|
||||||
returns: None,
|
kwonlyargs: [
|
||||||
type_comment: None,
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"d",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 18..19,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 21..22,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"f",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 27..28,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
kw_defaults: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 23..25,
|
||||||
|
value: Int(
|
||||||
|
20,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 29..31,
|
||||||
|
value: Int(
|
||||||
|
30,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 34..38,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,140 +4,111 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..42,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..42,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [
|
||||||
posonlyargs: [],
|
Arg {
|
||||||
args: [
|
arg: Identifier(
|
||||||
Attributed {
|
"a",
|
||||||
range: 6..7,
|
),
|
||||||
custom: (),
|
annotation: None,
|
||||||
node: ArgData {
|
type_comment: None,
|
||||||
arg: Identifier(
|
range: 6..7,
|
||||||
"a",
|
},
|
||||||
),
|
Arg {
|
||||||
annotation: None,
|
arg: Identifier(
|
||||||
type_comment: None,
|
"b",
|
||||||
},
|
),
|
||||||
},
|
annotation: None,
|
||||||
Attributed {
|
type_comment: None,
|
||||||
range: 9..10,
|
range: 9..10,
|
||||||
custom: (),
|
},
|
||||||
node: ArgData {
|
Arg {
|
||||||
arg: Identifier(
|
arg: Identifier(
|
||||||
"b",
|
"c",
|
||||||
),
|
),
|
||||||
annotation: None,
|
annotation: None,
|
||||||
type_comment: None,
|
type_comment: None,
|
||||||
},
|
range: 12..13,
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: Some(
|
|
||||||
Attributed {
|
|
||||||
range: 16..20,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"args",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
kwonlyargs: [
|
|
||||||
Attributed {
|
|
||||||
range: 22..23,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"d",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 25..26,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 31..32,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"f",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [
|
|
||||||
Attributed {
|
|
||||||
range: 27..29,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
20,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 33..35,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 38..42,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
decorator_list: [],
|
vararg: Some(
|
||||||
returns: None,
|
Arg {
|
||||||
type_comment: None,
|
arg: Identifier(
|
||||||
|
"args",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 16..20,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
kwonlyargs: [
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"d",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 22..23,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 25..26,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"f",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 31..32,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
kw_defaults: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 27..29,
|
||||||
|
value: Int(
|
||||||
|
20,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 33..35,
|
||||||
|
value: Int(
|
||||||
|
30,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 38..42,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,152 +4,120 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..52,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..52,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [
|
||||||
posonlyargs: [],
|
Arg {
|
||||||
args: [
|
arg: Identifier(
|
||||||
Attributed {
|
"a",
|
||||||
range: 6..7,
|
),
|
||||||
custom: (),
|
annotation: None,
|
||||||
node: ArgData {
|
type_comment: None,
|
||||||
arg: Identifier(
|
range: 6..7,
|
||||||
"a",
|
},
|
||||||
),
|
Arg {
|
||||||
annotation: None,
|
arg: Identifier(
|
||||||
type_comment: None,
|
"b",
|
||||||
},
|
),
|
||||||
},
|
annotation: None,
|
||||||
Attributed {
|
type_comment: None,
|
||||||
range: 9..10,
|
range: 9..10,
|
||||||
custom: (),
|
},
|
||||||
node: ArgData {
|
Arg {
|
||||||
arg: Identifier(
|
arg: Identifier(
|
||||||
"b",
|
"c",
|
||||||
),
|
),
|
||||||
annotation: None,
|
annotation: None,
|
||||||
type_comment: None,
|
type_comment: None,
|
||||||
},
|
range: 12..13,
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: Some(
|
|
||||||
Attributed {
|
|
||||||
range: 16..20,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"args",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
kwonlyargs: [
|
|
||||||
Attributed {
|
|
||||||
range: 22..23,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"d",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 25..26,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 31..32,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"f",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [
|
|
||||||
Attributed {
|
|
||||||
range: 27..29,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
20,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 33..35,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kwarg: Some(
|
|
||||||
Attributed {
|
|
||||||
range: 39..45,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"kwargs",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 48..52,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
decorator_list: [],
|
vararg: Some(
|
||||||
returns: None,
|
Arg {
|
||||||
type_comment: None,
|
arg: Identifier(
|
||||||
|
"args",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 16..20,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
kwonlyargs: [
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"d",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 22..23,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 25..26,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"f",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 31..32,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
kw_defaults: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 27..29,
|
||||||
|
value: Int(
|
||||||
|
20,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 33..35,
|
||||||
|
value: Int(
|
||||||
|
30,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
kwarg: Some(
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"kwargs",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 39..45,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 48..52,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,69 +4,58 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..20,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..20,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [
|
||||||
posonlyargs: [],
|
Arg {
|
||||||
args: [
|
arg: Identifier(
|
||||||
Attributed {
|
"a",
|
||||||
range: 6..7,
|
),
|
||||||
custom: (),
|
annotation: None,
|
||||||
node: ArgData {
|
type_comment: None,
|
||||||
arg: Identifier(
|
range: 6..7,
|
||||||
"a",
|
},
|
||||||
),
|
Arg {
|
||||||
annotation: None,
|
arg: Identifier(
|
||||||
type_comment: None,
|
"b",
|
||||||
},
|
),
|
||||||
},
|
annotation: None,
|
||||||
Attributed {
|
type_comment: None,
|
||||||
range: 9..10,
|
range: 9..10,
|
||||||
custom: (),
|
},
|
||||||
node: ArgData {
|
Arg {
|
||||||
arg: Identifier(
|
arg: Identifier(
|
||||||
"b",
|
"c",
|
||||||
),
|
),
|
||||||
annotation: None,
|
annotation: None,
|
||||||
type_comment: None,
|
type_comment: None,
|
||||||
},
|
range: 12..13,
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 16..20,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
decorator_list: [],
|
vararg: None,
|
||||||
returns: None,
|
kwonlyargs: [],
|
||||||
type_comment: None,
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 16..20,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,94 +4,77 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 0..26,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 0..26,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"f",
|
||||||
name: Identifier(
|
),
|
||||||
"f",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [
|
||||||
posonlyargs: [],
|
Arg {
|
||||||
args: [
|
arg: Identifier(
|
||||||
Attributed {
|
"a",
|
||||||
range: 6..7,
|
),
|
||||||
custom: (),
|
annotation: None,
|
||||||
node: ArgData {
|
type_comment: None,
|
||||||
arg: Identifier(
|
range: 6..7,
|
||||||
"a",
|
},
|
||||||
),
|
Arg {
|
||||||
annotation: None,
|
arg: Identifier(
|
||||||
type_comment: None,
|
"b",
|
||||||
},
|
),
|
||||||
},
|
annotation: None,
|
||||||
Attributed {
|
type_comment: None,
|
||||||
range: 9..10,
|
range: 9..10,
|
||||||
custom: (),
|
},
|
||||||
node: ArgData {
|
Arg {
|
||||||
arg: Identifier(
|
arg: Identifier(
|
||||||
"b",
|
"c",
|
||||||
),
|
),
|
||||||
annotation: None,
|
annotation: None,
|
||||||
type_comment: None,
|
type_comment: None,
|
||||||
},
|
range: 15..16,
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 15..16,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [
|
|
||||||
Attributed {
|
|
||||||
range: 11..13,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
20,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 17..19,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 22..26,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
decorator_list: [],
|
vararg: None,
|
||||||
returns: None,
|
kwonlyargs: [],
|
||||||
type_comment: None,
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 11..13,
|
||||||
|
value: Int(
|
||||||
|
20,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 17..19,
|
||||||
|
value: Int(
|
||||||
|
30,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
body: [
|
||||||
},
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 22..26,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,76 +4,59 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..20,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..20,
|
||||||
node: Expr(
|
value: Lambda(
|
||||||
StmtExpr {
|
ExprLambda {
|
||||||
value: Attributed {
|
|
||||||
range: 0..20,
|
range: 0..20,
|
||||||
custom: (),
|
args: Arguments {
|
||||||
node: Lambda(
|
posonlyargs: [],
|
||||||
ExprLambda {
|
args: [],
|
||||||
args: Arguments {
|
vararg: None,
|
||||||
posonlyargs: [],
|
kwonlyargs: [
|
||||||
args: [],
|
Arg {
|
||||||
vararg: None,
|
arg: Identifier(
|
||||||
kwonlyargs: [
|
"a",
|
||||||
Attributed {
|
|
||||||
range: 10..11,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 13..14,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"b",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 16..17,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: Attributed {
|
|
||||||
range: 19..20,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 10..11,
|
||||||
},
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"b",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 13..14,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"c",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 16..17,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
body: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 19..20,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,101 +4,78 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..26,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..26,
|
||||||
node: Expr(
|
value: Lambda(
|
||||||
StmtExpr {
|
ExprLambda {
|
||||||
value: Attributed {
|
|
||||||
range: 0..26,
|
range: 0..26,
|
||||||
custom: (),
|
args: Arguments {
|
||||||
node: Lambda(
|
posonlyargs: [],
|
||||||
ExprLambda {
|
args: [],
|
||||||
args: Arguments {
|
vararg: None,
|
||||||
posonlyargs: [],
|
kwonlyargs: [
|
||||||
args: [],
|
Arg {
|
||||||
vararg: None,
|
arg: Identifier(
|
||||||
kwonlyargs: [
|
"a",
|
||||||
Attributed {
|
|
||||||
range: 10..11,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 13..14,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"b",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 19..20,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [
|
|
||||||
Attributed {
|
|
||||||
range: 15..17,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
20,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 21..23,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: Attributed {
|
|
||||||
range: 25..26,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 10..11,
|
||||||
},
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"b",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 13..14,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"c",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 19..20,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
kw_defaults: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 15..17,
|
||||||
|
value: Int(
|
||||||
|
20,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 21..23,
|
||||||
|
value: Int(
|
||||||
|
30,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
body: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 25..26,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,42 +4,34 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..9,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..9,
|
||||||
node: Expr(
|
value: Lambda(
|
||||||
StmtExpr {
|
ExprLambda {
|
||||||
value: Attributed {
|
|
||||||
range: 0..9,
|
range: 0..9,
|
||||||
custom: (),
|
args: Arguments {
|
||||||
node: Lambda(
|
posonlyargs: [],
|
||||||
ExprLambda {
|
args: [],
|
||||||
args: Arguments {
|
vararg: None,
|
||||||
posonlyargs: [],
|
kwonlyargs: [],
|
||||||
args: [],
|
kw_defaults: [],
|
||||||
vararg: None,
|
kwarg: None,
|
||||||
kwonlyargs: [],
|
defaults: [],
|
||||||
kw_defaults: [],
|
range: (),
|
||||||
kwarg: None,
|
},
|
||||||
defaults: [],
|
body: Constant(
|
||||||
},
|
ExprConstant {
|
||||||
body: Attributed {
|
range: 8..9,
|
||||||
range: 8..9,
|
value: Int(
|
||||||
custom: (),
|
1,
|
||||||
node: Constant(
|
),
|
||||||
ExprConstant {
|
kind: None,
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,99 +4,76 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..26,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..26,
|
||||||
node: Expr(
|
value: Lambda(
|
||||||
StmtExpr {
|
ExprLambda {
|
||||||
value: Attributed {
|
|
||||||
range: 0..26,
|
range: 0..26,
|
||||||
custom: (),
|
args: Arguments {
|
||||||
node: Lambda(
|
posonlyargs: [],
|
||||||
ExprLambda {
|
args: [
|
||||||
args: Arguments {
|
Arg {
|
||||||
posonlyargs: [],
|
arg: Identifier(
|
||||||
args: [
|
"a",
|
||||||
Attributed {
|
|
||||||
range: 7..8,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 10..11,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"b",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 13..14,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [
|
|
||||||
Attributed {
|
|
||||||
range: 19..20,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"d",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 22..23,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: Attributed {
|
|
||||||
range: 25..26,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 7..8,
|
||||||
},
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"b",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 10..11,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"c",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 13..14,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vararg: None,
|
||||||
|
kwonlyargs: [
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"d",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 19..20,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 22..23,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
body: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 25..26,
|
||||||
|
value: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,76 +4,59 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..17,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..17,
|
||||||
node: Expr(
|
value: Lambda(
|
||||||
StmtExpr {
|
ExprLambda {
|
||||||
value: Attributed {
|
|
||||||
range: 0..17,
|
range: 0..17,
|
||||||
custom: (),
|
args: Arguments {
|
||||||
node: Lambda(
|
posonlyargs: [],
|
||||||
ExprLambda {
|
args: [
|
||||||
args: Arguments {
|
Arg {
|
||||||
posonlyargs: [],
|
arg: Identifier(
|
||||||
args: [
|
"a",
|
||||||
Attributed {
|
|
||||||
range: 7..8,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 10..11,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"b",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 13..14,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: Attributed {
|
|
||||||
range: 16..17,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 7..8,
|
||||||
},
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"b",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 10..11,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"c",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 13..14,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vararg: None,
|
||||||
|
kwonlyargs: [],
|
||||||
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
body: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 16..17,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,101 +4,78 @@ expression: parse_ast
|
||||||
---
|
---
|
||||||
Ok(
|
Ok(
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..23,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..23,
|
||||||
node: Expr(
|
value: Lambda(
|
||||||
StmtExpr {
|
ExprLambda {
|
||||||
value: Attributed {
|
|
||||||
range: 0..23,
|
range: 0..23,
|
||||||
custom: (),
|
args: Arguments {
|
||||||
node: Lambda(
|
posonlyargs: [],
|
||||||
ExprLambda {
|
args: [
|
||||||
args: Arguments {
|
Arg {
|
||||||
posonlyargs: [],
|
arg: Identifier(
|
||||||
args: [
|
"a",
|
||||||
Attributed {
|
|
||||||
range: 7..8,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 10..11,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"b",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 16..17,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [
|
|
||||||
Attributed {
|
|
||||||
range: 12..14,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
20,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 18..20,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
body: Attributed {
|
|
||||||
range: 22..23,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 7..8,
|
||||||
},
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"b",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 10..11,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"c",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 16..17,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vararg: None,
|
||||||
|
kwonlyargs: [],
|
||||||
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 12..14,
|
||||||
|
value: Int(
|
||||||
|
20,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 18..20,
|
||||||
|
value: Int(
|
||||||
|
30,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
body: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 22..23,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,80 +2,62 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
Dict(
|
||||||
range: 0..25,
|
ExprDict {
|
||||||
custom: (),
|
range: 0..25,
|
||||||
node: Dict(
|
keys: [
|
||||||
ExprDict {
|
Some(
|
||||||
keys: [
|
Constant(
|
||||||
Some(
|
ExprConstant {
|
||||||
Attributed {
|
|
||||||
range: 1..4,
|
range: 1..4,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"a",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
None,
|
),
|
||||||
Some(
|
None,
|
||||||
Attributed {
|
Some(
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 16..19,
|
range: 16..19,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"d",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"d",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
values: [
|
],
|
||||||
Attributed {
|
values: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 6..9,
|
range: 6..9,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"b",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"b",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
range: 13..14,
|
range: 13..14,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"c",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"c",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 21..24,
|
range: 21..24,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"e",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
},
|
||||||
}
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,213 +2,157 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
Call(
|
||||||
range: 0..141,
|
ExprCall {
|
||||||
custom: (),
|
range: 0..141,
|
||||||
node: Call(
|
func: Attribute(
|
||||||
ExprCall {
|
ExprAttribute {
|
||||||
func: Attributed {
|
|
||||||
range: 0..8,
|
range: 0..8,
|
||||||
custom: (),
|
value: Constant(
|
||||||
node: Attribute(
|
ExprConstant {
|
||||||
ExprAttribute {
|
range: 0..3,
|
||||||
value: Attributed {
|
value: Str(
|
||||||
range: 0..3,
|
" ",
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
" ",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
attr: Identifier(
|
|
||||||
"join",
|
|
||||||
),
|
),
|
||||||
ctx: Load,
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
attr: Identifier(
|
||||||
|
"join",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
args: [
|
),
|
||||||
Attributed {
|
args: [
|
||||||
|
GeneratorExp(
|
||||||
|
ExprGeneratorExp {
|
||||||
range: 14..139,
|
range: 14..139,
|
||||||
custom: (),
|
elt: Name(
|
||||||
node: GeneratorExp(
|
ExprName {
|
||||||
ExprGeneratorExp {
|
range: 14..17,
|
||||||
elt: Attributed {
|
id: Identifier(
|
||||||
range: 14..17,
|
"sql",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"sql",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
generators: [
|
|
||||||
Comprehension {
|
|
||||||
target: Attributed {
|
|
||||||
range: 26..29,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"sql",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
iter: Attributed {
|
|
||||||
range: 33..139,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 43..80,
|
|
||||||
custom: (),
|
|
||||||
node: IfExp(
|
|
||||||
ExprIfExp {
|
|
||||||
test: Attributed {
|
|
||||||
range: 65..70,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"limit",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
body: Attributed {
|
|
||||||
range: 43..61,
|
|
||||||
custom: (),
|
|
||||||
node: BinOp(
|
|
||||||
ExprBinOp {
|
|
||||||
left: Attributed {
|
|
||||||
range: 43..53,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"LIMIT %d",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
op: Mod,
|
|
||||||
right: Attributed {
|
|
||||||
range: 56..61,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"limit",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
orelse: Attributed {
|
|
||||||
range: 76..80,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: None,
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 90..132,
|
|
||||||
custom: (),
|
|
||||||
node: IfExp(
|
|
||||||
ExprIfExp {
|
|
||||||
test: Attributed {
|
|
||||||
range: 116..122,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"offset",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
body: Attributed {
|
|
||||||
range: 91..111,
|
|
||||||
custom: (),
|
|
||||||
node: BinOp(
|
|
||||||
ExprBinOp {
|
|
||||||
left: Attributed {
|
|
||||||
range: 91..102,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"OFFSET %d",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
op: Mod,
|
|
||||||
right: Attributed {
|
|
||||||
range: 105..111,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"offset",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
orelse: Attributed {
|
|
||||||
range: 128..132,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: None,
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ifs: [],
|
|
||||||
is_async: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
generators: [
|
||||||
|
Comprehension {
|
||||||
|
target: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 26..29,
|
||||||
|
id: Identifier(
|
||||||
|
"sql",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
iter: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 33..139,
|
||||||
|
elts: [
|
||||||
|
IfExp(
|
||||||
|
ExprIfExp {
|
||||||
|
range: 43..80,
|
||||||
|
test: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 65..70,
|
||||||
|
id: Identifier(
|
||||||
|
"limit",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
body: BinOp(
|
||||||
|
ExprBinOp {
|
||||||
|
range: 43..61,
|
||||||
|
left: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 43..53,
|
||||||
|
value: Str(
|
||||||
|
"LIMIT %d",
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
op: Mod,
|
||||||
|
right: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 56..61,
|
||||||
|
id: Identifier(
|
||||||
|
"limit",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
orelse: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 76..80,
|
||||||
|
value: None,
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
IfExp(
|
||||||
|
ExprIfExp {
|
||||||
|
range: 90..132,
|
||||||
|
test: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 116..122,
|
||||||
|
id: Identifier(
|
||||||
|
"offset",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
body: BinOp(
|
||||||
|
ExprBinOp {
|
||||||
|
range: 91..111,
|
||||||
|
left: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 91..102,
|
||||||
|
value: Str(
|
||||||
|
"OFFSET %d",
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
op: Mod,
|
||||||
|
right: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 105..111,
|
||||||
|
id: Identifier(
|
||||||
|
"offset",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
orelse: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 128..132,
|
||||||
|
value: None,
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ifs: [],
|
||||||
|
is_async: false,
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
keywords: [],
|
],
|
||||||
},
|
keywords: [],
|
||||||
),
|
},
|
||||||
}
|
)
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -2,38 +2,29 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
BoolOp(
|
||||||
range: 0..7,
|
ExprBoolOp {
|
||||||
custom: (),
|
range: 0..7,
|
||||||
node: BoolOp(
|
op: And,
|
||||||
ExprBoolOp {
|
values: [
|
||||||
op: And,
|
Name(
|
||||||
values: [
|
ExprName {
|
||||||
Attributed {
|
|
||||||
range: 0..1,
|
range: 0..1,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
range: 6..7,
|
range: 6..7,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"y",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
},
|
||||||
}
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,38 +2,29 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
BoolOp(
|
||||||
range: 0..6,
|
ExprBoolOp {
|
||||||
custom: (),
|
range: 0..6,
|
||||||
node: BoolOp(
|
op: Or,
|
||||||
ExprBoolOp {
|
values: [
|
||||||
op: Or,
|
Name(
|
||||||
values: [
|
ExprName {
|
||||||
Attributed {
|
|
||||||
range: 0..1,
|
range: 0..1,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
range: 5..6,
|
range: 5..6,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"y",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
},
|
||||||
}
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,153 +3,128 @@ source: parser/src/parser.rs
|
||||||
expression: "parse_program(source, \"<test>\").unwrap()"
|
expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
ClassDef(
|
||||||
range: 0..98,
|
StmtClassDef {
|
||||||
custom: (),
|
range: 0..98,
|
||||||
node: ClassDef(
|
name: Identifier(
|
||||||
StmtClassDef {
|
"Foo",
|
||||||
name: Identifier(
|
),
|
||||||
"Foo",
|
bases: [
|
||||||
),
|
Name(
|
||||||
bases: [
|
ExprName {
|
||||||
Attributed {
|
|
||||||
range: 10..11,
|
range: 10..11,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"A",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"A",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
range: 13..14,
|
range: 13..14,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"B",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"B",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
keywords: [],
|
],
|
||||||
body: [
|
keywords: [],
|
||||||
Attributed {
|
body: [
|
||||||
|
FunctionDef(
|
||||||
|
StmtFunctionDef {
|
||||||
range: 18..44,
|
range: 18..44,
|
||||||
custom: (),
|
name: Identifier(
|
||||||
node: FunctionDef(
|
"__init__",
|
||||||
StmtFunctionDef {
|
|
||||||
name: Identifier(
|
|
||||||
"__init__",
|
|
||||||
),
|
|
||||||
args: Arguments {
|
|
||||||
posonlyargs: [],
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 31..35,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"self",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 40..44,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
decorator_list: [],
|
|
||||||
returns: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
args: Arguments {
|
||||||
|
posonlyargs: [],
|
||||||
|
args: [
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"self",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 31..35,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vararg: None,
|
||||||
|
kwonlyargs: [],
|
||||||
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
body: [
|
||||||
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 40..44,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
|
FunctionDef(
|
||||||
|
StmtFunctionDef {
|
||||||
range: 46..98,
|
range: 46..98,
|
||||||
custom: (),
|
name: Identifier(
|
||||||
node: FunctionDef(
|
"method_with_default",
|
||||||
StmtFunctionDef {
|
|
||||||
name: Identifier(
|
|
||||||
"method_with_default",
|
|
||||||
),
|
|
||||||
args: Arguments {
|
|
||||||
posonlyargs: [],
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 70..74,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"self",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 76..79,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"arg",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [
|
|
||||||
Attributed {
|
|
||||||
range: 80..89,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"default",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 94..98,
|
|
||||||
custom: (),
|
|
||||||
node: Pass,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
decorator_list: [],
|
|
||||||
returns: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
args: Arguments {
|
||||||
|
posonlyargs: [],
|
||||||
|
args: [
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"self",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 70..74,
|
||||||
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"arg",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 76..79,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vararg: None,
|
||||||
|
kwonlyargs: [],
|
||||||
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 80..89,
|
||||||
|
value: Str(
|
||||||
|
"default",
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
body: [
|
||||||
|
Pass(
|
||||||
|
StmtPass {
|
||||||
|
range: 94..98,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
decorator_list: [],
|
||||||
|
returns: None,
|
||||||
|
type_comment: None,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
decorator_list: [],
|
],
|
||||||
},
|
decorator_list: [],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -2,65 +2,51 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
DictComp(
|
||||||
range: 0..19,
|
ExprDictComp {
|
||||||
custom: (),
|
range: 0..19,
|
||||||
node: DictComp(
|
key: Name(
|
||||||
ExprDictComp {
|
ExprName {
|
||||||
key: Attributed {
|
|
||||||
range: 1..3,
|
range: 1..3,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x1",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x1",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
value: Attributed {
|
),
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
range: 5..7,
|
range: 5..7,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x2",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
generators: [
|
||||||
|
Comprehension {
|
||||||
|
target: Name(
|
||||||
ExprName {
|
ExprName {
|
||||||
|
range: 12..13,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"x2",
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
iter: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 17..18,
|
||||||
|
id: Identifier(
|
||||||
|
"z",
|
||||||
),
|
),
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ifs: [],
|
||||||
|
is_async: false,
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
generators: [
|
],
|
||||||
Comprehension {
|
},
|
||||||
target: Attributed {
|
)
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
iter: Attributed {
|
|
||||||
range: 17..18,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"z",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ifs: [],
|
|
||||||
is_async: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,179 +2,139 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
ListComp(
|
||||||
range: 0..48,
|
ExprListComp {
|
||||||
custom: (),
|
range: 0..48,
|
||||||
node: ListComp(
|
elt: Name(
|
||||||
ExprListComp {
|
ExprName {
|
||||||
elt: Attributed {
|
|
||||||
range: 1..2,
|
range: 1..2,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
generators: [
|
||||||
|
Comprehension {
|
||||||
|
target: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 7..12,
|
||||||
|
elts: [
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
|
range: 7..8,
|
||||||
|
id: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
|
range: 10..12,
|
||||||
|
id: Identifier(
|
||||||
|
"y2",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
iter: Name(
|
||||||
ExprName {
|
ExprName {
|
||||||
|
range: 16..17,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"x",
|
"z",
|
||||||
),
|
),
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ifs: [],
|
||||||
|
is_async: false,
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
generators: [
|
Comprehension {
|
||||||
Comprehension {
|
target: Name(
|
||||||
target: Attributed {
|
ExprName {
|
||||||
range: 7..12,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 7..8,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 10..12,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y2",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
iter: Attributed {
|
|
||||||
range: 16..17,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"z",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ifs: [],
|
|
||||||
is_async: false,
|
|
||||||
},
|
|
||||||
Comprehension {
|
|
||||||
target: Attributed {
|
|
||||||
range: 22..23,
|
range: 22..23,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"a",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
iter: Attributed {
|
),
|
||||||
|
iter: Name(
|
||||||
|
ExprName {
|
||||||
range: 27..28,
|
range: 27..28,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"b",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"b",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
ifs: [
|
),
|
||||||
Attributed {
|
ifs: [
|
||||||
|
Compare(
|
||||||
|
ExprCompare {
|
||||||
range: 32..37,
|
range: 32..37,
|
||||||
custom: (),
|
left: Name(
|
||||||
node: Compare(
|
ExprName {
|
||||||
ExprCompare {
|
range: 32..33,
|
||||||
left: Attributed {
|
id: Identifier(
|
||||||
range: 32..33,
|
"a",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ops: [
|
|
||||||
Lt,
|
|
||||||
],
|
|
||||||
comparators: [
|
|
||||||
Attributed {
|
|
||||||
range: 36..37,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
5,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ops: [
|
||||||
|
Lt,
|
||||||
|
],
|
||||||
|
comparators: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 36..37,
|
||||||
|
value: Int(
|
||||||
|
5,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
|
Compare(
|
||||||
|
ExprCompare {
|
||||||
range: 41..47,
|
range: 41..47,
|
||||||
custom: (),
|
left: Name(
|
||||||
node: Compare(
|
ExprName {
|
||||||
ExprCompare {
|
range: 41..42,
|
||||||
left: Attributed {
|
id: Identifier(
|
||||||
range: 41..42,
|
"a",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"a",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ops: [
|
|
||||||
Gt,
|
|
||||||
],
|
|
||||||
comparators: [
|
|
||||||
Attributed {
|
|
||||||
range: 45..47,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
10,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ops: [
|
||||||
|
Gt,
|
||||||
|
],
|
||||||
|
comparators: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 45..47,
|
||||||
|
value: Int(
|
||||||
|
10,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
is_async: false,
|
],
|
||||||
},
|
is_async: false,
|
||||||
],
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
],
|
||||||
}
|
},
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,34 +3,25 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..14,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..14,
|
||||||
node: Expr(
|
value: JoinedStr(
|
||||||
StmtExpr {
|
ExprJoinedStr {
|
||||||
value: Attributed {
|
|
||||||
range: 0..14,
|
range: 0..14,
|
||||||
custom: (),
|
values: [
|
||||||
node: JoinedStr(
|
Constant(
|
||||||
ExprJoinedStr {
|
ExprConstant {
|
||||||
values: [
|
range: 0..14,
|
||||||
Attributed {
|
value: Str(
|
||||||
range: 0..14,
|
"Hello world",
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Str(
|
),
|
||||||
"Hello world",
|
],
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -2,53 +2,42 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
GeneratorExp(
|
||||||
range: 0..14,
|
ExprGeneratorExp {
|
||||||
custom: (),
|
range: 0..14,
|
||||||
node: GeneratorExp(
|
elt: Name(
|
||||||
ExprGeneratorExp {
|
ExprName {
|
||||||
elt: Attributed {
|
|
||||||
range: 1..2,
|
range: 1..2,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
generators: [
|
||||||
|
Comprehension {
|
||||||
|
target: Name(
|
||||||
ExprName {
|
ExprName {
|
||||||
|
range: 7..8,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"x",
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
iter: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 12..13,
|
||||||
|
id: Identifier(
|
||||||
|
"z",
|
||||||
),
|
),
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ifs: [],
|
||||||
|
is_async: false,
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
generators: [
|
],
|
||||||
Comprehension {
|
},
|
||||||
target: Attributed {
|
)
|
||||||
range: 7..8,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
iter: Attributed {
|
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"z",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ifs: [],
|
|
||||||
is_async: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -3,112 +3,82 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
If(
|
||||||
range: 0..28,
|
StmtIf {
|
||||||
custom: (),
|
range: 0..28,
|
||||||
node: If(
|
test: Constant(
|
||||||
StmtIf {
|
ExprConstant {
|
||||||
test: Attributed {
|
|
||||||
range: 3..4,
|
range: 3..4,
|
||||||
custom: (),
|
value: Int(
|
||||||
node: Constant(
|
1,
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
body: [
|
),
|
||||||
Attributed {
|
body: [
|
||||||
|
Expr(
|
||||||
|
StmtExpr {
|
||||||
range: 6..8,
|
range: 6..8,
|
||||||
custom: (),
|
value: Constant(
|
||||||
node: Expr(
|
ExprConstant {
|
||||||
StmtExpr {
|
range: 6..8,
|
||||||
value: Attributed {
|
value: Int(
|
||||||
range: 6..8,
|
10,
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
10,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
orelse: [
|
],
|
||||||
Attributed {
|
orelse: [
|
||||||
|
If(
|
||||||
|
StmtIf {
|
||||||
range: 9..28,
|
range: 9..28,
|
||||||
custom: (),
|
test: Constant(
|
||||||
node: If(
|
ExprConstant {
|
||||||
StmtIf {
|
range: 14..15,
|
||||||
test: Attributed {
|
value: Int(
|
||||||
range: 14..15,
|
2,
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
body: [
|
||||||
|
Expr(
|
||||||
|
StmtExpr {
|
||||||
|
range: 17..19,
|
||||||
|
value: Constant(
|
||||||
ExprConstant {
|
ExprConstant {
|
||||||
|
range: 17..19,
|
||||||
value: Int(
|
value: Int(
|
||||||
2,
|
20,
|
||||||
),
|
),
|
||||||
kind: None,
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
body: [
|
),
|
||||||
Attributed {
|
],
|
||||||
range: 17..19,
|
orelse: [
|
||||||
custom: (),
|
Expr(
|
||||||
node: Expr(
|
StmtExpr {
|
||||||
StmtExpr {
|
range: 26..28,
|
||||||
value: Attributed {
|
value: Constant(
|
||||||
range: 17..19,
|
ExprConstant {
|
||||||
custom: (),
|
range: 26..28,
|
||||||
node: Constant(
|
value: Int(
|
||||||
ExprConstant {
|
30,
|
||||||
value: Int(
|
),
|
||||||
20,
|
kind: None,
|
||||||
),
|
},
|
||||||
kind: None,
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
],
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
orelse: [
|
|
||||||
Attributed {
|
|
||||||
range: 26..28,
|
|
||||||
custom: (),
|
|
||||||
node: Expr(
|
|
||||||
StmtExpr {
|
|
||||||
value: Attributed {
|
|
||||||
range: 26..28,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -2,85 +2,65 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
GeneratorExp(
|
||||||
range: 0..26,
|
ExprGeneratorExp {
|
||||||
custom: (),
|
range: 0..26,
|
||||||
node: GeneratorExp(
|
elt: IfExp(
|
||||||
ExprGeneratorExp {
|
ExprIfExp {
|
||||||
elt: Attributed {
|
|
||||||
range: 1..14,
|
range: 1..14,
|
||||||
custom: (),
|
test: Name(
|
||||||
node: IfExp(
|
ExprName {
|
||||||
ExprIfExp {
|
range: 6..7,
|
||||||
test: Attributed {
|
id: Identifier(
|
||||||
range: 6..7,
|
"y",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"y",
|
body: Name(
|
||||||
),
|
ExprName {
|
||||||
ctx: Load,
|
range: 1..2,
|
||||||
},
|
id: Identifier(
|
||||||
),
|
"x",
|
||||||
},
|
),
|
||||||
body: Attributed {
|
ctx: Load,
|
||||||
range: 1..2,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
orelse: Name(
|
||||||
ExprName {
|
ExprName {
|
||||||
id: Identifier(
|
range: 13..14,
|
||||||
"x",
|
id: Identifier(
|
||||||
),
|
"y",
|
||||||
ctx: Load,
|
),
|
||||||
},
|
ctx: Load,
|
||||||
),
|
|
||||||
},
|
|
||||||
orelse: Attributed {
|
|
||||||
range: 13..14,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
generators: [
|
),
|
||||||
Comprehension {
|
generators: [
|
||||||
target: Attributed {
|
Comprehension {
|
||||||
|
target: Name(
|
||||||
|
ExprName {
|
||||||
range: 19..20,
|
range: 19..20,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"y",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
iter: Attributed {
|
),
|
||||||
|
iter: Name(
|
||||||
|
ExprName {
|
||||||
range: 24..25,
|
range: 24..25,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"z",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"z",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
ifs: [],
|
),
|
||||||
is_async: false,
|
ifs: [],
|
||||||
},
|
is_async: false,
|
||||||
],
|
range: (),
|
||||||
},
|
},
|
||||||
),
|
],
|
||||||
}
|
},
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,71 +3,53 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..32,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..32,
|
||||||
node: Expr(
|
value: Call(
|
||||||
StmtExpr {
|
ExprCall {
|
||||||
value: Attributed {
|
|
||||||
range: 0..32,
|
range: 0..32,
|
||||||
custom: (),
|
func: Name(
|
||||||
node: Call(
|
ExprName {
|
||||||
ExprCall {
|
range: 0..7,
|
||||||
func: Attributed {
|
id: Identifier(
|
||||||
range: 0..7,
|
"my_func",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"my_func",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 8..20,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"positional",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [
|
|
||||||
Attributed {
|
|
||||||
range: 22..31,
|
|
||||||
custom: (),
|
|
||||||
node: KeywordData {
|
|
||||||
arg: Some(
|
|
||||||
Identifier(
|
|
||||||
"keyword",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
value: Attributed {
|
|
||||||
range: 30..31,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
args: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 8..20,
|
||||||
|
value: Str(
|
||||||
|
"positional",
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
keywords: [
|
||||||
|
Keyword {
|
||||||
|
arg: Some(
|
||||||
|
Identifier(
|
||||||
|
"keyword",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
value: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 30..31,
|
||||||
|
value: Int(
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
range: 22..31,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,85 +3,65 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..18,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..18,
|
||||||
node: Expr(
|
value: Lambda(
|
||||||
StmtExpr {
|
ExprLambda {
|
||||||
value: Attributed {
|
|
||||||
range: 0..18,
|
range: 0..18,
|
||||||
custom: (),
|
args: Arguments {
|
||||||
node: Lambda(
|
posonlyargs: [],
|
||||||
ExprLambda {
|
args: [
|
||||||
args: Arguments {
|
Arg {
|
||||||
posonlyargs: [],
|
arg: Identifier(
|
||||||
args: [
|
"x",
|
||||||
Attributed {
|
|
||||||
range: 7..8,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 10..11,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
annotation: None,
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vararg: None,
|
|
||||||
kwonlyargs: [],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: Attributed {
|
|
||||||
range: 13..18,
|
|
||||||
custom: (),
|
|
||||||
node: BinOp(
|
|
||||||
ExprBinOp {
|
|
||||||
left: Attributed {
|
|
||||||
range: 13..14,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
op: Mult,
|
|
||||||
right: Attributed {
|
|
||||||
range: 17..18,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 7..8,
|
||||||
},
|
},
|
||||||
|
Arg {
|
||||||
|
arg: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
annotation: None,
|
||||||
|
type_comment: None,
|
||||||
|
range: 10..11,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vararg: None,
|
||||||
|
kwonlyargs: [],
|
||||||
|
kw_defaults: [],
|
||||||
|
kwarg: None,
|
||||||
|
defaults: [],
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
body: BinOp(
|
||||||
|
ExprBinOp {
|
||||||
|
range: 13..18,
|
||||||
|
left: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 13..14,
|
||||||
|
id: Identifier(
|
||||||
|
"x",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
op: Mult,
|
||||||
|
right: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 17..18,
|
||||||
|
id: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -2,53 +2,42 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
ListComp(
|
||||||
range: 0..14,
|
ExprListComp {
|
||||||
custom: (),
|
range: 0..14,
|
||||||
node: ListComp(
|
elt: Name(
|
||||||
ExprListComp {
|
ExprName {
|
||||||
elt: Attributed {
|
|
||||||
range: 1..2,
|
range: 1..2,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
generators: [
|
||||||
|
Comprehension {
|
||||||
|
target: Name(
|
||||||
ExprName {
|
ExprName {
|
||||||
|
range: 7..8,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"x",
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
iter: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 12..13,
|
||||||
|
id: Identifier(
|
||||||
|
"z",
|
||||||
),
|
),
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ifs: [],
|
||||||
|
is_async: false,
|
||||||
|
range: (),
|
||||||
},
|
},
|
||||||
generators: [
|
],
|
||||||
Comprehension {
|
},
|
||||||
target: Attributed {
|
)
|
||||||
range: 7..8,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
iter: Attributed {
|
|
||||||
range: 12..13,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"z",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ifs: [],
|
|
||||||
is_async: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,94 +2,71 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
GeneratorExp(
|
||||||
range: 0..23,
|
ExprGeneratorExp {
|
||||||
custom: (),
|
range: 0..23,
|
||||||
node: GeneratorExp(
|
elt: NamedExpr(
|
||||||
ExprGeneratorExp {
|
ExprNamedExpr {
|
||||||
elt: Attributed {
|
|
||||||
range: 1..11,
|
range: 1..11,
|
||||||
custom: (),
|
target: Name(
|
||||||
node: NamedExpr(
|
ExprName {
|
||||||
ExprNamedExpr {
|
range: 1..2,
|
||||||
target: Attributed {
|
id: Identifier(
|
||||||
range: 1..2,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Store,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
value: Attributed {
|
|
||||||
range: 6..11,
|
|
||||||
custom: (),
|
|
||||||
node: BinOp(
|
|
||||||
ExprBinOp {
|
|
||||||
left: Attributed {
|
|
||||||
range: 6..7,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"y",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
op: Add,
|
|
||||||
right: Attributed {
|
|
||||||
range: 10..11,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
value: BinOp(
|
||||||
generators: [
|
ExprBinOp {
|
||||||
Comprehension {
|
range: 6..11,
|
||||||
target: Attributed {
|
left: Name(
|
||||||
range: 16..17,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
ExprName {
|
||||||
|
range: 6..7,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"y",
|
"y",
|
||||||
),
|
),
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
iter: Attributed {
|
|
||||||
range: 21..22,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"z",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
op: Add,
|
||||||
|
right: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 10..11,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
ifs: [],
|
),
|
||||||
is_async: false,
|
},
|
||||||
},
|
),
|
||||||
],
|
generators: [
|
||||||
},
|
Comprehension {
|
||||||
),
|
target: Name(
|
||||||
}
|
ExprName {
|
||||||
|
range: 16..17,
|
||||||
|
id: Identifier(
|
||||||
|
"y",
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
iter: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 21..22,
|
||||||
|
id: Identifier(
|
||||||
|
"z",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ifs: [],
|
||||||
|
is_async: false,
|
||||||
|
range: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,59 +3,44 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..23,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..23,
|
||||||
node: Expr(
|
value: Call(
|
||||||
StmtExpr {
|
ExprCall {
|
||||||
value: Attributed {
|
|
||||||
range: 0..23,
|
range: 0..23,
|
||||||
custom: (),
|
func: Name(
|
||||||
node: Call(
|
ExprName {
|
||||||
ExprCall {
|
range: 0..5,
|
||||||
func: Attributed {
|
id: Identifier(
|
||||||
range: 0..5,
|
"print",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"print",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 6..19,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"Hello world",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 21..22,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
args: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 6..19,
|
||||||
|
value: Str(
|
||||||
|
"Hello world",
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 21..22,
|
||||||
|
value: Int(
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
keywords: [],
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,47 +3,35 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..20,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..20,
|
||||||
node: Expr(
|
value: Call(
|
||||||
StmtExpr {
|
ExprCall {
|
||||||
value: Attributed {
|
|
||||||
range: 0..20,
|
range: 0..20,
|
||||||
custom: (),
|
func: Name(
|
||||||
node: Call(
|
ExprName {
|
||||||
ExprCall {
|
range: 0..5,
|
||||||
func: Attributed {
|
id: Identifier(
|
||||||
range: 0..5,
|
"print",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"print",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 6..19,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"Hello world",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
args: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 6..19,
|
||||||
|
value: Str(
|
||||||
|
"Hello world",
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
keywords: [],
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,18 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..13,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..13,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..13,
|
range: 0..13,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"Hello world",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"Hello world",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,85 +3,64 @@ source: parser/src/parser.rs
|
||||||
expression: "parse_program(source, \"<test>\").unwrap()"
|
expression: "parse_program(source, \"<test>\").unwrap()"
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..11,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..11,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Tuple(
|
||||||
targets: [
|
ExprTuple {
|
||||||
Attributed {
|
|
||||||
range: 0..4,
|
range: 0..4,
|
||||||
custom: (),
|
elts: [
|
||||||
node: Tuple(
|
Name(
|
||||||
ExprTuple {
|
ExprName {
|
||||||
elts: [
|
range: 0..1,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 0..1,
|
"a",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Store,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"a",
|
Name(
|
||||||
),
|
ExprName {
|
||||||
ctx: Store,
|
range: 3..4,
|
||||||
},
|
id: Identifier(
|
||||||
),
|
"b",
|
||||||
},
|
),
|
||||||
Attributed {
|
ctx: Store,
|
||||||
range: 3..4,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
],
|
||||||
ExprName {
|
ctx: Store,
|
||||||
id: Identifier(
|
},
|
||||||
"b",
|
),
|
||||||
),
|
],
|
||||||
ctx: Store,
|
value: Tuple(
|
||||||
},
|
ExprTuple {
|
||||||
),
|
range: 7..11,
|
||||||
},
|
elts: [
|
||||||
],
|
Constant(
|
||||||
ctx: Store,
|
ExprConstant {
|
||||||
|
range: 7..8,
|
||||||
|
value: Int(
|
||||||
|
4,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
Constant(
|
||||||
],
|
ExprConstant {
|
||||||
value: Attributed {
|
range: 10..11,
|
||||||
range: 7..11,
|
value: Int(
|
||||||
custom: (),
|
5,
|
||||||
node: Tuple(
|
),
|
||||||
ExprTuple {
|
kind: None,
|
||||||
elts: [
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 7..8,
|
],
|
||||||
custom: (),
|
ctx: Load,
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
4,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 10..11,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
5,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,74 +2,56 @@
|
||||||
source: parser/src/parser.rs
|
source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
Attributed {
|
Subscript(
|
||||||
range: 0..8,
|
ExprSubscript {
|
||||||
custom: (),
|
range: 0..8,
|
||||||
node: Subscript(
|
value: Name(
|
||||||
ExprSubscript {
|
ExprName {
|
||||||
value: Attributed {
|
|
||||||
range: 0..1,
|
range: 0..1,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"x",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"x",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
slice: Attributed {
|
),
|
||||||
|
slice: Slice(
|
||||||
|
ExprSlice {
|
||||||
range: 2..7,
|
range: 2..7,
|
||||||
custom: (),
|
lower: Some(
|
||||||
node: Slice(
|
Constant(
|
||||||
ExprSlice {
|
ExprConstant {
|
||||||
lower: Some(
|
range: 2..3,
|
||||||
Attributed {
|
value: Int(
|
||||||
range: 2..3,
|
1,
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Int(
|
),
|
||||||
1,
|
),
|
||||||
),
|
upper: Some(
|
||||||
kind: None,
|
Constant(
|
||||||
},
|
ExprConstant {
|
||||||
),
|
range: 4..5,
|
||||||
},
|
value: Int(
|
||||||
),
|
2,
|
||||||
upper: Some(
|
),
|
||||||
Attributed {
|
kind: None,
|
||||||
range: 4..5,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
),
|
||||||
ExprConstant {
|
step: Some(
|
||||||
value: Int(
|
Constant(
|
||||||
2,
|
ExprConstant {
|
||||||
),
|
range: 6..7,
|
||||||
kind: None,
|
value: Int(
|
||||||
},
|
3,
|
||||||
),
|
),
|
||||||
},
|
kind: None,
|
||||||
),
|
},
|
||||||
step: Some(
|
),
|
||||||
Attributed {
|
|
||||||
range: 6..7,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
ctx: Load,
|
),
|
||||||
},
|
ctx: Load,
|
||||||
),
|
},
|
||||||
}
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,402 +3,291 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Assign(
|
||||||
range: 0..36,
|
StmtAssign {
|
||||||
custom: (),
|
range: 0..36,
|
||||||
node: Assign(
|
targets: [
|
||||||
StmtAssign {
|
Name(
|
||||||
targets: [
|
ExprName {
|
||||||
Attributed {
|
|
||||||
range: 0..11,
|
range: 0..11,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"array_slice",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"array_slice",
|
|
||||||
),
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Store,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
value: Attributed {
|
],
|
||||||
|
value: Subscript(
|
||||||
|
ExprSubscript {
|
||||||
range: 14..36,
|
range: 14..36,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Subscript(
|
|
||||||
ExprSubscript {
|
|
||||||
value: Attributed {
|
|
||||||
range: 14..19,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"array",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
slice: Attributed {
|
|
||||||
range: 20..35,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 20..21,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 23..31,
|
|
||||||
custom: (),
|
|
||||||
node: Starred(
|
|
||||||
ExprStarred {
|
|
||||||
value: Attributed {
|
|
||||||
range: 24..31,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"indexes",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 33..35,
|
|
||||||
custom: (),
|
|
||||||
node: UnaryOp(
|
|
||||||
ExprUnaryOp {
|
|
||||||
op: USub,
|
|
||||||
operand: Attributed {
|
|
||||||
range: 34..35,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 37..73,
|
|
||||||
custom: (),
|
|
||||||
node: Assign(
|
|
||||||
StmtAssign {
|
|
||||||
targets: [
|
|
||||||
Attributed {
|
|
||||||
range: 37..59,
|
|
||||||
custom: (),
|
|
||||||
node: Subscript(
|
|
||||||
ExprSubscript {
|
|
||||||
value: Attributed {
|
|
||||||
range: 37..42,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"array",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
slice: Attributed {
|
|
||||||
range: 43..58,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 43..44,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 46..54,
|
|
||||||
custom: (),
|
|
||||||
node: Starred(
|
|
||||||
ExprStarred {
|
|
||||||
value: Attributed {
|
|
||||||
range: 47..54,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"indexes",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 56..58,
|
|
||||||
custom: (),
|
|
||||||
node: UnaryOp(
|
|
||||||
ExprUnaryOp {
|
|
||||||
op: USub,
|
|
||||||
operand: Attributed {
|
|
||||||
range: 57..58,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Store,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
value: Attributed {
|
|
||||||
range: 62..73,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
ExprName {
|
||||||
|
range: 14..19,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"array_slice",
|
"array",
|
||||||
),
|
),
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
slice: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 20..35,
|
||||||
|
elts: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 20..21,
|
||||||
|
value: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Starred(
|
||||||
|
ExprStarred {
|
||||||
|
range: 23..31,
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 24..31,
|
||||||
|
id: Identifier(
|
||||||
|
"indexes",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
UnaryOp(
|
||||||
|
ExprUnaryOp {
|
||||||
|
range: 33..35,
|
||||||
|
op: USub,
|
||||||
|
operand: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 34..35,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
type_comment: None,
|
),
|
||||||
},
|
type_comment: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
Attributed {
|
Assign(
|
||||||
range: 74..119,
|
StmtAssign {
|
||||||
custom: (),
|
range: 37..73,
|
||||||
node: Expr(
|
targets: [
|
||||||
StmtExpr {
|
Subscript(
|
||||||
value: Attributed {
|
ExprSubscript {
|
||||||
|
range: 37..59,
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 37..42,
|
||||||
|
id: Identifier(
|
||||||
|
"array",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
slice: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 43..58,
|
||||||
|
elts: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 43..44,
|
||||||
|
value: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Starred(
|
||||||
|
ExprStarred {
|
||||||
|
range: 46..54,
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 47..54,
|
||||||
|
id: Identifier(
|
||||||
|
"indexes",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
UnaryOp(
|
||||||
|
ExprUnaryOp {
|
||||||
|
range: 56..58,
|
||||||
|
op: USub,
|
||||||
|
operand: Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 57..58,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Store,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 62..73,
|
||||||
|
id: Identifier(
|
||||||
|
"array_slice",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Expr(
|
||||||
|
StmtExpr {
|
||||||
|
range: 74..119,
|
||||||
|
value: Subscript(
|
||||||
|
ExprSubscript {
|
||||||
range: 74..119,
|
range: 74..119,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Subscript(
|
ExprName {
|
||||||
ExprSubscript {
|
range: 74..79,
|
||||||
value: Attributed {
|
id: Identifier(
|
||||||
range: 74..79,
|
"array",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"array",
|
slice: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 80..118,
|
||||||
|
elts: [
|
||||||
|
Starred(
|
||||||
|
ExprStarred {
|
||||||
|
range: 80..98,
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 81..98,
|
||||||
|
id: Identifier(
|
||||||
|
"indexes_to_select",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
Starred(
|
||||||
slice: Attributed {
|
ExprStarred {
|
||||||
range: 80..118,
|
range: 100..118,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Tuple(
|
ExprName {
|
||||||
ExprTuple {
|
range: 101..118,
|
||||||
elts: [
|
id: Identifier(
|
||||||
Attributed {
|
"indexes_to_select",
|
||||||
range: 80..98,
|
|
||||||
custom: (),
|
|
||||||
node: Starred(
|
|
||||||
ExprStarred {
|
|
||||||
value: Attributed {
|
|
||||||
range: 81..98,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"indexes_to_select",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 100..118,
|
|
||||||
custom: (),
|
|
||||||
node: Starred(
|
|
||||||
ExprStarred {
|
|
||||||
value: Attributed {
|
|
||||||
range: 101..118,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"indexes_to_select",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
],
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
Attributed {
|
Expr(
|
||||||
range: 120..150,
|
StmtExpr {
|
||||||
custom: (),
|
range: 120..150,
|
||||||
node: Expr(
|
value: Subscript(
|
||||||
StmtExpr {
|
ExprSubscript {
|
||||||
value: Attributed {
|
|
||||||
range: 120..150,
|
range: 120..150,
|
||||||
custom: (),
|
value: Name(
|
||||||
node: Subscript(
|
ExprName {
|
||||||
ExprSubscript {
|
range: 120..125,
|
||||||
value: Attributed {
|
id: Identifier(
|
||||||
range: 120..125,
|
"array",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"array",
|
slice: Tuple(
|
||||||
|
ExprTuple {
|
||||||
|
range: 126..149,
|
||||||
|
elts: [
|
||||||
|
Slice(
|
||||||
|
ExprSlice {
|
||||||
|
range: 126..129,
|
||||||
|
lower: Some(
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 126..127,
|
||||||
|
value: Int(
|
||||||
|
3,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
upper: Some(
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 128..129,
|
||||||
|
value: Int(
|
||||||
|
5,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
step: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Starred(
|
||||||
|
ExprStarred {
|
||||||
|
range: 131..149,
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 132..149,
|
||||||
|
id: Identifier(
|
||||||
|
"indexes_to_select",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
],
|
||||||
slice: Attributed {
|
|
||||||
range: 126..149,
|
|
||||||
custom: (),
|
|
||||||
node: Tuple(
|
|
||||||
ExprTuple {
|
|
||||||
elts: [
|
|
||||||
Attributed {
|
|
||||||
range: 126..129,
|
|
||||||
custom: (),
|
|
||||||
node: Slice(
|
|
||||||
ExprSlice {
|
|
||||||
lower: Some(
|
|
||||||
Attributed {
|
|
||||||
range: 126..127,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
upper: Some(
|
|
||||||
Attributed {
|
|
||||||
range: 128..129,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
5,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
step: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 131..149,
|
|
||||||
custom: (),
|
|
||||||
node: Starred(
|
|
||||||
ExprStarred {
|
|
||||||
value: Attributed {
|
|
||||||
range: 132..149,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"indexes_to_select",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,322 +3,241 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Try(
|
||||||
range: 0..134,
|
StmtTry {
|
||||||
custom: (),
|
range: 0..134,
|
||||||
node: Try(
|
body: [
|
||||||
StmtTry {
|
Raise(
|
||||||
body: [
|
StmtRaise {
|
||||||
Attributed {
|
|
||||||
range: 9..28,
|
range: 9..28,
|
||||||
custom: (),
|
exc: Some(
|
||||||
node: Raise(
|
Call(
|
||||||
StmtRaise {
|
ExprCall {
|
||||||
exc: Some(
|
range: 15..28,
|
||||||
Attributed {
|
func: Name(
|
||||||
range: 15..28,
|
ExprName {
|
||||||
custom: (),
|
range: 15..25,
|
||||||
node: Call(
|
id: Identifier(
|
||||||
ExprCall {
|
"ValueError",
|
||||||
func: Attributed {
|
),
|
||||||
range: 15..25,
|
ctx: Load,
|
||||||
custom: (),
|
},
|
||||||
node: Name(
|
),
|
||||||
ExprName {
|
args: [
|
||||||
id: Identifier(
|
Constant(
|
||||||
"ValueError",
|
ExprConstant {
|
||||||
),
|
range: 26..27,
|
||||||
ctx: Load,
|
value: Int(
|
||||||
},
|
1,
|
||||||
),
|
),
|
||||||
},
|
kind: None,
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 26..27,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
],
|
||||||
),
|
keywords: [],
|
||||||
cause: None,
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
|
cause: None,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
handlers: [
|
],
|
||||||
Attributed {
|
handlers: [
|
||||||
|
ExceptHandler(
|
||||||
|
ExcepthandlerExceptHandler {
|
||||||
range: 29..82,
|
range: 29..82,
|
||||||
custom: (),
|
type_: Some(
|
||||||
node: ExceptHandler(
|
Name(
|
||||||
ExcepthandlerExceptHandler {
|
ExprName {
|
||||||
type_: Some(
|
range: 36..45,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 36..45,
|
"TypeError",
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"TypeError",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
name: Some(
|
|
||||||
Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
),
|
||||||
),
|
ctx: Load,
|
||||||
body: [
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 56..82,
|
),
|
||||||
custom: (),
|
name: Some(
|
||||||
node: Expr(
|
Identifier(
|
||||||
StmtExpr {
|
"e",
|
||||||
value: Attributed {
|
),
|
||||||
range: 56..82,
|
),
|
||||||
custom: (),
|
body: [
|
||||||
node: Call(
|
Expr(
|
||||||
ExprCall {
|
StmtExpr {
|
||||||
func: Attributed {
|
range: 56..82,
|
||||||
range: 56..61,
|
value: Call(
|
||||||
custom: (),
|
ExprCall {
|
||||||
node: Name(
|
range: 56..82,
|
||||||
ExprName {
|
func: Name(
|
||||||
id: Identifier(
|
ExprName {
|
||||||
"print",
|
range: 56..61,
|
||||||
),
|
id: Identifier(
|
||||||
ctx: Load,
|
"print",
|
||||||
},
|
),
|
||||||
),
|
ctx: Load,
|
||||||
},
|
},
|
||||||
args: [
|
),
|
||||||
Attributed {
|
args: [
|
||||||
|
JoinedStr(
|
||||||
|
ExprJoinedStr {
|
||||||
|
range: 62..81,
|
||||||
|
values: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 62..81,
|
range: 62..81,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: JoinedStr(
|
"caught ",
|
||||||
ExprJoinedStr {
|
),
|
||||||
values: [
|
kind: None,
|
||||||
Attributed {
|
},
|
||||||
range: 62..81,
|
),
|
||||||
custom: (),
|
FormattedValue(
|
||||||
node: Constant(
|
ExprFormattedValue {
|
||||||
ExprConstant {
|
range: 62..81,
|
||||||
value: Str(
|
value: Call(
|
||||||
"caught ",
|
ExprCall {
|
||||||
),
|
range: 72..79,
|
||||||
kind: None,
|
func: Name(
|
||||||
},
|
ExprName {
|
||||||
),
|
range: 72..76,
|
||||||
},
|
id: Identifier(
|
||||||
Attributed {
|
"type",
|
||||||
range: 62..81,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 72..79,
|
|
||||||
custom: (),
|
|
||||||
node: Call(
|
|
||||||
ExprCall {
|
|
||||||
func: Attributed {
|
|
||||||
range: 72..76,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"type",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 77..78,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
args: [
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
|
range: 77..78,
|
||||||
|
id: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
|
keywords: [],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
conversion: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
format_spec: None,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
keywords: [],
|
],
|
||||||
},
|
},
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 83..134,
|
|
||||||
custom: (),
|
|
||||||
node: ExceptHandler(
|
|
||||||
ExcepthandlerExceptHandler {
|
|
||||||
type_: Some(
|
|
||||||
Attributed {
|
|
||||||
range: 90..97,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"OSError",
|
|
||||||
),
|
),
|
||||||
ctx: Load,
|
],
|
||||||
},
|
keywords: [],
|
||||||
),
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
name: Some(
|
|
||||||
Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
),
|
||||||
),
|
},
|
||||||
body: [
|
),
|
||||||
Attributed {
|
],
|
||||||
range: 108..134,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Expr(
|
ExceptHandler(
|
||||||
StmtExpr {
|
ExcepthandlerExceptHandler {
|
||||||
value: Attributed {
|
range: 83..134,
|
||||||
range: 108..134,
|
type_: Some(
|
||||||
custom: (),
|
Name(
|
||||||
node: Call(
|
ExprName {
|
||||||
ExprCall {
|
range: 90..97,
|
||||||
func: Attributed {
|
id: Identifier(
|
||||||
range: 108..113,
|
"OSError",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"print",
|
),
|
||||||
),
|
name: Some(
|
||||||
ctx: Load,
|
Identifier(
|
||||||
},
|
"e",
|
||||||
),
|
),
|
||||||
},
|
),
|
||||||
args: [
|
body: [
|
||||||
Attributed {
|
Expr(
|
||||||
|
StmtExpr {
|
||||||
|
range: 108..134,
|
||||||
|
value: Call(
|
||||||
|
ExprCall {
|
||||||
|
range: 108..134,
|
||||||
|
func: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 108..113,
|
||||||
|
id: Identifier(
|
||||||
|
"print",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
args: [
|
||||||
|
JoinedStr(
|
||||||
|
ExprJoinedStr {
|
||||||
|
range: 114..133,
|
||||||
|
values: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 114..133,
|
range: 114..133,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: JoinedStr(
|
"caught ",
|
||||||
ExprJoinedStr {
|
),
|
||||||
values: [
|
kind: None,
|
||||||
Attributed {
|
},
|
||||||
range: 114..133,
|
),
|
||||||
custom: (),
|
FormattedValue(
|
||||||
node: Constant(
|
ExprFormattedValue {
|
||||||
ExprConstant {
|
range: 114..133,
|
||||||
value: Str(
|
value: Call(
|
||||||
"caught ",
|
ExprCall {
|
||||||
),
|
range: 124..131,
|
||||||
kind: None,
|
func: Name(
|
||||||
},
|
ExprName {
|
||||||
),
|
range: 124..128,
|
||||||
},
|
id: Identifier(
|
||||||
Attributed {
|
"type",
|
||||||
range: 114..133,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 124..131,
|
|
||||||
custom: (),
|
|
||||||
node: Call(
|
|
||||||
ExprCall {
|
|
||||||
func: Attributed {
|
|
||||||
range: 124..128,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"type",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 129..130,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
args: [
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
|
range: 129..130,
|
||||||
|
id: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
|
keywords: [],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
conversion: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
format_spec: None,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
keywords: [],
|
],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
],
|
||||||
},
|
keywords: [],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
],
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
orelse: [],
|
],
|
||||||
finalbody: [],
|
orelse: [],
|
||||||
},
|
finalbody: [],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,569 +3,425 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
TryStar(
|
||||||
range: 0..260,
|
StmtTryStar {
|
||||||
custom: (),
|
range: 0..260,
|
||||||
node: TryStar(
|
body: [
|
||||||
StmtTryStar {
|
Raise(
|
||||||
body: [
|
StmtRaise {
|
||||||
Attributed {
|
|
||||||
range: 9..98,
|
range: 9..98,
|
||||||
custom: (),
|
exc: Some(
|
||||||
node: Raise(
|
Call(
|
||||||
StmtRaise {
|
ExprCall {
|
||||||
exc: Some(
|
range: 15..98,
|
||||||
Attributed {
|
func: Name(
|
||||||
range: 15..98,
|
ExprName {
|
||||||
custom: (),
|
range: 15..29,
|
||||||
node: Call(
|
id: Identifier(
|
||||||
ExprCall {
|
"ExceptionGroup",
|
||||||
func: Attributed {
|
),
|
||||||
range: 15..29,
|
ctx: Load,
|
||||||
custom: (),
|
},
|
||||||
node: Name(
|
),
|
||||||
ExprName {
|
args: [
|
||||||
id: Identifier(
|
Constant(
|
||||||
"ExceptionGroup",
|
ExprConstant {
|
||||||
|
range: 30..34,
|
||||||
|
value: Str(
|
||||||
|
"eg",
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
List(
|
||||||
|
ExprList {
|
||||||
|
range: 44..97,
|
||||||
|
elts: [
|
||||||
|
Call(
|
||||||
|
ExprCall {
|
||||||
|
range: 45..58,
|
||||||
|
func: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 45..55,
|
||||||
|
id: Identifier(
|
||||||
|
"ValueError",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
ctx: Load,
|
args: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 56..57,
|
||||||
|
value: Int(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
keywords: [],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
Call(
|
||||||
args: [
|
ExprCall {
|
||||||
Attributed {
|
range: 60..72,
|
||||||
range: 30..34,
|
func: Name(
|
||||||
custom: (),
|
ExprName {
|
||||||
node: Constant(
|
range: 60..69,
|
||||||
ExprConstant {
|
id: Identifier(
|
||||||
value: Str(
|
"TypeError",
|
||||||
"eg",
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
args: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
|
range: 70..71,
|
||||||
|
value: Int(
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
kind: None,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
kind: None,
|
],
|
||||||
},
|
keywords: [],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
Attributed {
|
Call(
|
||||||
range: 44..97,
|
ExprCall {
|
||||||
custom: (),
|
range: 74..84,
|
||||||
node: List(
|
func: Name(
|
||||||
ExprList {
|
ExprName {
|
||||||
elts: [
|
range: 74..81,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 45..58,
|
"OSError",
|
||||||
custom: (),
|
),
|
||||||
node: Call(
|
ctx: Load,
|
||||||
ExprCall {
|
},
|
||||||
func: Attributed {
|
),
|
||||||
range: 45..55,
|
args: [
|
||||||
custom: (),
|
Constant(
|
||||||
node: Name(
|
ExprConstant {
|
||||||
ExprName {
|
range: 82..83,
|
||||||
id: Identifier(
|
value: Int(
|
||||||
"ValueError",
|
3,
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 56..57,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 60..72,
|
],
|
||||||
custom: (),
|
keywords: [],
|
||||||
node: Call(
|
},
|
||||||
ExprCall {
|
),
|
||||||
func: Attributed {
|
Call(
|
||||||
range: 60..69,
|
ExprCall {
|
||||||
custom: (),
|
range: 86..96,
|
||||||
node: Name(
|
func: Name(
|
||||||
ExprName {
|
ExprName {
|
||||||
id: Identifier(
|
range: 86..93,
|
||||||
"TypeError",
|
id: Identifier(
|
||||||
),
|
"OSError",
|
||||||
ctx: Load,
|
),
|
||||||
},
|
ctx: Load,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
args: [
|
args: [
|
||||||
Attributed {
|
Constant(
|
||||||
range: 70..71,
|
ExprConstant {
|
||||||
custom: (),
|
range: 94..95,
|
||||||
node: Constant(
|
value: Int(
|
||||||
ExprConstant {
|
4,
|
||||||
value: Int(
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 74..84,
|
],
|
||||||
custom: (),
|
keywords: [],
|
||||||
node: Call(
|
},
|
||||||
ExprCall {
|
),
|
||||||
func: Attributed {
|
|
||||||
range: 74..81,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"OSError",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 82..83,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 86..96,
|
|
||||||
custom: (),
|
|
||||||
node: Call(
|
|
||||||
ExprCall {
|
|
||||||
func: Attributed {
|
|
||||||
range: 86..93,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"OSError",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 94..95,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Int(
|
|
||||||
4,
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
keywords: [],
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
],
|
||||||
),
|
keywords: [],
|
||||||
cause: None,
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
|
cause: None,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
handlers: [
|
],
|
||||||
Attributed {
|
handlers: [
|
||||||
|
ExceptHandler(
|
||||||
|
ExcepthandlerExceptHandler {
|
||||||
range: 99..180,
|
range: 99..180,
|
||||||
custom: (),
|
type_: Some(
|
||||||
node: ExceptHandler(
|
Name(
|
||||||
ExcepthandlerExceptHandler {
|
ExprName {
|
||||||
type_: Some(
|
range: 107..116,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 107..116,
|
"TypeError",
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"TypeError",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
name: Some(
|
|
||||||
Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
),
|
||||||
),
|
ctx: Load,
|
||||||
body: [
|
},
|
||||||
Attributed {
|
),
|
||||||
range: 127..180,
|
),
|
||||||
custom: (),
|
name: Some(
|
||||||
node: Expr(
|
Identifier(
|
||||||
StmtExpr {
|
"e",
|
||||||
value: Attributed {
|
),
|
||||||
range: 127..180,
|
),
|
||||||
custom: (),
|
body: [
|
||||||
node: Call(
|
Expr(
|
||||||
ExprCall {
|
StmtExpr {
|
||||||
func: Attributed {
|
range: 127..180,
|
||||||
range: 127..132,
|
value: Call(
|
||||||
custom: (),
|
ExprCall {
|
||||||
node: Name(
|
range: 127..180,
|
||||||
ExprName {
|
func: Name(
|
||||||
id: Identifier(
|
ExprName {
|
||||||
"print",
|
range: 127..132,
|
||||||
),
|
id: Identifier(
|
||||||
ctx: Load,
|
"print",
|
||||||
},
|
),
|
||||||
),
|
ctx: Load,
|
||||||
},
|
},
|
||||||
args: [
|
),
|
||||||
Attributed {
|
args: [
|
||||||
|
JoinedStr(
|
||||||
|
ExprJoinedStr {
|
||||||
|
range: 133..179,
|
||||||
|
values: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 133..179,
|
range: 133..179,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: JoinedStr(
|
"caught ",
|
||||||
ExprJoinedStr {
|
),
|
||||||
values: [
|
kind: None,
|
||||||
Attributed {
|
},
|
||||||
range: 133..179,
|
),
|
||||||
custom: (),
|
FormattedValue(
|
||||||
node: Constant(
|
ExprFormattedValue {
|
||||||
ExprConstant {
|
range: 133..179,
|
||||||
value: Str(
|
value: Call(
|
||||||
"caught ",
|
ExprCall {
|
||||||
),
|
range: 143..150,
|
||||||
kind: None,
|
func: Name(
|
||||||
},
|
ExprName {
|
||||||
),
|
range: 143..147,
|
||||||
},
|
id: Identifier(
|
||||||
Attributed {
|
"type",
|
||||||
range: 133..179,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 143..150,
|
|
||||||
custom: (),
|
|
||||||
node: Call(
|
|
||||||
ExprCall {
|
|
||||||
func: Attributed {
|
|
||||||
range: 143..147,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"type",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 148..149,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 133..179,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
" with nested ",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 133..179,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 165..177,
|
|
||||||
custom: (),
|
|
||||||
node: Attribute(
|
|
||||||
ExprAttribute {
|
|
||||||
value: Attributed {
|
|
||||||
range: 165..166,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
attr: Identifier(
|
|
||||||
"exceptions",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
args: [
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
|
range: 148..149,
|
||||||
|
id: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
|
keywords: [],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
conversion: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
format_spec: None,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
keywords: [],
|
Constant(
|
||||||
},
|
ExprConstant {
|
||||||
),
|
range: 133..179,
|
||||||
},
|
value: Str(
|
||||||
},
|
" with nested ",
|
||||||
),
|
),
|
||||||
},
|
kind: None,
|
||||||
],
|
},
|
||||||
},
|
),
|
||||||
),
|
FormattedValue(
|
||||||
},
|
ExprFormattedValue {
|
||||||
Attributed {
|
range: 133..179,
|
||||||
range: 181..260,
|
value: Attribute(
|
||||||
custom: (),
|
ExprAttribute {
|
||||||
node: ExceptHandler(
|
range: 165..177,
|
||||||
ExcepthandlerExceptHandler {
|
value: Name(
|
||||||
type_: Some(
|
ExprName {
|
||||||
Attributed {
|
range: 165..166,
|
||||||
range: 189..196,
|
id: Identifier(
|
||||||
custom: (),
|
"e",
|
||||||
node: Name(
|
),
|
||||||
ExprName {
|
ctx: Load,
|
||||||
id: Identifier(
|
},
|
||||||
"OSError",
|
),
|
||||||
|
attr: Identifier(
|
||||||
|
"exceptions",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
conversion: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
format_spec: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
),
|
),
|
||||||
ctx: Load,
|
],
|
||||||
},
|
keywords: [],
|
||||||
),
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
name: Some(
|
|
||||||
Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
),
|
||||||
),
|
},
|
||||||
body: [
|
),
|
||||||
Attributed {
|
],
|
||||||
range: 207..260,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Expr(
|
ExceptHandler(
|
||||||
StmtExpr {
|
ExcepthandlerExceptHandler {
|
||||||
value: Attributed {
|
range: 181..260,
|
||||||
range: 207..260,
|
type_: Some(
|
||||||
custom: (),
|
Name(
|
||||||
node: Call(
|
ExprName {
|
||||||
ExprCall {
|
range: 189..196,
|
||||||
func: Attributed {
|
id: Identifier(
|
||||||
range: 207..212,
|
"OSError",
|
||||||
custom: (),
|
),
|
||||||
node: Name(
|
ctx: Load,
|
||||||
ExprName {
|
},
|
||||||
id: Identifier(
|
),
|
||||||
"print",
|
),
|
||||||
),
|
name: Some(
|
||||||
ctx: Load,
|
Identifier(
|
||||||
},
|
"e",
|
||||||
),
|
),
|
||||||
},
|
),
|
||||||
args: [
|
body: [
|
||||||
Attributed {
|
Expr(
|
||||||
|
StmtExpr {
|
||||||
|
range: 207..260,
|
||||||
|
value: Call(
|
||||||
|
ExprCall {
|
||||||
|
range: 207..260,
|
||||||
|
func: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 207..212,
|
||||||
|
id: Identifier(
|
||||||
|
"print",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
args: [
|
||||||
|
JoinedStr(
|
||||||
|
ExprJoinedStr {
|
||||||
|
range: 213..259,
|
||||||
|
values: [
|
||||||
|
Constant(
|
||||||
|
ExprConstant {
|
||||||
range: 213..259,
|
range: 213..259,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: JoinedStr(
|
"caught ",
|
||||||
ExprJoinedStr {
|
),
|
||||||
values: [
|
kind: None,
|
||||||
Attributed {
|
},
|
||||||
range: 213..259,
|
),
|
||||||
custom: (),
|
FormattedValue(
|
||||||
node: Constant(
|
ExprFormattedValue {
|
||||||
ExprConstant {
|
range: 213..259,
|
||||||
value: Str(
|
value: Call(
|
||||||
"caught ",
|
ExprCall {
|
||||||
),
|
range: 223..230,
|
||||||
kind: None,
|
func: Name(
|
||||||
},
|
ExprName {
|
||||||
),
|
range: 223..227,
|
||||||
},
|
id: Identifier(
|
||||||
Attributed {
|
"type",
|
||||||
range: 213..259,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 223..230,
|
|
||||||
custom: (),
|
|
||||||
node: Call(
|
|
||||||
ExprCall {
|
|
||||||
func: Attributed {
|
|
||||||
range: 223..227,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"type",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
Attributed {
|
|
||||||
range: 228..229,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keywords: [],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 213..259,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
" with nested ",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 213..259,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 245..257,
|
|
||||||
custom: (),
|
|
||||||
node: Attribute(
|
|
||||||
ExprAttribute {
|
|
||||||
value: Attributed {
|
|
||||||
range: 245..246,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"e",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
attr: Identifier(
|
|
||||||
"exceptions",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
args: [
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
|
range: 228..229,
|
||||||
|
id: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
|
keywords: [],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
conversion: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
format_spec: None,
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
keywords: [],
|
Constant(
|
||||||
},
|
ExprConstant {
|
||||||
),
|
range: 213..259,
|
||||||
},
|
value: Str(
|
||||||
},
|
" with nested ",
|
||||||
),
|
),
|
||||||
},
|
kind: None,
|
||||||
],
|
},
|
||||||
},
|
),
|
||||||
),
|
FormattedValue(
|
||||||
|
ExprFormattedValue {
|
||||||
|
range: 213..259,
|
||||||
|
value: Attribute(
|
||||||
|
ExprAttribute {
|
||||||
|
range: 245..257,
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 245..246,
|
||||||
|
id: Identifier(
|
||||||
|
"e",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
attr: Identifier(
|
||||||
|
"exceptions",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
conversion: Int(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
format_spec: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
keywords: [],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
orelse: [],
|
],
|
||||||
finalbody: [],
|
orelse: [],
|
||||||
},
|
finalbody: [],
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,124 +3,95 @@ source: parser/src/parser.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
FunctionDef(
|
||||||
range: 1..49,
|
StmtFunctionDef {
|
||||||
custom: (),
|
range: 1..49,
|
||||||
node: FunctionDef(
|
name: Identifier(
|
||||||
StmtFunctionDef {
|
"args_to_tuple",
|
||||||
name: Identifier(
|
),
|
||||||
"args_to_tuple",
|
args: Arguments {
|
||||||
),
|
posonlyargs: [],
|
||||||
args: Arguments {
|
args: [],
|
||||||
posonlyargs: [],
|
vararg: Some(
|
||||||
args: [],
|
Arg {
|
||||||
vararg: Some(
|
arg: Identifier(
|
||||||
Attributed {
|
"args",
|
||||||
range: 20..29,
|
|
||||||
custom: (),
|
|
||||||
node: ArgData {
|
|
||||||
arg: Identifier(
|
|
||||||
"args",
|
|
||||||
),
|
|
||||||
annotation: Some(
|
|
||||||
Attributed {
|
|
||||||
range: 26..29,
|
|
||||||
custom: (),
|
|
||||||
node: Starred(
|
|
||||||
ExprStarred {
|
|
||||||
value: Attributed {
|
|
||||||
range: 27..29,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"Ts",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
type_comment: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
kwonlyargs: [],
|
|
||||||
kw_defaults: [],
|
|
||||||
kwarg: None,
|
|
||||||
defaults: [],
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
Attributed {
|
|
||||||
range: 46..49,
|
|
||||||
custom: (),
|
|
||||||
node: Expr(
|
|
||||||
StmtExpr {
|
|
||||||
value: Attributed {
|
|
||||||
range: 46..49,
|
|
||||||
custom: (),
|
|
||||||
node: Constant(
|
|
||||||
ExprConstant {
|
|
||||||
value: Ellipsis,
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
},
|
annotation: Some(
|
||||||
],
|
Starred(
|
||||||
decorator_list: [],
|
ExprStarred {
|
||||||
returns: Some(
|
range: 26..29,
|
||||||
Attributed {
|
value: Name(
|
||||||
range: 34..44,
|
|
||||||
custom: (),
|
|
||||||
node: Subscript(
|
|
||||||
ExprSubscript {
|
|
||||||
value: Attributed {
|
|
||||||
range: 34..39,
|
|
||||||
custom: (),
|
|
||||||
node: Name(
|
|
||||||
ExprName {
|
ExprName {
|
||||||
|
range: 27..29,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"Tuple",
|
"Ts",
|
||||||
),
|
),
|
||||||
ctx: Load,
|
ctx: Load,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
slice: Attributed {
|
),
|
||||||
range: 40..43,
|
),
|
||||||
custom: (),
|
type_comment: None,
|
||||||
node: Starred(
|
range: 20..29,
|
||||||
ExprStarred {
|
},
|
||||||
value: Attributed {
|
),
|
||||||
range: 41..43,
|
kwonlyargs: [],
|
||||||
custom: (),
|
kw_defaults: [],
|
||||||
node: Name(
|
kwarg: None,
|
||||||
ExprName {
|
defaults: [],
|
||||||
id: Identifier(
|
range: (),
|
||||||
"Ts",
|
},
|
||||||
),
|
body: [
|
||||||
ctx: Load,
|
Expr(
|
||||||
},
|
StmtExpr {
|
||||||
),
|
range: 46..49,
|
||||||
},
|
value: Constant(
|
||||||
ctx: Load,
|
ExprConstant {
|
||||||
},
|
range: 46..49,
|
||||||
),
|
value: Ellipsis,
|
||||||
},
|
kind: None,
|
||||||
ctx: Load,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
type_comment: None,
|
],
|
||||||
},
|
decorator_list: [],
|
||||||
),
|
returns: Some(
|
||||||
},
|
Subscript(
|
||||||
|
ExprSubscript {
|
||||||
|
range: 34..44,
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 34..39,
|
||||||
|
id: Identifier(
|
||||||
|
"Tuple",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
slice: Starred(
|
||||||
|
ExprStarred {
|
||||||
|
range: 40..43,
|
||||||
|
value: Name(
|
||||||
|
ExprName {
|
||||||
|
range: 41..43,
|
||||||
|
id: Identifier(
|
||||||
|
"Ts",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
type_comment: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,24 +3,18 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..15,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..15,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..15,
|
range: 0..15,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"\u{8}",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"\u{8}",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,18 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..9,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..9,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..9,
|
range: 0..9,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"\u{7}",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"\u{7}",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,18 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..21,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..21,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..21,
|
range: 0..21,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"\r",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"\r",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,18 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..45,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..45,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..45,
|
range: 0..45,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"\u{89}",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"\u{89}",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,18 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..12,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..12,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..12,
|
range: 0..12,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"\u{7f}",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"\u{7f}",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,281 +3,275 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..738,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..738,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..738,
|
range: 0..738,
|
||||||
custom: (),
|
value: Bytes(
|
||||||
node: Constant(
|
[
|
||||||
ExprConstant {
|
0,
|
||||||
value: Bytes(
|
1,
|
||||||
[
|
2,
|
||||||
0,
|
3,
|
||||||
1,
|
4,
|
||||||
2,
|
5,
|
||||||
3,
|
6,
|
||||||
4,
|
7,
|
||||||
5,
|
8,
|
||||||
6,
|
9,
|
||||||
7,
|
10,
|
||||||
8,
|
11,
|
||||||
9,
|
12,
|
||||||
10,
|
13,
|
||||||
11,
|
14,
|
||||||
12,
|
15,
|
||||||
13,
|
16,
|
||||||
14,
|
17,
|
||||||
15,
|
18,
|
||||||
16,
|
19,
|
||||||
17,
|
20,
|
||||||
18,
|
21,
|
||||||
19,
|
22,
|
||||||
20,
|
23,
|
||||||
21,
|
24,
|
||||||
22,
|
25,
|
||||||
23,
|
26,
|
||||||
24,
|
27,
|
||||||
25,
|
28,
|
||||||
26,
|
29,
|
||||||
27,
|
30,
|
||||||
28,
|
31,
|
||||||
29,
|
32,
|
||||||
30,
|
33,
|
||||||
31,
|
34,
|
||||||
32,
|
35,
|
||||||
33,
|
36,
|
||||||
34,
|
37,
|
||||||
35,
|
38,
|
||||||
36,
|
39,
|
||||||
37,
|
40,
|
||||||
38,
|
41,
|
||||||
39,
|
42,
|
||||||
40,
|
43,
|
||||||
41,
|
44,
|
||||||
42,
|
45,
|
||||||
43,
|
46,
|
||||||
44,
|
47,
|
||||||
45,
|
48,
|
||||||
46,
|
49,
|
||||||
47,
|
50,
|
||||||
48,
|
51,
|
||||||
49,
|
52,
|
||||||
50,
|
53,
|
||||||
51,
|
54,
|
||||||
52,
|
55,
|
||||||
53,
|
56,
|
||||||
54,
|
57,
|
||||||
55,
|
58,
|
||||||
56,
|
59,
|
||||||
57,
|
60,
|
||||||
58,
|
61,
|
||||||
59,
|
62,
|
||||||
60,
|
63,
|
||||||
61,
|
64,
|
||||||
62,
|
65,
|
||||||
63,
|
66,
|
||||||
64,
|
67,
|
||||||
65,
|
68,
|
||||||
66,
|
69,
|
||||||
67,
|
70,
|
||||||
68,
|
71,
|
||||||
69,
|
72,
|
||||||
70,
|
73,
|
||||||
71,
|
74,
|
||||||
72,
|
75,
|
||||||
73,
|
76,
|
||||||
74,
|
77,
|
||||||
75,
|
78,
|
||||||
76,
|
79,
|
||||||
77,
|
80,
|
||||||
78,
|
81,
|
||||||
79,
|
82,
|
||||||
80,
|
83,
|
||||||
81,
|
84,
|
||||||
82,
|
85,
|
||||||
83,
|
86,
|
||||||
84,
|
87,
|
||||||
85,
|
88,
|
||||||
86,
|
89,
|
||||||
87,
|
90,
|
||||||
88,
|
91,
|
||||||
89,
|
92,
|
||||||
90,
|
93,
|
||||||
91,
|
94,
|
||||||
92,
|
95,
|
||||||
93,
|
96,
|
||||||
94,
|
97,
|
||||||
95,
|
98,
|
||||||
96,
|
99,
|
||||||
97,
|
100,
|
||||||
98,
|
101,
|
||||||
99,
|
102,
|
||||||
100,
|
103,
|
||||||
101,
|
104,
|
||||||
102,
|
105,
|
||||||
103,
|
106,
|
||||||
104,
|
107,
|
||||||
105,
|
108,
|
||||||
106,
|
109,
|
||||||
107,
|
110,
|
||||||
108,
|
111,
|
||||||
109,
|
112,
|
||||||
110,
|
113,
|
||||||
111,
|
114,
|
||||||
112,
|
115,
|
||||||
113,
|
116,
|
||||||
114,
|
117,
|
||||||
115,
|
118,
|
||||||
116,
|
119,
|
||||||
117,
|
120,
|
||||||
118,
|
121,
|
||||||
119,
|
122,
|
||||||
120,
|
123,
|
||||||
121,
|
124,
|
||||||
122,
|
125,
|
||||||
123,
|
126,
|
||||||
124,
|
127,
|
||||||
125,
|
128,
|
||||||
126,
|
129,
|
||||||
127,
|
130,
|
||||||
128,
|
131,
|
||||||
129,
|
132,
|
||||||
130,
|
133,
|
||||||
131,
|
134,
|
||||||
132,
|
135,
|
||||||
133,
|
136,
|
||||||
134,
|
137,
|
||||||
135,
|
138,
|
||||||
136,
|
139,
|
||||||
137,
|
140,
|
||||||
138,
|
141,
|
||||||
139,
|
142,
|
||||||
140,
|
143,
|
||||||
141,
|
144,
|
||||||
142,
|
145,
|
||||||
143,
|
146,
|
||||||
144,
|
147,
|
||||||
145,
|
148,
|
||||||
146,
|
149,
|
||||||
147,
|
150,
|
||||||
148,
|
151,
|
||||||
149,
|
152,
|
||||||
150,
|
153,
|
||||||
151,
|
154,
|
||||||
152,
|
155,
|
||||||
153,
|
156,
|
||||||
154,
|
157,
|
||||||
155,
|
158,
|
||||||
156,
|
159,
|
||||||
157,
|
160,
|
||||||
158,
|
161,
|
||||||
159,
|
162,
|
||||||
160,
|
163,
|
||||||
161,
|
164,
|
||||||
162,
|
165,
|
||||||
163,
|
166,
|
||||||
164,
|
167,
|
||||||
165,
|
168,
|
||||||
166,
|
169,
|
||||||
167,
|
170,
|
||||||
168,
|
171,
|
||||||
169,
|
172,
|
||||||
170,
|
173,
|
||||||
171,
|
174,
|
||||||
172,
|
175,
|
||||||
173,
|
176,
|
||||||
174,
|
177,
|
||||||
175,
|
178,
|
||||||
176,
|
179,
|
||||||
177,
|
180,
|
||||||
178,
|
181,
|
||||||
179,
|
182,
|
||||||
180,
|
183,
|
||||||
181,
|
184,
|
||||||
182,
|
185,
|
||||||
183,
|
186,
|
||||||
184,
|
187,
|
||||||
185,
|
188,
|
||||||
186,
|
189,
|
||||||
187,
|
190,
|
||||||
188,
|
191,
|
||||||
189,
|
192,
|
||||||
190,
|
193,
|
||||||
191,
|
194,
|
||||||
192,
|
195,
|
||||||
193,
|
196,
|
||||||
194,
|
197,
|
||||||
195,
|
198,
|
||||||
196,
|
199,
|
||||||
197,
|
200,
|
||||||
198,
|
201,
|
||||||
199,
|
202,
|
||||||
200,
|
203,
|
||||||
201,
|
204,
|
||||||
202,
|
205,
|
||||||
203,
|
206,
|
||||||
204,
|
207,
|
||||||
205,
|
208,
|
||||||
206,
|
209,
|
||||||
207,
|
210,
|
||||||
208,
|
211,
|
||||||
209,
|
212,
|
||||||
210,
|
213,
|
||||||
211,
|
214,
|
||||||
212,
|
215,
|
||||||
213,
|
216,
|
||||||
214,
|
217,
|
||||||
215,
|
218,
|
||||||
216,
|
219,
|
||||||
217,
|
220,
|
||||||
218,
|
221,
|
||||||
219,
|
222,
|
||||||
220,
|
223,
|
||||||
221,
|
224,
|
||||||
222,
|
225,
|
||||||
223,
|
226,
|
||||||
224,
|
227,
|
||||||
225,
|
228,
|
||||||
226,
|
229,
|
||||||
227,
|
230,
|
||||||
228,
|
231,
|
||||||
229,
|
232,
|
||||||
230,
|
233,
|
||||||
231,
|
234,
|
||||||
232,
|
235,
|
||||||
233,
|
236,
|
||||||
234,
|
237,
|
||||||
235,
|
238,
|
||||||
236,
|
239,
|
||||||
237,
|
240,
|
||||||
238,
|
241,
|
||||||
239,
|
242,
|
||||||
240,
|
243,
|
||||||
241,
|
244,
|
||||||
242,
|
245,
|
||||||
243,
|
246,
|
||||||
244,
|
247,
|
||||||
245,
|
248,
|
||||||
246,
|
249,
|
||||||
247,
|
250,
|
||||||
248,
|
251,
|
||||||
249,
|
252,
|
||||||
250,
|
253,
|
||||||
251,
|
254,
|
||||||
252,
|
255,
|
||||||
253,
|
],
|
||||||
254,
|
|
||||||
255,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,18 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..12,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..12,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..12,
|
range: 0..12,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"\u{1b}",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"\u{1b}",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,35 +3,29 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..13,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..13,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..13,
|
range: 0..13,
|
||||||
custom: (),
|
value: Bytes(
|
||||||
node: Constant(
|
[
|
||||||
ExprConstant {
|
111,
|
||||||
value: Bytes(
|
109,
|
||||||
[
|
107,
|
||||||
111,
|
109,
|
||||||
109,
|
111,
|
||||||
107,
|
107,
|
||||||
109,
|
92,
|
||||||
111,
|
88,
|
||||||
107,
|
97,
|
||||||
92,
|
97,
|
||||||
88,
|
],
|
||||||
97,
|
|
||||||
97,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,30 +3,24 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..14,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..14,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..14,
|
range: 0..14,
|
||||||
custom: (),
|
value: Bytes(
|
||||||
node: Constant(
|
[
|
||||||
ExprConstant {
|
35,
|
||||||
value: Bytes(
|
97,
|
||||||
[
|
4,
|
||||||
35,
|
83,
|
||||||
97,
|
52,
|
||||||
4,
|
],
|
||||||
83,
|
|
||||||
52,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,18 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..15,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..15,
|
||||||
node: Expr(
|
value: Constant(
|
||||||
StmtExpr {
|
ExprConstant {
|
||||||
value: Attributed {
|
|
||||||
range: 0..15,
|
range: 0..15,
|
||||||
custom: (),
|
value: Str(
|
||||||
node: Constant(
|
"\u{c}",
|
||||||
ExprConstant {
|
|
||||||
value: Str(
|
|
||||||
"\u{c}",
|
|
||||||
),
|
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
kind: None,
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,58 +3,43 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..8,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..8,
|
||||||
node: Expr(
|
value: JoinedStr(
|
||||||
StmtExpr {
|
ExprJoinedStr {
|
||||||
value: Attributed {
|
|
||||||
range: 0..8,
|
range: 0..8,
|
||||||
custom: (),
|
values: [
|
||||||
node: JoinedStr(
|
Constant(
|
||||||
ExprJoinedStr {
|
ExprConstant {
|
||||||
values: [
|
range: 0..8,
|
||||||
Attributed {
|
value: Str(
|
||||||
range: 0..8,
|
"\\",
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Str(
|
),
|
||||||
"\\",
|
FormattedValue(
|
||||||
),
|
ExprFormattedValue {
|
||||||
kind: None,
|
range: 0..8,
|
||||||
},
|
value: Name(
|
||||||
),
|
ExprName {
|
||||||
},
|
range: 5..6,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 0..8,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: FormattedValue(
|
ctx: Load,
|
||||||
ExprFormattedValue {
|
},
|
||||||
value: Attributed {
|
),
|
||||||
range: 5..6,
|
conversion: Int(
|
||||||
custom: (),
|
0,
|
||||||
node: Name(
|
),
|
||||||
ExprName {
|
format_spec: None,
|
||||||
id: Identifier(
|
},
|
||||||
"x",
|
),
|
||||||
),
|
],
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,58 +3,43 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..8,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..8,
|
||||||
node: Expr(
|
value: JoinedStr(
|
||||||
StmtExpr {
|
ExprJoinedStr {
|
||||||
value: Attributed {
|
|
||||||
range: 0..8,
|
range: 0..8,
|
||||||
custom: (),
|
values: [
|
||||||
node: JoinedStr(
|
Constant(
|
||||||
ExprJoinedStr {
|
ExprConstant {
|
||||||
values: [
|
range: 0..8,
|
||||||
Attributed {
|
value: Str(
|
||||||
range: 0..8,
|
"\n",
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Str(
|
),
|
||||||
"\n",
|
FormattedValue(
|
||||||
),
|
ExprFormattedValue {
|
||||||
kind: None,
|
range: 0..8,
|
||||||
},
|
value: Name(
|
||||||
),
|
ExprName {
|
||||||
},
|
range: 5..6,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 0..8,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: FormattedValue(
|
ctx: Load,
|
||||||
ExprFormattedValue {
|
},
|
||||||
value: Attributed {
|
),
|
||||||
range: 5..6,
|
conversion: Int(
|
||||||
custom: (),
|
0,
|
||||||
node: Name(
|
),
|
||||||
ExprName {
|
format_spec: None,
|
||||||
id: Identifier(
|
},
|
||||||
"x",
|
),
|
||||||
),
|
],
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,58 +3,43 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Expr(
|
||||||
range: 0..9,
|
StmtExpr {
|
||||||
custom: (),
|
range: 0..9,
|
||||||
node: Expr(
|
value: JoinedStr(
|
||||||
StmtExpr {
|
ExprJoinedStr {
|
||||||
value: Attributed {
|
|
||||||
range: 0..9,
|
range: 0..9,
|
||||||
custom: (),
|
values: [
|
||||||
node: JoinedStr(
|
Constant(
|
||||||
ExprJoinedStr {
|
ExprConstant {
|
||||||
values: [
|
range: 0..9,
|
||||||
Attributed {
|
value: Str(
|
||||||
range: 0..9,
|
"\\\n",
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Str(
|
),
|
||||||
"\\\n",
|
FormattedValue(
|
||||||
),
|
ExprFormattedValue {
|
||||||
kind: None,
|
range: 0..9,
|
||||||
},
|
value: Name(
|
||||||
),
|
ExprName {
|
||||||
},
|
range: 6..7,
|
||||||
Attributed {
|
id: Identifier(
|
||||||
range: 0..9,
|
"x",
|
||||||
custom: (),
|
),
|
||||||
node: FormattedValue(
|
ctx: Load,
|
||||||
ExprFormattedValue {
|
},
|
||||||
value: Attributed {
|
),
|
||||||
range: 6..7,
|
conversion: Int(
|
||||||
custom: (),
|
0,
|
||||||
node: Name(
|
),
|
||||||
ExprName {
|
format_spec: None,
|
||||||
id: Identifier(
|
},
|
||||||
"x",
|
),
|
||||||
),
|
],
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
conversion: Int(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
format_spec: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,52 +3,40 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Constant(
|
||||||
range: 0..10,
|
ExprConstant {
|
||||||
custom: (),
|
range: 0..10,
|
||||||
node: Constant(
|
value: Str(
|
||||||
ExprConstant {
|
"user=",
|
||||||
value: Str(
|
),
|
||||||
"user=",
|
kind: None,
|
||||||
),
|
},
|
||||||
kind: None,
|
),
|
||||||
},
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
},
|
range: 0..10,
|
||||||
Attributed {
|
value: Str(
|
||||||
range: 0..10,
|
"",
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Str(
|
),
|
||||||
"",
|
FormattedValue(
|
||||||
),
|
ExprFormattedValue {
|
||||||
kind: None,
|
range: 0..10,
|
||||||
},
|
value: Name(
|
||||||
),
|
ExprName {
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 0..10,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 3..7,
|
range: 3..7,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"user",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"user",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
conversion: Int(
|
),
|
||||||
114,
|
conversion: Int(
|
||||||
),
|
114,
|
||||||
format_spec: None,
|
),
|
||||||
},
|
format_spec: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -3,124 +3,94 @@ source: parser/src/string.rs
|
||||||
expression: parse_ast
|
expression: parse_ast
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
Attributed {
|
Constant(
|
||||||
range: 0..38,
|
ExprConstant {
|
||||||
custom: (),
|
range: 0..38,
|
||||||
node: Constant(
|
value: Str(
|
||||||
ExprConstant {
|
"mix ",
|
||||||
value: Str(
|
),
|
||||||
"mix ",
|
kind: None,
|
||||||
),
|
},
|
||||||
kind: None,
|
),
|
||||||
},
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
},
|
range: 0..38,
|
||||||
Attributed {
|
value: Str(
|
||||||
range: 0..38,
|
"user=",
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Str(
|
),
|
||||||
"user=",
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
kind: None,
|
range: 0..38,
|
||||||
},
|
value: Str(
|
||||||
),
|
"",
|
||||||
},
|
),
|
||||||
Attributed {
|
kind: None,
|
||||||
range: 0..38,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
FormattedValue(
|
||||||
ExprConstant {
|
ExprFormattedValue {
|
||||||
value: Str(
|
range: 0..38,
|
||||||
"",
|
value: Name(
|
||||||
),
|
ExprName {
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 0..38,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 7..11,
|
range: 7..11,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"user",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"user",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
conversion: Int(
|
),
|
||||||
114,
|
conversion: Int(
|
||||||
),
|
114,
|
||||||
format_spec: None,
|
),
|
||||||
},
|
format_spec: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
Attributed {
|
Constant(
|
||||||
range: 0..38,
|
ExprConstant {
|
||||||
custom: (),
|
range: 0..38,
|
||||||
node: Constant(
|
value: Str(
|
||||||
ExprConstant {
|
" with text and ",
|
||||||
value: Str(
|
),
|
||||||
" with text and ",
|
kind: None,
|
||||||
),
|
},
|
||||||
kind: None,
|
),
|
||||||
},
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
},
|
range: 0..38,
|
||||||
Attributed {
|
value: Str(
|
||||||
range: 0..38,
|
"second=",
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
kind: None,
|
||||||
ExprConstant {
|
},
|
||||||
value: Str(
|
),
|
||||||
"second=",
|
Constant(
|
||||||
),
|
ExprConstant {
|
||||||
kind: None,
|
range: 0..38,
|
||||||
},
|
value: Str(
|
||||||
),
|
"",
|
||||||
},
|
),
|
||||||
Attributed {
|
kind: None,
|
||||||
range: 0..38,
|
},
|
||||||
custom: (),
|
),
|
||||||
node: Constant(
|
FormattedValue(
|
||||||
ExprConstant {
|
ExprFormattedValue {
|
||||||
value: Str(
|
range: 0..38,
|
||||||
"",
|
value: Name(
|
||||||
),
|
ExprName {
|
||||||
kind: None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Attributed {
|
|
||||||
range: 0..38,
|
|
||||||
custom: (),
|
|
||||||
node: FormattedValue(
|
|
||||||
ExprFormattedValue {
|
|
||||||
value: Attributed {
|
|
||||||
range: 29..35,
|
range: 29..35,
|
||||||
custom: (),
|
id: Identifier(
|
||||||
node: Name(
|
"second",
|
||||||
ExprName {
|
|
||||||
id: Identifier(
|
|
||||||
"second",
|
|
||||||
),
|
|
||||||
ctx: Load,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
ctx: Load,
|
||||||
},
|
},
|
||||||
conversion: Int(
|
),
|
||||||
114,
|
conversion: Int(
|
||||||
),
|
114,
|
||||||
format_spec: None,
|
),
|
||||||
},
|
format_spec: None,
|
||||||
),
|
},
|
||||||
},
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue