Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visitor pattern for Expression #43

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

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