Place set union and minus at same precedence, place xor above or in precedence, fix chained comparison parsing#658
Merged
Happypig375 merged 2 commits intomasterfrom Jan 21, 2026
Conversation
…recedence, fix chained comparison parsing
There was a problem hiding this comment.
Pull request overview
This pull request refactors operator precedence and parsing for comparison chains, Boolean operations, and set operations. The changes introduce a new EqualTo method to distinguish between chained and non-chained equality comparisons, adjust operator precedence levels (XOR above OR, set union/minus at same level), and fix chained comparison parsing to correctly expand chains like a < b = c into (a < b) and (b = c).
Changes:
- Adjusted precedence: XOR now at 50 (above OR at 30), set union and minus both at 20, conjunction at 70
- Added
EqualTomethod for non-chained equality;Equalizesfor chained equality - Fixed "provided" operator to be right-associative
- Replaced grammar rules to properly parse chained comparisons and consolidate set operations
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Entity.Definition.cs | Updated operator precedence values and fixed spelling |
| Entity.Discrete.Definition.cs | Added EqualTo method with documentation |
| Entity.Discrete.Classes.cs | Fixed Implication spelling |
| AngouriMath.g | Rewrote comparison parsing and consolidated set operations |
| AngouriMathParser.cs | Generated parser code from grammar changes |
| AngouriMathListener.cs | Updated listener interfaces for renamed rules |
| PriorityTest.cs | Updated tests for new precedence and parsing behavior |
| LatexTest.cs | Replaced Equalizes with EqualTo in tests |
| FromStringTest.cs | Added tests for chained vs non-chained equality |
| InnerSimplifyTest.cs | Updated expected test output |
| IntegrationTest.cs | Replaced Equalizes with EqualTo throughout |
| Simplification patterns | Updated to use EqualTo instead of Equalizes |
| Evaluation patterns | Updated to use EqualTo instead of Equalizes |
| MathS.cs | Updated Equality method to use EqualTo |
| ToString classes | Fixed Provided stringization with precedence checks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -3213,281 +3030,270 @@ public StatementContext statement() { | |||
| } | |||
|
|
|||
| private static int[] _serializedATN = { | |||
There was a problem hiding this comment.
Field '_serializedATN' can be 'readonly'.
Suggested change
| private static int[] _serializedATN = { | |
| private static readonly int[] _serializedATN = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.