[
https://jira.jboss.org/jira/browse/JBRULES-1970?page=com.atlassian.jira.p...
]
Edson Tirelli resolved JBRULES-1970.
------------------------------------
Fix Version/s: 5.0.0.CR1
Resolution: Done
Assignee: Edson Tirelli (was: Mark Proctor)
Ok, I see the problem and I fixed it in CR1. Although, for now, I would like to keep the
ability of adding comments not only as the first character in the line, as suggested by
JBRULES-1960. So, # is handled as a special character in the grammar and as so, it
requires escaping. The grammar mapping would be:
[condition][]Bedingung-\#19-MKM4 = eval ( $p.getTempVal("\#UML-ATZ-1") <
$p.getZvUmlStfr() )
Please note that I added a # on the left side of your expression just to make sure it
works there too, and both are escaped as any regexp special character. The escaping is
only required for the grammar, obviously, and does not affect the way users write the
sentences.
The following test case shows the example:
public void testExpandWithPound() throws IOException {
final String inputKey = "Bedingung-\\#19-MKM4";
final String inputValue = "eval ( $p.getTempVal(\"\\#UML-ATZ-1\")
< $p.getZvUmlStfr() )";
DSLMappingEntry entry = createEntry( inputKey,
inputValue );
assertEquals( "(\\W|^)Bedingung-#19-MKM4(\\W|$)",
entry.getKeyPattern().toString() );
assertEquals( "$1eval ( \\$p.getTempVal(\"#UML-ATZ-1\") <
\\$p.getZvUmlStfr() )$2",
entry.getValuePattern());
String result = entry.getKeyPattern().matcher( "Bedingung-#19-MKM4"
).replaceAll( entry.getValuePattern() );
assertEquals( result,
"eval ( $p.getTempVal(\"#UML-ATZ-1\") <
$p.getZvUmlStfr() )",
result );
}
Let me know if that fix the problem for you.
Thank you for reporting and providing example.
Edson
Error expanding DSL when #-Character is in right-side of
dsl-property
---------------------------------------------------------------------
Key: JBRULES-1970
URL:
https://jira.jboss.org/jira/browse/JBRULES-1970
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-compiler
Affects Versions: 5.0.0.M5
Environment: Eclipse 3.4, jre6u10, WinXp
Reporter: Norbert Ziegler
Assignee: Edson Tirelli
Fix For: 5.0.0.CR1
Having a line in a DSL like following:
[condition][]Bedingung-19-MKM4 = eval ( $p.getTempVal("#UML-ATZ-1") <
$p.getZvUmlStfr() )
Using "Bedingung-19-MKM4" in the LHS of a rule "Regel-151" in an
dslr-File I get the following 3 errors:
[12] Unable to expand: Bedingung-19-MKM4
[ERR 103] Line 201:2 no viable alternative at input 'Bedingung' in rule
"Regel-151"
Unknown error while parsing. This is a bug. Please contact the Development team.
The problem is the #-Character. If you change the line to
[condition][]Bedingung-19-MKM4 = eval ( $p.getTempVal("UML-ATZ-1") <
$p.getZvUmlStfr() )
it works. But that's not what I need.
Hint: maybe this is related to (JBRULES-1960) Syntaxcoloring wrong if DSLR contains a
"#"-Character.
But in this case it's more important because it's not an "optical"
problem only.
By the way: if I use the value #UML-ATZ-1 as an argument / placeholder it works (thank
God, need this often). But using a placeholder is not what I need.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira