Skip to content

fix(parse): use StarStar for ** precedence#743

Open
cuiweixie wants to merge 1 commit intoparadigmxyz:mainfrom
cuiweixie:fix/parse-starstar-precedence
Open

fix(parse): use StarStar for ** precedence#743
cuiweixie wants to merge 1 commit intoparadigmxyz:mainfrom
cuiweixie:fix/parse-starstar-precedence

Conversation

@cuiweixie
Copy link
Copy Markdown

Summary

Exponentiation (**) is lexed as TokenKind::StarStar, not BinOp(Star). The precedence loop was checking the wrong token kind, so chained exponentiation did not get the intended right associativity (a**b**c as a**(b**c)).

Changes

  • Compare against TokenKind::StarStar and adjust next_precedence accordingly for the ** operator.

Exponentiation is lexed as `TokenKind::StarStar`, not `BinOp(Star)`. Match
`StarStar` so chained `**` parses with right associativity as intended
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant