Skip to content

Enhance QueryUtils.parseAndVisit to support mixed AND/OR conditions with parentheses #100

@aureamunoz

Description

@aureamunoz

QueryUtils.parseAndVisit() currently cannot handle rule conditions that combine AND and OR operators with parentheses to define precedence. When both are present, the generated QueryVisitor includes simple, AND, and OR queries at the same level, causing the evaluation logic to always prioritize simple queries.

Example of a problematic condition:

java.annotation is 'org.springframework.boot.autoconfigure.SpringBootApplication' AND  
(java.annotation is 'org.springframework.web.bind.annotation.RestController' OR  
 java.annotation is 'org.springframework.stereotype.Service')

Expected

  • Parentheses and operator precedence should be properly parsed.
  • The resulting structure should represent the logical tree of the condition (nested AND/OR).
  • The evaluation logic in scan() should correctly combine results according to that tree.

Tasks

  • Extend the grammar (Query.g4) to support nested logical expressions.
  • Update QueryUtils.parseAndVisit() to build a hierarchical query tree.
  • Adjust QueryVisitor and related evaluation logic to process nested AND/OR combinations.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions