Hi Laun,

Can you take a look at this regression?
  https://issues.jboss.org/browse/JBRULES-2849

I believe the usage of "?" in the regexes is wrong (which is causing the issue).
For example: regex "(?<=\\W|^)-\\s*\\s+(.*?)\\s+is\\s+(.*?)$"

The "?" means the character before me might or might not be there.
so "ab?c" matches on "abc" and "ac"
The "(" means start of a group.
So "(?" should fail-fast (but it doesn't, just behave differently in jdk5 and jdk6).
Also ".*?" should fail-fast: either you want ".*" (none or more) or ".+" (one ore more).

Op 24-12-10 11:23, Wolfgang Laun schreef:
This is a summary of the currently implemented new features for the DSL expansion. I'll have to add tests and documentation, but before doing so, I'd like to learn whether there are any objections (resulting in the removal) or suggestions for improvement. Myself, I'm not sure about one or two items which I've marked with "(?)". Also, there's a couple of items which might gain from easy-to-implement additions, see "Votes, please". An example showing most of the new options is given below.
  1. The right hand side of entry definitions can be empty. (Useful for deleting "filler" phrases.)
  2. Long entry lines can be split without the need of escaping EOL:
  3. The special comment introduction "#/" is used to mark a line containing debug options. Currently recognized keywords are:
  4. Variable substitution uses the definition of that variable seen last in the current when or then part expansion. not just from the current line. (But this probably should keep variables from the when part for the following then part. Votes, please.)
  5. The value used in a variable substitution can be modified on the fly by adding one of the modifiers after and '!' in the variable reference. Currently recognized modifiers are:
  6. Another modification of the value used for substituting the reference is by providing a "multiple choice" after an '!', consisting of strings separated alternatively by '?' and '/': If the string extracted from the DSLR line matches the string before a '?', the string following it is used for substitution; otherwise test the next choice. (?)
  7. A DSL value starting with a hyphen ('-') can also be used in a consequence to add another setter expression into a preceding "modify(x){}". (Should probably be extended to be able to handle the insertion of another parameter to any preceding method call and, as a special, but useful, case the concatenation to a preceding x.println() or x.print() call. Votes, please.)
DSL:
[when][][Tt]here is an?=
[when][]{entity} called {x}=
        ${entity!lc}: {entity!ucfirst}( $name: name=="{x!M?Mark/E?Edson/G?Geoffrey/unknown}")
[when][]and no other with the same {attr}=not {entity!ucfirst}( {attr} == ${attr} )
[then][]change person=modify($person)\{\}
[then][]- set {attr} to {value} = set{attr!ucfirst}( {value!num} )

DSLR:
rule "Rule 1"
when
    There is a PERSON called M
    and no other with the same name
then
    change person
    - set salary to US$9,999.99
    - set rank to "colonel"
end

DRL:
   8  rule "Rule 1"
   9  when
  10  $person: Person( $name: name=="Mark")
  11  not Person( name == $name )
  12  then
  13  modify($person){ setSalary( 9999.99 ), setRank( "colonel" ) }
  14  end

Cheers
Wolfgang


_______________________________________________ rules-dev mailing list rules-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-dev

-- 
With kind regards,
Geoffrey De Smet