Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2814

DSL variable definition may create strange effects

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • 6.0.0.Alpha1
    • 5.1.1.FINAL
    • drools-compiler-DSL
    • None

    Description

      The DSL parser accepts variable definitions

      {name} {name:pattern} {name:q:pattern}

      but also

      {name:xyz:}

      a) What is the purpose of "q"? It is tested in DSLMapWalker and influences what is used as a pattern, sometimes overriding a specified pattern: q pattern use-for-matching null null (.?) null pattern pattern X null (.?) X pattern pattern ENUM – (.?) DATE – (.?) BOOLEAN – (.*?)

      b) A "null" pattern is used for matching if

      {name:xyz:}

      is used.

      I think the "q" is a relic and should be discarded. A ':' as delimiter in an area where any character is possible (as in a pattern) is bound to create ambiguities.

      The "C" entry in the DSL below produces "null" in the pattern trying to match a condition; i.e., the string "null" is actually matched.

      A, E, F result in pattern "(.*?)"

      B, D use the pattern ("Boolean" or "Double", respectively)

      DSL:
      [when][]A

      {type} value=${type}: {type}

      ()
      [when][]B

      {type:Boolean} value=${type}: {type}

      ()
      [when][]C

      {type:xyz:} value=${type}: {type}

      ()
      [when][]D

      {type:xyz:Double} value=${type}: {type}

      ()
      [when][]E

      {type:ENUM:} value=${type}: {type}

      ()
      [when][]F

      {type:DATE:Float} value=${type}: {type}

      ()

      DSLR:
      rule "rule 1"
      when
      A Integer value
      B Boolean value
      C Character value # fails; use "null" instead of Character to get a match
      D Double value
      E Enum value
      F Float value
      then
      > System.out.println( "hello" );
      end

      Attachments

        Activity

          People

            etirelli@redhat.com Edson Tirelli
            laune Wolfgang Laun (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Archived:

              PagerDuty