[jboss-svn-commits] JBL Code SVN: r20312 - labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jun 4 16:24:41 EDT 2008
Author: mattgeis
Date: 2008-06-04 16:24:41 -0400 (Wed, 04 Jun 2008)
New Revision: 20312
Modified:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/AntlrDSLMappingEntry.java
Log:
JBRULES-1633: Adjusting numbering of match groups in valuepattern for DSL expansion to cover cases where no variables are declared in the DSL entry
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/AntlrDSLMappingEntry.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/AntlrDSLMappingEntry.java 2008-06-04 18:55:28 UTC (rev 20311)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/AntlrDSLMappingEntry.java 2008-06-04 20:24:41 UTC (rev 20312)
@@ -126,9 +126,14 @@
valuePatternBuffer.append(value);
valueBuffer.append(value);
if(tailMatchGroupAdded){
- Integer tailMatchGroupIndex = (Integer) Collections.max(variables.values()) + 1;//get max in variables, plus 1
- valuePatternBuffer.append("$" + tailMatchGroupIndex);
- valueBuffer.append("$" + tailMatchGroupIndex);
+ int maxGroupIndex = 0;
+ if(!variables.isEmpty()){
+ Integer tailMatchGroupIndex = (Integer) Collections.max(variables.values());
+ maxGroupIndex = tailMatchGroupIndex.intValue();
+ }
+ maxGroupIndex++;
+ valuePatternBuffer.append("$" + maxGroupIndex);
+ valueBuffer.append("$" + maxGroupIndex);
}
this.valuePattern = valuePatternBuffer.toString();
this.value = valueBuffer.toString();
More information about the jboss-svn-commits
mailing list