[jboss-svn-commits] JBL Code SVN: r8415 - labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Dec 19 13:06:32 EST 2006


Author: tirelli
Date: 2006-12-19 13:06:29 -0500 (Tue, 19 Dec 2006)
New Revision: 8415

Modified:
   labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/DRL.g
Log:
updating grammar to ignore whitespaces after 'then' until the end of the line

Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/DRL.g
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/DRL.g	2006-12-19 18:05:40 UTC (rev 8414)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/DRL.g	2006-12-19 18:06:29 UTC (rev 8415)
@@ -1291,7 +1291,17 @@
 		}
                 END
                 {
-		    rule.setConsequence( buf.toString() );
+                    // ignoring first line in the consequence
+                    int index = 0;
+                    while( (index < buf.length() ) && Character.isWhitespace( buf.charAt( index ) ) &&
+                           (buf.charAt( index ) != 10 ) && (buf.charAt( index ) != 13 ))
+                               index++;
+                    if( (index < buf.length() ) && ( buf.charAt( index ) == 10 ) )
+                        index++;
+                    if( (index < buf.length() ) && ( buf.charAt( index ) == 13 ) )
+                        index++;
+                    
+		    rule.setConsequence( buf.substring( index ) );
      		    rule.setConsequenceLocation(offset(start.getLine()), start.getCharPositionInLine());
                 }
 	;




More information about the jboss-svn-commits mailing list