See inline.
Hi Droolers,
Regarding this blurb from the 5.2 DSL reference:
Given this DSL (test_expander.dsl)
[when](C|c)heese is "{type}"=Cheese(type=="{type}")
[when](is|hails|comes) from {country}=Cheese(country=="{country}")
[then]Add the message {message}=System.out.println({message});
And this DSLR
package com.sample
import com.sample.DroolsTest.Cheese;
expander test_expander.dsl
rule "rule_1"
when
Cheese is "cheddar" and is from Italy
then
Add the message "Cheddar IS from Italy"
end
I know that rule_2 fails because I removed the “distinctive characters” so
ANTLR is confused on what to capture.
It just seems so unnatural for a rule
author to have to somehow magically know to add quotes in order to merge
different DSL expressions to generate a composite DRL pattern.
2) We can no longer just write “Cheese is cheddar” by itself but are
forced to write “Cheese is cheddar and” if we want to match only the first
expression. You might as well just combined the two expressions into one
since there is no real advantage now to having two expressions!
One nice thing would be for the Guvnor DSL editor to
1)try the capture greedily first,
2)get the annoying “no viable alternative error”,
3)CATCH the error instead of just giving up,
4)capture non-greedily and match only the first word,
5)then search for matching DSL expressions beyond that.
Or something like that.
The only time you should have to add quotes is if
the text you are matching actually contains multiple words. Anything else is
counter-intuitive.
Please tell me the planned replacement for DSL addresses
this!
Jeff