Skip to content

Visitor pattern for Expression#43

Open
chrstphlbr wants to merge 34 commits intodvare:masterfrom
chrstphlbr:expression-visitor
Open

Visitor pattern for Expression#43
chrstphlbr wants to merge 34 commits intodvare:masterfrom
chrstphlbr:expression-visitor

Conversation

@chrstphlbr
Copy link

@chrstphlbr chrstphlbr commented Apr 10, 2024

Hi,

I added the Visitor pattern (org.dvare.expression.ExpressionVisitor) for Expression (and all its subclasses) to support, e.g., transformations of expressions in a neat way.
I also added a base implementation org.dvare.expression.BaseExpressionVisitor that traverses the expression tree and returns copies of each node, and tests to ensure the correct behavior.

In addition, I changed org.dvare.expression.operation.utility.LeftPriority and org.dvare.expression.operation.utility.RightPriority to remain in the parsed expression (when Leftpriority::parse is called), to retain the information of groupings after a visitor pass.

I further implemented the distinct function in org.dvare.expression.operation.list.DistinctOperation, added tests for it, and implemented the corresponding visitor methods.

I added support for boolean literals and variables in logical operator expressions and if-then-else conditionals.

Let me know if there is anything to adapt.

Christoph

… the parsed expression (otherwise vistor-based transformations lose the initial grouping)
@hammadirshad hammadirshad self-assigned this Jun 25, 2024
@hammadirshad
Copy link
Member

Thankyou @chrstphlbr for PR
I will look into soon

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.

2 participants