Merge pull request #4348 from harupy/fix-binop-location

Fix the location of `BinOp`
This commit is contained in:
Jeong YunWon 2022-12-24 09:09:24 +09:00 committed by GitHub
commit 607c97e57e
2 changed files with 7 additions and 7 deletions

View file

@ -870,7 +870,7 @@ CompOp: ast::Cmpop = {
Expression = ExpressionAs<ExprGoal>; Expression = ExpressionAs<ExprGoal>;
ExpressionAs<Goal>: Goal = { ExpressionAs<Goal>: Goal = {
<e1:Expression> <location:@L> "|" <e2:XorExpression> <end_location:@R> => ast::Expr { <location:@L> <e1:Expression> "|" <e2:XorExpression> <end_location:@R> => ast::Expr {
location, location,
end_location: Some(end_location), end_location: Some(end_location),
custom: (), custom: (),
@ -881,7 +881,7 @@ ExpressionAs<Goal>: Goal = {
XorExpression = XorExpressionAs<ExprGoal>; XorExpression = XorExpressionAs<ExprGoal>;
XorExpressionAs<Goal>: Goal = { XorExpressionAs<Goal>: Goal = {
<e1:XorExpression> <location:@L> "^" <e2:AndExpression> <end_location:@R> => ast::Expr { <location:@L> <e1:XorExpression> "^" <e2:AndExpression> <end_location:@R> => ast::Expr {
location, location,
end_location: Some(end_location), end_location: Some(end_location),
custom: (), custom: (),
@ -892,7 +892,7 @@ XorExpressionAs<Goal>: Goal = {
AndExpression = AndExpressionAs<ExprGoal>; AndExpression = AndExpressionAs<ExprGoal>;
AndExpressionAs<Goal>: Goal = { AndExpressionAs<Goal>: Goal = {
<e1:AndExpression> <location:@L> "&" <e2:ShiftExpression> <end_location:@R> => ast::Expr { <location:@L> <e1:AndExpression> "&" <e2:ShiftExpression> <end_location:@R> => ast::Expr {
location, location,
end_location: Some(end_location), end_location: Some(end_location),
custom: (), custom: (),
@ -903,7 +903,7 @@ AndExpressionAs<Goal>: Goal = {
ShiftExpression = ShiftExpressionAs<ExprGoal>; ShiftExpression = ShiftExpressionAs<ExprGoal>;
ShiftExpressionAs<Goal>: Goal = { ShiftExpressionAs<Goal>: Goal = {
<e1:ShiftExpression> <location:@L> <op:ShiftOp> <e2:ArithmeticExpression> <end_location:@R> => ast::Expr { <location:@L> <e1:ShiftExpression> <op:ShiftOp> <e2:ArithmeticExpression> <end_location:@R> => ast::Expr {
location, location,
end_location: Some(end_location), end_location: Some(end_location),
custom: (), custom: (),
@ -935,7 +935,7 @@ AddOp: ast::Operator = {
Term = TermAs<ExprGoal>; Term = TermAs<ExprGoal>;
TermAs<Goal>: Goal = { TermAs<Goal>: Goal = {
<a:Term> <location:@L> <op:MulOp> <b:Factor> <end_location:@R> => ast::Expr { <location:@L> <a:Term> <op:MulOp> <b:Factor> <end_location:@R> => ast::Expr {
location, location,
end_location: Some(end_location), end_location: Some(end_location),
custom: (), custom: (),
@ -971,7 +971,7 @@ UnaryOp: ast::Unaryop = {
Power = PowerAs<ExprGoal>; Power = PowerAs<ExprGoal>;
PowerAs<Goal>: Goal = { PowerAs<Goal>: Goal = {
<e:AtomExpr> <location:@L> "**" <b:Factor> <end_location:@R> => ast::Expr { <location:@L> <e:AtomExpr> "**" <b:Factor> <end_location:@R> => ast::Expr {
location, location,
end_location: Some(end_location), end_location: Some(end_location),
custom: (), custom: (),

View file

@ -78,7 +78,7 @@ expression: parse_ast
body: Located { body: Located {
location: Location { location: Location {
row: 1, row: 1,
column: 15, column: 13,
}, },
end_location: Some( end_location: Some(
Location { Location {