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

Numeric ops #1123

Merged
merged 1 commit into from
Dec 20, 2022
Merged

Numeric ops #1123

merged 1 commit into from
Dec 20, 2022

Conversation

aziz-mu
Copy link
Contributor

@aziz-mu aziz-mu commented Dec 18, 2022

This PR Implements some of the functions from issue #942 . Specifically, it implements for integers:

  • bitwise and (&)
  • bitwise OR (|)
  • bit shift left (<<)
  • bit shift right (>>)
    New tests are included as well. I'll do factorial in another PR as it requires additional parser support

Copy link
Contributor

@andyfengHKU andyfengHKU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an additional comment on factorial. If factorial can be supported by simply modifying

oC_UnaryAddOrSubtractExpression 
    : ( MINUS SP? )? oC_StringListNullOperatorExpression ;

to

oC_UnaryAddSubtractOrFactorialExpression
    : ( MINUS | FACTORIAL SP? )? oC_StringListNullOperatorExpression ;

then let's do it. Otherwise we don't need this syntax sugar for factorial given there is already a factorial function exists in the code base.

My concern is on the antlr4 side. Antlr4's performance will degrade as we add more and more rules.

@aziz-mu
Copy link
Contributor Author

aziz-mu commented Dec 19, 2022

Turns out adding factorial syntax was a lot easier than I thought, so I added it as part of this PR too.

src/antlr4/Cypher.g4 Outdated Show resolved Hide resolved
@aziz-mu aziz-mu merged commit c5cb218 into master Dec 20, 2022
@aziz-mu aziz-mu deleted the numeric-ops branch December 20, 2022 17:40
@ray6080 ray6080 added the feature New features or missing components of existing features label Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features or missing components of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants