Skip to content

Commit 3dd786f

Browse files
authored
Merge pull request RustPython#4348 from harupy/fix-binop-location
Fix the location of `BinOp`
2 parents ac9be9f + 083191d commit 3dd786f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compiler/parser/python.lalrpop

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ CompOp: ast::Cmpop = {
870870

871871
Expression = ExpressionAs<ExprGoal>;
872872
ExpressionAs<Goal>: Goal = {
873-
<e1:Expression> <location:@L> "|" <e2:XorExpression> <end_location:@R> => ast::Expr {
873+
<location:@L> <e1:Expression> "|" <e2:XorExpression> <end_location:@R> => ast::Expr {
874874
location,
875875
end_location: Some(end_location),
876876
custom: (),
@@ -881,7 +881,7 @@ ExpressionAs<Goal>: Goal = {
881881

882882
XorExpression = XorExpressionAs<ExprGoal>;
883883
XorExpressionAs<Goal>: Goal = {
884-
<e1:XorExpression> <location:@L> "^" <e2:AndExpression> <end_location:@R> => ast::Expr {
884+
<location:@L> <e1:XorExpression> "^" <e2:AndExpression> <end_location:@R> => ast::Expr {
885885
location,
886886
end_location: Some(end_location),
887887
custom: (),
@@ -892,7 +892,7 @@ XorExpressionAs<Goal>: Goal = {
892892

893893
AndExpression = AndExpressionAs<ExprGoal>;
894894
AndExpressionAs<Goal>: Goal = {
895-
<e1:AndExpression> <location:@L> "&" <e2:ShiftExpression> <end_location:@R> => ast::Expr {
895+
<location:@L> <e1:AndExpression> "&" <e2:ShiftExpression> <end_location:@R> => ast::Expr {
896896
location,
897897
end_location: Some(end_location),
898898
custom: (),
@@ -903,7 +903,7 @@ AndExpressionAs<Goal>: Goal = {
903903

904904
ShiftExpression = ShiftExpressionAs<ExprGoal>;
905905
ShiftExpressionAs<Goal>: Goal = {
906-
<e1:ShiftExpression> <location:@L> <op:ShiftOp> <e2:ArithmeticExpression> <end_location:@R> => ast::Expr {
906+
<location:@L> <e1:ShiftExpression> <op:ShiftOp> <e2:ArithmeticExpression> <end_location:@R> => ast::Expr {
907907
location,
908908
end_location: Some(end_location),
909909
custom: (),
@@ -935,7 +935,7 @@ AddOp: ast::Operator = {
935935

936936
Term = TermAs<ExprGoal>;
937937
TermAs<Goal>: Goal = {
938-
<a:Term> <location:@L> <op:MulOp> <b:Factor> <end_location:@R> => ast::Expr {
938+
<location:@L> <a:Term> <op:MulOp> <b:Factor> <end_location:@R> => ast::Expr {
939939
location,
940940
end_location: Some(end_location),
941941
custom: (),
@@ -971,7 +971,7 @@ UnaryOp: ast::Unaryop = {
971971

972972
Power = PowerAs<ExprGoal>;
973973
PowerAs<Goal>: Goal = {
974-
<e:AtomExpr> <location:@L> "**" <b:Factor> <end_location:@R> => ast::Expr {
974+
<location:@L> <e:AtomExpr> "**" <b:Factor> <end_location:@R> => ast::Expr {
975975
location,
976976
end_location: Some(end_location),
977977
custom: (),

compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_lambda.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)