Skip to content

Fix operator precedence#43

Merged
MidnightDesign merged 1 commit into0.2.xfrom
operator-precedence
Oct 16, 2025
Merged

Fix operator precedence#43
MidnightDesign merged 1 commit into0.2.xfrom
operator-precedence

Conversation

@MidnightDesign
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes operator precedence issues in an expression parser by ensuring that comparison operators (===, >) have higher precedence than logical operators (&& and ||). The fix introduces a new parsing method that stops at logical operators, allowing comparisons to be evaluated first.

  • Added parseExpressionUntilLogical() method to handle operator precedence correctly
  • Updated comparison operators to use the new parsing method instead of recursive parseExpression()
  • Added comprehensive test cases covering various combinations of comparison and logical operators

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

File Description
src/Parser/ExpressionParser.php Implements operator precedence fix by adding new parsing method and updating comparison operator parsing
tests/unit/cases/precedence/*.txt Adds test cases for equality/greater-than operators with logical AND/OR operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MidnightDesign MidnightDesign merged commit 55be7b9 into 0.2.x Oct 16, 2025
25 checks passed
@MidnightDesign MidnightDesign deleted the operator-precedence branch October 16, 2025 05:00
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.

3 participants