I'm having problems using DSL's in the guided editor specifically within the
eclipse plugin. The simplest of rules using a DSL report a syntax error in
eclipse. However, the same DSL rules (using the same DSL) are validated
correctly in the normal drl editor in eclipse, and in the guided editor in
the BRMS. Whatever condition I add to a rule in the eclipse guided editor,
it always reports a validation error along the lines that the first word in
the when part of my DSL rule is an unexpected token. It's as if the editor
is trying to validate the DSL sentence itself, rather than the translation
of the DSL sentence. Here's the simplest example I could think off to
reproduce the issue:
1. I have a single DSL sentence in my .dsl file as follows:
[condition][]string=String()
(I've used String as it avoids having to import a model to recreate this
issue)
2. In eclipse I create a new file called rule.package containing:
package com.example
import java.lang.String
3. In the guided editor in eclipse I create a new rule by clicking on the
add condition on the When part of the rule and choosing the single DSL
sentence in the drop-down list displayed by the add condition dialog to get
the rule:
When
string
Then
4. I get an error in the list of error that says that string is an
unexpected token.
5. I noticed that in the "Generated DRL (read only)" tab under the guided
editor, it also displays the rule in DSL format, and not translated into the
expressions on the right-hand-side of the DSL definition. This made me
wonder if the eclipse guided editor is trying to validate the DSL rule
without applying the DSL translation. So I deliberately changed my DSL so
that the left-hand-side just happened to be a valid technical rule
condition:
[condition][]String()=String()
I also changed the rule in the guided editor to
When
String()
Then
This was validated without any issues, but in theory is exactly the same
rule as in point 3 as, apart from keywords, it shouldn't matter what is on
the left-hand -side of the DSL definition.
As I said at the beginning, the dsl and rule in point 1 and 3 work fine with
the normal drl editor in the eclipse plugin, and within the guided editor in
the BRMS.
I also tried adding the expander definition to point to my DSL file in the
rule.package file, but that made no difference either.
Regards
Shahad
Show replies by date