feat(cql2-text): add modulo, integer division, and power arithmetic operators - #151
Open
constantinius wants to merge 1 commit into
Open
feat(cql2-text): add modulo, integer division, and power arithmetic operators#151constantinius wants to merge 1 commit into
constantinius wants to merge 1 commit into
Conversation
…perators Implements three CQL2 arithmetic operators missing from the text parser: - Modulo (%): e.g. 'attr % 2 = 0' - Integer division (div): e.g. 'attr div 2 = 1' - Power (^): e.g. 'attr ^ 2 = 4' (right-associative) Changes span all layers: - ast.py: adds ArithmeticOp.MOD/INTDIV/POW enums and Mod/IntDiv/Pow dataclasses - cql2.py: extends ARITHMETIC_MAP with the three new operators - grammar.lark: introduces a 'power' precedence level above 'product' for right-associative exponentiation; adds mod and intdiv production rules; uses named filter terminals (_PERCENT, _INTDIV) so they don't bleed into transformer callbacks - parser.py: adds mod(), intdiv(), and pow() transformer methods - tests: adds test_modulo, test_integer_division, test_power
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.
Implements three CQL2 arithmetic operators missing from the text parser:
Changes span all layers: