Skip to content

Commit

Permalink
Merge pull request #1597 from actonlang/fix-issue-1522
Browse files Browse the repository at this point in the history
fix of #1522
  • Loading branch information
sydow authored Dec 5, 2023
2 parents 05c3993 + 325308b commit 60d8b31
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions compiler/Acton/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,11 @@ small_stmt = del_stmt <|> pass_stmt <|> flow_stmt <|> assert_stmt <|> var_stmt <
expr_stmt :: Parser S.Stmt
expr_stmt = addLoc $ do
o <- getOffset
try ((S.AugAssign NoLoc <$> target <*> augassign <*> rhs) <* assertNotData (Loc o o) "augmented assignment")
<|> try (S.Assign NoLoc <$> trysome assign <*> rhs) -- Single variable lhs matches here
<|> try (S.MutAssign NoLoc <$> target <* equals <*> rhs) -- and not here
<|> (((S.Expr NoLoc <$> rhs) <* assertNotData (Loc o o) "call") <?> "expression statement")
S.Assign NoLoc <$> some (try assign) <*> rhs -- Single variable lhs matches here
<|> (do t <- target
((S.AugAssign NoLoc t <$> augassign <*> rhs) <* assertNotData (Loc o o) "augmented assignment")
<|> (S.MutAssign NoLoc t <$> (equals *> rhs))) -- and not here
<|> (((S.Expr NoLoc <$> rhs) <* assertNotData (Loc o o) "call") <?> "expression statement")
where augassign :: Parser S.Aug
augassign = augops
where augops = S.PlusA <$ symbol "+="
Expand Down

0 comments on commit 60d8b31

Please sign in to comment.