Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-295

Add unary plus operator

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1
    • 3.2
    • None

    Description

      WHAT
      Introduce a new operator, the unary plus as in '+4' or '+b' expressions. JEXL arithmetic already allows using a unary minus operator (the negate operation) so there is logic in having the counterpart.

      The proposed default behaviour would be to:

      • call the 'Math.abs(...)' method for numbers
      • return true for boolean
      • could uppercase strings ? (should '-' lowercase strings ??)

      HOW

      • Follow the unary minus syntax and construct in the .jjt / ASTUnaryPlus / ParserVisitor
      • Implement Interpreter, Debugger
      • Implement abs in JexlArithmetic

      Attachments

        Issue Links

          Activity

            People

              henrib Henri Biestro
              henrib Henri Biestro
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: