Cayenne
  1. Cayenne
  2. CAY-1726

Expression parser support for bit operators, support for << and >>

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2.M1
    • Component/s: Core Library
    • Labels:
      None

      Description

      Building upon CAY-1693, let's create support for bit operations in String expressions. Parser BNF [1] need to be expanded to include &, |, ^, ~, hence allowing creation of these expressions via 'Expression.fromString(..)". Some examples of how those might look like:

      someProperty & 3 = 1
      someOtherProperty | 1 = 0
      someOtherProperty ^ 1 = 0
      ~yetAnotherProperty = 1
      someProperty & ~yetAnotherProperty = 1

      [1] http://cayenne.apache.org/doc/bnf-for-expressionparser.html

        Activity

        Hide
        Vital Zanko added a comment - - edited

        Hi there guys,

        Let's say here is a beta version patch https://issues.apache.org/jira/secure/attachment/12551341/0001-Cayenne-3.1-supplies-bitwise-operations.patch

        Now bitwise operations are defined in Java CC *.jjt file and implemented its evaluation in Java. Expression parser class and its helper classes are re-generated by Java CC compiler and legacy Java sources for build replaced. SelectQueryTest and ExpressionTest are extended to call bit operations. The last checks bit operations parsing by expression parser, evaluating and its correct precedence in computing process. Those JUnit tests are passed succesfully.

        Kindly appreciate your feedback.

        Show
        Vital Zanko added a comment - - edited Hi there guys, Let's say here is a beta version patch https://issues.apache.org/jira/secure/attachment/12551341/0001-Cayenne-3.1-supplies-bitwise-operations.patch Now bitwise operations are defined in Java CC *.jjt file and implemented its evaluation in Java. Expression parser class and its helper classes are re-generated by Java CC compiler and legacy Java sources for build replaced. SelectQueryTest and ExpressionTest are extended to call bit operations. The last checks bit operations parsing by expression parser, evaluating and its correct precedence in computing process. Those JUnit tests are passed succesfully. Kindly appreciate your feedback.
        Hide
        Andrus Adamchik added a comment -

        (also this issue will be adding previously unsupported << and >>)

        Show
        Andrus Adamchik added a comment - (also this issue will be adding previously unsupported << and >>)
        Hide
        Andrus Adamchik added a comment -

        Committed to 3.2. Thanks Vital!

        Show
        Andrus Adamchik added a comment - Committed to 3.2. Thanks Vital!

          People

          • Assignee:
            Andrus Adamchik
            Reporter:
            Andrus Adamchik
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development