Fix tests, rename feature

This commit is contained in:
Micha Reiser 2023-05-13 18:08:20 +02:00
parent bbfaf17b0b
commit 3277ec29af
No known key found for this signature in database
45 changed files with 277 additions and 229 deletions

View file

@ -14,7 +14,7 @@ location = ["fold", "rustpython-parser-core/location"]
fold = []
unparse = ["rustpython-literal"]
visitor = []
more-attributes = []
all-nodes-with-ranges = []
[dependencies]
rustpython-parser-core = { workspace = true }

View file

@ -280,10 +280,10 @@ class StructVisitor(EmitVisitor):
if has_attributes:
self.emit("pub range: R,", depth + 1)
else:
self.emit('#[cfg(feature = "more-attributes")]', depth + 1)
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', depth + 1)
self.emit("pub range: R,", depth + 1)
self.emit('#[cfg(not(feature = "more-attributes"))]', depth + 1)
self.emit("pub range: std::marker::PhantomData<R>,", depth + 1)
self.emit('#[cfg(not(feature = "all-nodes-with-ranges"))]', depth + 1)
self.emit("pub range: crate::EmptyRange<R>,", depth + 1)
def simple_sum(self, sum, name, depth):
rust_name = rust_type_name(name)
@ -404,13 +404,13 @@ class FoldTraitDefVisitor(EmitVisitor):
self.emit(
"""
fn map_user(&mut self, user: U) -> Result<Self::TargetU, Self::Error>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
fn map_user_cfg(&mut self, user: U) -> Result<Self::TargetU, Self::Error> {
self.map_user(user)
}
#[cfg(not(feature = "more-attributes"))]
fn map_user_cfg(&mut self, _user: std::marker::PhantomData<U>) -> Result<std::marker::PhantomData<Self::TargetU>, Self::Error> {
Ok(std::marker::PhantomData)
#[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,
@ -947,7 +947,7 @@ class RangedDefVisitor(EmitVisitor):
self.emit_ranged_impl(variant_info)
if not info.no_cfg(self.type_info):
self.emit('#[cfg(feature = "more-attributes")]', 0)
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', 0)
self.emit(f"""
impl Ranged for crate::{info.rust_sum_name} {{
@ -966,7 +966,7 @@ class RangedDefVisitor(EmitVisitor):
def emit_ranged_impl(self, info):
if not info.no_cfg(self.type_info):
self.emit('#[cfg(feature = "more-attributes")]', 0)
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', 0)
self.file.write(
f"""
@ -1004,7 +1004,7 @@ class LocatedDefVisitor(EmitVisitor):
self.emit_located_impl(variant_info)
if not info.no_cfg(self.type_info):
self.emit('#[cfg(feature = "more-attributes")]', 0)
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', 0)
self.emit(f"""
impl Located for {info.rust_sum_name} {{
@ -1030,7 +1030,7 @@ class LocatedDefVisitor(EmitVisitor):
def emit_located_impl(self, info):
if not info.no_cfg(self.type_info):
self.emit('#[cfg(feature = "more-attributes")]', 0)
self.emit('#[cfg(feature = "all-nodes-with-ranges")]', 0)
self.emit(
f"""

View file

@ -6,16 +6,16 @@ pub trait Fold<U> {
type Error;
fn map_user(&mut self, user: U) -> Result<Self::TargetU, Self::Error>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
fn map_user_cfg(&mut self, user: U) -> Result<Self::TargetU, Self::Error> {
self.map_user(user)
}
#[cfg(not(feature = "more-attributes"))]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn map_user_cfg(
&mut self,
_user: std::marker::PhantomData<U>,
) -> Result<std::marker::PhantomData<Self::TargetU>, Self::Error> {
Ok(std::marker::PhantomData)
_user: crate::EmptyRange<U>,
) -> Result<crate::EmptyRange<Self::TargetU>, Self::Error> {
Ok(crate::EmptyRange::default())
}
fn fold<X: Foldable<U, Self::TargetU>>(&mut self, node: X) -> Result<X::Mapped, Self::Error> {

View file

@ -5,10 +5,10 @@ use crate::text_size::TextRange;
pub struct ModModule<R = TextRange> {
pub body: Vec<Stmt<R>>,
pub type_ignores: Vec<TypeIgnore<R>>,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
impl<R> From<ModModule<R>> for Mod<R> {
@ -20,10 +20,10 @@ impl<R> From<ModModule<R>> for Mod<R> {
#[derive(Clone, Debug, PartialEq)]
pub struct ModInteractive<R = TextRange> {
pub body: Vec<Stmt<R>>,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
impl<R> From<ModInteractive<R>> for Mod<R> {
@ -35,10 +35,10 @@ impl<R> From<ModInteractive<R>> for Mod<R> {
#[derive(Clone, Debug, PartialEq)]
pub struct ModExpression<R = TextRange> {
pub body: Box<Expr<R>>,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
impl<R> From<ModExpression<R>> for Mod<R> {
@ -51,10 +51,10 @@ impl<R> From<ModExpression<R>> for Mod<R> {
pub struct ModFunctionType<R = TextRange> {
pub argtypes: Vec<Expr<R>>,
pub returns: Box<Expr<R>>,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
impl<R> From<ModFunctionType<R>> for Mod<R> {
@ -969,10 +969,10 @@ pub struct Comprehension<R = TextRange> {
pub iter: Expr<R>,
pub ifs: Vec<Expr<R>>,
pub is_async: bool,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
#[derive(Clone, Debug, PartialEq)]
@ -1003,10 +1003,10 @@ pub struct Arguments<R = TextRange> {
pub kw_defaults: Vec<Expr<R>>,
pub kwarg: Option<Box<Arg<R>>>,
pub defaults: Vec<Expr<R>>,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
#[derive(Clone, Debug, PartialEq)]
@ -1035,10 +1035,10 @@ pub struct Alias<R = TextRange> {
pub struct Withitem<R = TextRange> {
pub context_expr: Expr<R>,
pub optional_vars: Option<Box<Expr<R>>>,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
#[derive(Clone, Debug, PartialEq)]
@ -1046,10 +1046,10 @@ pub struct MatchCase<R = TextRange> {
pub pattern: Pattern<R>,
pub guard: Option<Box<Expr<R>>>,
pub body: Vec<Stmt<R>>,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
#[derive(Clone, Debug, PartialEq)]
@ -1170,10 +1170,10 @@ pub enum Pattern<R = TextRange> {
pub struct TypeIgnoreTypeIgnore<R = TextRange> {
pub lineno: Int,
pub tag: String,
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
pub range: R,
#[cfg(not(feature = "more-attributes"))]
pub range: std::marker::PhantomData<R>,
#[cfg(not(feature = "all-nodes-with-ranges"))]
pub range: crate::EmptyRange<R>,
}
impl<R> From<TypeIgnoreTypeIgnore<R>> for TypeIgnore<R> {

View file

@ -4,7 +4,7 @@ pub type Mod = crate::generic::Mod<SourceRange>;
pub type ModModule = crate::generic::ModModule<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for ModModule {
fn range(&self) -> SourceRange {
@ -14,7 +14,7 @@ impl Located for ModModule {
pub type ModInteractive = crate::generic::ModInteractive<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for ModInteractive {
fn range(&self) -> SourceRange {
@ -24,7 +24,7 @@ impl Located for ModInteractive {
pub type ModExpression = crate::generic::ModExpression<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for ModExpression {
fn range(&self) -> SourceRange {
@ -34,7 +34,7 @@ impl Located for ModExpression {
pub type ModFunctionType = crate::generic::ModFunctionType<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for ModFunctionType {
fn range(&self) -> SourceRange {
@ -42,7 +42,7 @@ impl Located for ModFunctionType {
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for Mod {
fn range(&self) -> SourceRange {
match self {
@ -570,7 +570,7 @@ pub type Cmpop = crate::generic::Cmpop;
pub type Comprehension = crate::generic::Comprehension<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for Comprehension {
fn range(&self) -> SourceRange {
@ -598,7 +598,7 @@ impl Located for Excepthandler {
pub type Arguments = crate::generic::Arguments<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for Arguments {
fn range(&self) -> SourceRange {
@ -632,7 +632,7 @@ impl Located for Alias {
pub type Withitem = crate::generic::Withitem<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for Withitem {
fn range(&self) -> SourceRange {
@ -642,7 +642,7 @@ impl Located for Withitem {
pub type MatchCase = crate::generic::MatchCase<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for MatchCase {
fn range(&self) -> SourceRange {
@ -735,7 +735,7 @@ pub type TypeIgnore = crate::generic::TypeIgnore<SourceRange>;
pub type TypeIgnoreTypeIgnore = crate::generic::TypeIgnoreTypeIgnore<SourceRange>;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for TypeIgnoreTypeIgnore {
fn range(&self) -> SourceRange {
@ -743,7 +743,7 @@ impl Located for TypeIgnoreTypeIgnore {
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Located for TypeIgnore {
fn range(&self) -> SourceRange {
match self {

View file

@ -1,31 +1,31 @@
// File automatically generated by ast/asdl_rs.py.
use crate::Ranged;
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::ModModule<TextRange> {
fn range(&self) -> TextRange {
self.range
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::ModInteractive<TextRange> {
fn range(&self) -> TextRange {
self.range
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::ModExpression<TextRange> {
fn range(&self) -> TextRange {
self.range
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::ModFunctionType<TextRange> {
fn range(&self) -> TextRange {
self.range
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::Mod {
fn range(&self) -> TextRange {
match self {
@ -375,7 +375,7 @@ impl Ranged for crate::Expr {
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::Comprehension<TextRange> {
fn range(&self) -> TextRange {
self.range
@ -394,7 +394,7 @@ impl Ranged for crate::Excepthandler {
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::Arguments<TextRange> {
fn range(&self) -> TextRange {
self.range
@ -415,13 +415,13 @@ impl Ranged for crate::generic::Alias<TextRange> {
self.range
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::Withitem<TextRange> {
fn range(&self) -> TextRange {
self.range
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::MatchCase<TextRange> {
fn range(&self) -> TextRange {
self.range
@ -482,13 +482,13 @@ impl Ranged for crate::Pattern {
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::generic::TypeIgnoreTypeIgnore<TextRange> {
fn range(&self) -> TextRange {
self.range
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
impl Ranged for crate::TypeIgnore {
fn range(&self) -> TextRange {
match self {

View file

@ -8,7 +8,7 @@ mod generic {
include!("gen/generic.rs");
}
mod impls;
pub mod ranged;
mod ranged;
#[cfg(feature = "location")]
mod source_locator;
#[cfg(feature = "unparse")]
@ -17,12 +17,15 @@ mod unparse;
pub use builtin::*;
pub use generic::*;
pub use rustpython_parser_core::{text_size, ConversionFlag};
use std::fmt::{Debug, Display, Formatter};
use std::marker::PhantomData;
pub type Suite<R = TextRange> = Vec<Stmt<R>>;
#[cfg(feature = "fold")]
pub mod fold {
use super::generic::*;
include!("gen/fold.rs");
}
@ -53,6 +56,31 @@ pub trait Ranged {
}
}
#[derive(Eq, PartialEq, Hash, Copy, Clone)]
pub struct EmptyRange<R> {
phantom: PhantomData<R>,
}
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,
}
}
}
#[cfg(feature = "constant-optimization")]
mod optimizer;

View file

@ -12,7 +12,7 @@ edition = "2021"
default = ["location"]
location = ["rustpython-ast/location"]
serde = ["dep:serde", "rustpython-parser-core/serde"]
more-attributes = ["rustpython-ast/more-attributes"]
all-nodes-with-ranges = ["rustpython-ast/all-nodes-with-ranges"]
[build-dependencies]
anyhow = { workspace = true }
@ -38,4 +38,4 @@ rustc-hash = "1.1.0"
serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] }
[dev-dependencies]
insta = { workspace = true }
insta = { workspace = true }

View file

@ -72,6 +72,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_assign_list() {
let source = "[x, y] = (1, 2, 3)";
let parse_ast = parse_program(source, "<test>").unwrap();
@ -107,6 +108,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_assign_list_comp() {
let source = "x = [y for y in (1, 2, 3)]";
let parse_ast = parse_program(source, "<test>").unwrap();
@ -114,6 +116,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_assign_set_comp() {
let source = "x = {y for y in (1, 2, 3)}";
let parse_ast = parse_program(source, "<test>").unwrap();
@ -121,6 +124,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_assign_with() {
let source = "with 1 as x: pass";
let parse_ast = parse_program(source, "<test>").unwrap();

View file

@ -157,6 +157,7 @@ mod tests {
use super::*;
use crate::parser::{parse_program, ParseErrorType};
#[cfg(not(feature = "all-nodes-with-ranges"))]
macro_rules! function_and_lambda {
($($name:ident: $code:expr,)*) => {
$(
@ -169,6 +170,7 @@ mod tests {
}
}
#[cfg(not(feature = "all-nodes-with-ranges"))]
function_and_lambda! {
test_function_no_args: "def f(): pass",
test_function_pos_args: "def f(a, b, c): pass",

View file

@ -318,18 +318,18 @@ impl ParseErrorType {
}
}
#[cfg(feature = "more-attributes")]
#[cfg(feature = "all-nodes-with-ranges")]
#[inline(always)]
pub(super) fn range_or_phantom<T: Into<crate::text_size::TextRange>>(
pub(super) fn range_or_empty<T: Into<crate::text_size::TextRange>>(
range: T,
) -> crate::text_size::TextRange {
range.into()
}
#[cfg(not(feature = "more-attributes"))]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[inline(always)]
pub(super) fn range_or_phantom<T, R>(_: T) -> std::marker::PhantomData<R> {
std::marker::PhantomData::<R>
pub(super) fn range_or_empty<T, R>(_: T) -> rustpython_ast::EmptyRange<R> {
rustpython_ast::EmptyRange::default()
}
#[cfg(test)]
@ -385,6 +385,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_parse_lambda() {
let source = "lambda x, y: x * y"; // lambda(x, y): x * y";
let parse_ast = parse_program(source, "<test>").unwrap();
@ -399,6 +400,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_parse_class() {
let source = "\
class Foo(A, B):
@ -411,6 +413,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_parse_dict_comprehension() {
let source = "{x1: x2 for y in z}";
let parse_ast = parse_expression(source, "<test>").unwrap();
@ -418,6 +421,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_parse_list_comprehension() {
let source = "[x for y in z]";
let parse_ast = parse_expression(source, "<test>").unwrap();
@ -425,6 +429,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
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 parse_ast = parse_expression(source, "<test>").unwrap();
@ -432,6 +437,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_parse_generator_comprehension() {
let source = "(x for y in z)";
let parse_ast = parse_expression(source, "<test>").unwrap();
@ -439,6 +445,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_parse_named_expression_generator_comprehension() {
let source = "(x := y + 1 for y in z)";
let parse_ast = parse_expression(source, "<test>").unwrap();
@ -446,6 +453,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_parse_if_else_generator_comprehension() {
let source = "(x if y else y for y in z)";
let parse_ast = parse_expression(source, "<test>").unwrap();
@ -474,6 +482,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_with_statement() {
let source = "\
with 0: pass
@ -543,6 +552,7 @@ array[3:5, *indexes_to_select]
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_generator_expression_argument() {
let source = r#"' '.join(
sql
@ -602,6 +612,7 @@ except* OSError as e:
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_match_as_identifier() {
let parse_ast = parse_program(
r#"
@ -634,6 +645,7 @@ print(match(12))
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_patma() {
let source = r#"# Cases sampled from Lib/test/test_patma.py
@ -805,6 +817,7 @@ match w := x,:
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_match() {
let parse_ast = parse_program(
r#"
@ -835,6 +848,7 @@ match x:
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
fn test_variadic_generics() {
let parse_ast = parse_program(
r#"

View file

@ -8,7 +8,7 @@ use crate::{
lexer::{LexicalError, LexicalErrorType},
function::{ArgumentList, parse_args, parse_params, validate_arguments},
context::set_context,
string::parse_strings, parser::range_or_phantom,
string::parse_strings, parser::range_or_empty,
token::{self, StringKind},
text_size::TextSize,
};
@ -20,9 +20,9 @@ grammar;
// For each public entry point, a full parse table is generated.
// By having only a single pub function, we reduce this to one.
pub Top: ast::Mod = {
<start:@L> StartModule <body:Program> <end:@R> => ast::ModModule { body, type_ignores: vec![], range: range_or_phantom(start..end) }.into(),
<start:@L> StartInteractive <body:Program> <end:@R> => ast::ModInteractive { body, range: range_or_phantom(start..end) }.into(),
<start:@L> StartExpression <body:TestList> ("\n")* <end:@R> => ast::ModExpression { body: Box::new(body), range: range_or_phantom(start..end) }.into()
<start:@L> StartModule <body:Program> <end:@R> => ast::ModModule { body, type_ignores: vec![], range: range_or_empty(start..end) }.into(),
<start:@L> StartInteractive <body:Program> <end:@R> => ast::ModInteractive { body, range: range_or_empty(start..end) }.into(),
<start:@L> StartExpression <body:TestList> ("\n")* <end:@R> => ast::ModExpression { body: Box::new(body), range: range_or_empty(start..end) }.into()
};
Program: ast::Suite = {
@ -371,7 +371,7 @@ MatchCase: ast::MatchCase = {
pattern,
guard: guard.map(Box::new),
body,
range: range_or_phantom(start..end)
range: range_or_empty(start..end)
}
},
}
@ -929,15 +929,15 @@ WithItems: Vec<ast::Withitem> = {
#[inline]
WithItemsNoAs: Vec<ast::Withitem> = {
<location:@L> <all:OneOrMore<Test<"all">>> <end_location:@R> => {
all.into_iter().map(|context_expr| ast::Withitem { context_expr, optional_vars: None, range: range_or_phantom(location..end_location) }).collect()
all.into_iter().map(|context_expr| ast::Withitem { context_expr, optional_vars: None, range: range_or_empty(location..end_location) }).collect()
},
}
WithItem<Goal>: ast::Withitem = {
<location:@L> <context_expr: Test<Goal>> <end_location:@R> if Goal != "as" => ast::Withitem { context_expr, optional_vars: None, range: range_or_phantom(location..end_location) },
<location:@L> <context_expr: Test<Goal>> <end_location:@R> if Goal != "as" => ast::Withitem { context_expr, optional_vars: None, range: range_or_empty(location..end_location) },
<location:@L> <context_expr:Test<"all">> "as" <vars:Expression<"all">> <end_location:@R> => {
let optional_vars = Some(Box::new(set_context(vars, ast::ExprContext::Store)));
ast::Withitem { context_expr, optional_vars, range: range_or_phantom(location..end_location) }
ast::Withitem { context_expr, optional_vars, range: range_or_empty(location..end_location) }
},
};
@ -966,7 +966,7 @@ Parameters: ast::Arguments = {
kw_defaults: vec![],
kwarg: None,
defaults: vec![],
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
})
)?;
@ -991,7 +991,7 @@ ParameterList<ArgType, StarArgType>: ast::Arguments = {
kwarg,
defaults,
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
})
},
<location:@L> <param1:ParameterDefs<ArgType>> <kw:("," KwargParameter<ArgType>)> ","? <end_location:@R> =>? {
@ -1011,7 +1011,7 @@ ParameterList<ArgType, StarArgType>: ast::Arguments = {
kwarg,
defaults,
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
})
},
<location:@L> <params:ParameterListStarArgs<ArgType, StarArgType>> ","? <end_location:@R> => {
@ -1024,7 +1024,7 @@ ParameterList<ArgType, StarArgType>: ast::Arguments = {
kwarg,
defaults: vec![],
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
},
<location:@L> <kwarg:KwargParameter<ArgType>> ","? <end_location:@R> => {
@ -1036,7 +1036,7 @@ ParameterList<ArgType, StarArgType>: ast::Arguments = {
kwarg,
defaults: vec![],
kw_defaults: vec![],
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
},
};
@ -1194,7 +1194,7 @@ LambdaDef: ast::Expr = {
kw_defaults: vec![],
kwarg: None,
defaults: vec![],
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
}
))?;
@ -1564,7 +1564,7 @@ SingleForComprehension: ast::Comprehension = {
iter,
ifs,
is_async,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
}
};

48
parser/src/python.rs generated
View file

@ -1,11 +1,11 @@
// auto-generated: "lalrpop 0.20.0"
// sha3: 66396fb90bec55aae5a20216846cc3a01d7e611d2b96a5a07e58b7cde5caeab3
// sha3: 402d166f44e2679fb2f083fb2e4d621c7725b86d3c93474c2730b9b240a8794a
use crate::{
ast::{self as ast, Ranged},
lexer::{LexicalError, LexicalErrorType},
function::{ArgumentList, parse_args, parse_params, validate_arguments},
context::set_context,
string::parse_strings, parser::range_or_phantom,
string::parse_strings, parser::range_or_empty,
token::{self, StringKind},
text_size::TextSize,
};
@ -26,7 +26,7 @@ mod __parse__Top {
lexer::{LexicalError, LexicalErrorType},
function::{ArgumentList, parse_args, parse_params, validate_arguments},
context::set_context,
string::parse_strings, parser::range_or_phantom,
string::parse_strings, parser::range_or_empty,
token::{self, StringKind},
text_size::TextSize,
};
@ -36623,7 +36623,7 @@ fn __action1<
(_, end, _): (TextSize, TextSize, TextSize),
) -> ast::Mod
{
ast::ModModule { body, type_ignores: vec![], range: range_or_phantom(start..end) }.into()
ast::ModModule { body, type_ignores: vec![], range: range_or_empty(start..end) }.into()
}
#[allow(clippy::too_many_arguments)]
@ -36635,7 +36635,7 @@ fn __action2<
(_, end, _): (TextSize, TextSize, TextSize),
) -> ast::Mod
{
ast::ModInteractive { body, range: range_or_phantom(start..end) }.into()
ast::ModInteractive { body, range: range_or_empty(start..end) }.into()
}
#[allow(clippy::too_many_arguments)]
@ -36648,7 +36648,7 @@ fn __action3<
(_, end, _): (TextSize, TextSize, TextSize),
) -> ast::Mod
{
ast::ModExpression { body: Box::new(body), range: range_or_phantom(start..end) }.into()
ast::ModExpression { body: Box::new(body), range: range_or_empty(start..end) }.into()
}
#[allow(clippy::too_many_arguments)]
@ -37615,7 +37615,7 @@ fn __action80<
pattern,
guard: guard.map(Box::new),
body,
range: range_or_phantom(start..end)
range: range_or_empty(start..end)
}
}
}
@ -38887,7 +38887,7 @@ fn __action153<
) -> Vec<ast::Withitem>
{
{
all.into_iter().map(|context_expr| ast::Withitem { context_expr, optional_vars: None, range: range_or_phantom(location..end_location) }).collect()
all.into_iter().map(|context_expr| ast::Withitem { context_expr, optional_vars: None, range: range_or_empty(location..end_location) }).collect()
}
}
@ -38938,7 +38938,7 @@ fn __action155<
kw_defaults: vec![],
kwarg: None,
defaults: vec![],
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
})
)?;
@ -39124,7 +39124,7 @@ fn __action166<
kw_defaults: vec![],
kwarg: None,
defaults: vec![],
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
}
))?;
@ -39555,7 +39555,7 @@ fn __action206<
iter,
ifs,
is_async,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
}
}
@ -39974,7 +39974,7 @@ fn __action240<
kwarg,
defaults,
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
})
}
}
@ -40006,7 +40006,7 @@ fn __action241<
kwarg,
defaults,
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
})
}
}
@ -40030,7 +40030,7 @@ fn __action242<
kwarg,
defaults: vec![],
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
}
}
@ -40053,7 +40053,7 @@ fn __action243<
kwarg,
defaults: vec![],
kw_defaults: vec![],
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
}
}
@ -40198,7 +40198,7 @@ fn __action256<
kwarg,
defaults,
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
})
}
}
@ -40230,7 +40230,7 @@ fn __action257<
kwarg,
defaults,
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
})
}
}
@ -40254,7 +40254,7 @@ fn __action258<
kwarg,
defaults: vec![],
kw_defaults,
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
}
}
@ -40277,7 +40277,7 @@ fn __action259<
kwarg,
defaults: vec![],
kw_defaults: vec![],
range: range_or_phantom(location..end_location)
range: range_or_empty(location..end_location)
}
}
}
@ -40371,7 +40371,7 @@ fn __action268<
(_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Withitem
{
ast::Withitem { context_expr, optional_vars: None, range: range_or_phantom(location..end_location) }
ast::Withitem { context_expr, optional_vars: None, range: range_or_empty(location..end_location) }
}
#[allow(clippy::too_many_arguments)]
@ -40386,7 +40386,7 @@ fn __action269<
{
{
let optional_vars = Some(Box::new(set_context(vars, ast::ExprContext::Store)));
ast::Withitem { context_expr, optional_vars, range: range_or_phantom(location..end_location) }
ast::Withitem { context_expr, optional_vars, range: range_or_empty(location..end_location) }
}
}
@ -40427,7 +40427,7 @@ fn __action273<
(_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Withitem
{
ast::Withitem { context_expr, optional_vars: None, range: range_or_phantom(location..end_location) }
ast::Withitem { context_expr, optional_vars: None, range: range_or_empty(location..end_location) }
}
#[allow(clippy::too_many_arguments)]
@ -40442,7 +40442,7 @@ fn __action274<
{
{
let optional_vars = Some(Box::new(set_context(vars, ast::ExprContext::Store)));
ast::Withitem { context_expr, optional_vars, range: range_or_phantom(location..end_location) }
ast::Withitem { context_expr, optional_vars, range: range_or_empty(location..end_location) }
}
}
@ -40458,7 +40458,7 @@ fn __action275<
{
{
let optional_vars = Some(Box::new(set_context(vars, ast::ExprContext::Store)));
ast::Withitem { context_expr, optional_vars, range: range_or_phantom(location..end_location) }
ast::Withitem { context_expr, optional_vars, range: range_or_empty(location..end_location) }
}
}

View file

@ -75,7 +75,7 @@ expression: parse_ast
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 4..26,

View file

@ -75,7 +75,7 @@ expression: parse_ast
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 4..26,

View file

@ -27,7 +27,7 @@ expression: parse_ast
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [

View file

@ -42,7 +42,7 @@ Ok(
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -61,7 +61,7 @@ Ok(
],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -17,7 +17,7 @@ Ok(
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -67,7 +67,7 @@ Ok(
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -86,7 +86,7 @@ Ok(
],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -95,7 +95,7 @@ Ok(
],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -104,7 +104,7 @@ Ok(
},
),
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -42,7 +42,7 @@ Ok(
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -61,7 +61,7 @@ Ok(
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -41,7 +41,7 @@ Ok(
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: Constant(
ExprConstant {

View file

@ -60,7 +60,7 @@ Ok(
],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: Constant(
ExprConstant {

View file

@ -16,7 +16,7 @@ Ok(
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: Constant(
ExprConstant {

View file

@ -58,7 +58,7 @@ Ok(
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: Constant(
ExprConstant {

View file

@ -41,7 +41,7 @@ Ok(
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: Constant(
ExprConstant {

View file

@ -60,7 +60,7 @@ Ok(
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: Constant(
ExprConstant {

View file

@ -145,7 +145,7 @@ Call(
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 14..139,

View file

@ -82,7 +82,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1..73,
@ -216,7 +216,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 74..177,
@ -299,7 +299,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 178..218,
@ -382,7 +382,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 219..259,
@ -451,7 +451,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 260..297,

View file

@ -733,7 +733,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchValue(
@ -758,7 +758,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 527..581,
@ -796,7 +796,7 @@ expression: parse_ast
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: Compare(
ExprCompare {

View file

@ -52,7 +52,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(
@ -107,7 +107,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Pass(

View file

@ -44,7 +44,7 @@ DictComp(
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 0..19,

View file

@ -52,7 +52,7 @@ ListComp(
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
Comprehension {
target: Name(
@ -132,7 +132,7 @@ ListComp(
),
],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 0..48,

View file

@ -35,7 +35,7 @@ GeneratorExp(
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 0..14,

View file

@ -58,7 +58,7 @@ GeneratorExp(
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 0..26,

View file

@ -32,7 +32,7 @@ expression: parse_ast
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: BinOp(
ExprBinOp {

View file

@ -35,7 +35,7 @@ ListComp(
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 0..14,

View file

@ -64,7 +64,7 @@ GeneratorExp(
),
ifs: [],
is_async: false,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 0..23,

View file

@ -66,7 +66,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 67..103,
@ -143,7 +143,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 126..167,
@ -215,7 +215,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchValue(
@ -271,7 +271,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 190..260,
@ -382,7 +382,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 283..332,
@ -507,7 +507,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 355..403,
@ -558,7 +558,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchMapping(
@ -588,7 +588,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 445..523,
@ -698,7 +698,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchOr(
@ -936,7 +936,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchSequence(
@ -974,7 +974,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 546..714,
@ -1052,7 +1052,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 737..782,
@ -1121,7 +1121,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 805..841,
@ -1232,7 +1232,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 864..913,
@ -1304,7 +1304,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 936..975,
@ -1385,7 +1385,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchMapping(
@ -1450,7 +1450,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchMapping(
@ -1494,7 +1494,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 998..1098,
@ -1562,7 +1562,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1121..1162,
@ -1624,7 +1624,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchValue(
@ -1670,7 +1670,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1185..1245,
@ -1748,7 +1748,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1268..1315,
@ -1881,7 +1881,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1338..1392,
@ -1950,7 +1950,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchSequence(
@ -2065,7 +2065,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchSequence(
@ -2132,7 +2132,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1415..1529,
@ -2215,7 +2215,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1552..1595,
@ -2299,7 +2299,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1618..1664,
@ -2373,7 +2373,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1687..1726,
@ -2462,7 +2462,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1749..1789,
@ -2516,7 +2516,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1812..1849,
@ -2578,7 +2578,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1872..1906,
@ -2634,7 +2634,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1929..1967,
@ -2688,7 +2688,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchSequence(
@ -2741,7 +2741,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchValue(
@ -2787,7 +2787,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 1990..2081,
@ -2846,7 +2846,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2104..2138,
@ -2933,7 +2933,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2161..2207,
@ -3110,7 +3110,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2230..2307,
@ -3220,7 +3220,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchOr(
@ -3458,7 +3458,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
MatchCase {
pattern: MatchSequence(
@ -3496,7 +3496,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2330..2499,
@ -3601,7 +3601,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2522..2568,
@ -3706,7 +3706,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2591..2638,
@ -3772,7 +3772,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2661..2697,
@ -3866,7 +3866,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2720..2760,
@ -3958,7 +3958,7 @@ expression: parse_ast
},
),
],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
range: 2783..2829,

View file

@ -41,7 +41,7 @@ expression: parse_ast
kw_defaults: [],
kwarg: None,
defaults: [],
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
body: [
Expr(

View file

@ -17,7 +17,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -55,7 +55,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -83,7 +83,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
Withitem {
context_expr: Constant(
@ -96,7 +96,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -134,7 +134,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
Withitem {
context_expr: Constant(
@ -157,7 +157,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -208,7 +208,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -269,7 +269,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -295,7 +295,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -331,7 +331,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -359,7 +359,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -397,7 +397,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -425,7 +425,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -471,7 +471,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -499,7 +499,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
Withitem {
context_expr: Constant(
@ -512,7 +512,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -567,7 +567,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -609,7 +609,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -661,7 +661,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -712,7 +712,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -773,7 +773,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -815,7 +815,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -867,7 +867,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -940,7 +940,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
optional_vars: None,
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -1023,7 +1023,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -1061,7 +1061,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -1099,7 +1099,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -1137,7 +1137,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
Withitem {
context_expr: Constant(
@ -1160,7 +1160,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [
@ -1198,7 +1198,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
Withitem {
context_expr: Constant(
@ -1221,7 +1221,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
},
),
),
range: PhantomData<ruff_text_size::range::TextRange>,
range: (),
},
],
body: [