[rules-users] DSL Bug?
Stephen Masters
stephen.masters at me.com
Mon Feb 11 11:27:38 EST 2013
Unless you provide some means of separating the two values, it's not feasible for the parser to recognise them. That's why adding a space works for you. Think about the DSRL that could be written:
There is a fact 12345678
>From that, what is the "fact_name" and what is the "fact_label"?
But add a space to your DSL and given:
There is a fact 123 45678
… it's clear that the fact_name is 123 and the fact_label is 45678.
Steve
On 11 Feb 2013, at 15:57, rjr201 <rich.j.riley at gmail.com> wrote:
> I've had the following problem when creating a DSL. Not sure if it's a bug,
> but it confused me for a good 40 minutes so thought I'd mention it here in
> case others have the same problem..
>
> If I create a DSL like this:
>
> [when]There is a fact {fact_name}{fact_label}={fact_label}:{fact_name}()
>
> And create a rule in the guided editor that has Object as the {fact_name}
> and $obj as the {fact_label} I get:
>
> 1. | rule "rule"
> 2. | dialect "mvel"
> 3. | when
> 4. | Object$obj:()
> 5. | then
> 6. | end
>
> as the source.
>
> At first I thought it was to do with putting quotation marks around the
> {}'s. But I've since found that if I put a space between {fact_name} and
> {fact_label} I get the expected result of:
>
> 1. | rule "rule"
> 2. | dialect "mvel"
> 3. | when
> 4. | $obj:Object()
> 5. | then
> 6. | end
>
> Again, sorry if this is down to my limited understanding of DSLs. Any
> further insights into why this happens or any other quirks of DSLs would be
> greatly appreciated as I'm going to be spending a lot of time with them in
> the not too distant future..
>
> Rich.
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/DSL-Bug-tp4022209.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
More information about the rules-users
mailing list