ruff integration support

This commit is contained in:
Jeong YunWon 2023-05-11 04:08:57 +09:00
parent 99e108dd53
commit aabc96dde9
4 changed files with 268 additions and 232 deletions

View file

@ -13,16 +13,33 @@ impl Identifier {
pub fn new(s: impl Into<String>) -> Self { pub fn new(s: impl Into<String>) -> Self {
Self(s.into()) Self(s.into())
} }
}
impl std::cmp::PartialEq<str> for Identifier {
#[inline] #[inline]
pub fn as_str(&self) -> &str { fn eq(&self, other: &str) -> bool {
self.0.as_str() self.0 == other
} }
} }
impl std::string::ToString for Identifier { impl std::cmp::PartialEq<String> for Identifier {
#[inline] #[inline]
fn to_string(&self) -> String { fn eq(&self, other: &String) -> bool {
self.0.clone() &self.0 == other
}
}
impl std::ops::Deref for Identifier {
type Target = String;
#[inline]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl std::fmt::Display for Identifier {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.0.fmt(f)
} }
} }
@ -33,24 +50,46 @@ impl From<Identifier> for String {
} }
} }
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] impl From<String> for Identifier {
#[inline]
fn from(id: String) -> Self {
Self(id)
}
}
impl<'a> From<&'a str> for Identifier {
#[inline]
fn from(id: &'a str) -> Identifier {
id.to_owned().into()
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Int(u32); pub struct Int(u32);
impl Int { impl Int {
pub fn new(i: u32) -> Self { pub fn new(i: u32) -> Self {
Self(i) Self(i)
} }
pub fn new_bool(i: bool) -> Self {
Self(i as u32)
}
pub fn to_u32(&self) -> u32 { pub fn to_u32(&self) -> u32 {
self.0 self.0
} }
pub fn to_usize(&self) -> usize { pub fn to_usize(&self) -> usize {
self.0 as _ self.0 as _
} }
pub fn to_bool(&self) -> bool { }
self.0 > 0
impl std::cmp::PartialEq<u32> for Int {
#[inline]
fn eq(&self, other: &u32) -> bool {
self.0 == *other
}
}
impl std::cmp::PartialEq<usize> for Int {
#[inline]
fn eq(&self, other: &usize) -> bool {
self.0 as usize == *other
} }
} }
@ -165,11 +204,11 @@ impl<T, U> Attributed<T, U> {
impl<T> Attributed<T, ()> { impl<T> Attributed<T, ()> {
/// Creates a new node that spans the position specified by `range`. /// Creates a new node that spans the position specified by `range`.
pub fn new(range: impl Into<TextRange>, node: T) -> Self { pub fn new(range: impl Into<TextRange>, node: impl Into<T>) -> Self {
Self { Self {
range: range.into(), range: range.into(),
custom: (), custom: (),
node, node: node.into(),
} }
} }

View file

@ -81,7 +81,7 @@ DelStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtDelete { targets: targets.into_iter().map(|expr| set_context(expr, ast::ExprContext::Del)).collect() }.into() ast::StmtDelete { targets: targets.into_iter().map(|expr| set_context(expr, ast::ExprContext::Del)).collect() }
) )
}, },
}; };
@ -93,7 +93,7 @@ ExpressionStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtExpr { value: Box::new(expression) }.into() ast::StmtExpr { value: Box::new(expression) }
) )
} else { } else {
let mut targets = vec![set_context(expression, ast::ExprContext::Store)]; let mut targets = vec![set_context(expression, ast::ExprContext::Store)];
@ -108,7 +108,7 @@ ExpressionStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtAssign { targets, value, type_comment: None }.into() ast::StmtAssign { targets, value, type_comment: None }
) )
} }
}, },
@ -120,7 +120,7 @@ ExpressionStatement: ast::Stmt = {
target: Box::new(set_context(target, ast::ExprContext::Store)), target: Box::new(set_context(target, ast::ExprContext::Store)),
op, op,
value: Box::new(rhs) value: Box::new(rhs)
}.into(), },
) )
}, },
<location:@L> <target:Test<"all">> ":" <annotation:Test<"all">> <rhs:AssignSuffix?> <end_location:@R> => { <location:@L> <target:Test<"all">> ":" <annotation:Test<"all">> <rhs:AssignSuffix?> <end_location:@R> => {
@ -133,7 +133,7 @@ ExpressionStatement: ast::Stmt = {
annotation: Box::new(annotation), annotation: Box::new(annotation),
value: rhs.map(Box::new), value: rhs.map(Box::new),
simple, simple,
}.into(), },
) )
}, },
}; };
@ -203,14 +203,14 @@ FlowStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtReturn { value: value.map(Box::new) }.into() ast::StmtReturn { value: value.map(Box::new) }
) )
}, },
<location:@L> <expression:YieldExpr> <end_location:@R> => { <location:@L> <expression:YieldExpr> <end_location:@R> => {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtExpr { value: Box::new(expression) }.into() ast::StmtExpr { value: Box::new(expression) }
) )
}, },
RaiseStatement, RaiseStatement,
@ -221,14 +221,14 @@ RaiseStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtRaise { exc: None, cause: None }.into() ast::StmtRaise { exc: None, cause: None }
) )
}, },
<location:@L> "raise" <t:Test<"all">> <c:("from" Test<"all">)?> <end_location:@R> => { <location:@L> "raise" <t:Test<"all">> <c:("from" Test<"all">)?> <end_location:@R> => {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtRaise { exc: Some(Box::new(t)), cause: c.map(|x| Box::new(x.1)) }.into() ast::StmtRaise { exc: Some(Box::new(t)), cause: c.map(|x| Box::new(x.1)) }
) )
}, },
}; };
@ -238,7 +238,7 @@ ImportStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtImport { names }.into() ast::StmtImport { names }
) )
}, },
<location:@L> "from" <source:ImportFromLocation> "import" <names: ImportAsNames> <end_location:@R> => { <location:@L> "from" <source:ImportFromLocation> "import" <names: ImportAsNames> <end_location:@R> => {
@ -250,7 +250,7 @@ ImportStatement: ast::Stmt = {
level, level,
module, module,
names names
}.into(), },
) )
}, },
}; };
@ -302,7 +302,7 @@ GlobalStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtGlobal { names }.into() ast::StmtGlobal { names }
) )
}, },
}; };
@ -312,7 +312,7 @@ NonlocalStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtNonlocal { names }.into() ast::StmtNonlocal { names }
) )
}, },
}; };
@ -325,7 +325,7 @@ AssertStatement: ast::Stmt = {
ast::StmtAssert { ast::StmtAssert {
test: Box::new(test), test: Box::new(test),
msg: msg.map(|e| Box::new(e.1)) msg: msg.map(|e| Box::new(e.1))
}.into() }
) )
}, },
}; };
@ -356,7 +356,7 @@ MatchStatement: ast::Stmt = {
ast::StmtMatch { ast::StmtMatch {
subject: Box::new(subject), subject: Box::new(subject),
cases cases
}.into() }
) )
}, },
<location:@L> "match" <subject:TestOrStarNamedExpr> "," ":" "\n" Indent <cases:MatchCase+> Dedent => { <location:@L> "match" <subject:TestOrStarNamedExpr> "," ":" "\n" Indent <cases:MatchCase+> Dedent => {
@ -373,7 +373,7 @@ MatchStatement: ast::Stmt = {
ast::StmtMatch { ast::StmtMatch {
subject: Box::new(subject), subject: Box::new(subject),
cases cases
}.into() }
) )
}, },
<location:@L> "match" <subject:TestOrStarNamedExpr> "," <subjects:OneOrMore<TestOrStarNamedExpr>> ","? ":" "\n" Indent <cases:MatchCase+> Dedent => { <location:@L> "match" <subject:TestOrStarNamedExpr> "," <subjects:OneOrMore<TestOrStarNamedExpr>> ","? ":" "\n" Indent <cases:MatchCase+> Dedent => {
@ -396,10 +396,10 @@ MatchStatement: ast::Stmt = {
ast::ExprTuple { ast::ExprTuple {
elts: subjects, elts: subjects,
ctx: ast::ExprContext::Load, ctx: ast::ExprContext::Load,
}.into(), },
)), )),
cases cases
}.into() }
) )
} }
} }
@ -426,7 +426,7 @@ Patterns: ast::Pattern = {
end_location, end_location,
ast::PatternMatchSequence { ast::PatternMatchSequence {
patterns: vec![pattern] patterns: vec![pattern]
}.into(), },
), ),
<location:@L> <pattern:Pattern> "," <patterns:OneOrMore<Pattern>> ","? <end_location:@R> => { <location:@L> <pattern:Pattern> "," <patterns:OneOrMore<Pattern>> ","? <end_location:@R> => {
let mut patterns = patterns; let mut patterns = patterns;
@ -436,7 +436,7 @@ Patterns: ast::Pattern = {
end_location, end_location,
ast::PatternMatchSequence { ast::PatternMatchSequence {
patterns patterns
}.into(), },
) )
}, },
<pattern:Pattern> => pattern <pattern:Pattern> => pattern
@ -461,7 +461,7 @@ AsPattern: ast::Pattern = {
ast::PatternMatchAs { ast::PatternMatchAs {
pattern: Some(Box::new(pattern)), pattern: Some(Box::new(pattern)),
name: Some(name), name: Some(name),
}.into(), },
)) ))
} }
}, },
@ -475,7 +475,7 @@ OrPattern: ast::Pattern = {
ast::Pattern::new( ast::Pattern::new(
location.. location..
end_location, end_location,
ast::PatternMatchOr { patterns }.into() ast::PatternMatchOr { patterns }
) )
} }
} }
@ -546,7 +546,7 @@ ConstantAtom: ast::Expr = {
<location:@L> <value:Constant> <end_location:@R> => ast::Expr::new( <location:@L> <value:Constant> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprConstant { value, kind: None }.into() ast::ExprConstant { value, kind: None }
), ),
} }
@ -558,7 +558,7 @@ ConstantExpr: ast::Expr = {
ast::ExprUnaryOp { ast::ExprUnaryOp {
op: ast::Unaryop::USub, op: ast::Unaryop::USub,
operand: Box::new(operand) operand: Box::new(operand)
}.into() }
), ),
} }
@ -570,7 +570,7 @@ AddOpExpr: ast::Expr = {
left: Box::new(left), left: Box::new(left),
op, op,
right: Box::new(right), right: Box::new(right),
}.into() }
), ),
} }
@ -606,7 +606,7 @@ MatchName: ast::Expr = {
<location:@L> <name:Identifier> <end_location:@R> => ast::Expr::new( <location:@L> <name:Identifier> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprName { id: name, ctx: ast::ExprContext::Load }.into(), ast::ExprName { id: name, ctx: ast::ExprContext::Load },
), ),
} }
@ -618,7 +618,7 @@ MatchNameOrAttr: ast::Expr = {
value: Box::new(name), value: Box::new(name),
attr, attr,
ctx: ast::ExprContext::Load, ctx: ast::ExprContext::Load,
}.into(), },
), ),
<location:@L> <e:MatchNameOrAttr> "." <attr:Identifier> <end_location:@R> => ast::Expr::new( <location:@L> <e:MatchNameOrAttr> "." <attr:Identifier> <end_location:@R> => ast::Expr::new(
location.. location..
@ -627,7 +627,7 @@ MatchNameOrAttr: ast::Expr = {
value: Box::new(e), value: Box::new(e),
attr, attr,
ctx: ast::ExprContext::Load, ctx: ast::ExprContext::Load,
}.into(), },
) )
} }
@ -647,7 +647,7 @@ MappingKey: ast::Expr = {
ast::ExprConstant { ast::ExprConstant {
value: ast::Constant::None, value: ast::Constant::None,
kind: None, kind: None,
}.into(), },
), ),
<location:@L> "True" <end_location:@R> => ast::Expr::new( <location:@L> "True" <end_location:@R> => ast::Expr::new(
location.. location..
@ -655,7 +655,7 @@ MappingKey: ast::Expr = {
ast::ExprConstant { ast::ExprConstant {
value: true.into(), value: true.into(),
kind: None, kind: None,
}.into(), },
), ),
<location:@L> "False" <end_location:@R> => ast::Expr::new( <location:@L> "False" <end_location:@R> => ast::Expr::new(
location.. location..
@ -663,7 +663,7 @@ MappingKey: ast::Expr = {
ast::ExprConstant { ast::ExprConstant {
value: false.into(), value: false.into(),
kind: None, kind: None,
}.into(), },
), ),
<location:@L> <s:(@L string @R)+> =>? Ok(parse_strings(s)?), <location:@L> <s:(@L string @R)+> =>? Ok(parse_strings(s)?),
} }
@ -807,7 +807,7 @@ IfStatement: ast::Stmt = {
let x = ast::Stmt::new( let x = ast::Stmt::new(
i.0.. i.0..
end_location, end_location,
ast::StmtIf { test: Box::new(i.2), body: i.4, orelse: last }.into() ast::StmtIf { test: Box::new(i.2), body: i.4, orelse: last }
); );
last = vec![x]; last = vec![x];
} }
@ -815,7 +815,7 @@ IfStatement: ast::Stmt = {
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtIf { test: Box::new(test), body, orelse: last }.into() ast::StmtIf { test: Box::new(test), body, orelse: last }
) )
}, },
}; };
@ -835,7 +835,7 @@ WhileStatement: ast::Stmt = {
test: Box::new(test), test: Box::new(test),
body, body,
orelse orelse
}.into(), },
) )
}, },
}; };
@ -851,7 +851,7 @@ ForStatement: ast::Stmt = {
let target = Box::new(set_context(target, ast::ExprContext::Store)); let target = Box::new(set_context(target, ast::ExprContext::Store));
let iter = Box::new(iter); let iter = Box::new(iter);
let type_comment = None; let type_comment = None;
let node = if is_async.is_some() { let node: ast::StmtKind = if is_async.is_some() {
ast::StmtAsyncFor { target, iter, body, orelse, type_comment }.into() ast::StmtAsyncFor { target, iter, body, orelse, type_comment }.into()
} else { } else {
ast::StmtFor { target, iter, body, orelse, type_comment }.into() ast::StmtFor { target, iter, body, orelse, type_comment }.into()
@ -878,7 +878,7 @@ TryStatement: ast::Stmt = {
handlers, handlers,
orelse, orelse,
finalbody, finalbody,
}.into(), },
) )
}, },
<location:@L> "try" ":" <body:Suite> <handlers:ExceptStarClause+> <else_suite:("else" ":" Suite)?> <finally:("finally" ":" Suite)?> <end_location:@R> => { <location:@L> "try" ":" <body:Suite> <handlers:ExceptStarClause+> <else_suite:("else" ":" Suite)?> <finally:("finally" ":" Suite)?> <end_location:@R> => {
@ -898,7 +898,7 @@ TryStatement: ast::Stmt = {
handlers, handlers,
orelse, orelse,
finalbody, finalbody,
}.into(), },
) )
}, },
<location:@L> "try" ":" <body:Suite> <finally:("finally" ":" Suite)> => { <location:@L> "try" ":" <body:Suite> <finally:("finally" ":" Suite)> => {
@ -914,7 +914,7 @@ TryStatement: ast::Stmt = {
handlers, handlers,
orelse, orelse,
finalbody, finalbody,
}.into(), },
) )
}, },
}; };
@ -929,7 +929,7 @@ ExceptStarClause: ast::Excepthandler = {
type_: Some(Box::new(typ)), type_: Some(Box::new(typ)),
name: None, name: None,
body, body,
}.into(), },
) )
}, },
<location:@L> "except" "*" <x:(Test<"all"> "as" Identifier)> ":" <body:Suite> => { <location:@L> "except" "*" <x:(Test<"all"> "as" Identifier)> ":" <body:Suite> => {
@ -941,7 +941,7 @@ ExceptStarClause: ast::Excepthandler = {
type_: Some(Box::new(x.0)), type_: Some(Box::new(x.0)),
name: Some(x.2), name: Some(x.2),
body, body,
}.into(), },
) )
}, },
}; };
@ -957,7 +957,7 @@ ExceptClause: ast::Excepthandler = {
type_: typ.map(Box::new), type_: typ.map(Box::new),
name: None, name: None,
body, body,
}.into(), },
) )
}, },
<location:@L> "except" <x:(Test<"all"> "as" Identifier)> ":" <body:Suite> => { <location:@L> "except" <x:(Test<"all"> "as" Identifier)> ":" <body:Suite> => {
@ -969,7 +969,7 @@ ExceptClause: ast::Excepthandler = {
type_: Some(Box::new(x.0)), type_: Some(Box::new(x.0)),
name: Some(x.2), name: Some(x.2),
body, body,
}.into(), },
) )
}, },
}; };
@ -978,7 +978,7 @@ WithStatement: ast::Stmt = {
<location:@L> <is_async:"async"?> "with" <items:WithItems> ":" <body:Suite> => { <location:@L> <is_async:"async"?> "with" <items:WithItems> ":" <body:Suite> => {
let end_location = body.last().unwrap().end(); let end_location = body.last().unwrap().end();
let type_comment = None; let type_comment = None;
let node = if is_async.is_some() { let node: ast::StmtKind = if is_async.is_some() {
ast::StmtAsyncWith { items, body, type_comment }.into() ast::StmtAsyncWith { items, body, type_comment }.into()
} else { } else {
ast::StmtWith { items, body, type_comment }.into() ast::StmtWith { items, body, type_comment }.into()
@ -1019,7 +1019,7 @@ FuncDef: ast::Stmt = {
let returns = r.map(|x| Box::new(x.1)); let returns = r.map(|x| Box::new(x.1));
let end_location = body.last().unwrap().end(); let end_location = body.last().unwrap().end();
let type_comment = None; let type_comment = None;
let node = if is_async.is_some() { let node: ast::StmtKind = if is_async.is_some() {
ast::StmtAsyncFunctionDef { name, args, body, decorator_list, returns, type_comment }.into() ast::StmtAsyncFunctionDef { name, args, body, decorator_list, returns, type_comment }.into()
} else { } else {
ast::StmtFunctionDef { name, args, body, decorator_list, returns, type_comment }.into() ast::StmtFunctionDef { name, args, body, decorator_list, returns, type_comment }.into()
@ -1202,7 +1202,7 @@ ClassDef: ast::Stmt = {
keywords, keywords,
body, body,
decorator_list, decorator_list,
}.into(), },
) )
}, },
}; };
@ -1218,12 +1218,12 @@ YieldExpr: ast::Expr = {
<location:@L> "yield" <value:TestList?> <end_location:@R> => ast::Expr::new( <location:@L> "yield" <value:TestList?> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprYield { value: value.map(Box::new) }.into() ast::ExprYield { value: value.map(Box::new) }
), ),
<location:@L> "yield" "from" <e:Test<"all">> <end_location:@R> => ast::Expr::new( <location:@L> "yield" "from" <e:Test<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprYieldFrom { value: Box::new(e) }.into() ast::ExprYieldFrom { value: Box::new(e) }
), ),
}; };
@ -1235,7 +1235,7 @@ Test<Goal>: ast::Expr = {
test: Box::new(test), test: Box::new(test),
body: Box::new(body), body: Box::new(body),
orelse: Box::new(orelse), orelse: Box::new(orelse),
}.into() }
), ),
OrTest<Goal>, OrTest<Goal>,
LambdaDef, LambdaDef,
@ -1255,10 +1255,10 @@ NamedExpression: ast::Expr = {
target: Box::new(ast::Expr::new( target: Box::new(ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprName { id, ctx: ast::ExprContext::Store }.into(), ast::ExprName { id, ctx: ast::ExprContext::Store },
)), )),
value: Box::new(value), value: Box::new(value),
}.into() }
) )
}, },
}; };
@ -1285,7 +1285,7 @@ LambdaDef: ast::Expr = {
ast::ExprLambda { ast::ExprLambda {
args: Box::new(p), args: Box::new(p),
body: Box::new(body) body: Box::new(body)
}.into() }
)) ))
} }
} }
@ -1297,7 +1297,7 @@ OrTest<Goal>: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBoolOp { op: ast::Boolop::Or, values }.into() ast::ExprBoolOp { op: ast::Boolop::Or, values }
) )
}, },
AndTest<Goal>, AndTest<Goal>,
@ -1310,7 +1310,7 @@ AndTest<Goal>: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBoolOp { op: ast::Boolop::And, values }.into() ast::ExprBoolOp { op: ast::Boolop::And, values }
) )
}, },
NotTest<Goal>, NotTest<Goal>,
@ -1320,7 +1320,7 @@ NotTest<Goal>: ast::Expr = {
<location:@L> "not" <e:NotTest<"all">> <end_location:@R> => ast::Expr::new( <location:@L> "not" <e:NotTest<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not }.into() ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not }
), ),
Comparison<Goal>, Comparison<Goal>,
}; };
@ -1331,7 +1331,7 @@ Comparison<Goal>: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprCompare { left: Box::new(left), ops, comparators }.into() ast::ExprCompare { left: Box::new(left), ops, comparators }
) )
}, },
Expression<Goal>, Expression<Goal>,
@ -1354,7 +1354,7 @@ Expression<Goal>: ast::Expr = {
<location:@L> <e1:Expression<"all">> "|" <e2:XorExpression<"all">> <end_location:@R> => ast::Expr::new( <location:@L> <e1:Expression<"all">> "|" <e2:XorExpression<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitOr, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitOr, right: Box::new(e2) }
), ),
XorExpression<Goal>, XorExpression<Goal>,
}; };
@ -1363,7 +1363,7 @@ XorExpression<Goal>: ast::Expr = {
<location:@L> <e1:XorExpression<"all">> "^" <e2:AndExpression<"all">> <end_location:@R> => ast::Expr::new( <location:@L> <e1:XorExpression<"all">> "^" <e2:AndExpression<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitXor, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitXor, right: Box::new(e2) }
), ),
AndExpression<Goal>, AndExpression<Goal>,
}; };
@ -1372,7 +1372,7 @@ AndExpression<Goal>: ast::Expr = {
<location:@L> <e1:AndExpression<"all">> "&" <e2:ShiftExpression<"all">> <end_location:@R> => ast::Expr::new( <location:@L> <e1:AndExpression<"all">> "&" <e2:ShiftExpression<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitAnd, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitAnd, right: Box::new(e2) }
), ),
ShiftExpression<Goal>, ShiftExpression<Goal>,
}; };
@ -1381,7 +1381,7 @@ ShiftExpression<Goal>: ast::Expr = {
<location:@L> <e1:ShiftExpression<"all">> <op:ShiftOp> <e2:ArithmeticExpression<"all">> <end_location:@R> => ast::Expr::new( <location:@L> <e1:ShiftExpression<"all">> <op:ShiftOp> <e2:ArithmeticExpression<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op, right: Box::new(e2) }
), ),
ArithmeticExpression<Goal>, ArithmeticExpression<Goal>,
}; };
@ -1395,7 +1395,7 @@ ArithmeticExpression<Goal>: ast::Expr = {
<location:@L> <a:ArithmeticExpression<"all">> <op:AddOp> <b:Term<"all">> <end_location:@R> => ast::Expr::new( <location:@L> <a:ArithmeticExpression<"all">> <op:AddOp> <b:Term<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }
), ),
Term<Goal>, Term<Goal>,
}; };
@ -1409,7 +1409,7 @@ Term<Goal>: ast::Expr = {
<location:@L> <a:Term<"all">> <op:MulOp> <b:Factor<"all">> <end_location:@R> => ast::Expr::new( <location:@L> <a:Term<"all">> <op:MulOp> <b:Factor<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }
), ),
Factor<Goal>, Factor<Goal>,
}; };
@ -1426,7 +1426,7 @@ Factor<Goal>: ast::Expr = {
<location:@L> <op:UnaryOp> <e:Factor<"all">> <end_location:@R> => ast::Expr::new( <location:@L> <op:UnaryOp> <e:Factor<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprUnaryOp { operand: Box::new(e), op }.into() ast::ExprUnaryOp { operand: Box::new(e), op }
), ),
Power<Goal>, Power<Goal>,
}; };
@ -1441,7 +1441,7 @@ Power<Goal>: ast::Expr = {
<location:@L> <e:AtomExpr<"all">> "**" <b:Factor<"all">> <end_location:@R> => ast::Expr::new( <location:@L> <e:AtomExpr<"all">> "**" <b:Factor<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e), op: ast::Operator::Pow, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(e), op: ast::Operator::Pow, right: Box::new(b) }
), ),
AtomExpr<Goal>, AtomExpr<Goal>,
}; };
@ -1451,7 +1451,7 @@ AtomExpr<Goal>: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprAwait { value: Box::new(atom) }.into() ast::ExprAwait { value: Box::new(atom) }
) )
}, },
AtomExpr2<Goal>, AtomExpr2<Goal>,
@ -1463,18 +1463,18 @@ AtomExpr2<Goal>: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprCall { func: Box::new(f), args: a.args, keywords: a.keywords }.into() ast::ExprCall { func: Box::new(f), args: a.args, keywords: a.keywords }
) )
}, },
<location:@L> <e:AtomExpr2<"all">> "[" <s:SubscriptList> "]" <end_location:@R> => ast::Expr::new( <location:@L> <e:AtomExpr2<"all">> "[" <s:SubscriptList> "]" <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSubscript { value: Box::new(e), slice: Box::new(s), ctx: ast::ExprContext::Load }.into() ast::ExprSubscript { value: Box::new(e), slice: Box::new(s), ctx: ast::ExprContext::Load }
), ),
<location:@L> <e:AtomExpr2<"all">> "." <attr:Identifier> <end_location:@R> => ast::Expr::new( <location:@L> <e:AtomExpr2<"all">> "." <attr:Identifier> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprAttribute { value: Box::new(e), attr, ctx: ast::ExprContext::Load }.into() ast::ExprAttribute { value: Box::new(e), attr, ctx: ast::ExprContext::Load }
), ),
}; };
@ -1491,7 +1491,7 @@ SubscriptList: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts: dims, ctx: ast::ExprContext::Load }.into(), ast::ExprTuple { elts: dims, ctx: ast::ExprContext::Load },
) )
} }
} }
@ -1506,7 +1506,7 @@ Subscript: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSlice { lower, upper, step }.into() ast::ExprSlice { lower, upper, step }
) )
} }
}; };
@ -1520,26 +1520,26 @@ Atom<Goal>: ast::Expr = {
<location:@L> <value:Constant> <end_location:@R> => ast::Expr::new( <location:@L> <value:Constant> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprConstant { value, kind: None }.into() ast::ExprConstant { value, kind: None }
), ),
<location:@L> <name:Identifier> <end_location:@R> => ast::Expr::new( <location:@L> <name:Identifier> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprName { id: name, ctx: ast::ExprContext::Load }.into() ast::ExprName { id: name, ctx: ast::ExprContext::Load }
), ),
<location:@L> "[" <e:ListLiteralValues?> "]"<end_location:@R> => { <location:@L> "[" <e:ListLiteralValues?> "]"<end_location:@R> => {
let elts = e.unwrap_or_default(); let elts = e.unwrap_or_default();
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprList { elts, ctx: ast::ExprContext::Load }.into() ast::ExprList { elts, ctx: ast::ExprContext::Load }
) )
}, },
<location:@L> "[" <elt:TestOrStarNamedExpr> <generators:CompFor> "]" <end_location:@R> => { <location:@L> "[" <elt:TestOrStarNamedExpr> <generators:CompFor> "]" <end_location:@R> => {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprListComp { elt: Box::new(elt), generators }.into() ast::ExprListComp { elt: Box::new(elt), generators }
) )
}, },
<location:@L> "(" <elts:OneOrMore<Test<"all">>> <trailing_comma:","?> ")" <end_location:@R> if Goal != "no-withitems" => { <location:@L> "(" <elts:OneOrMore<Test<"all">>> <trailing_comma:","?> ")" <end_location:@R> if Goal != "no-withitems" => {
@ -1549,7 +1549,7 @@ Atom<Goal>: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts, ctx: ast::ExprContext::Load }.into() ast::ExprTuple { elts, ctx: ast::ExprContext::Load }
) )
} }
}, },
@ -1567,21 +1567,21 @@ Atom<Goal>: ast::Expr = {
Ok(ast::Expr::new( Ok(ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts, ctx: ast::ExprContext::Load }.into(), ast::ExprTuple { elts, ctx: ast::ExprContext::Load },
)) ))
} }
}, },
<location:@L> "(" ")" <end_location:@R> => ast::Expr::new( <location:@L> "(" ")" <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts: Vec::new(), ctx: ast::ExprContext::Load }.into() ast::ExprTuple { elts: Vec::new(), ctx: ast::ExprContext::Load }
), ),
"(" <e:YieldExpr> ")" => e, "(" <e:YieldExpr> ")" => e,
<location:@L> "(" <elt:NamedExpressionTest> <generators:CompFor> ")" <end_location:@R> => { <location:@L> "(" <elt:NamedExpressionTest> <generators:CompFor> ")" <end_location:@R> => {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprGeneratorExp { elt: Box::new(elt), generators }.into() ast::ExprGeneratorExp { elt: Box::new(elt), generators }
) )
}, },
"(" <location:@L> "**" <e:Expression<"all">> ")" <end_location:@R> =>? { "(" <location:@L> "**" <e:Expression<"all">> ")" <end_location:@R> =>? {
@ -1599,7 +1599,7 @@ Atom<Goal>: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprDict { keys, values }.into() ast::ExprDict { keys, values }
) )
}, },
<location:@L> "{" <e1:DictEntry> <generators:CompFor> "}" <end_location:@R> => { <location:@L> "{" <e1:DictEntry> <generators:CompFor> "}" <end_location:@R> => {
@ -1610,25 +1610,25 @@ Atom<Goal>: ast::Expr = {
key: Box::new(e1.0), key: Box::new(e1.0),
value: Box::new(e1.1), value: Box::new(e1.1),
generators, generators,
}.into() }
) )
}, },
<location:@L> "{" <elts:SetLiteralValues> "}" <end_location:@R> => ast::Expr::new( <location:@L> "{" <elts:SetLiteralValues> "}" <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSet { elts }.into() ast::ExprSet { elts }
), ),
<location:@L> "{" <elt:NamedExpressionTest> <generators:CompFor> "}" <end_location:@R> => { <location:@L> "{" <elt:NamedExpressionTest> <generators:CompFor> "}" <end_location:@R> => {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSetComp { elt: Box::new(elt), generators }.into() ast::ExprSetComp { elt: Box::new(elt), generators }
) )
}, },
<location:@L> "True" <end_location:@R> => ast::Expr::new(location..end_location, ast::ExprConstant { value: true.into(), kind: None }.into()), <location:@L> "True" <end_location:@R> => ast::Expr::new(location..end_location, ast::ExprConstant { value: true.into(), kind: None }),
<location:@L> "False" <end_location:@R> => ast::Expr::new(location..end_location, ast::ExprConstant { value: false.into(), kind: None }.into()), <location:@L> "False" <end_location:@R> => ast::Expr::new(location..end_location, ast::ExprConstant { value: false.into(), kind: None }),
<location:@L> "None" <end_location:@R> => ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::None, kind: None }.into()), <location:@L> "None" <end_location:@R> => ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::None, kind: None }),
<location:@L> "..." <end_location:@R> => ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::Ellipsis, kind: None }.into()), <location:@L> "..." <end_location:@R> => ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::Ellipsis, kind: None }),
}; };
ListLiteralValues: Vec<ast::Expr> = { ListLiteralValues: Vec<ast::Expr> = {
@ -1682,7 +1682,7 @@ GenericList<Element>: ast::Expr = {
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts, ctx: ast::ExprContext::Load }.into() ast::ExprTuple { elts, ctx: ast::ExprContext::Load }
) )
} }
} }
@ -1693,7 +1693,7 @@ StarExpr: ast::Expr = {
<location:@L> "*" <e:Expression<"all">> <end_location:@R> => ast::Expr::new( <location:@L> "*" <e:Expression<"all">> <end_location:@R> => ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprStarred { value: Box::new(e), ctx: ast::ExprContext::Load }.into(), ast::ExprStarred { value: Box::new(e), ctx: ast::ExprContext::Load },
) )
}; };
@ -1730,7 +1730,7 @@ FunctionArgument: (Option<(TextSize, TextSize, Option<ast::Identifier>)>, ast::E
ast::ExprGeneratorExp { ast::ExprGeneratorExp {
elt: Box::new(e), elt: Box::new(e),
generators: c, generators: c,
}.into() }
), ),
None => e, None => e,
}; };
@ -1741,7 +1741,7 @@ FunctionArgument: (Option<(TextSize, TextSize, Option<ast::Identifier>)>, ast::E
let expr = ast::Expr::new( let expr = ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprStarred { value: Box::new(e), ctx: ast::ExprContext::Load }.into(), ast::ExprStarred { value: Box::new(e), ctx: ast::ExprContext::Load },
); );
(None, expr) (None, expr)
}, },

246
parser/src/python.rs generated
View file

@ -1,5 +1,5 @@
// auto-generated: "lalrpop 0.20.0" // auto-generated: "lalrpop 0.20.0"
// sha3: 0198c5dceea306627c61f209b8fb7f17dffba455b06a7ba59f55447f864b84db // sha3: 94b68331f7fbb668c2e962084095e319cfff9ba09cd78a361c735e7e60c57497
use crate::{ use crate::{
ast, ast,
lexer::{LexicalError, LexicalErrorType}, lexer::{LexicalError, LexicalErrorType},
@ -36842,7 +36842,7 @@ fn __action21<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtDelete { targets: targets.into_iter().map(|expr| set_context(expr, ast::ExprContext::Del)).collect() }.into() ast::StmtDelete { targets: targets.into_iter().map(|expr| set_context(expr, ast::ExprContext::Del)).collect() }
) )
} }
} }
@ -36862,7 +36862,7 @@ fn __action22<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtExpr { value: Box::new(expression) }.into() ast::StmtExpr { value: Box::new(expression) }
) )
} else { } else {
let mut targets = vec![set_context(expression, ast::ExprContext::Store)]; let mut targets = vec![set_context(expression, ast::ExprContext::Store)];
@ -36877,7 +36877,7 @@ fn __action22<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtAssign { targets, value, type_comment: None }.into() ast::StmtAssign { targets, value, type_comment: None }
) )
} }
} }
@ -36901,7 +36901,7 @@ fn __action23<
target: Box::new(set_context(target, ast::ExprContext::Store)), target: Box::new(set_context(target, ast::ExprContext::Store)),
op, op,
value: Box::new(rhs) value: Box::new(rhs)
}.into(), },
) )
} }
} }
@ -36927,7 +36927,7 @@ fn __action24<
annotation: Box::new(annotation), annotation: Box::new(annotation),
value: rhs.map(Box::new), value: rhs.map(Box::new),
simple, simple,
}.into(), },
) )
} }
} }
@ -37187,7 +37187,7 @@ fn __action50<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtReturn { value: value.map(Box::new) }.into() ast::StmtReturn { value: value.map(Box::new) }
) )
} }
} }
@ -37204,7 +37204,7 @@ fn __action51<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtExpr { value: Box::new(expression) }.into() ast::StmtExpr { value: Box::new(expression) }
) )
} }
} }
@ -37230,7 +37230,7 @@ fn __action53<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtRaise { exc: None, cause: None }.into() ast::StmtRaise { exc: None, cause: None }
) )
} }
} }
@ -37249,7 +37249,7 @@ fn __action54<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtRaise { exc: Some(Box::new(t)), cause: c.map(|x| Box::new(x.1)) }.into() ast::StmtRaise { exc: Some(Box::new(t)), cause: c.map(|x| Box::new(x.1)) }
) )
} }
} }
@ -37267,7 +37267,7 @@ fn __action55<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtImport { names }.into() ast::StmtImport { names }
) )
} }
} }
@ -37292,7 +37292,7 @@ fn __action56<
level, level,
module, module,
names names
}.into(), },
) )
} }
} }
@ -37416,7 +37416,7 @@ fn __action66<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtGlobal { names }.into() ast::StmtGlobal { names }
) )
} }
} }
@ -37434,7 +37434,7 @@ fn __action67<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtNonlocal { names }.into() ast::StmtNonlocal { names }
) )
} }
} }
@ -37456,7 +37456,7 @@ fn __action68<
ast::StmtAssert { ast::StmtAssert {
test: Box::new(test), test: Box::new(test),
msg: msg.map(|e| Box::new(e.1)) msg: msg.map(|e| Box::new(e.1))
}.into() }
) )
} }
} }
@ -37560,7 +37560,7 @@ fn __action77<
ast::StmtMatch { ast::StmtMatch {
subject: Box::new(subject), subject: Box::new(subject),
cases cases
}.into() }
) )
} }
} }
@ -37593,7 +37593,7 @@ fn __action78<
ast::StmtMatch { ast::StmtMatch {
subject: Box::new(subject), subject: Box::new(subject),
cases cases
}.into() }
) )
} }
} }
@ -37634,10 +37634,10 @@ fn __action79<
ast::ExprTuple { ast::ExprTuple {
elts: subjects, elts: subjects,
ctx: ast::ExprContext::Load, ctx: ast::ExprContext::Load,
}.into(), },
)), )),
cases cases
}.into() }
) )
} }
} }
@ -37687,7 +37687,7 @@ fn __action82<
end_location, end_location,
ast::PatternMatchSequence { ast::PatternMatchSequence {
patterns: vec![pattern] patterns: vec![pattern]
}.into(), },
) )
} }
@ -37710,7 +37710,7 @@ fn __action83<
end_location, end_location,
ast::PatternMatchSequence { ast::PatternMatchSequence {
patterns patterns
}.into(), },
) )
} }
} }
@ -37765,7 +37765,7 @@ fn __action87<
ast::PatternMatchAs { ast::PatternMatchAs {
pattern: Some(Box::new(pattern)), pattern: Some(Box::new(pattern)),
name: Some(name), name: Some(name),
}.into(), },
)) ))
} }
} }
@ -37795,7 +37795,7 @@ fn __action89<
ast::Pattern::new( ast::Pattern::new(
location.. location..
end_location, end_location,
ast::PatternMatchOr { patterns }.into() ast::PatternMatchOr { patterns }
) )
} }
} }
@ -37993,7 +37993,7 @@ fn __action102<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprConstant { value, kind: None }.into() ast::ExprConstant { value, kind: None }
) )
} }
@ -38021,7 +38021,7 @@ fn __action104<
ast::ExprUnaryOp { ast::ExprUnaryOp {
op: ast::Unaryop::USub, op: ast::Unaryop::USub,
operand: Box::new(operand) operand: Box::new(operand)
}.into() }
) )
} }
@ -38042,7 +38042,7 @@ fn __action105<
left: Box::new(left), left: Box::new(left),
op, op,
right: Box::new(right), right: Box::new(right),
}.into() }
) )
} }
@ -38141,7 +38141,7 @@ fn __action113<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprName { id: name, ctx: ast::ExprContext::Load }.into(), ast::ExprName { id: name, ctx: ast::ExprContext::Load },
) )
} }
@ -38162,7 +38162,7 @@ fn __action114<
value: Box::new(name), value: Box::new(name),
attr, attr,
ctx: ast::ExprContext::Load, ctx: ast::ExprContext::Load,
}.into(), },
) )
} }
@ -38183,7 +38183,7 @@ fn __action115<
value: Box::new(e), value: Box::new(e),
attr, attr,
ctx: ast::ExprContext::Load, ctx: ast::ExprContext::Load,
}.into(), },
) )
} }
@ -38239,7 +38239,7 @@ fn __action120<
ast::ExprConstant { ast::ExprConstant {
value: ast::Constant::None, value: ast::Constant::None,
kind: None, kind: None,
}.into(), },
) )
} }
@ -38257,7 +38257,7 @@ fn __action121<
ast::ExprConstant { ast::ExprConstant {
value: true.into(), value: true.into(),
kind: None, kind: None,
}.into(), },
) )
} }
@ -38275,7 +38275,7 @@ fn __action122<
ast::ExprConstant { ast::ExprConstant {
value: false.into(), value: false.into(),
kind: None, kind: None,
}.into(), },
) )
} }
@ -38613,7 +38613,7 @@ fn __action138<
let x = ast::Stmt::new( let x = ast::Stmt::new(
i.0.. i.0..
end_location, end_location,
ast::StmtIf { test: Box::new(i.2), body: i.4, orelse: last }.into() ast::StmtIf { test: Box::new(i.2), body: i.4, orelse: last }
); );
last = vec![x]; last = vec![x];
} }
@ -38621,7 +38621,7 @@ fn __action138<
ast::Stmt::new( ast::Stmt::new(
location.. location..
end_location, end_location,
ast::StmtIf { test: Box::new(test), body, orelse: last }.into() ast::StmtIf { test: Box::new(test), body, orelse: last }
) )
} }
} }
@ -38651,7 +38651,7 @@ fn __action139<
test: Box::new(test), test: Box::new(test),
body, body,
orelse orelse
}.into(), },
) )
} }
} }
@ -38680,7 +38680,7 @@ fn __action140<
let target = Box::new(set_context(target, ast::ExprContext::Store)); let target = Box::new(set_context(target, ast::ExprContext::Store));
let iter = Box::new(iter); let iter = Box::new(iter);
let type_comment = None; let type_comment = None;
let node = if is_async.is_some() { let node: ast::StmtKind = if is_async.is_some() {
ast::StmtAsyncFor { target, iter, body, orelse, type_comment }.into() ast::StmtAsyncFor { target, iter, body, orelse, type_comment }.into()
} else { } else {
ast::StmtFor { target, iter, body, orelse, type_comment }.into() ast::StmtFor { target, iter, body, orelse, type_comment }.into()
@ -38719,7 +38719,7 @@ fn __action141<
handlers, handlers,
orelse, orelse,
finalbody, finalbody,
}.into(), },
) )
} }
} }
@ -38754,7 +38754,7 @@ fn __action142<
handlers, handlers,
orelse, orelse,
finalbody, finalbody,
}.into(), },
) )
} }
} }
@ -38782,7 +38782,7 @@ fn __action143<
handlers, handlers,
orelse, orelse,
finalbody, finalbody,
}.into(), },
) )
} }
} }
@ -38807,7 +38807,7 @@ fn __action144<
type_: Some(Box::new(typ)), type_: Some(Box::new(typ)),
name: None, name: None,
body, body,
}.into(), },
) )
} }
} }
@ -38832,7 +38832,7 @@ fn __action145<
type_: Some(Box::new(x.0)), type_: Some(Box::new(x.0)),
name: Some(x.2), name: Some(x.2),
body, body,
}.into(), },
) )
} }
} }
@ -38856,7 +38856,7 @@ fn __action146<
type_: typ.map(Box::new), type_: typ.map(Box::new),
name: None, name: None,
body, body,
}.into(), },
) )
} }
} }
@ -38880,7 +38880,7 @@ fn __action147<
type_: Some(Box::new(x.0)), type_: Some(Box::new(x.0)),
name: Some(x.2), name: Some(x.2),
body, body,
}.into(), },
) )
} }
} }
@ -38899,7 +38899,7 @@ fn __action148<
{ {
let end_location = body.last().unwrap().end(); let end_location = body.last().unwrap().end();
let type_comment = None; let type_comment = None;
let node = if is_async.is_some() { let node: ast::StmtKind = if is_async.is_some() {
ast::StmtAsyncWith { items, body, type_comment }.into() ast::StmtAsyncWith { items, body, type_comment }.into()
} else { } else {
ast::StmtWith { items, body, type_comment }.into() ast::StmtWith { items, body, type_comment }.into()
@ -38987,7 +38987,7 @@ fn __action154<
let returns = r.map(|x| Box::new(x.1)); let returns = r.map(|x| Box::new(x.1));
let end_location = body.last().unwrap().end(); let end_location = body.last().unwrap().end();
let type_comment = None; let type_comment = None;
let node = if is_async.is_some() { let node: ast::StmtKind = if is_async.is_some() {
ast::StmtAsyncFunctionDef { name, args, body, decorator_list, returns, type_comment }.into() ast::StmtAsyncFunctionDef { name, args, body, decorator_list, returns, type_comment }.into()
} else { } else {
ast::StmtFunctionDef { name, args, body, decorator_list, returns, type_comment }.into() ast::StmtFunctionDef { name, args, body, decorator_list, returns, type_comment }.into()
@ -39093,7 +39093,7 @@ fn __action159<
keywords, keywords,
body, body,
decorator_list, decorator_list,
}.into(), },
) )
} }
} }
@ -39124,7 +39124,7 @@ fn __action161<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprYield { value: value.map(Box::new) }.into() ast::ExprYield { value: value.map(Box::new) }
) )
} }
@ -39141,7 +39141,7 @@ fn __action162<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprYieldFrom { value: Box::new(e) }.into() ast::ExprYieldFrom { value: Box::new(e) }
) )
} }
@ -39181,10 +39181,10 @@ fn __action165<
target: Box::new(ast::Expr::new( target: Box::new(ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprName { id, ctx: ast::ExprContext::Store }.into(), ast::ExprName { id, ctx: ast::ExprContext::Store },
)), )),
value: Box::new(value), value: Box::new(value),
}.into() }
) )
} }
} }
@ -39221,7 +39221,7 @@ fn __action166<
ast::ExprLambda { ast::ExprLambda {
args: Box::new(p), args: Box::new(p),
body: Box::new(body) body: Box::new(body)
}.into() }
)) ))
} }
} }
@ -39448,7 +39448,7 @@ fn __action189<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts: dims, ctx: ast::ExprContext::Load }.into(), ast::ExprTuple { elts: dims, ctx: ast::ExprContext::Load },
) )
} }
} }
@ -39481,7 +39481,7 @@ fn __action191<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSlice { lower, upper, step }.into() ast::ExprSlice { lower, upper, step }
) )
} }
} }
@ -39615,7 +39615,7 @@ fn __action204<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprStarred { value: Box::new(e), ctx: ast::ExprContext::Load }.into(), ast::ExprStarred { value: Box::new(e), ctx: ast::ExprContext::Load },
) )
} }
@ -39699,7 +39699,7 @@ fn __action210<
ast::ExprGeneratorExp { ast::ExprGeneratorExp {
elt: Box::new(e), elt: Box::new(e),
generators: c, generators: c,
}.into() }
), ),
None => e, None => e,
}; };
@ -39733,7 +39733,7 @@ fn __action212<
let expr = ast::Expr::new( let expr = ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprStarred { value: Box::new(e), ctx: ast::ExprContext::Load }.into(), ast::ExprStarred { value: Box::new(e), ctx: ast::ExprContext::Load },
); );
(None, expr) (None, expr)
} }
@ -39854,7 +39854,7 @@ fn __action223<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBoolOp { op: ast::Boolop::Or, values }.into() ast::ExprBoolOp { op: ast::Boolop::Or, values }
) )
} }
} }
@ -39903,7 +39903,7 @@ fn __action227<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts, ctx: ast::ExprContext::Load }.into() ast::ExprTuple { elts, ctx: ast::ExprContext::Load }
) )
} }
} }
@ -39939,7 +39939,7 @@ fn __action229<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts, ctx: ast::ExprContext::Load }.into() ast::ExprTuple { elts, ctx: ast::ExprContext::Load }
) )
} }
} }
@ -39958,7 +39958,7 @@ fn __action230<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitOr, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitOr, right: Box::new(e2) }
) )
} }
@ -41181,7 +41181,7 @@ fn __action337<
test: Box::new(test), test: Box::new(test),
body: Box::new(body), body: Box::new(body),
orelse: Box::new(orelse), orelse: Box::new(orelse),
}.into() }
) )
} }
@ -41748,7 +41748,7 @@ fn __action395<
test: Box::new(test), test: Box::new(test),
body: Box::new(body), body: Box::new(body),
orelse: Box::new(orelse), orelse: Box::new(orelse),
}.into() }
) )
} }
@ -42099,7 +42099,7 @@ fn __action423<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitXor, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitXor, right: Box::new(e2) }
) )
} }
@ -42199,7 +42199,7 @@ fn __action432<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBoolOp { op: ast::Boolop::And, values }.into() ast::ExprBoolOp { op: ast::Boolop::And, values }
) )
} }
} }
@ -42340,7 +42340,7 @@ fn __action446<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not }.into() ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not }
) )
} }
@ -42414,7 +42414,7 @@ fn __action453<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitAnd, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitAnd, right: Box::new(e2) }
) )
} }
@ -42701,7 +42701,7 @@ fn __action481<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBoolOp { op: ast::Boolop::Or, values }.into() ast::ExprBoolOp { op: ast::Boolop::Or, values }
) )
} }
} }
@ -42882,7 +42882,7 @@ fn __action499<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBoolOp { op: ast::Boolop::And, values }.into() ast::ExprBoolOp { op: ast::Boolop::And, values }
) )
} }
} }
@ -42947,7 +42947,7 @@ fn __action505<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op, right: Box::new(e2) }
) )
} }
@ -42993,7 +42993,7 @@ fn __action509<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprCompare { left: Box::new(left), ops, comparators }.into() ast::ExprCompare { left: Box::new(left), ops, comparators }
) )
} }
} }
@ -43049,7 +43049,7 @@ fn __action514<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }
) )
} }
@ -43074,7 +43074,7 @@ fn __action516<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not }.into() ast::ExprUnaryOp { operand: Box::new(e), op: ast::Unaryop::Not }
) )
} }
@ -43101,7 +43101,7 @@ fn __action518<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprCompare { left: Box::new(left), ops, comparators }.into() ast::ExprCompare { left: Box::new(left), ops, comparators }
) )
} }
} }
@ -43128,7 +43128,7 @@ fn __action520<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }
) )
} }
@ -43153,7 +43153,7 @@ fn __action522<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprUnaryOp { operand: Box::new(e), op }.into() ast::ExprUnaryOp { operand: Box::new(e), op }
) )
} }
@ -43179,7 +43179,7 @@ fn __action524<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitOr, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitOr, right: Box::new(e2) }
) )
} }
@ -43205,7 +43205,7 @@ fn __action526<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitXor, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitXor, right: Box::new(e2) }
) )
} }
@ -43231,7 +43231,7 @@ fn __action528<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e), op: ast::Operator::Pow, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(e), op: ast::Operator::Pow, right: Box::new(b) }
) )
} }
@ -43257,7 +43257,7 @@ fn __action530<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprAwait { value: Box::new(atom) }.into() ast::ExprAwait { value: Box::new(atom) }
) )
} }
} }
@ -43284,7 +43284,7 @@ fn __action532<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitAnd, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op: ast::Operator::BitAnd, right: Box::new(e2) }
) )
} }
@ -43310,7 +43310,7 @@ fn __action534<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e1), op, right: Box::new(e2) }.into() ast::ExprBinOp { left: Box::new(e1), op, right: Box::new(e2) }
) )
} }
@ -43347,7 +43347,7 @@ fn __action537<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprCall { func: Box::new(f), args: a.args, keywords: a.keywords }.into() ast::ExprCall { func: Box::new(f), args: a.args, keywords: a.keywords }
) )
} }
} }
@ -43366,7 +43366,7 @@ fn __action538<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSubscript { value: Box::new(e), slice: Box::new(s), ctx: ast::ExprContext::Load }.into() ast::ExprSubscript { value: Box::new(e), slice: Box::new(s), ctx: ast::ExprContext::Load }
) )
} }
@ -43383,7 +43383,7 @@ fn __action539<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprAttribute { value: Box::new(e), attr, ctx: ast::ExprContext::Load }.into() ast::ExprAttribute { value: Box::new(e), attr, ctx: ast::ExprContext::Load }
) )
} }
@ -43408,7 +43408,7 @@ fn __action541<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprConstant { value, kind: None }.into() ast::ExprConstant { value, kind: None }
) )
} }
@ -43423,7 +43423,7 @@ fn __action542<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprName { id: name, ctx: ast::ExprContext::Load }.into() ast::ExprName { id: name, ctx: ast::ExprContext::Load }
) )
} }
@ -43442,7 +43442,7 @@ fn __action543<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprList { elts, ctx: ast::ExprContext::Load }.into() ast::ExprList { elts, ctx: ast::ExprContext::Load }
) )
} }
} }
@ -43462,7 +43462,7 @@ fn __action544<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprListComp { elt: Box::new(elt), generators }.into() ast::ExprListComp { elt: Box::new(elt), generators }
) )
} }
} }
@ -43485,7 +43485,7 @@ fn __action545<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts, ctx: ast::ExprContext::Load }.into() ast::ExprTuple { elts, ctx: ast::ExprContext::Load }
) )
} }
} }
@ -43518,7 +43518,7 @@ fn __action546<
Ok(ast::Expr::new( Ok(ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts, ctx: ast::ExprContext::Load }.into(), ast::ExprTuple { elts, ctx: ast::ExprContext::Load },
)) ))
} }
} }
@ -43536,7 +43536,7 @@ fn __action547<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts: Vec::new(), ctx: ast::ExprContext::Load }.into() ast::ExprTuple { elts: Vec::new(), ctx: ast::ExprContext::Load }
) )
} }
@ -43566,7 +43566,7 @@ fn __action549<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprGeneratorExp { elt: Box::new(elt), generators }.into() ast::ExprGeneratorExp { elt: Box::new(elt), generators }
) )
} }
} }
@ -43609,7 +43609,7 @@ fn __action551<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprDict { keys, values }.into() ast::ExprDict { keys, values }
) )
} }
} }
@ -43633,7 +43633,7 @@ fn __action552<
key: Box::new(e1.0), key: Box::new(e1.0),
value: Box::new(e1.1), value: Box::new(e1.1),
generators, generators,
}.into() }
) )
} }
} }
@ -43651,7 +43651,7 @@ fn __action553<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSet { elts }.into() ast::ExprSet { elts }
) )
} }
@ -43670,7 +43670,7 @@ fn __action554<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSetComp { elt: Box::new(elt), generators }.into() ast::ExprSetComp { elt: Box::new(elt), generators }
) )
} }
} }
@ -43683,7 +43683,7 @@ fn __action555<
(_, end_location, _): (TextSize, TextSize, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Expr ) -> ast::Expr
{ {
ast::Expr::new(location..end_location, ast::ExprConstant { value: true.into(), kind: None }.into()) ast::Expr::new(location..end_location, ast::ExprConstant { value: true.into(), kind: None })
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -43694,7 +43694,7 @@ fn __action556<
(_, end_location, _): (TextSize, TextSize, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Expr ) -> ast::Expr
{ {
ast::Expr::new(location..end_location, ast::ExprConstant { value: false.into(), kind: None }.into()) ast::Expr::new(location..end_location, ast::ExprConstant { value: false.into(), kind: None })
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -43705,7 +43705,7 @@ fn __action557<
(_, end_location, _): (TextSize, TextSize, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Expr ) -> ast::Expr
{ {
ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::None, kind: None }.into()) ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::None, kind: None })
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -43716,7 +43716,7 @@ fn __action558<
(_, end_location, _): (TextSize, TextSize, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Expr ) -> ast::Expr
{ {
ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::Ellipsis, kind: None }.into()) ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::Ellipsis, kind: None })
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -43732,7 +43732,7 @@ fn __action559<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }
) )
} }
@ -43758,7 +43758,7 @@ fn __action561<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(a), op, right: Box::new(b) }
) )
} }
@ -43898,7 +43898,7 @@ fn __action575<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprUnaryOp { operand: Box::new(e), op }.into() ast::ExprUnaryOp { operand: Box::new(e), op }
) )
} }
@ -43924,7 +43924,7 @@ fn __action577<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprBinOp { left: Box::new(e), op: ast::Operator::Pow, right: Box::new(b) }.into() ast::ExprBinOp { left: Box::new(e), op: ast::Operator::Pow, right: Box::new(b) }
) )
} }
@ -43950,7 +43950,7 @@ fn __action579<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprAwait { value: Box::new(atom) }.into() ast::ExprAwait { value: Box::new(atom) }
) )
} }
} }
@ -43988,7 +43988,7 @@ fn __action582<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprCall { func: Box::new(f), args: a.args, keywords: a.keywords }.into() ast::ExprCall { func: Box::new(f), args: a.args, keywords: a.keywords }
) )
} }
} }
@ -44007,7 +44007,7 @@ fn __action583<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSubscript { value: Box::new(e), slice: Box::new(s), ctx: ast::ExprContext::Load }.into() ast::ExprSubscript { value: Box::new(e), slice: Box::new(s), ctx: ast::ExprContext::Load }
) )
} }
@ -44024,7 +44024,7 @@ fn __action584<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprAttribute { value: Box::new(e), attr, ctx: ast::ExprContext::Load }.into() ast::ExprAttribute { value: Box::new(e), attr, ctx: ast::ExprContext::Load }
) )
} }
@ -44049,7 +44049,7 @@ fn __action586<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprConstant { value, kind: None }.into() ast::ExprConstant { value, kind: None }
) )
} }
@ -44064,7 +44064,7 @@ fn __action587<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprName { id: name, ctx: ast::ExprContext::Load }.into() ast::ExprName { id: name, ctx: ast::ExprContext::Load }
) )
} }
@ -44083,7 +44083,7 @@ fn __action588<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprList { elts, ctx: ast::ExprContext::Load }.into() ast::ExprList { elts, ctx: ast::ExprContext::Load }
) )
} }
} }
@ -44103,7 +44103,7 @@ fn __action589<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprListComp { elt: Box::new(elt), generators }.into() ast::ExprListComp { elt: Box::new(elt), generators }
) )
} }
} }
@ -44135,7 +44135,7 @@ fn __action590<
Ok(ast::Expr::new( Ok(ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts, ctx: ast::ExprContext::Load }.into(), ast::ExprTuple { elts, ctx: ast::ExprContext::Load },
)) ))
} }
} }
@ -44153,7 +44153,7 @@ fn __action591<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprTuple { elts: Vec::new(), ctx: ast::ExprContext::Load }.into() ast::ExprTuple { elts: Vec::new(), ctx: ast::ExprContext::Load }
) )
} }
@ -44183,7 +44183,7 @@ fn __action593<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprGeneratorExp { elt: Box::new(elt), generators }.into() ast::ExprGeneratorExp { elt: Box::new(elt), generators }
) )
} }
} }
@ -44226,7 +44226,7 @@ fn __action595<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprDict { keys, values }.into() ast::ExprDict { keys, values }
) )
} }
} }
@ -44250,7 +44250,7 @@ fn __action596<
key: Box::new(e1.0), key: Box::new(e1.0),
value: Box::new(e1.1), value: Box::new(e1.1),
generators, generators,
}.into() }
) )
} }
} }
@ -44268,7 +44268,7 @@ fn __action597<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSet { elts }.into() ast::ExprSet { elts }
) )
} }
@ -44287,7 +44287,7 @@ fn __action598<
ast::Expr::new( ast::Expr::new(
location.. location..
end_location, end_location,
ast::ExprSetComp { elt: Box::new(elt), generators }.into() ast::ExprSetComp { elt: Box::new(elt), generators }
) )
} }
} }
@ -44300,7 +44300,7 @@ fn __action599<
(_, end_location, _): (TextSize, TextSize, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Expr ) -> ast::Expr
{ {
ast::Expr::new(location..end_location, ast::ExprConstant { value: true.into(), kind: None }.into()) ast::Expr::new(location..end_location, ast::ExprConstant { value: true.into(), kind: None })
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -44311,7 +44311,7 @@ fn __action600<
(_, end_location, _): (TextSize, TextSize, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Expr ) -> ast::Expr
{ {
ast::Expr::new(location..end_location, ast::ExprConstant { value: false.into(), kind: None }.into()) ast::Expr::new(location..end_location, ast::ExprConstant { value: false.into(), kind: None })
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -44322,7 +44322,7 @@ fn __action601<
(_, end_location, _): (TextSize, TextSize, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Expr ) -> ast::Expr
{ {
ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::None, kind: None }.into()) ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::None, kind: None })
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -44333,7 +44333,7 @@ fn __action602<
(_, end_location, _): (TextSize, TextSize, TextSize), (_, end_location, _): (TextSize, TextSize, TextSize),
) -> ast::Expr ) -> ast::Expr
{ {
ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::Ellipsis, kind: None }.into()) ast::Expr::new(location..end_location, ast::ExprConstant { value: ast::Constant::Ellipsis, kind: None })
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]

View file

@ -629,8 +629,7 @@ pub(crate) fn parse_strings(
ast::ExprConstant { ast::ExprConstant {
value: Constant::Bytes(content), value: Constant::Bytes(content),
kind: None, kind: None,
} },
.into(),
)); ));
} }
@ -652,8 +651,7 @@ pub(crate) fn parse_strings(
ast::ExprConstant { ast::ExprConstant {
value: Constant::Str(content.join("")), value: Constant::Str(content.join("")),
kind: initial_kind, kind: initial_kind,
} },
.into(),
)); ));
} }
@ -667,8 +665,7 @@ pub(crate) fn parse_strings(
ast::ExprConstant { ast::ExprConstant {
value: Constant::Str(current.drain(..).join("")), value: Constant::Str(current.drain(..).join("")),
kind: initial_kind.clone(), kind: initial_kind.clone(),
} },
.into(),
) )
}; };
@ -695,7 +692,7 @@ pub(crate) fn parse_strings(
Ok(Expr::new( Ok(Expr::new(
initial_start..last_end, initial_start..last_end,
ast::ExprJoinedStr { values: deduped }.into(), ast::ExprJoinedStr { values: deduped },
)) ))
} }