-
-
Notifications
You must be signed in to change notification settings - Fork 2
Parser: implement comparison operators (<, >, <=, >=) #34
Copy link
Copy link
Labels
compatibilitylibmagic compatibility and migrationlibmagic compatibility and migrationenhancementNew feature or requestNew feature or requestevaluatorRule evaluation engine and logicRule evaluation engine and logicparserMagic file parsing components and grammarMagic file parsing components and grammarpriority:criticalMust have, blocks releaseMust have, blocks release
Milestone
Metadata
Metadata
Assignees
Labels
compatibilitylibmagic compatibility and migrationlibmagic compatibility and migrationenhancementNew feature or requestNew feature or requestevaluatorRule evaluation engine and logicRule evaluation engine and logicparserMagic file parsing components and grammarMagic file parsing components and grammarpriority:criticalMust have, blocks releaseMust have, blocks release
Type
Fields
Give feedbackNo fields configured for Feature.
Summary
Implement comparison operators
<,>,<=,>=in both the parser and evaluator. These are currently explicitly rejected by the parser (grammar.rs) and are critical for compatibility with real magic files.Context
Many magic rules use comparison operators for version checks, size validation, and range matching. Without these, the vast majority of system magic files cannot be fully interpreted.
Current state: Only
=,!=,&, and&maskoperators are implemented.Acceptance Criteria
<,>,<=,>=operators in magic rule syntaxOperatorenum extended withLessThan,GreaterThan,LessEqual,GreaterEqualvariantsImpact
HIGH - Would unlock ~40% more magic file compatibility. Used extensively in format version detection, file size checks, and range-based matching.
Files to Modify
src/parser/ast.rs- ExtendOperatorenumsrc/parser/grammar.rs- Parse new operatorssrc/evaluator/operators.rs- Implement comparison logicReferences