[jboss-svn-commits] JBL Code SVN: r10428 - in labs/jbossrules/trunk/drools-compiler/src: main/java/org/drools/clp/functions and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Mar 22 07:44:41 EDT 2007


Author: mark.proctor at jboss.com
Date: 2007-03-22 07:44:41 -0400 (Thu, 22 Mar 2007)
New Revision: 10428

Added:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BuiltinFunctions.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Deffunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionCaller.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionDelegator.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionRegistry.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/AddFunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/BindFunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/LessThanFunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/ModifyFunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/MultiplyFunction.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/BlockExecutionTest.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/DeffunctionTest.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ModifyFunctionTest.java
Removed:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java
Modified:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseFunction.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseValueHandler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BlockExecutionEngine.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPEval.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLexer.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLocalDeclarationVariable.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPParser.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPredicate.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPreviousDeclarationVariable.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPReturnValue.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionBuildContext.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionContext.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionEngine.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Function.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LocalVariableValue.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ValueHandler.java
   labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/CLP.g
   labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/functions.conf
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/Person.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/AddFunctionTest.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ClpParserTest.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/FunctionFactoryTest.java
Log:
JBRULES-720 Clips Parser
-Defunction is now done
-Working on getting BlockExecutionEngine working, have co-ersion problems.

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,34 +0,0 @@
-package org.drools.clp;
-
-import java.math.BigDecimal;
-
-import org.drools.FactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.Extractor;
-
-public class AddFunction extends BaseFunction implements Function {
-    private static final String name = "+";
-
-    public AddFunction() {
-        
-    }
-    
-    public AddFunction(ValueHandler[] parameters) {
-        super( parameters );
-    }
-
-    public Object getValue(ExecutionContext context) {
-        BigDecimal bdval = new BigDecimal(0);        
-        ValueHandler[] args = getParameters();
-        for ( int i = 0, length = args.length; i < length; i++ ) {
-            bdval = bdval.add( args[i].getBigDecimalValue( context ) );
-        }
-                
-        return bdval;
-    }        
-
-    public String getName() {
-        return name;
-    }
-
-}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseFunction.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -33,17 +33,5 @@
                          Object object) {
         throw new RuntimeException( "You cannot set the value on a Function" );
     }
-    
-    public void replaceTempTokens(Map variables) {
-        for ( int i = 0; i < this.parameters.length; i++ ) {
-            if ( this.parameters[i] instanceof TempTokenVariable ) {
-                TempTokenVariable var = ( TempTokenVariable ) this.parameters[i]; 
-                this.parameters[i] = ( ValueHandler ) variables.get( var.getIdentifier() );
-            } else if ( this.parameters[i] instanceof Function ) {
-                Function function = ( Function ) this.parameters[i];
-                function.replaceTempTokens( variables );
-            }
-        }
-        
-    }
+   
 }

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseValueHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseValueHandler.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseValueHandler.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -8,11 +8,21 @@
 public abstract class BaseValueHandler implements ValueHandler {        
     
     public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
-        return (BigDecimal) getValue(context);
+        Object object = getValue( context );
+        if ( object instanceof BigDecimal ) {
+            return (BigDecimal) object;
+        } else {
+            return new BigDecimal( object.toString() );
+        }
     }
 
     public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
-        return (BigInteger) getValue(context);
+        Object object = getValue( context );
+        if ( object instanceof BigInteger ) {
+            return (BigInteger) object;
+        } else {
+            return new BigInteger( object.toString() );
+        }
     }
 
     public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,32 +0,0 @@
-package org.drools.clp;
-
-import java.math.BigDecimal;
-
-import org.drools.FactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.Extractor;
-
-public class BindFunction extends BaseFunction implements Function {
-    private static final String name = "bind";
-
-    public BindFunction() {
-        
-    }
-    
-    public BindFunction(ValueHandler[] parameters) {
-        super( parameters );
-    }
-
-    public Object getValue(ExecutionContext context) {
-        ValueHandler args[] = getParameters();
-        
-        args[0].setValue( context, args[1].getValue( context ) );
-        
-        return args[0];
-    }        
-
-    public String getName() {
-        return name;
-    }
-
-}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BlockExecutionEngine.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BlockExecutionEngine.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BlockExecutionEngine.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,5 +1,7 @@
 package org.drools.clp;
 
+import java.util.Map;
+
 import org.drools.WorkingMemory;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.reteoo.ReteTuple;
@@ -18,22 +20,22 @@
     ExecutionEngine {
     //private Map variableMap = new HashMap();
 
-    private Function[] functions;
+    private FunctionCaller[] functions;
 
     private int        index;               
 
-    public void addFunction(Function function) {
-        Function[] temp = new Function[functions.length];
-        System.arraycopy( this.functions,
-                          0,
-                          temp,
-                          0,
-                          this.functions.length - 1 );
-        temp[temp.length - 1] = function;
-        this.functions = temp;
+    public void addFunction(FunctionCaller function) {
+        if (this.functions == null) {
+            this.functions = new FunctionCaller[] { function };
+        } else {
+            FunctionCaller[] temp =  new FunctionCaller[ functions.length + 1 ];
+            System.arraycopy( this.functions, 0, temp, 0, this.functions.length );
+            temp[ temp.length - 1] = function;
+            this.functions = temp;             
+        }                     
     } 
     
-    public Function[] getFunctions() {
+    public FunctionCaller[] getFunctions() {
         return this.functions;
     }    
 
@@ -58,6 +60,10 @@
     }
 
     public void execute(ExecutionContext context) {
+        if ( this.functions == null ) {
+            return;
+        }
+        
         for ( int i = 0, length = functions.length; i < length; i++ ) {
             this.functions[i].getValue( context );
         }
@@ -71,9 +77,10 @@
         execute( context );
     }
 
-    public void getVariableValueHandler(String name) {
-        // TODO Auto-generated method stub
-        
+    public void replaceTempTokens(Map variables) {
+        for ( int i = 0, length = functions.length; i < length; i++ ) {
+            this.functions[i].replaceTempTokens( variables );
+        }
     }
 
 }

Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BuiltinFunctions.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BuiltinFunctions.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BuiltinFunctions.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,54 @@
+package org.drools.clp;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+public class BuiltinFunctions {
+    public static final BuiltinFunctions instance = new BuiltinFunctions();
+    
+    public static BuiltinFunctions getInstance() {
+        return instance;
+    }
+    
+    public Map functions;
+    
+    private BuiltinFunctions() {
+        this.functions = new HashMap();
+        
+        try {
+            loadFunctions();
+        } catch ( IOException e ) {
+            throw new RuntimeException( e );
+        } catch ( ClassNotFoundException e ) {
+            throw new RuntimeException( e );
+        }
+    }        
+    
+    public void loadFunctions() throws IOException, ClassNotFoundException {        
+        BufferedReader reader = new BufferedReader( new InputStreamReader( getClass().getResourceAsStream( "functions.conf" ) ) );
+        loadFunctions( reader );
+    }
+    
+    public void loadFunctions(BufferedReader reader) throws IOException, ClassNotFoundException {
+        String line = null;       
+        
+        try {
+            while( (line = reader.readLine() ) != null ) {
+                Class clazz = getClass().getClassLoader().loadClass( line );
+                Function function = ( Function) clazz.newInstance();
+                this.functions.put(  function.getName(), function );
+            }
+        } catch(IllegalAccessException e) {
+            throw new RuntimeException( e );            
+        } catch(InstantiationException e) {
+            throw new RuntimeException( e );
+        }
+    }
+    
+    public Function getFunction(String name) {
+        return ( Function ) this.functions.get( name );
+    }
+}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPEval.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPEval.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPEval.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -3,6 +3,8 @@
  */
 package org.drools.clp;
 
+import java.util.Map;
+
 import org.drools.WorkingMemory;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.reteoo.ReteTuple;
@@ -14,27 +16,27 @@
     implements
     EvalExpression,
     ExecutionEngine {
-    private Function function;
+    private FunctionCaller function;
     private int      index;
     
     public CLPEval() {
         
     }
     
-    public CLPEval(Function function) {
+    public CLPEval(FunctionCaller function) {
         this.function = function;
     }
 
-    public void setFunction(Function function) {
+    public void setFunction(FunctionCaller function) {
         this.function = function;
     }
 
-    public void addFunction(Function function) {
+    public void addFunction(FunctionCaller function) {
         setFunction( function );        
     }
     
-    public Function[] getFunctions() {
-        return new Function[] { this.function };
+    public FunctionCaller[] getFunctions() {
+        return new FunctionCaller[] { this.function };
     }    
     
     public int getNextIndex() {
@@ -49,5 +51,9 @@
                                                          this.index-1 );
         return this.function.getBooleanValue( context );
     }
+    
+    public void replaceTempTokens(Map variables) {
+        this.function.replaceTempTokens( variables );
+    }        
 
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLexer.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLexer.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLexer.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,4 +1,4 @@
-// $ANTLR 3.0b7 C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g 2007-03-18 12:17:59
+// $ANTLR 3.0b7 C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g 2007-03-21 20:40:58
 
 	package org.drools.clp;
 
@@ -166,10 +166,10 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:582:17: ( ( ' ' | '\\t' | '\\f' | EOL ) )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:582:17: ( ' ' | '\\t' | '\\f' | EOL )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:594:17: ( ( ' ' | '\\t' | '\\f' | EOL ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:594:17: ( ' ' | '\\t' | '\\f' | EOL )
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:582:17: ( ' ' | '\\t' | '\\f' | EOL )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:594:17: ( ' ' | '\\t' | '\\f' | EOL )
             int alt1=4;
             switch ( input.LA(1) ) {
             case ' ':
@@ -188,35 +188,35 @@
             default:
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("582:17: ( ' ' | '\\t' | '\\f' | EOL )", 1, 0, input);
+                    new NoViableAltException("594:17: ( ' ' | '\\t' | '\\f' | EOL )", 1, 0, input);
 
                 throw nvae;
             }
 
             switch (alt1) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:582:19: ' '
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:594:19: ' '
                     {
                     match(' '); if (failed) return ;
 
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:583:19: '\\t'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:595:19: '\\t'
                     {
                     match('\t'); if (failed) return ;
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:584:19: '\\f'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:596:19: '\\f'
                     {
                     match('\f'); if (failed) return ;
 
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:585:19: EOL
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:597:19: EOL
                     {
                     mEOL(); if (failed) return ;
 
@@ -256,8 +256,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:11: ( 'defrule' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:11: 'defrule'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:602:11: ( 'defrule' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:602:11: 'defrule'
             {
             match("defrule"); if (failed) return ;
 
@@ -289,8 +289,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:591:7: ( 'or' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:591:7: 'or'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:603:7: ( 'or' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:603:7: 'or'
             {
             match("or"); if (failed) return ;
 
@@ -322,8 +322,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:592:8: ( 'and' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:592:8: 'and'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:604:8: ( 'and' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:604:8: 'and'
             {
             match("and"); if (failed) return ;
 
@@ -355,8 +355,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:593:8: ( 'not' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:593:8: 'not'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:8: ( 'not' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:8: 'not'
             {
             match("not"); if (failed) return ;
 
@@ -388,8 +388,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:594:11: ( 'exists' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:594:11: 'exists'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:606:11: ( 'exists' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:606:11: 'exists'
             {
             match("exists"); if (failed) return ;
 
@@ -421,8 +421,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:595:9: ( 'test' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:595:9: 'test'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:607:9: ( 'test' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:607:9: 'test'
             {
             match("test"); if (failed) return ;
 
@@ -454,8 +454,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:597:8: ( 'null' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:597:8: 'null'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:609:8: ( 'null' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:609:8: 'null'
             {
             match("null"); if (failed) return ;
 
@@ -487,8 +487,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:599:11: ( 'declare' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:599:11: 'declare'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:611:11: ( 'declare' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:611:11: 'declare'
             {
             match("declare"); if (failed) return ;
 
@@ -520,8 +520,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:601:11: ( 'salience' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:601:11: 'salience'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:613:11: ( 'salience' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:613:11: 'salience'
             {
             match("salience"); if (failed) return ;
 
@@ -548,10 +548,10 @@
     public void mEOL() throws RecognitionException {
         try {
             ruleNestingLevel++;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:617:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:617:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:617:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
             int alt2=3;
             int LA2_0 = input.LA(1);
             if ( (LA2_0=='\r') ) {
@@ -568,13 +568,13 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("605:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
+                    new NoViableAltException("617:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
 
                 throw nvae;
             }
             switch (alt2) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:14: ( '\\r\\n' )=> '\\r\\n'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:617:14: ( '\\r\\n' )=> '\\r\\n'
                     {
                     match("\r\n"); if (failed) return ;
 
@@ -582,14 +582,14 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:606:25: '\\r'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:618:25: '\\r'
                     {
                     match('\r'); if (failed) return ;
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:607:25: '\\n'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:619:25: '\\n'
                     {
                     match('\n'); if (failed) return ;
 
@@ -617,10 +617,10 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:612:4: ( ( '-' )? ( '0' .. '9' )+ )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:612:4: ( '-' )? ( '0' .. '9' )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:624:4: ( ( '-' )? ( '0' .. '9' )+ )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:624:4: ( '-' )? ( '0' .. '9' )+
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:612:4: ( '-' )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:624:4: ( '-' )?
             int alt3=2;
             int LA3_0 = input.LA(1);
             if ( (LA3_0=='-') ) {
@@ -628,7 +628,7 @@
             }
             switch (alt3) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:612:5: '-'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:624:5: '-'
                     {
                     match('-'); if (failed) return ;
 
@@ -637,7 +637,7 @@
 
             }
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:612:10: ( '0' .. '9' )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:624:10: ( '0' .. '9' )+
             int cnt4=0;
             loop4:
             do {
@@ -650,7 +650,7 @@
 
                 switch (alt4) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:612:11: '0' .. '9'
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:624:11: '0' .. '9'
             	    {
             	    matchRange('0','9'); if (failed) return ;
 
@@ -695,10 +695,10 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:616:4: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:616:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:628:4: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:628:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:616:4: ( '-' )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:628:4: ( '-' )?
             int alt5=2;
             int LA5_0 = input.LA(1);
             if ( (LA5_0=='-') ) {
@@ -706,7 +706,7 @@
             }
             switch (alt5) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:616:5: '-'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:628:5: '-'
                     {
                     match('-'); if (failed) return ;
 
@@ -715,7 +715,7 @@
 
             }
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:616:10: ( '0' .. '9' )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:628:10: ( '0' .. '9' )+
             int cnt6=0;
             loop6:
             do {
@@ -728,7 +728,7 @@
 
                 switch (alt6) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:616:11: '0' .. '9'
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:628:11: '0' .. '9'
             	    {
             	    matchRange('0','9'); if (failed) return ;
 
@@ -746,7 +746,7 @@
             } while (true);
 
             match('.'); if (failed) return ;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:616:26: ( '0' .. '9' )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:628:26: ( '0' .. '9' )+
             int cnt7=0;
             loop7:
             do {
@@ -759,7 +759,7 @@
 
                 switch (alt7) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:616:27: '0' .. '9'
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:628:27: '0' .. '9'
             	    {
             	    matchRange('0','9'); if (failed) return ;
 
@@ -804,7 +804,7 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:620:8: ( ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' ) | ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:632:8: ( ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' ) | ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' ) )
             int alt10=2;
             int LA10_0 = input.LA(1);
             if ( (LA10_0=='\"') ) {
@@ -816,19 +816,19 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("619:1: STRING : ( ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' ) | ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' ) );", 10, 0, input);
+                    new NoViableAltException("631:1: STRING : ( ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' ) | ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' ) );", 10, 0, input);
 
                 throw nvae;
             }
             switch (alt10) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:620:8: ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:632:8: ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' )
                     {
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:620:8: ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' )
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:620:9: '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:632:8: ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:632:9: '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"'
                     {
                     match('\"'); if (failed) return ;
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:620:13: ( EscapeSequence | ~ ('\\\\'|'\"'))*
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:632:13: ( EscapeSequence | ~ ('\\\\'|'\"'))*
                     loop8:
                     do {
                         int alt8=3;
@@ -843,14 +843,14 @@
 
                         switch (alt8) {
                     	case 1 :
-                    	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:620:15: EscapeSequence
+                    	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:632:15: EscapeSequence
                     	    {
                     	    mEscapeSequence(); if (failed) return ;
 
                     	    }
                     	    break;
                     	case 2 :
-                    	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:620:32: ~ ('\\\\'|'\"')
+                    	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:632:32: ~ ('\\\\'|'\"')
                     	    {
                     	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
                     	        input.consume();
@@ -880,13 +880,13 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:621:8: ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:633:8: ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' )
                     {
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:621:8: ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' )
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:621:9: '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\''
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:633:8: ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:633:9: '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\''
                     {
                     match('\''); if (failed) return ;
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:621:14: ( EscapeSequence | ~ ('\\\\'|'\\''))*
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:633:14: ( EscapeSequence | ~ ('\\\\'|'\\''))*
                     loop9:
                     do {
                         int alt9=3;
@@ -901,14 +901,14 @@
 
                         switch (alt9) {
                     	case 1 :
-                    	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:621:16: EscapeSequence
+                    	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:633:16: EscapeSequence
                     	    {
                     	    mEscapeSequence(); if (failed) return ;
 
                     	    }
                     	    break;
                     	case 2 :
-                    	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:621:33: ~ ('\\\\'|'\\'')
+                    	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:633:33: ~ ('\\\\'|'\\'')
                     	    {
                     	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
                     	        input.consume();
@@ -959,8 +959,8 @@
     public void mHexDigit() throws RecognitionException {
         try {
             ruleNestingLevel++;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:625:12: ( ('0'..'9'|'a'..'f'|'A'..'F'))
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:625:12: ('0'..'9'|'a'..'f'|'A'..'F')
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:12: ( ('0'..'9'|'a'..'f'|'A'..'F'))
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:12: ('0'..'9'|'a'..'f'|'A'..'F')
             {
             if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||(input.LA(1)>='a' && input.LA(1)<='f') ) {
                 input.consume();
@@ -987,7 +987,7 @@
     public void mEscapeSequence() throws RecognitionException {
         try {
             ruleNestingLevel++;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:629:9: ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:641:9: ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape )
             int alt11=3;
             int LA11_0 = input.LA(1);
             if ( (LA11_0=='\\') ) {
@@ -1018,7 +1018,7 @@
                 default:
                     if (backtracking>0) {failed=true; return ;}
                     NoViableAltException nvae =
-                        new NoViableAltException("627:1: fragment EscapeSequence : ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape );", 11, 1, input);
+                        new NoViableAltException("639:1: fragment EscapeSequence : ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape );", 11, 1, input);
 
                     throw nvae;
                 }
@@ -1027,13 +1027,13 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("627:1: fragment EscapeSequence : ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape );", 11, 0, input);
+                    new NoViableAltException("639:1: fragment EscapeSequence : ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape );", 11, 0, input);
 
                 throw nvae;
             }
             switch (alt11) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:629:9: '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\')
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:641:9: '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\')
                     {
                     match('\\'); if (failed) return ;
                     if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
@@ -1051,14 +1051,14 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:630:9: UnicodeEscape
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:642:9: UnicodeEscape
                     {
                     mUnicodeEscape(); if (failed) return ;
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:631:9: OctalEscape
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:643:9: OctalEscape
                     {
                     mOctalEscape(); if (failed) return ;
 
@@ -1077,7 +1077,7 @@
     public void mOctalEscape() throws RecognitionException {
         try {
             ruleNestingLevel++;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:636:9: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:648:9: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
             int alt12=3;
             int LA12_0 = input.LA(1);
             if ( (LA12_0=='\\') ) {
@@ -1106,7 +1106,7 @@
                 else {
                     if (backtracking>0) {failed=true; return ;}
                     NoViableAltException nvae =
-                        new NoViableAltException("634:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 1, input);
+                        new NoViableAltException("646:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 1, input);
 
                     throw nvae;
                 }
@@ -1114,31 +1114,31 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("634:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 0, input);
+                    new NoViableAltException("646:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 0, input);
 
                 throw nvae;
             }
             switch (alt12) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:636:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:648:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
                     {
                     match('\\'); if (failed) return ;
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:636:14: ( '0' .. '3' )
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:636:15: '0' .. '3'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:648:14: ( '0' .. '3' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:648:15: '0' .. '3'
                     {
                     matchRange('0','3'); if (failed) return ;
 
                     }
 
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:636:25: ( '0' .. '7' )
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:636:26: '0' .. '7'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:648:25: ( '0' .. '7' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:648:26: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
                     }
 
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:636:36: ( '0' .. '7' )
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:636:37: '0' .. '7'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:648:36: ( '0' .. '7' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:648:37: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
@@ -1148,18 +1148,18 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:649:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
                     {
                     match('\\'); if (failed) return ;
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:14: ( '0' .. '7' )
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:15: '0' .. '7'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:649:14: ( '0' .. '7' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:649:15: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
                     }
 
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:25: ( '0' .. '7' )
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:26: '0' .. '7'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:649:25: ( '0' .. '7' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:649:26: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
@@ -1169,11 +1169,11 @@
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:638:9: '\\\\' ( '0' .. '7' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:650:9: '\\\\' ( '0' .. '7' )
                     {
                     match('\\'); if (failed) return ;
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:638:14: ( '0' .. '7' )
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:638:15: '0' .. '7'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:650:14: ( '0' .. '7' )
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:650:15: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
@@ -1195,8 +1195,8 @@
     public void mUnicodeEscape() throws RecognitionException {
         try {
             ruleNestingLevel++;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:643:9: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:643:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:655:9: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:655:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
             {
             match('\\'); if (failed) return ;
             match('u'); if (failed) return ;
@@ -1223,10 +1223,10 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:647:4: ( ( 'true' | 'false' ) )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:647:4: ( 'true' | 'false' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:659:4: ( ( 'true' | 'false' ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:659:4: ( 'true' | 'false' )
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:647:4: ( 'true' | 'false' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:659:4: ( 'true' | 'false' )
             int alt13=2;
             int LA13_0 = input.LA(1);
             if ( (LA13_0=='t') ) {
@@ -1238,13 +1238,13 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("647:4: ( 'true' | 'false' )", 13, 0, input);
+                    new NoViableAltException("659:4: ( 'true' | 'false' )", 13, 0, input);
 
                 throw nvae;
             }
             switch (alt13) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:647:5: 'true'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:659:5: 'true'
                     {
                     match("true"); if (failed) return ;
 
@@ -1252,7 +1252,7 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:647:12: 'false'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:659:12: 'false'
                     {
                     match("false"); if (failed) return ;
 
@@ -1290,8 +1290,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:650:8: ( '?' ('a'..'z'|'A'..'Z'|'_'|'$') ( SYMBOL )* )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:650:8: '?' ('a'..'z'|'A'..'Z'|'_'|'$') ( SYMBOL )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:662:8: ( '?' ('a'..'z'|'A'..'Z'|'_'|'$') ( SYMBOL )* )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:662:8: '?' ('a'..'z'|'A'..'Z'|'_'|'$') ( SYMBOL )*
             {
             match('?'); if (failed) return ;
             if ( input.LA(1)=='$'||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
@@ -1305,7 +1305,7 @@
                 recover(mse);    throw mse;
             }
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:650:38: ( SYMBOL )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:662:38: ( SYMBOL )*
             loop14:
             do {
                 int alt14=2;
@@ -1317,7 +1317,7 @@
 
                 switch (alt14) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:650:38: SYMBOL
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:662:38: SYMBOL
             	    {
             	    mSYMBOL(); if (failed) return ;
 
@@ -1357,11 +1357,11 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:654:4: ( '#' ( options {greedy=false; } : . )* EOL )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:654:4: '#' ( options {greedy=false; } : . )* EOL
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:666:4: ( '#' ( options {greedy=false; } : . )* EOL )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:666:4: '#' ( options {greedy=false; } : . )* EOL
             {
             match('#'); if (failed) return ;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:654:8: ( options {greedy=false; } : . )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:666:8: ( options {greedy=false; } : . )*
             loop15:
             do {
                 int alt15=2;
@@ -1379,7 +1379,7 @@
 
                 switch (alt15) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:654:35: .
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:666:35: .
             	    {
             	    matchAny(); if (failed) return ;
 
@@ -1423,12 +1423,12 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:660:4: ( '//' ( options {greedy=false; } : . )* EOL )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:660:4: '//' ( options {greedy=false; } : . )* EOL
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:672:4: ( '//' ( options {greedy=false; } : . )* EOL )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:672:4: '//' ( options {greedy=false; } : . )* EOL
             {
             match("//"); if (failed) return ;
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:660:9: ( options {greedy=false; } : . )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:672:9: ( options {greedy=false; } : . )*
             loop16:
             do {
                 int alt16=2;
@@ -1446,7 +1446,7 @@
 
                 switch (alt16) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:660:36: .
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:672:36: .
             	    {
             	    matchAny(); if (failed) return ;
 
@@ -1490,8 +1490,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:666:4: ( '(' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:666:4: '('
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:678:4: ( '(' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:678:4: '('
             {
             match('('); if (failed) return ;
 
@@ -1522,8 +1522,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:670:4: ( ')' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:670:4: ')'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:682:4: ( ')' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:682:4: ')'
             {
             match(')'); if (failed) return ;
 
@@ -1554,8 +1554,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:674:4: ( '[' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:674:4: '['
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:686:4: ( '[' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:686:4: '['
             {
             match('['); if (failed) return ;
 
@@ -1586,8 +1586,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:678:4: ( ']' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:678:4: ']'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:690:4: ( ']' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:690:4: ']'
             {
             match(']'); if (failed) return ;
 
@@ -1618,8 +1618,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:682:4: ( '{' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:682:4: '{'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:694:4: ( '{' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:694:4: '{'
             {
             match('{'); if (failed) return ;
 
@@ -1650,8 +1650,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:686:4: ( '}' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:686:4: '}'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:698:4: ( '}' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:698:4: '}'
             {
             match('}'); if (failed) return ;
 
@@ -1682,8 +1682,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:689:9: ( '~' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:689:9: '~'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:701:9: ( '~' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:701:9: '~'
             {
             match('~'); if (failed) return ;
 
@@ -1714,8 +1714,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:693:4: ( '&' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:693:4: '&'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:705:4: ( '&' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:705:4: '&'
             {
             match('&'); if (failed) return ;
 
@@ -1746,8 +1746,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:697:4: ( '|' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:697:4: '|'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:709:4: ( '|' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:709:4: '|'
             {
             match('|'); if (failed) return ;
 
@@ -1778,8 +1778,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:701:4: ( '<-' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:701:4: '<-'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:713:4: ( '<-' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:713:4: '<-'
             {
             match("<-"); if (failed) return ;
 
@@ -1811,8 +1811,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:704:9: ( ':' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:704:9: ':'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:716:9: ( ':' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:716:9: ':'
             {
             match(':'); if (failed) return ;
 
@@ -1843,8 +1843,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:706:10: ( '=' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:706:10: '='
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:718:10: ( '=' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:718:10: '='
             {
             match('='); if (failed) return ;
 
@@ -1875,12 +1875,12 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:709:4: ( '/*' ( options {greedy=false; } : . )* '*/' )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:709:4: '/*' ( options {greedy=false; } : . )* '*/'
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:721:4: ( '/*' ( options {greedy=false; } : . )* '*/' )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:721:4: '/*' ( options {greedy=false; } : . )* '*/'
             {
             match("/*"); if (failed) return ;
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:709:9: ( options {greedy=false; } : . )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:721:9: ( options {greedy=false; } : . )*
             loop17:
             do {
                 int alt17=2;
@@ -1903,7 +1903,7 @@
 
                 switch (alt17) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:709:35: .
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:721:35: .
             	    {
             	    matchAny(); if (failed) return ;
 
@@ -1948,8 +1948,8 @@
             int _line = getLine();
             int _charPosition = getCharPositionInLine();
             int _channel = Token.DEFAULT_CHANNEL;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:713:8: ( SYMBOL )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:713:8: SYMBOL
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:725:8: ( SYMBOL )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:725:8: SYMBOL
             {
             mSYMBOL(); if (failed) return ;
 
@@ -1975,10 +1975,10 @@
     public void mSYMBOL() throws RecognitionException {
         try {
             ruleNestingLevel++;
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:4: ( ( (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')) | ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')) ) (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'|'?'))* )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:4: ( (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')) | ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')) ) (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'|'?'))*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:4: ( ( (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')) | ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')) ) (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'|'?'))* )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:4: ( (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')) | ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')) ) (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'|'?'))*
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:4: ( (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')) | ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:4: ( (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')) | ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')) )
             int alt18=2;
             int LA18_0 = input.LA(1);
             if ( ((LA18_0>='\u0000' && LA18_0<='\b')||(LA18_0>='\u000B' && LA18_0<='\f')||(LA18_0>='\u000E' && LA18_0<='\u001F')||LA18_0=='!'||LA18_0=='#'||LA18_0=='%'||LA18_0=='\''||(LA18_0>='*' && LA18_0<=':')||(LA18_0>='<' && LA18_0<='>')||(LA18_0>='@' && LA18_0<='{')||LA18_0=='}'||(LA18_0>='\u007F' && LA18_0<='\uFFFE')) ) {
@@ -1990,16 +1990,16 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("717:4: ( (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')) | ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')) )", 18, 0, input);
+                    new NoViableAltException("729:4: ( (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')) | ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')) )", 18, 0, input);
 
                 throw nvae;
             }
             switch (alt18) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:5: (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$'))
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:5: (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$'))
                     {
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:5: (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$'))
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:6: ~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:5: (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$'))
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:6: ~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'?'|'$')
                     {
                     if ( (input.LA(1)>='\u0000' && input.LA(1)<='\b')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\u001F')||input.LA(1)=='!'||input.LA(1)=='#'||input.LA(1)=='%'||input.LA(1)=='\''||(input.LA(1)>='*' && input.LA(1)<=':')||(input.LA(1)>='<' && input.LA(1)<='>')||(input.LA(1)>='@' && input.LA(1)<='{')||input.LA(1)=='}'||(input.LA(1)>='\u007F' && input.LA(1)<='\uFFFE') ) {
                         input.consume();
@@ -2019,10 +2019,10 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:65: ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'))
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:65: ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'))
                     {
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:65: ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'))
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:717:66: '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:65: ( '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'))
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:729:66: '$' ~ ('?'|' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<')
                     {
                     match('$'); if (failed) return ;
                     if ( (input.LA(1)>='\u0000' && input.LA(1)<='\b')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\u001F')||input.LA(1)=='!'||(input.LA(1)>='#' && input.LA(1)<='%')||input.LA(1)=='\''||(input.LA(1)>='*' && input.LA(1)<=':')||(input.LA(1)>='=' && input.LA(1)<='>')||(input.LA(1)>='@' && input.LA(1)<='{')||input.LA(1)=='}'||(input.LA(1)>='\u007F' && input.LA(1)<='\uFFFE') ) {
@@ -2045,7 +2045,7 @@
 
             }
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:718:11: (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'|'?'))*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:730:11: (~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'|'?'))*
             loop19:
             do {
                 int alt19=2;
@@ -2057,7 +2057,7 @@
 
                 switch (alt19) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:718:12: ~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'|'?')
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:730:12: ~ (' '|'\\t'|'\\n'|'\\r'|'\"'|'('|')'|';'|'&'|'|'|'~'|'<'|'?')
             	    {
             	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='\b')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\u001F')||input.LA(1)=='!'||(input.LA(1)>='#' && input.LA(1)<='%')||input.LA(1)=='\''||(input.LA(1)>='*' && input.LA(1)<=':')||(input.LA(1)>='=' && input.LA(1)<='>')||(input.LA(1)>='@' && input.LA(1)<='{')||input.LA(1)=='}'||(input.LA(1)>='\u007F' && input.LA(1)<='\uFFFE') ) {
             	        input.consume();

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLocalDeclarationVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLocalDeclarationVariable.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLocalDeclarationVariable.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -37,12 +37,22 @@
     }
     
     public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
-        return (BigDecimal) declaration.getValue( context.getObject() );
+        Object object = declaration.getValue( context.getObject() );
+        if ( object instanceof BigDecimal ) {
+            return (BigDecimal) object;
+        } else {
+            return new BigDecimal( object.toString() );
+        }
     }
 
     public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
-        return (BigInteger) declaration.getValue( context.getObject() );
-    }
+        Object object = declaration.getValue( context.getObject() );
+        if ( object instanceof BigInteger ) {
+            return (BigInteger) object;
+        } else {
+            return new BigInteger( object.toString() );
+        }
+    }    
 
     public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
         return declaration.getBooleanValue( context.getObject() );

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPParser.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPParser.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPParser.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,4 +1,4 @@
-// $ANTLR 3.0b7 C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g 2007-03-18 12:17:59
+// $ANTLR 3.0b7 C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g 2007-03-21 20:40:58
 
 	package org.drools.clp;
 	import java.util.List;
@@ -73,10 +73,17 @@
     	private int lineOffset = 0;
     	private DescrFactory factory = new DescrFactory();
     	private boolean parserDebug = false;
+    	private FunctionRegistry functionRegistry;
     	
+        FunctionRegistry factoryRegistry;
+    	
+    	public void setFunctionRegistry(FunctionRegistry functionRegistry) {
+    		this.functionRegistry = functionRegistry;
+    	}
+    	
     	public void setParserDebug(boolean parserDebug) {
     		this.parserDebug = parserDebug;
-    	}
+    	}		
     	
     	public void debug(String message) {
     		if ( parserDebug ) 
@@ -214,13 +221,13 @@
 
 
     // $ANTLR start opt_semicolon
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:164:1: opt_semicolon : ( ';' )? ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:171:1: opt_semicolon : ( ';' )? ;
     public void opt_semicolon() throws RecognitionException {
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:165:4: ( ( ';' )? )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:165:4: ( ';' )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:172:4: ( ( ';' )? )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:172:4: ( ';' )?
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:165:4: ( ';' )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:172:4: ( ';' )?
             int alt1=2;
             int LA1_0 = input.LA(1);
             if ( (LA1_0==41) ) {
@@ -228,7 +235,7 @@
             }
             switch (alt1) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:165:4: ';'
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:172:4: ';'
                     {
                     match(input,41,FOLLOW_41_in_opt_semicolon38); 
 
@@ -253,26 +260,26 @@
 
 
     // $ANTLR start compilation_unit
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:169:1: compilation_unit : ( statement )+ ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:176:1: compilation_unit : ( statement )+ ;
     public void compilation_unit() throws RecognitionException {
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:171:3: ( ( statement )+ )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:171:3: ( statement )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:178:3: ( ( statement )+ )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:178:3: ( statement )+
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:171:3: ( statement )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:178:3: ( statement )+
             int cnt2=0;
             loop2:
             do {
                 int alt2=2;
                 int LA2_0 = input.LA(1);
-                if ( (LA2_0==LEFT_PAREN) ) {
+                if ( (LA2_0==EOF) ) {
                     alt2=1;
                 }
 
 
                 switch (alt2) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:171:5: statement
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:178:5: statement
             	    {
             	    pushFollow(FOLLOW_statement_in_compilation_unit56);
             	    statement();
@@ -307,40 +314,48 @@
 
 
     // $ANTLR start statement
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:174:1: statement : ( rule ) ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:181:1: statement : () ;
     public void statement() throws RecognitionException {
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:177:2: ( ( rule ) )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:177:2: ( rule )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:184:2: ( () )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:184:2: ()
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:177:2: ( rule )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:177:4: rule
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:184:2: ()
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:184:50: 
             {
-            pushFollow(FOLLOW_rule_in_statement76);
-            rule();
-            _fsp--;
+            }
 
 
             }
 
+        }
+        finally {
+        }
+        return ;
+    }
+    // $ANTLR end statement
 
+
+    // $ANTLR start deffunction
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:221:1: deffunction : ;
+    public void deffunction() throws RecognitionException {
+        try {
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:223:2: ()
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:223:2: 
+            {
             }
 
         }
-        catch (RecognitionException re) {
-            reportError(re);
-            recover(input,re);
-        }
         finally {
         }
         return ;
     }
-    // $ANTLR end statement
+    // $ANTLR end deffunction
 
 
-    // $ANTLR start rule
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:214:1: rule returns [RuleDescr rule] : loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs] )* '=>' rhs[rule] RIGHT_PAREN ;
-    public RuleDescr rule() throws RecognitionException {
+    // $ANTLR start defrule
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:225:1: defrule returns [RuleDescr rule] : loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs] )* '=>' rhs[rule] RIGHT_PAREN ;
+    public RuleDescr defrule() throws RecognitionException {
         RuleDescr rule = null;
 
         Token loc=null;
@@ -354,30 +369,31 @@
         	        AttributeDescr module = null;	        
         	      
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:221:4: (loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs] )* '=>' rhs[rule] RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:221:4: loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs] )* '=>' rhs[rule] RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:232:4: (loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs] )* '=>' rhs[rule] RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:232:4: loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs] )* '=>' rhs[rule] RIGHT_PAREN
             {
             loc=(Token)input.LT(1);
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_rule107); 
-            match(input,DEFRULE,FOLLOW_DEFRULE_in_rule115); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_defrule114); 
+            match(input,DEFRULE,FOLLOW_DEFRULE_in_defrule122); 
             ruleName=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_rule119); 
+            match(input,NAME,FOLLOW_NAME_in_defrule126); 
              	  			  		
             	  		debug( "start rule: " + ruleName.getText() );
             	  		String ruleStr = ruleName.getText();
             
-            	        	if ( ruleStr.indexOf("::") >= 0 ) {
-            	        	        String mod = ruleStr.substring(0, ruleStr.indexOf("::"));
-            	        	        ruleStr = ruleStr.substring(ruleStr.indexOf("::")+2);
+            	        if ( ruleStr.indexOf("::") >= 0 ) {
+            	            String mod = ruleStr.substring(0, ruleStr.indexOf("::"));
+            	            ruleStr = ruleStr.substring(ruleStr.indexOf("::")+2);
             				module = new AttributeDescr( "agenda-group", mod );
             				module.setLocation( offset(ruleName.getLine()), ruleName.getCharPositionInLine() );
             				module.setStartCharacter( ((CommonToken)ruleName).getStartIndex() );
             				module.setEndCharacter( ((CommonToken)ruleName).getStopIndex() );
             			}
-            		        rule = new RuleDescr( ruleStr, null ); 
-            		        if( module != null ) {
-            		        	rule.addAttribute( module );
-            		        }
+            		    
+            		    rule = new RuleDescr( ruleStr, null ); 
+            		    if( module != null ) {
+            		    	rule.addAttribute( module );
+            		    }
             		        
             			rule.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
             			rule.setStartCharacter( ((CommonToken)loc).getStartIndex() ); 
@@ -389,15 +405,15 @@
             			lhs.setStartCharacter( ((CommonToken)loc).getStartIndex() );				
             		
             documentation=(Token)input.LT(1);
-            match(input,STRING,FOLLOW_STRING_in_rule131); 
+            match(input,STRING,FOLLOW_STRING_in_defrule138); 
             
             	    	// do nothing here for now
             		
-            pushFollow(FOLLOW_ruleAttribute_in_rule137);
+            pushFollow(FOLLOW_ruleAttribute_in_defrule144);
             ruleAttribute(rule);
             _fsp--;
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:255:3: ( ce[lhs] )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:267:3: ( ce[lhs] )*
             loop3:
             do {
                 int alt3=2;
@@ -409,9 +425,9 @@
 
                 switch (alt3) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:255:3: ce[lhs]
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:267:3: ce[lhs]
             	    {
-            	    pushFollow(FOLLOW_ce_in_rule145);
+            	    pushFollow(FOLLOW_ce_in_defrule152);
             	    ce(lhs);
             	    _fsp--;
 
@@ -424,12 +440,12 @@
                 }
             } while (true);
 
-            match(input,42,FOLLOW_42_in_rule154); 
-            pushFollow(FOLLOW_rhs_in_rule161);
+            match(input,42,FOLLOW_42_in_defrule161); 
+            pushFollow(FOLLOW_rhs_in_defrule168);
             rhs(rule);
             _fsp--;
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_rule169); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_defrule176); 
 
             }
 
@@ -442,20 +458,20 @@
         }
         return rule;
     }
-    // $ANTLR end rule
+    // $ANTLR end defrule
 
 
     // $ANTLR start ruleAttribute
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:265:1: ruleAttribute[RuleDescr rule] : ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:277:1: ruleAttribute[RuleDescr rule] : ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? ;
     public void ruleAttribute(RuleDescr rule) throws RecognitionException {
         AttributeDescr d = null;
 
 
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:267:3: ( ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:267:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:279:3: ( ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:279:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:267:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:279:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
             int alt5=2;
             int LA5_0 = input.LA(1);
             if ( (LA5_0==LEFT_PAREN) ) {
@@ -466,11 +482,11 @@
             }
             switch (alt5) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:267:5: LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:279:5: LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN
                     {
-                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute186); 
-                    match(input,DECLARE,FOLLOW_DECLARE_in_ruleAttribute188); 
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:268:4: ( LEFT_PAREN d= salience RIGHT_PAREN )?
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute193); 
+                    match(input,DECLARE,FOLLOW_DECLARE_in_ruleAttribute195); 
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:280:4: ( LEFT_PAREN d= salience RIGHT_PAREN )?
                     int alt4=2;
                     int LA4_0 = input.LA(1);
                     if ( (LA4_0==LEFT_PAREN) ) {
@@ -478,22 +494,22 @@
                     }
                     switch (alt4) {
                         case 1 :
-                            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:268:6: LEFT_PAREN d= salience RIGHT_PAREN
+                            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:280:6: LEFT_PAREN d= salience RIGHT_PAREN
                             {
-                            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute195); 
-                            pushFollow(FOLLOW_salience_in_ruleAttribute199);
+                            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute202); 
+                            pushFollow(FOLLOW_salience_in_ruleAttribute206);
                             d=salience();
                             _fsp--;
 
                              rule.addAttribute( d ); 
-                            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute203); 
+                            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute210); 
 
                             }
                             break;
 
                     }
 
-                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute210); 
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute217); 
 
                     }
                     break;
@@ -516,7 +532,7 @@
 
 
     // $ANTLR start salience
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:272:1: salience returns [AttributeDescr d ] : loc= SALIENCE i= INT ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:284:1: salience returns [AttributeDescr d ] : loc= SALIENCE i= INT ;
     public AttributeDescr salience() throws RecognitionException {
         AttributeDescr d = null;
 
@@ -527,13 +543,13 @@
         		d = null;
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:277:3: (loc= SALIENCE i= INT )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:277:3: loc= SALIENCE i= INT
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:289:3: (loc= SALIENCE i= INT )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:289:3: loc= SALIENCE i= INT
             {
             loc=(Token)input.LT(1);
-            match(input,SALIENCE,FOLLOW_SALIENCE_in_salience240); 
+            match(input,SALIENCE,FOLLOW_SALIENCE_in_salience247); 
             i=(Token)input.LT(1);
-            match(input,INT,FOLLOW_INT_in_salience244); 
+            match(input,INT,FOLLOW_INT_in_salience251); 
             
             			d = new AttributeDescr( "salience", i.getText() );
             			d.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
@@ -556,38 +572,38 @@
 
 
     // $ANTLR start ce
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:287:1: ce[ConditionalElementDescr in_ce] : ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] ) ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:299:1: ce[ConditionalElementDescr in_ce] : ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] ) ;
     public void ce(ConditionalElementDescr in_ce) throws RecognitionException {
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:288:4: ( ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] ) )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:288:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:300:4: ( ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:300:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:288:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:300:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )
             int alt6=7;
             int LA6_0 = input.LA(1);
             if ( (LA6_0==LEFT_PAREN) ) {
                 switch ( input.LA(2) ) {
+                case OR:
+                    alt6=2;
+                    break;
+                case AND:
+                    alt6=1;
+                    break;
+                case NOT:
+                    alt6=3;
+                    break;
                 case NAME:
                     alt6=6;
                     break;
                 case EXISTS:
                     alt6=4;
                     break;
-                case NOT:
-                    alt6=3;
-                    break;
-                case AND:
-                    alt6=1;
-                    break;
                 case TEST:
                     alt6=5;
                     break;
-                case OR:
-                    alt6=2;
-                    break;
                 default:
                     NoViableAltException nvae =
-                        new NoViableAltException("288:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )", 6, 1, input);
+                        new NoViableAltException("300:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )", 6, 1, input);
 
                     throw nvae;
                 }
@@ -598,15 +614,15 @@
             }
             else {
                 NoViableAltException nvae =
-                    new NoViableAltException("288:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )", 6, 0, input);
+                    new NoViableAltException("300:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )", 6, 0, input);
 
                 throw nvae;
             }
             switch (alt6) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:288:8: and_ce[in_ce]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:300:8: and_ce[in_ce]
                     {
-                    pushFollow(FOLLOW_and_ce_in_ce270);
+                    pushFollow(FOLLOW_and_ce_in_ce277);
                     and_ce(in_ce);
                     _fsp--;
 
@@ -614,9 +630,9 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:289:7: or_ce[in_ce]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:301:7: or_ce[in_ce]
                     {
-                    pushFollow(FOLLOW_or_ce_in_ce280);
+                    pushFollow(FOLLOW_or_ce_in_ce287);
                     or_ce(in_ce);
                     _fsp--;
 
@@ -624,9 +640,9 @@
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:290:7: not_ce[in_ce]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:302:7: not_ce[in_ce]
                     {
-                    pushFollow(FOLLOW_not_ce_in_ce289);
+                    pushFollow(FOLLOW_not_ce_in_ce296);
                     not_ce(in_ce);
                     _fsp--;
 
@@ -634,9 +650,9 @@
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:291:7: exists_ce[in_ce]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:303:7: exists_ce[in_ce]
                     {
-                    pushFollow(FOLLOW_exists_ce_in_ce298);
+                    pushFollow(FOLLOW_exists_ce_in_ce305);
                     exists_ce(in_ce);
                     _fsp--;
 
@@ -644,9 +660,9 @@
                     }
                     break;
                 case 5 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:292:8: eval_ce[in_ce]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:304:8: eval_ce[in_ce]
                     {
-                    pushFollow(FOLLOW_eval_ce_in_ce312);
+                    pushFollow(FOLLOW_eval_ce_in_ce319);
                     eval_ce(in_ce);
                     _fsp--;
 
@@ -654,9 +670,9 @@
                     }
                     break;
                 case 6 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:293:7: normal_pattern[in_ce]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:305:7: normal_pattern[in_ce]
                     {
-                    pushFollow(FOLLOW_normal_pattern_in_ce326);
+                    pushFollow(FOLLOW_normal_pattern_in_ce333);
                     normal_pattern(in_ce);
                     _fsp--;
 
@@ -664,9 +680,9 @@
                     }
                     break;
                 case 7 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:294:7: bound_pattern[in_ce]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:306:7: bound_pattern[in_ce]
                     {
-                    pushFollow(FOLLOW_bound_pattern_in_ce335);
+                    pushFollow(FOLLOW_bound_pattern_in_ce342);
                     bound_pattern(in_ce);
                     _fsp--;
 
@@ -692,17 +708,17 @@
 
 
     // $ANTLR start rhs
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:298:1: rhs[RuleDescr rule] : ( function[context] )* ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:310:1: rhs[RuleDescr rule] : ( function[context] )* ;
     public void rhs(RuleDescr rule) throws RecognitionException {
         
         	        ExecutionEngine engine = new BlockExecutionEngine();
         			ExecutionBuildContext context = new ExecutionBuildContext( engine );  	
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:305:4: ( ( function[context] )* )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:305:4: ( function[context] )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:317:4: ( ( function[context] )* )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:317:4: ( function[context] )*
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:305:4: ( function[context] )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:317:4: ( function[context] )*
             loop7:
             do {
                 int alt7=2;
@@ -714,9 +730,9 @@
 
                 switch (alt7) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:305:4: function[context]
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:317:4: function[context]
             	    {
-            	    pushFollow(FOLLOW_function_in_rhs363);
+            	    pushFollow(FOLLOW_function_in_rhs370);
             	    function(context);
             	    _fsp--;
 
@@ -746,22 +762,22 @@
 
 
     // $ANTLR start and_ce
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:308:1: and_ce[ConditionalElementDescr in_ce] : LEFT_PAREN AND ( ce[andDescr] )+ RIGHT_PAREN ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:320:1: and_ce[ConditionalElementDescr in_ce] : LEFT_PAREN AND ( ce[andDescr] )+ RIGHT_PAREN ;
     public void and_ce(ConditionalElementDescr in_ce) throws RecognitionException {
         
                 AndDescr andDescr= null;        
             
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:312:4: ( LEFT_PAREN AND ( ce[andDescr] )+ RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:312:4: LEFT_PAREN AND ( ce[andDescr] )+ RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:324:4: ( LEFT_PAREN AND ( ce[andDescr] )+ RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:324:4: LEFT_PAREN AND ( ce[andDescr] )+ RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_and_ce392); 
-            match(input,AND,FOLLOW_AND_in_and_ce397); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_and_ce399); 
+            match(input,AND,FOLLOW_AND_in_and_ce404); 
             
             	    	andDescr = new AndDescr();
             			in_ce.addDescr( andDescr );
             		
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:317:3: ( ce[andDescr] )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:329:3: ( ce[andDescr] )+
             int cnt8=0;
             loop8:
             do {
@@ -774,9 +790,9 @@
 
                 switch (alt8) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:317:3: ce[andDescr]
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:329:3: ce[andDescr]
             	    {
-            	    pushFollow(FOLLOW_ce_in_and_ce403);
+            	    pushFollow(FOLLOW_ce_in_and_ce410);
             	    ce(andDescr);
             	    _fsp--;
 
@@ -793,7 +809,7 @@
                 cnt8++;
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_and_ce412); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_and_ce419); 
 
             }
 
@@ -810,22 +826,22 @@
 
 
     // $ANTLR start or_ce
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:321:1: or_ce[ConditionalElementDescr in_ce] : LEFT_PAREN OR ( ce[orDescr] )+ RIGHT_PAREN ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:333:1: or_ce[ConditionalElementDescr in_ce] : LEFT_PAREN OR ( ce[orDescr] )+ RIGHT_PAREN ;
     public void or_ce(ConditionalElementDescr in_ce) throws RecognitionException {
         
                 OrDescr orDescr= null;         
             
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:325:4: ( LEFT_PAREN OR ( ce[orDescr] )+ RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:325:4: LEFT_PAREN OR ( ce[orDescr] )+ RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:337:4: ( LEFT_PAREN OR ( ce[orDescr] )+ RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:337:4: LEFT_PAREN OR ( ce[orDescr] )+ RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_or_ce440); 
-            match(input,OR,FOLLOW_OR_in_or_ce445); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_or_ce447); 
+            match(input,OR,FOLLOW_OR_in_or_ce452); 
             
             	    	orDescr = new OrDescr();
             			in_ce.addDescr( orDescr );
             		
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:330:3: ( ce[orDescr] )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:342:3: ( ce[orDescr] )+
             int cnt9=0;
             loop9:
             do {
@@ -838,9 +854,9 @@
 
                 switch (alt9) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:330:3: ce[orDescr]
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:342:3: ce[orDescr]
             	    {
-            	    pushFollow(FOLLOW_ce_in_or_ce451);
+            	    pushFollow(FOLLOW_ce_in_or_ce458);
             	    ce(orDescr);
             	    _fsp--;
 
@@ -857,7 +873,7 @@
                 cnt9++;
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_or_ce460); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_or_ce467); 
 
             }
 
@@ -874,26 +890,26 @@
 
 
     // $ANTLR start not_ce
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:334:1: not_ce[ConditionalElementDescr in_ce] : LEFT_PAREN NOT ce[notDescr] RIGHT_PAREN ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:346:1: not_ce[ConditionalElementDescr in_ce] : LEFT_PAREN NOT ce[notDescr] RIGHT_PAREN ;
     public void not_ce(ConditionalElementDescr in_ce) throws RecognitionException {
         
                 NotDescr notDescr= null;         
             
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:338:4: ( LEFT_PAREN NOT ce[notDescr] RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:338:4: LEFT_PAREN NOT ce[notDescr] RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:350:4: ( LEFT_PAREN NOT ce[notDescr] RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:350:4: LEFT_PAREN NOT ce[notDescr] RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_not_ce488); 
-            match(input,NOT,FOLLOW_NOT_in_not_ce493); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_not_ce495); 
+            match(input,NOT,FOLLOW_NOT_in_not_ce500); 
             
             			notDescr = new NotDescr();
             		    in_ce.addDescr( notDescr );
             		
-            pushFollow(FOLLOW_ce_in_not_ce499);
+            pushFollow(FOLLOW_ce_in_not_ce506);
             ce(notDescr);
             _fsp--;
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_not_ce507); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_not_ce514); 
 
             }
 
@@ -910,26 +926,26 @@
 
 
     // $ANTLR start exists_ce
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:347:1: exists_ce[ConditionalElementDescr in_ce] : LEFT_PAREN EXISTS ce[existsDescr] RIGHT_PAREN ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:359:1: exists_ce[ConditionalElementDescr in_ce] : LEFT_PAREN EXISTS ce[existsDescr] RIGHT_PAREN ;
     public void exists_ce(ConditionalElementDescr in_ce) throws RecognitionException {
         
                 ExistsDescr existsDescr= null;        
             
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:351:4: ( LEFT_PAREN EXISTS ce[existsDescr] RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:351:4: LEFT_PAREN EXISTS ce[existsDescr] RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:363:4: ( LEFT_PAREN EXISTS ce[existsDescr] RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:363:4: LEFT_PAREN EXISTS ce[existsDescr] RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_exists_ce536); 
-            match(input,EXISTS,FOLLOW_EXISTS_in_exists_ce541); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_exists_ce543); 
+            match(input,EXISTS,FOLLOW_EXISTS_in_exists_ce548); 
             
             		    existsDescr = new ExistsDescr();
             		    in_ce.addDescr( existsDescr );
             		
-            pushFollow(FOLLOW_ce_in_exists_ce547);
+            pushFollow(FOLLOW_ce_in_exists_ce554);
             ce(existsDescr);
             _fsp--;
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_exists_ce555); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_exists_ce562); 
 
             }
 
@@ -946,7 +962,7 @@
 
 
     // $ANTLR start eval_ce
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:360:1: eval_ce[ConditionalElementDescr in_ce] : LEFT_PAREN TEST function[context] RIGHT_PAREN ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:372:1: eval_ce[ConditionalElementDescr in_ce] : LEFT_PAREN TEST function[context] RIGHT_PAREN ;
     public void eval_ce(ConditionalElementDescr in_ce) throws RecognitionException {
         
                 EvalDescr evalDescr= null;    
@@ -954,23 +970,23 @@
         		ExecutionBuildContext context = new ExecutionBuildContext( engine );   		         
             
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:366:4: ( LEFT_PAREN TEST function[context] RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:366:4: LEFT_PAREN TEST function[context] RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:378:4: ( LEFT_PAREN TEST function[context] RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:378:4: LEFT_PAREN TEST function[context] RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce583); 
-            match(input,TEST,FOLLOW_TEST_in_eval_ce588); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce590); 
+            match(input,TEST,FOLLOW_TEST_in_eval_ce595); 
             
             		    evalDescr = new EvalDescr();
             		    in_ce.addDescr( evalDescr );
             		
-            pushFollow(FOLLOW_function_in_eval_ce594);
+            pushFollow(FOLLOW_function_in_eval_ce601);
             function(context);
             _fsp--;
 
             					
             			evalDescr.setContent( engine );			
             		
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce605); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce612); 
 
             }
 
@@ -987,7 +1003,7 @@
 
 
     // $ANTLR start normal_pattern
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:377:1: normal_pattern[ConditionalElementDescr in_ce] : LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:389:1: normal_pattern[ConditionalElementDescr in_ce] : LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN ;
     public void normal_pattern(ConditionalElementDescr in_ce) throws RecognitionException {
         Token name=null;
 
@@ -995,17 +1011,17 @@
                 ColumnDescr column = null;
             
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:381:4: ( LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:381:4: LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:393:4: ( LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:393:4: LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_normal_pattern633); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_normal_pattern640); 
             name=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_normal_pattern640); 
+            match(input,NAME,FOLLOW_NAME_in_normal_pattern647); 
             
             			column = new ColumnDescr(name.getText());
             			in_ce.addDescr( column );
             		
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:386:3: ( field_constriant[column] )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:398:3: ( field_constriant[column] )*
             loop10:
             do {
                 int alt10=2;
@@ -1017,9 +1033,9 @@
 
                 switch (alt10) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:386:3: field_constriant[column]
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:398:3: field_constriant[column]
             	    {
-            	    pushFollow(FOLLOW_field_constriant_in_normal_pattern646);
+            	    pushFollow(FOLLOW_field_constriant_in_normal_pattern653);
             	    field_constriant(column);
             	    _fsp--;
 
@@ -1032,7 +1048,7 @@
                 }
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_normal_pattern656); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_normal_pattern663); 
 
             }
 
@@ -1049,7 +1065,7 @@
 
 
     // $ANTLR start bound_pattern
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:392:1: bound_pattern[ConditionalElementDescr in_ce] : var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:404:1: bound_pattern[ConditionalElementDescr in_ce] : var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN ;
     public void bound_pattern(ConditionalElementDescr in_ce) throws RecognitionException {
         Token var=null;
         Token name=null;
@@ -1059,24 +1075,24 @@
                 String identifier = null;
             
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:397:4: (var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:397:4: var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:409:4: (var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:409:4: var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[column] )* RIGHT_PAREN
             {
             var=(Token)input.LT(1);
-            match(input,VAR,FOLLOW_VAR_in_bound_pattern684); 
+            match(input,VAR,FOLLOW_VAR_in_bound_pattern691); 
             
             			identifier = var.getText();
             		
-            match(input,ASSIGN_OP,FOLLOW_ASSIGN_OP_in_bound_pattern690); 
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_bound_pattern692); 
+            match(input,ASSIGN_OP,FOLLOW_ASSIGN_OP_in_bound_pattern697); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_bound_pattern699); 
             name=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_bound_pattern696); 
+            match(input,NAME,FOLLOW_NAME_in_bound_pattern703); 
             
             			column = new ColumnDescr(name.getText());
             			column.setIdentifier( identifier );
             			in_ce.addDescr( column );	    
             		
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:406:3: ( field_constriant[column] )*
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:418:3: ( field_constriant[column] )*
             loop11:
             do {
                 int alt11=2;
@@ -1088,9 +1104,9 @@
 
                 switch (alt11) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:406:3: field_constriant[column]
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:418:3: field_constriant[column]
             	    {
-            	    pushFollow(FOLLOW_field_constriant_in_bound_pattern705);
+            	    pushFollow(FOLLOW_field_constriant_in_bound_pattern712);
             	    field_constriant(column);
             	    _fsp--;
 
@@ -1103,7 +1119,7 @@
                 }
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_bound_pattern712); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_bound_pattern719); 
 
             }
 
@@ -1120,7 +1136,7 @@
 
 
     // $ANTLR start field_constriant
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:410:1: field_constriant[ColumnDescr column] : LEFT_PAREN f= NAME connected_constraint[fc, column] RIGHT_PAREN ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:422:1: field_constriant[ColumnDescr column] : LEFT_PAREN f= NAME connected_constraint[fc, column] RIGHT_PAREN ;
     public void field_constriant(ColumnDescr column) throws RecognitionException {
         Token f=null;
 
@@ -1131,23 +1147,23 @@
         		String op = "==";
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:418:3: ( LEFT_PAREN f= NAME connected_constraint[fc, column] RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:418:3: LEFT_PAREN f= NAME connected_constraint[fc, column] RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:430:3: ( LEFT_PAREN f= NAME connected_constraint[fc, column] RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:430:3: LEFT_PAREN f= NAME connected_constraint[fc, column] RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_field_constriant743); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_field_constriant750); 
             f=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_field_constriant747); 
+            match(input,NAME,FOLLOW_NAME_in_field_constriant754); 
             
             			fc = new FieldConstraintDescr(f.getText());
             			fc.setLocation( offset(f.getLine()), f.getCharPositionInLine() );
             			fc.setStartCharacter( ((CommonToken)f).getStartIndex() );
             			column.addDescr( fc );			
             		
-            pushFollow(FOLLOW_connected_constraint_in_field_constriant762);
+            pushFollow(FOLLOW_connected_constraint_in_field_constriant769);
             connected_constraint(fc,  column);
             _fsp--;
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_field_constriant768); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_field_constriant775); 
 
             }
 
@@ -1164,17 +1180,17 @@
 
 
     // $ANTLR start connected_constraint
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:430:1: connected_constraint[FieldConstraintDescr fc, ColumnDescr column] : restriction[fc, column] ( AMPERSAND connected_constraint[fc, column] | PIPE connected_constraint[fc, column] )? ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:442:1: connected_constraint[FieldConstraintDescr fc, ColumnDescr column] : restriction[fc, column] ( AMPERSAND connected_constraint[fc, column] | PIPE connected_constraint[fc, column] )? ;
     public void connected_constraint(FieldConstraintDescr fc, ColumnDescr column) throws RecognitionException {
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:432:2: ( restriction[fc, column] ( AMPERSAND connected_constraint[fc, column] | PIPE connected_constraint[fc, column] )? )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:432:2: restriction[fc, column] ( AMPERSAND connected_constraint[fc, column] | PIPE connected_constraint[fc, column] )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:444:2: ( restriction[fc, column] ( AMPERSAND connected_constraint[fc, column] | PIPE connected_constraint[fc, column] )? )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:444:2: restriction[fc, column] ( AMPERSAND connected_constraint[fc, column] | PIPE connected_constraint[fc, column] )?
             {
-            pushFollow(FOLLOW_restriction_in_connected_constraint784);
+            pushFollow(FOLLOW_restriction_in_connected_constraint791);
             restriction(fc,  column);
             _fsp--;
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:433:2: ( AMPERSAND connected_constraint[fc, column] | PIPE connected_constraint[fc, column] )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:445:2: ( AMPERSAND connected_constraint[fc, column] | PIPE connected_constraint[fc, column] )?
             int alt12=3;
             int LA12_0 = input.LA(1);
             if ( (LA12_0==AMPERSAND) ) {
@@ -1185,11 +1201,11 @@
             }
             switch (alt12) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:434:6: AMPERSAND connected_constraint[fc, column]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:446:6: AMPERSAND connected_constraint[fc, column]
                     {
-                    match(input,AMPERSAND,FOLLOW_AMPERSAND_in_connected_constraint796); 
+                    match(input,AMPERSAND,FOLLOW_AMPERSAND_in_connected_constraint803); 
                      fc.addRestriction(new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND)); 
-                    pushFollow(FOLLOW_connected_constraint_in_connected_constraint805);
+                    pushFollow(FOLLOW_connected_constraint_in_connected_constraint812);
                     connected_constraint(fc,  column);
                     _fsp--;
 
@@ -1197,11 +1213,11 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:437:6: PIPE connected_constraint[fc, column]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:449:6: PIPE connected_constraint[fc, column]
                     {
-                    match(input,PIPE,FOLLOW_PIPE_in_connected_constraint817); 
+                    match(input,PIPE,FOLLOW_PIPE_in_connected_constraint824); 
                     fc.addRestriction(new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR)); 
-                    pushFollow(FOLLOW_connected_constraint_in_connected_constraint826);
+                    pushFollow(FOLLOW_connected_constraint_in_connected_constraint833);
                     connected_constraint(fc,  column);
                     _fsp--;
 
@@ -1227,7 +1243,7 @@
 
 
     // $ANTLR start restriction
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:442:1: restriction[FieldConstraintDescr fc, ColumnDescr column] : ( TILDE )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction ) ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:454:1: restriction[FieldConstraintDescr fc, ColumnDescr column] : ( TILDE )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction ) ;
     public void restriction(FieldConstraintDescr fc, ColumnDescr column) throws RecognitionException {
         String lc = null;
 
@@ -1236,10 +1252,10 @@
         			String op = "==";
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:446:4: ( ( TILDE )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction ) )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:446:4: ( TILDE )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:458:4: ( ( TILDE )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:458:4: ( TILDE )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:446:4: ( TILDE )?
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:458:4: ( TILDE )?
             int alt13=2;
             int LA13_0 = input.LA(1);
             if ( (LA13_0==TILDE) ) {
@@ -1247,9 +1263,9 @@
             }
             switch (alt13) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:446:5: TILDE
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:458:5: TILDE
                     {
-                    match(input,TILDE,FOLLOW_TILDE_in_restriction852); 
+                    match(input,TILDE,FOLLOW_TILDE_in_restriction859); 
                     op = "!=";
 
                     }
@@ -1257,7 +1273,7 @@
 
             }
 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:447:3: ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:459:3: ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )
             int alt14=4;
             switch ( input.LA(1) ) {
             case COLON:
@@ -1279,16 +1295,16 @@
                 break;
             default:
                 NoViableAltException nvae =
-                    new NoViableAltException("447:3: ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )", 14, 0, input);
+                    new NoViableAltException("459:3: ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )", 14, 0, input);
 
                 throw nvae;
             }
 
             switch (alt14) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:447:5: predicate_constraint[op, column]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:459:5: predicate_constraint[op, column]
                     {
-                    pushFollow(FOLLOW_predicate_constraint_in_restriction868);
+                    pushFollow(FOLLOW_predicate_constraint_in_restriction875);
                     predicate_constraint(op,  column);
                     _fsp--;
 
@@ -1296,9 +1312,9 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:448:7: return_value_restriction[op, fc]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:460:7: return_value_restriction[op, fc]
                     {
-                    pushFollow(FOLLOW_return_value_restriction_in_restriction884);
+                    pushFollow(FOLLOW_return_value_restriction_in_restriction891);
                     return_value_restriction(op,  fc);
                     _fsp--;
 
@@ -1306,9 +1322,9 @@
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:449:7: variable_restriction[op, fc]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:461:7: variable_restriction[op, fc]
                     {
-                    pushFollow(FOLLOW_variable_restriction_in_restriction893);
+                    pushFollow(FOLLOW_variable_restriction_in_restriction900);
                     variable_restriction(op,  fc);
                     _fsp--;
 
@@ -1316,9 +1332,9 @@
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:450:8: lc= literal_restriction
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:462:8: lc= literal_restriction
                     {
-                    pushFollow(FOLLOW_literal_restriction_in_restriction905);
+                    pushFollow(FOLLOW_literal_restriction_in_restriction912);
                     lc=literal_restriction();
                     _fsp--;
 
@@ -1348,18 +1364,18 @@
 
 
     // $ANTLR start predicate_constraint
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:457:1: predicate_constraint[String op, ColumnDescr column] : COLON function[context] ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:469:1: predicate_constraint[String op, ColumnDescr column] : COLON function[context] ;
     public void predicate_constraint(String op, ColumnDescr column) throws RecognitionException {
         
            		ExecutionEngine engine = new CLPPredicate();
         		ExecutionBuildContext context = new ExecutionBuildContext( engine );    
             
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:462:4: ( COLON function[context] )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:462:4: COLON function[context]
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:474:4: ( COLON function[context] )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:474:4: COLON function[context]
             {
-            match(input,COLON,FOLLOW_COLON_in_predicate_constraint947); 
-            pushFollow(FOLLOW_function_in_predicate_constraint951);
+            match(input,COLON,FOLLOW_COLON_in_predicate_constraint954); 
+            pushFollow(FOLLOW_function_in_predicate_constraint958);
             function(context);
             _fsp--;
 
@@ -1382,18 +1398,18 @@
 
 
     // $ANTLR start return_value_restriction
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:469:1: return_value_restriction[String op, FieldConstraintDescr fc] : EQUALS function[context] ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:481:1: return_value_restriction[String op, FieldConstraintDescr fc] : EQUALS function[context] ;
     public void return_value_restriction(String op, FieldConstraintDescr fc) throws RecognitionException {
         
         		ExecutionEngine engine = new CLPReturnValue();
         		ExecutionBuildContext context = new ExecutionBuildContext( engine );
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:474:4: ( EQUALS function[context] )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:474:4: EQUALS function[context]
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:486:4: ( EQUALS function[context] )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:486:4: EQUALS function[context]
             {
-            match(input,EQUALS,FOLLOW_EQUALS_in_return_value_restriction974); 
-            pushFollow(FOLLOW_function_in_return_value_restriction979);
+            match(input,EQUALS,FOLLOW_EQUALS_in_return_value_restriction981); 
+            pushFollow(FOLLOW_function_in_return_value_restriction986);
             function(context);
             _fsp--;
 
@@ -1416,16 +1432,16 @@
 
 
     // $ANTLR start variable_restriction
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:480:1: variable_restriction[String op, FieldConstraintDescr fc] : var= VAR ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:492:1: variable_restriction[String op, FieldConstraintDescr fc] : var= VAR ;
     public void variable_restriction(String op, FieldConstraintDescr fc) throws RecognitionException {
         Token var=null;
 
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:481:4: (var= VAR )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:481:4: var= VAR
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:493:4: (var= VAR )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:493:4: var= VAR
             {
             var=(Token)input.LT(1);
-            match(input,VAR,FOLLOW_VAR_in_variable_restriction1000); 
+            match(input,VAR,FOLLOW_VAR_in_variable_restriction1007); 
             
             			fc.addRestriction( new VariableRestrictionDescr(op, var.getText()) );
             		
@@ -1445,7 +1461,7 @@
 
 
     // $ANTLR start literal_restriction
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:487:1: literal_restriction returns [String text] : t= literal ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:499:1: literal_restriction returns [String text] : t= literal ;
     public String literal_restriction() throws RecognitionException {
         String text = null;
 
@@ -1456,10 +1472,10 @@
         		text = null;
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:492:6: (t= literal )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:492:6: t= literal
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:504:6: (t= literal )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:504:6: t= literal
             {
-            pushFollow(FOLLOW_literal_in_literal_restriction1033);
+            pushFollow(FOLLOW_literal_in_literal_restriction1040);
             t=literal();
             _fsp--;
 
@@ -1482,29 +1498,30 @@
 
 
     // $ANTLR start function
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:497:1: function[ExecutionBuildContext context] returns [Function f] : LEFT_PAREN name= NAME ( function_params[context, f] )+ RIGHT_PAREN ;
-    public Function function(ExecutionBuildContext context) throws RecognitionException {
-        Function f = null;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:509:1: function[ExecutionBuildContext context] returns [FunctionCaller fc] : LEFT_PAREN name= NAME ( function_params[context, fc] )+ RIGHT_PAREN ;
+    public FunctionCaller function(ExecutionBuildContext context) throws RecognitionException {
+        FunctionCaller fc = null;
 
         Token name=null;
 
         
-        	    FunctionFactory factory = FunctionFactory.getInstance();
+        		Function f = null;        
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:501:4: ( LEFT_PAREN name= NAME ( function_params[context, f] )+ RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:501:4: LEFT_PAREN name= NAME ( function_params[context, f] )+ RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:513:4: ( LEFT_PAREN name= NAME ( function_params[context, fc] )+ RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:513:4: LEFT_PAREN name= NAME ( function_params[context, fc] )+ RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_function1058); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_function1065); 
             name=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_function1064); 
+            match(input,NAME,FOLLOW_NAME_in_function1071); 
             
             			if ( name.getText().equals("bind") ) {
             		  		context.createLocalVariable( name.getText() );
             			}
-            		  	f = factory.createFunction( name.getText() );		  
+            		  	f = functionRegistry.getFunction( name.getText() );		  
+            			fc= new FunctionCaller( f );
             		
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:509:3: ( function_params[context, f] )+
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:522:3: ( function_params[context, fc] )+
             int cnt15=0;
             loop15:
             do {
@@ -1517,10 +1534,10 @@
 
                 switch (alt15) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:509:3: function_params[context, f]
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:522:3: function_params[context, fc]
             	    {
-            	    pushFollow(FOLLOW_function_params_in_function1077);
-            	    function_params(context,  f);
+            	    pushFollow(FOLLOW_function_params_in_function1084);
+            	    function_params(context,  fc);
             	    _fsp--;
 
 
@@ -1536,8 +1553,8 @@
                 cnt15++;
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_function1087); 
-             context.addFunction( f ); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_function1094); 
+             context.addFunction( fc ); 
 
             }
 
@@ -1548,27 +1565,31 @@
         }
         finally {
         }
-        return f;
+        return fc;
     }
     // $ANTLR end function
 
 
     // $ANTLR start modify_function
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:515:1: modify_function[ExecutionBuildContext context] returns [Function f] : LEFT_PAREN 'modify' ( slot_name_value_pair[context, f] )+ RIGHT_PAREN ;
-    public Function modify_function(ExecutionBuildContext context) throws RecognitionException {
-        Function f = null;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:528:1: modify_function[ExecutionBuildContext context] returns [FunctionCaller fc] : LEFT_PAREN 'modify' t= VAR ( slot_name_value_pair[context, fchg] )+ RIGHT_PAREN ;
+    public FunctionCaller modify_function(ExecutionBuildContext context) throws RecognitionException {
+        FunctionCaller fc = null;
 
-        
-        	    FunctionFactory factory = FunctionFactory.getInstance();
-        		f = factory.createFunction( "modify" );
-        	
+        Token t=null;
+
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:521:3: ( LEFT_PAREN 'modify' ( slot_name_value_pair[context, f] )+ RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:521:3: LEFT_PAREN 'modify' ( slot_name_value_pair[context, f] )+ RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:530:3: ( LEFT_PAREN 'modify' t= VAR ( slot_name_value_pair[context, fchg] )+ RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:530:3: LEFT_PAREN 'modify' t= VAR ( slot_name_value_pair[context, fchg] )+ RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_modify_function1118); 
-            match(input,43,FOLLOW_43_in_modify_function1123); 
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:523:4: ( slot_name_value_pair[context, f] )+
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_modify_function1119); 
+            match(input,43,FOLLOW_43_in_modify_function1124); 
+            
+            				fc = new FunctionCaller( functionRegistry.getFunction( "modify" ) );
+            			
+            t=(Token)input.LT(1);
+            match(input,VAR,FOLLOW_VAR_in_modify_function1133); 
+             fc.addParameter( context.getVariableValueHandler( t.getText() ) ); 
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:535:4: ( slot_name_value_pair[context, fchg] )+
             int cnt16=0;
             loop16:
             do {
@@ -1581,10 +1602,10 @@
 
                 switch (alt16) {
             	case 1 :
-            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:523:4: slot_name_value_pair[context, f]
+            	    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:535:4: slot_name_value_pair[context, fchg]
             	    {
-            	    pushFollow(FOLLOW_slot_name_value_pair_in_modify_function1128);
-            	    slot_name_value_pair(context,  f);
+            	    pushFollow(FOLLOW_slot_name_value_pair_in_modify_function1144);
+            	    slot_name_value_pair(context,  fchg);
             	    _fsp--;
 
 
@@ -1600,7 +1621,7 @@
                 cnt16++;
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_modify_function1134); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_modify_function1150); 
 
             }
 
@@ -1611,26 +1632,26 @@
         }
         finally {
         }
-        return f;
+        return fc;
     }
     // $ANTLR end modify_function
 
 
     // $ANTLR start function_params
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:527:1: function_params[ExecutionBuildContext context, Function f] : (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) ;
-    public void function_params(ExecutionBuildContext context, Function f) throws RecognitionException {
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:539:1: function_params[ExecutionBuildContext context, FunctionCaller fc] : (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) ;
+    public void function_params(ExecutionBuildContext context, FunctionCaller fc) throws RecognitionException {
         Token t=null;
-        Function nf = null;
+        FunctionCaller nf = null;
 
 
         
         		ValueHandler value  =  null;		
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:532:3: ( (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:532:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:544:3: ( (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:544:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:532:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:544:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
             int alt17=8;
             switch ( input.LA(1) ) {
             case VAR:
@@ -1659,79 +1680,79 @@
                 break;
             default:
                 NoViableAltException nvae =
-                    new NoViableAltException("532:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )", 17, 0, input);
+                    new NoViableAltException("544:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )", 17, 0, input);
 
                 throw nvae;
             }
 
             switch (alt17) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:532:6: t= VAR
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:544:6: t= VAR
                     {
                     t=(Token)input.LT(1);
-                    match(input,VAR,FOLLOW_VAR_in_function_params1163); 
+                    match(input,VAR,FOLLOW_VAR_in_function_params1179); 
                      value = context.getVariableValueHandler(t.getText() ); 
 
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:533:6: t= STRING
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:545:6: t= STRING
                     {
                     t=(Token)input.LT(1);
-                    match(input,STRING,FOLLOW_STRING_in_function_params1175); 
+                    match(input,STRING,FOLLOW_STRING_in_function_params1191); 
                      value = new ObjectLiteralValue( getString( t ) ); 
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:534:7: t= NAME
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:546:7: t= NAME
                     {
                     t=(Token)input.LT(1);
-                    match(input,NAME,FOLLOW_NAME_in_function_params1190); 
+                    match(input,NAME,FOLLOW_NAME_in_function_params1206); 
                      value = new ObjectLiteralValue( t.getText() ); 
 
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:535:6: t= FLOAT
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:547:6: t= FLOAT
                     {
                     t=(Token)input.LT(1);
-                    match(input,FLOAT,FOLLOW_FLOAT_in_function_params1207); 
+                    match(input,FLOAT,FOLLOW_FLOAT_in_function_params1223); 
                      value = new DoubleLiteralValue( t.getText() ); 
 
                     }
                     break;
                 case 5 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:536:6: t= INT
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:548:6: t= INT
                     {
                     t=(Token)input.LT(1);
-                    match(input,INT,FOLLOW_INT_in_function_params1222); 
+                    match(input,INT,FOLLOW_INT_in_function_params1238); 
                      value = new LongLiteralValue( t.getText() ); 
 
                     }
                     break;
                 case 6 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:537:6: t= BOOL
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:549:6: t= BOOL
                     {
                     t=(Token)input.LT(1);
-                    match(input,BOOL,FOLLOW_BOOL_in_function_params1242); 
+                    match(input,BOOL,FOLLOW_BOOL_in_function_params1258); 
                      value = new BooleanLiteralValue( t.getText() ); 
 
                     }
                     break;
                 case 7 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:538:6: t= NULL
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:550:6: t= NULL
                     {
                     t=(Token)input.LT(1);
-                    match(input,NULL,FOLLOW_NULL_in_function_params1264); 
+                    match(input,NULL,FOLLOW_NULL_in_function_params1280); 
                      value = ObjectLiteralValue.NULL; 
 
                     }
                     break;
                 case 8 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:539:6: nf= function[context]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:551:6: nf= function[context]
                     {
-                    pushFollow(FOLLOW_function_in_function_params1280);
+                    pushFollow(FOLLOW_function_in_function_params1296);
                     nf=function(context);
                     _fsp--;
 
@@ -1742,7 +1763,7 @@
 
             }
 
-             f.addParameter( value ); 
+             fc.addParameter( value ); 
 
             }
 
@@ -1759,11 +1780,11 @@
 
 
     // $ANTLR start slot_name_value_pair
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:545:1: slot_name_value_pair[ExecutionBuildContext context, Function f] : LEFT_PAREN id= NAME (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN ;
-    public void slot_name_value_pair(ExecutionBuildContext context, Function f) throws RecognitionException {
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:557:1: slot_name_value_pair[ExecutionBuildContext context, FunctionCaller fc] : LEFT_PAREN id= NAME (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN ;
+    public void slot_name_value_pair(ExecutionBuildContext context, FunctionCaller fc) throws RecognitionException {
         Token id=null;
         Token t=null;
-        Function nf = null;
+        FunctionCaller nf = null;
 
 
         
@@ -1771,16 +1792,16 @@
         		String name = null;
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:551:3: ( LEFT_PAREN id= NAME (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:551:3: LEFT_PAREN id= NAME (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:563:3: ( LEFT_PAREN id= NAME (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:563:3: LEFT_PAREN id= NAME (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_slot_name_value_pair1322); 
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_slot_name_value_pair1338); 
             id=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_slot_name_value_pair1328); 
+            match(input,NAME,FOLLOW_NAME_in_slot_name_value_pair1344); 
             
             			name = id.getText();
             		
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:555:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:567:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
             int alt18=8;
             switch ( input.LA(1) ) {
             case VAR:
@@ -1809,79 +1830,79 @@
                 break;
             default:
                 NoViableAltException nvae =
-                    new NoViableAltException("555:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )", 18, 0, input);
+                    new NoViableAltException("567:3: (t= VAR | t= STRING | t= NAME | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )", 18, 0, input);
 
                 throw nvae;
             }
 
             switch (alt18) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:555:6: t= VAR
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:567:6: t= VAR
                     {
                     t=(Token)input.LT(1);
-                    match(input,VAR,FOLLOW_VAR_in_slot_name_value_pair1339); 
+                    match(input,VAR,FOLLOW_VAR_in_slot_name_value_pair1355); 
                      nameValuePair = new SlotNameValuePair(name, context.getVariableValueHandler( t.getText() ) ); 
 
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:556:7: t= STRING
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:568:7: t= STRING
                     {
                     t=(Token)input.LT(1);
-                    match(input,STRING,FOLLOW_STRING_in_slot_name_value_pair1357); 
+                    match(input,STRING,FOLLOW_STRING_in_slot_name_value_pair1373); 
                      nameValuePair = new SlotNameValuePair(name, new ObjectLiteralValue( getString( t ) ) ); 
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:557:7: t= NAME
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:569:7: t= NAME
                     {
                     t=(Token)input.LT(1);
-                    match(input,NAME,FOLLOW_NAME_in_slot_name_value_pair1372); 
+                    match(input,NAME,FOLLOW_NAME_in_slot_name_value_pair1388); 
                      nameValuePair = new SlotNameValuePair(name, new ObjectLiteralValue( t.getText() ) ); 
 
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:558:6: t= FLOAT
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:6: t= FLOAT
                     {
                     t=(Token)input.LT(1);
-                    match(input,FLOAT,FOLLOW_FLOAT_in_slot_name_value_pair1389); 
+                    match(input,FLOAT,FOLLOW_FLOAT_in_slot_name_value_pair1405); 
                      nameValuePair = new SlotNameValuePair(name, new DoubleLiteralValue( t.getText() ) ); 
 
                     }
                     break;
                 case 5 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:559:6: t= INT
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:571:6: t= INT
                     {
                     t=(Token)input.LT(1);
-                    match(input,INT,FOLLOW_INT_in_slot_name_value_pair1404); 
+                    match(input,INT,FOLLOW_INT_in_slot_name_value_pair1420); 
                      nameValuePair = new SlotNameValuePair(name, new LongLiteralValue( t.getText() ) ); 
 
                     }
                     break;
                 case 6 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:560:6: t= BOOL
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:572:6: t= BOOL
                     {
                     t=(Token)input.LT(1);
-                    match(input,BOOL,FOLLOW_BOOL_in_slot_name_value_pair1424); 
+                    match(input,BOOL,FOLLOW_BOOL_in_slot_name_value_pair1440); 
                      nameValuePair = new SlotNameValuePair(name, new BooleanLiteralValue( t.getText() ) ) ; 
 
                     }
                     break;
                 case 7 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:561:6: t= NULL
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:573:6: t= NULL
                     {
                     t=(Token)input.LT(1);
-                    match(input,NULL,FOLLOW_NULL_in_slot_name_value_pair1446); 
+                    match(input,NULL,FOLLOW_NULL_in_slot_name_value_pair1462); 
                      nameValuePair = new SlotNameValuePair(name, ObjectLiteralValue.NULL ); 
 
                     }
                     break;
                 case 8 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:562:6: nf= function[context]
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:6: nf= function[context]
                     {
-                    pushFollow(FOLLOW_function_in_slot_name_value_pair1462);
+                    pushFollow(FOLLOW_function_in_slot_name_value_pair1478);
                     nf=function(context);
                     _fsp--;
 
@@ -1892,8 +1913,8 @@
 
             }
 
-             f.addParameter( nameValuePair ); 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_slot_name_value_pair1499); 
+             fc.addParameter( nameValuePair ); 
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_slot_name_value_pair1515); 
 
             }
 
@@ -1910,7 +1931,7 @@
 
 
     // $ANTLR start literal
-    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:569:1: literal returns [String text] : (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
+    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:581:1: literal returns [String text] : (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
     public String literal() throws RecognitionException {
         String text = null;
 
@@ -1920,10 +1941,10 @@
         		text = null;
         	
         try {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:573:4: ( (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:573:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:585:4: ( (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:585:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
             {
-            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:573:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
+            // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:585:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
             int alt19=6;
             switch ( input.LA(1) ) {
             case STRING:
@@ -1946,62 +1967,62 @@
                 break;
             default:
                 NoViableAltException nvae =
-                    new NoViableAltException("573:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )", 19, 0, input);
+                    new NoViableAltException("585:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )", 19, 0, input);
 
                 throw nvae;
             }
 
             switch (alt19) {
                 case 1 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:573:8: t= STRING
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:585:8: t= STRING
                     {
                     t=(Token)input.LT(1);
-                    match(input,STRING,FOLLOW_STRING_in_literal1528); 
+                    match(input,STRING,FOLLOW_STRING_in_literal1544); 
                      text = getString( t ); 
 
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:7: t= NAME
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:586:7: t= NAME
                     {
                     t=(Token)input.LT(1);
-                    match(input,NAME,FOLLOW_NAME_in_literal1541); 
+                    match(input,NAME,FOLLOW_NAME_in_literal1557); 
                      text = t.getText(); 
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:575:7: t= INT
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:587:7: t= INT
                     {
                     t=(Token)input.LT(1);
-                    match(input,INT,FOLLOW_INT_in_literal1557); 
+                    match(input,INT,FOLLOW_INT_in_literal1573); 
                      text = t.getText(); 
 
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:576:7: t= FLOAT
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:588:7: t= FLOAT
                     {
                     t=(Token)input.LT(1);
-                    match(input,FLOAT,FOLLOW_FLOAT_in_literal1572); 
+                    match(input,FLOAT,FOLLOW_FLOAT_in_literal1588); 
                      text = t.getText(); 
 
                     }
                     break;
                 case 5 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:577:7: t= BOOL
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:589:7: t= BOOL
                     {
                     t=(Token)input.LT(1);
-                    match(input,BOOL,FOLLOW_BOOL_in_literal1585); 
+                    match(input,BOOL,FOLLOW_BOOL_in_literal1601); 
                      text = t.getText(); 
 
                     }
                     break;
                 case 6 :
-                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:578:7: t= NULL
+                    // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:7: t= NULL
                     {
                     t=(Token)input.LT(1);
-                    match(input,NULL,FOLLOW_NULL_in_literal1599); 
+                    match(input,NULL,FOLLOW_NULL_in_literal1615); 
                      text = null; 
 
                     }
@@ -2027,115 +2048,115 @@
  
 
     public static final BitSet FOLLOW_41_in_opt_semicolon38 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_statement_in_compilation_unit56 = new BitSet(new long[]{0x0000000000000012L});
-    public static final BitSet FOLLOW_rule_in_statement76 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_rule107 = new BitSet(new long[]{0x0000000000000020L});
-    public static final BitSet FOLLOW_DEFRULE_in_rule115 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_NAME_in_rule119 = new BitSet(new long[]{0x0000000000000080L});
-    public static final BitSet FOLLOW_STRING_in_rule131 = new BitSet(new long[]{0x0000040000010010L});
-    public static final BitSet FOLLOW_ruleAttribute_in_rule137 = new BitSet(new long[]{0x0000040000010010L});
-    public static final BitSet FOLLOW_ce_in_rule145 = new BitSet(new long[]{0x0000040000010010L});
-    public static final BitSet FOLLOW_42_in_rule154 = new BitSet(new long[]{0x0000000000000110L});
-    public static final BitSet FOLLOW_rhs_in_rule161 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_rule169 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute186 = new BitSet(new long[]{0x0000000010000000L});
-    public static final BitSet FOLLOW_DECLARE_in_ruleAttribute188 = new BitSet(new long[]{0x0000000000000110L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute195 = new BitSet(new long[]{0x0000000000000200L});
-    public static final BitSet FOLLOW_salience_in_ruleAttribute199 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute203 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute210 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_SALIENCE_in_salience240 = new BitSet(new long[]{0x0000000000000400L});
-    public static final BitSet FOLLOW_INT_in_salience244 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_and_ce_in_ce270 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_or_ce_in_ce280 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_not_ce_in_ce289 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_exists_ce_in_ce298 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_eval_ce_in_ce312 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_normal_pattern_in_ce326 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_bound_pattern_in_ce335 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_function_in_rhs363 = new BitSet(new long[]{0x0000000000000012L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_and_ce392 = new BitSet(new long[]{0x0000000000000800L});
-    public static final BitSet FOLLOW_AND_in_and_ce397 = new BitSet(new long[]{0x0000000000010010L});
-    public static final BitSet FOLLOW_ce_in_and_ce403 = new BitSet(new long[]{0x0000000000010110L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_and_ce412 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_or_ce440 = new BitSet(new long[]{0x0000000000001000L});
-    public static final BitSet FOLLOW_OR_in_or_ce445 = new BitSet(new long[]{0x0000000000010010L});
-    public static final BitSet FOLLOW_ce_in_or_ce451 = new BitSet(new long[]{0x0000000000010110L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_or_ce460 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_not_ce488 = new BitSet(new long[]{0x0000000000002000L});
-    public static final BitSet FOLLOW_NOT_in_not_ce493 = new BitSet(new long[]{0x0000000000010010L});
-    public static final BitSet FOLLOW_ce_in_not_ce499 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_not_ce507 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_exists_ce536 = new BitSet(new long[]{0x0000000000004000L});
-    public static final BitSet FOLLOW_EXISTS_in_exists_ce541 = new BitSet(new long[]{0x0000000000010010L});
-    public static final BitSet FOLLOW_ce_in_exists_ce547 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_exists_ce555 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce583 = new BitSet(new long[]{0x0000000000008000L});
-    public static final BitSet FOLLOW_TEST_in_eval_ce588 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_function_in_eval_ce594 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce605 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_normal_pattern633 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_NAME_in_normal_pattern640 = new BitSet(new long[]{0x0000000000000110L});
-    public static final BitSet FOLLOW_field_constriant_in_normal_pattern646 = new BitSet(new long[]{0x0000000000000110L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_normal_pattern656 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_VAR_in_bound_pattern684 = new BitSet(new long[]{0x0000000000020000L});
-    public static final BitSet FOLLOW_ASSIGN_OP_in_bound_pattern690 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_bound_pattern692 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_NAME_in_bound_pattern696 = new BitSet(new long[]{0x0000000000000110L});
-    public static final BitSet FOLLOW_field_constriant_in_bound_pattern705 = new BitSet(new long[]{0x0000000000000110L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_bound_pattern712 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_field_constriant743 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_NAME_in_field_constriant747 = new BitSet(new long[]{0x0000000003F104C0L});
-    public static final BitSet FOLLOW_connected_constraint_in_field_constriant762 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_field_constriant768 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_restriction_in_connected_constraint784 = new BitSet(new long[]{0x00000000000C0002L});
-    public static final BitSet FOLLOW_AMPERSAND_in_connected_constraint796 = new BitSet(new long[]{0x0000000003F104C0L});
-    public static final BitSet FOLLOW_connected_constraint_in_connected_constraint805 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_PIPE_in_connected_constraint817 = new BitSet(new long[]{0x0000000003F104C0L});
-    public static final BitSet FOLLOW_connected_constraint_in_connected_constraint826 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_TILDE_in_restriction852 = new BitSet(new long[]{0x0000000003E104C0L});
-    public static final BitSet FOLLOW_predicate_constraint_in_restriction868 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_return_value_restriction_in_restriction884 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_variable_restriction_in_restriction893 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_literal_restriction_in_restriction905 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_COLON_in_predicate_constraint947 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_function_in_predicate_constraint951 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_EQUALS_in_return_value_restriction974 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_function_in_return_value_restriction979 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_VAR_in_variable_restriction1000 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_literal_in_literal_restriction1033 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_function1058 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_NAME_in_function1064 = new BitSet(new long[]{0x00000000038104D0L});
-    public static final BitSet FOLLOW_function_params_in_function1077 = new BitSet(new long[]{0x00000000038105D0L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_function1087 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_modify_function1118 = new BitSet(new long[]{0x0000080000000000L});
-    public static final BitSet FOLLOW_43_in_modify_function1123 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_slot_name_value_pair_in_modify_function1128 = new BitSet(new long[]{0x0000000000000110L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_modify_function1134 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_VAR_in_function_params1163 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_STRING_in_function_params1175 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NAME_in_function_params1190 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_FLOAT_in_function_params1207 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_INT_in_function_params1222 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_BOOL_in_function_params1242 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NULL_in_function_params1264 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_function_in_function_params1280 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_slot_name_value_pair1322 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_NAME_in_slot_name_value_pair1328 = new BitSet(new long[]{0x00000000038104D0L});
-    public static final BitSet FOLLOW_VAR_in_slot_name_value_pair1339 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_STRING_in_slot_name_value_pair1357 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_NAME_in_slot_name_value_pair1372 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_FLOAT_in_slot_name_value_pair1389 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_INT_in_slot_name_value_pair1404 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_BOOL_in_slot_name_value_pair1424 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_NULL_in_slot_name_value_pair1446 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_function_in_slot_name_value_pair1462 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_slot_name_value_pair1499 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_STRING_in_literal1528 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NAME_in_literal1541 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_INT_in_literal1557 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_FLOAT_in_literal1572 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_BOOL_in_literal1585 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NULL_in_literal1599 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_statement_in_compilation_unit56 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_defrule114 = new BitSet(new long[]{0x0000000000000020L});
+    public static final BitSet FOLLOW_DEFRULE_in_defrule122 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_NAME_in_defrule126 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_STRING_in_defrule138 = new BitSet(new long[]{0x0000040000010010L});
+    public static final BitSet FOLLOW_ruleAttribute_in_defrule144 = new BitSet(new long[]{0x0000040000010010L});
+    public static final BitSet FOLLOW_ce_in_defrule152 = new BitSet(new long[]{0x0000040000010010L});
+    public static final BitSet FOLLOW_42_in_defrule161 = new BitSet(new long[]{0x0000000000000110L});
+    public static final BitSet FOLLOW_rhs_in_defrule168 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_defrule176 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute193 = new BitSet(new long[]{0x0000000010000000L});
+    public static final BitSet FOLLOW_DECLARE_in_ruleAttribute195 = new BitSet(new long[]{0x0000000000000110L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute202 = new BitSet(new long[]{0x0000000000000200L});
+    public static final BitSet FOLLOW_salience_in_ruleAttribute206 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute210 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute217 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_SALIENCE_in_salience247 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_INT_in_salience251 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_and_ce_in_ce277 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_or_ce_in_ce287 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_not_ce_in_ce296 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_exists_ce_in_ce305 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_eval_ce_in_ce319 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_normal_pattern_in_ce333 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_bound_pattern_in_ce342 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_function_in_rhs370 = new BitSet(new long[]{0x0000000000000012L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_and_ce399 = new BitSet(new long[]{0x0000000000000800L});
+    public static final BitSet FOLLOW_AND_in_and_ce404 = new BitSet(new long[]{0x0000000000010010L});
+    public static final BitSet FOLLOW_ce_in_and_ce410 = new BitSet(new long[]{0x0000000000010110L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_and_ce419 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_or_ce447 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_OR_in_or_ce452 = new BitSet(new long[]{0x0000000000010010L});
+    public static final BitSet FOLLOW_ce_in_or_ce458 = new BitSet(new long[]{0x0000000000010110L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_or_ce467 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_not_ce495 = new BitSet(new long[]{0x0000000000002000L});
+    public static final BitSet FOLLOW_NOT_in_not_ce500 = new BitSet(new long[]{0x0000000000010010L});
+    public static final BitSet FOLLOW_ce_in_not_ce506 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_not_ce514 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_exists_ce543 = new BitSet(new long[]{0x0000000000004000L});
+    public static final BitSet FOLLOW_EXISTS_in_exists_ce548 = new BitSet(new long[]{0x0000000000010010L});
+    public static final BitSet FOLLOW_ce_in_exists_ce554 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_exists_ce562 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce590 = new BitSet(new long[]{0x0000000000008000L});
+    public static final BitSet FOLLOW_TEST_in_eval_ce595 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_function_in_eval_ce601 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce612 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_normal_pattern640 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_NAME_in_normal_pattern647 = new BitSet(new long[]{0x0000000000000110L});
+    public static final BitSet FOLLOW_field_constriant_in_normal_pattern653 = new BitSet(new long[]{0x0000000000000110L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_normal_pattern663 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_VAR_in_bound_pattern691 = new BitSet(new long[]{0x0000000000020000L});
+    public static final BitSet FOLLOW_ASSIGN_OP_in_bound_pattern697 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_bound_pattern699 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_NAME_in_bound_pattern703 = new BitSet(new long[]{0x0000000000000110L});
+    public static final BitSet FOLLOW_field_constriant_in_bound_pattern712 = new BitSet(new long[]{0x0000000000000110L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_bound_pattern719 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_field_constriant750 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_NAME_in_field_constriant754 = new BitSet(new long[]{0x0000000003F104C0L});
+    public static final BitSet FOLLOW_connected_constraint_in_field_constriant769 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_field_constriant775 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_restriction_in_connected_constraint791 = new BitSet(new long[]{0x00000000000C0002L});
+    public static final BitSet FOLLOW_AMPERSAND_in_connected_constraint803 = new BitSet(new long[]{0x0000000003F104C0L});
+    public static final BitSet FOLLOW_connected_constraint_in_connected_constraint812 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_PIPE_in_connected_constraint824 = new BitSet(new long[]{0x0000000003F104C0L});
+    public static final BitSet FOLLOW_connected_constraint_in_connected_constraint833 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_TILDE_in_restriction859 = new BitSet(new long[]{0x0000000003E104C0L});
+    public static final BitSet FOLLOW_predicate_constraint_in_restriction875 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_return_value_restriction_in_restriction891 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variable_restriction_in_restriction900 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_literal_restriction_in_restriction912 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_COLON_in_predicate_constraint954 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_function_in_predicate_constraint958 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EQUALS_in_return_value_restriction981 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_function_in_return_value_restriction986 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_VAR_in_variable_restriction1007 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_literal_in_literal_restriction1040 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_function1065 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_NAME_in_function1071 = new BitSet(new long[]{0x00000000038104D0L});
+    public static final BitSet FOLLOW_function_params_in_function1084 = new BitSet(new long[]{0x00000000038105D0L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_function1094 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_modify_function1119 = new BitSet(new long[]{0x0000080000000000L});
+    public static final BitSet FOLLOW_43_in_modify_function1124 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_VAR_in_modify_function1133 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_slot_name_value_pair_in_modify_function1144 = new BitSet(new long[]{0x0000000000000110L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_modify_function1150 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_VAR_in_function_params1179 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_STRING_in_function_params1191 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NAME_in_function_params1206 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FLOAT_in_function_params1223 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_INT_in_function_params1238 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_BOOL_in_function_params1258 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NULL_in_function_params1280 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_function_in_function_params1296 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_slot_name_value_pair1338 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_NAME_in_slot_name_value_pair1344 = new BitSet(new long[]{0x00000000038104D0L});
+    public static final BitSet FOLLOW_VAR_in_slot_name_value_pair1355 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_STRING_in_slot_name_value_pair1373 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_NAME_in_slot_name_value_pair1388 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_FLOAT_in_slot_name_value_pair1405 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_INT_in_slot_name_value_pair1420 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_BOOL_in_slot_name_value_pair1440 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_NULL_in_slot_name_value_pair1462 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_function_in_slot_name_value_pair1478 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_slot_name_value_pair1515 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_STRING_in_literal1544 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NAME_in_literal1557 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_INT_in_literal1573 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FLOAT_in_literal1588 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_BOOL_in_literal1601 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NULL_in_literal1615 = new BitSet(new long[]{0x0000000000000002L});
 
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPredicate.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPredicate.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPredicate.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -3,6 +3,8 @@
  */
 package org.drools.clp;
 
+import java.util.Map;
+
 import org.drools.WorkingMemory;
 import org.drools.base.FieldFactory;
 import org.drools.common.InternalWorkingMemory;
@@ -15,26 +17,26 @@
     implements
     PredicateExpression,
     ExecutionEngine {
-    private Function function;
+    private FunctionCaller function;
     private int      index;
     
     public CLPPredicate() {        
     }
     
-    public CLPPredicate(Function function) {
+    public CLPPredicate(FunctionCaller function) {
         this.function = function;
     }
 
-    public void addFunction(Function function) {
+    public void addFunction(FunctionCaller function) {
         setFunction( function );        
     }
     
-    public void setFunction(Function function) {
+    public void setFunction(FunctionCaller function) {
         this.function = function;
     }
     
-    public Function[] getFunctions() {
-        return new Function[] { this.function };
+    public FunctionCaller[] getFunctions() {
+        return new FunctionCaller[] { this.function };
     }    
     
     public int getNextIndex() {
@@ -52,4 +54,8 @@
                                                          this.index-1 );
         return this.function.getBooleanValue( context );
     }
+    
+    public void replaceTempTokens(Map variables) {
+        this.function.replaceTempTokens( variables );
+    }    
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPreviousDeclarationVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPreviousDeclarationVariable.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPreviousDeclarationVariable.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -40,13 +40,23 @@
     
     public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return (BigDecimal) declaration.getValue( handle.getObject() );
+        Object object = declaration.getValue(  handle.getObject() );
+        if ( object instanceof BigDecimal ) {
+            return (BigDecimal) object;
+        } else {
+            return new BigDecimal( object.toString() );
+        }
     }
 
     public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return (BigInteger) declaration.getValue( handle.getObject() );
-    }
+        Object object = declaration.getValue(  handle.getObject() );
+        if ( object instanceof BigInteger ) {
+            return (BigInteger) object;
+        } else {
+            return new BigInteger( object.toString() );
+        }
+    }    
 
     public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPReturnValue.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPReturnValue.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPReturnValue.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -3,6 +3,8 @@
  */
 package org.drools.clp;
 
+import java.util.Map;
+
 import org.drools.WorkingMemory;
 import org.drools.base.FieldFactory;
 import org.drools.common.InternalWorkingMemory;
@@ -16,27 +18,27 @@
     implements
     ReturnValueExpression,
     ExecutionEngine {
-    private Function function;
+    private FunctionCaller function;
     private int index;
     
     public CLPReturnValue() {
         
     }
     
-    public CLPReturnValue(Function function) {
+    public CLPReturnValue(FunctionCaller function) {
         this.function = function;
     }
 
-    public void setFunction(Function function) {
+    public void setFunction(FunctionCaller function) {
         this.function = function;
     }
     
-    public void addFunction(Function function) {
+    public void addFunction(FunctionCaller function) {
         setFunction( function );        
     }  
     
-    public Function[] getFunctions() {
-        return new Function[] { this.function };
+    public FunctionCaller[] getFunctions() {
+        return new FunctionCaller[] { this.function };
     }
 
     public int getNextIndex() {
@@ -54,4 +56,8 @@
                                                          this.index-1 );
         return FieldFactory.getFieldValue( this.function.getBooleanValue( context ) );
     }
+    
+    public void replaceTempTokens(Map variables) {
+        this.function.replaceTempTokens( variables );
+    }    
 }
\ No newline at end of file

Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Deffunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Deffunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Deffunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,64 @@
+package org.drools.clp;
+
+public class Deffunction implements Function {
+    private final String name;
+    private FunctionCaller[] functions;
+  
+    private ValueHandler[] parameters;
+    
+    public Deffunction(String name) {
+        this.name = name;
+    }
+    
+    public void addParameter(ValueHandler parameter) {
+        if (parameters == null) {
+            this.parameters = new ValueHandler[] { parameter };
+        } else {
+            ValueHandler[] temp =  new ValueHandler[ parameters.length + 1 ];
+            System.arraycopy( this.parameters, 0, temp, 0, this.parameters.length );
+            temp[ temp.length - 1] = parameter;
+            this.parameters = temp;             
+        }                
+    }
+    
+    public void addFunction(FunctionCaller function) {
+        if (functions == null) {
+            this.functions = new FunctionCaller[] { function};
+        } else {
+            FunctionCaller[] temp =  new FunctionCaller[ functions.length + 1 ];
+            System.arraycopy( this.functions, 0, temp, 0, this.functions.length );
+            temp[ temp.length - 1] = function;
+            this.functions = temp;             
+        }                
+    }    
+    
+    public ValueHandler[] getParameters() {
+        return this.parameters;
+    }    
+    
+
+    public Object execute(ValueHandler[] args,
+                          ExecutionContext context) {
+        ExecutionContext newContext = initContext(args, context);
+        
+        Object returnValue = null;
+        
+        for ( int i = 0, length = this.functions.length; i < length; i++ ) {
+            returnValue = this.functions[i].getValue( newContext ); 
+        }
+        return returnValue;
+    }
+    
+    private ExecutionContext initContext(ValueHandler[] args,
+                             ExecutionContext context) {
+        ExecutionContext newContext = new ExecutionContext(context.getWorkingMemory(), context.getTuple(), args.length );
+        for ( int i = 0, length = args.length; i < length; i++ ) {
+            newContext.setLocalVariable( i, args[i].getValue( context ) );
+        }
+        return newContext;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionBuildContext.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionBuildContext.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionBuildContext.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -11,7 +11,7 @@
         this.engine = engine;
     }
     
-    public void addFunction(Function function) {
+    public void addFunction(FunctionCaller function) {
         this.engine.addFunction( function );
     }
     
@@ -19,6 +19,7 @@
         ValueHandler var = ( ValueHandler ) this.vars.get( identifier ) ;
         if (  var == null ) {
             var = new LocalVariableValue(identifier, this.engine.getNextIndex() );
+            this.vars.put( identifier, var );
         }
         return var;
     }

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionContext.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionContext.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionContext.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -39,7 +39,7 @@
 
     public Object getLocalVariable(int index) {
         return localVariables[index];
-    }
+    }    
 
     public void setLocalVariable(int index, Object object) {
         this.localVariables[index] = object;

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionEngine.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionEngine.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionEngine.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,9 +1,9 @@
 package org.drools.clp;
 
 public interface ExecutionEngine {
-    public void addFunction(Function function);
+    public void addFunction(FunctionCaller function);
     
     public int getNextIndex();
     
-    public Function[] getFunctions();
+    public FunctionCaller[] getFunctions();
 }

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Function.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Function.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Function.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -2,13 +2,12 @@
 
 import java.util.Map;
 
-public interface Function extends ValueHandler {
+public interface Function { //extends ValueHandler {
+    public Object execute(ValueHandler[] args, ExecutionContext context);    
+    
     public String getName();    
     
-    public void addParameter(ValueHandler valueHandler);
+    //public void addParameter(ValueHandler valueHandler);
     
-    public ValueHandler[] getParameters();
-    
-    public void replaceTempTokens(Map variables);
-            
+    //public ValueHandler[] getParameters();                
 }

Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionCaller.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionCaller.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionCaller.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,65 @@
+package org.drools.clp;
+
+import java.util.Map;
+
+public class FunctionCaller extends BaseValueHandler {
+    private Function function;
+    
+    protected ValueHandler[] parameters;
+    
+    public FunctionCaller() {
+        this( null );
+    }
+    
+    public FunctionCaller(Function function) {
+        this.function = function;
+    }
+    
+    public void setFunction(Function function) {
+        this.function = function;
+    }
+    
+    public Function getFunction() {
+        return this.function;
+    }
+    
+    public String getName() {
+        return ( this.function == null ) ? null : this.function.getName();
+    }
+    
+    public void addParameter(ValueHandler valueHandler) {
+        if (parameters == null) {
+            this.parameters = new ValueHandler[] { valueHandler};
+        } else {
+            ValueHandler[] temp =  new ValueHandler[ parameters.length + 1 ];
+            System.arraycopy( this.parameters, 0, temp, 0, this.parameters.length );
+            temp[ temp.length - 1] = valueHandler;
+            this.parameters = temp;             
+        }                
+    }
+    
+    public ValueHandler[] getParameters() {
+        return this.parameters;
+    }    
+    
+    public Object getValue(ExecutionContext context) {        
+        return function.execute( parameters, context );
+    }
+
+    public void setValue(ExecutionContext context,
+                         Object object) {
+        throw new RuntimeException( "You cannot set the value on a Function" );        
+    }
+    
+  public void replaceTempTokens(Map variables) {
+      for ( int i = 0, length = this.parameters.length; i < length; i++ ) {
+          if ( this.parameters[i] instanceof TempTokenVariable ) {
+              TempTokenVariable var = ( TempTokenVariable ) this.parameters[i]; 
+              this.parameters[i] = ( ValueHandler ) variables.get( var.getIdentifier() );
+          } else if ( this.parameters[i] instanceof FunctionCaller ) {
+              ((FunctionCaller)parameters[i]).replaceTempTokens( variables );
+          }
+      }  
+  }    
+
+}

Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionDelegator.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionDelegator.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionDelegator.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,30 @@
+package org.drools.clp;
+
+public class FunctionDelegator implements Function {    
+    private Function function;
+    
+    public FunctionDelegator() {
+        
+    }
+
+    public FunctionDelegator(Function function) {
+        this.function = function;
+    }
+    
+    public void setFunction(Function function) {
+        this.function = function;
+    }
+
+    public Object execute(ValueHandler[] args,
+                          ExecutionContext context) {
+        return function.execute( args,
+                                 context );
+    }
+
+    public String getName() {
+        return function.getName();
+    }
+    
+    
+    
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,96 +0,0 @@
-package org.drools.clp;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-public class FunctionFactory {
-    public static final FunctionFactory instance = new FunctionFactory();
-    
-    public static FunctionFactory getInstance() {
-        return instance;
-    }
-    
-    public Map functions;
-    
-    public Map variables;        
-    
-    private FunctionFactory() {
-        this.functions = new HashMap();
-        this.variables = new HashMap();
-        
-        try {
-            loadFunctions();
-        } catch ( IOException e ) {
-            throw new RuntimeException( e );
-        } catch ( ClassNotFoundException e ) {
-            throw new RuntimeException( e );
-        }
-    }        
-    
-    public void loadFunctions() throws IOException, ClassNotFoundException {        
-        BufferedReader reader = new BufferedReader( new InputStreamReader( getClass().getResourceAsStream( "functions.conf" ) ) );
-        loadFunctions( reader );
-    }
-    
-    public void loadFunctions(BufferedReader reader) throws IOException, ClassNotFoundException {
-        String line = null;       
-        
-        try {
-            while( (line = reader.readLine() ) != null ) {
-                Class clazz = getClass().getClassLoader().loadClass( line );
-                Function function = ( Function) clazz.newInstance();
-                this.functions.put( function.getName(), clazz );
-            }
-        } catch(IllegalAccessException e) {
-            throw new RuntimeException( e );            
-        } catch(InstantiationException e) {
-            throw new RuntimeException( e );
-        }
-    }
-    
-    public Function createFunction(String name) {
-        try {
-            Class clazz = ( Class ) this.functions.get( name );
-            if ( clazz == null ) {
-                throw new RuntimeException( "Function '" + name + "' does not exist" );
-            }
-            return (Function) clazz.newInstance();
-        } catch ( InstantiationException e ) {
-            throw new RuntimeException( e );
-        } catch ( IllegalAccessException e ) {
-            throw new RuntimeException( e );
-        }
-    }        
-    
-    public void addFunction(String name, Function function) {
-        this.functions.put( name, function );
-    }
-    
-    public void init() {
-        this.variables.clear();
-    }
-    
-    public void setVariable(LocalVariableValue variable) {
-        this.variables.put( variable.getIdentifier(), variable );
-    }
-    
-    public VariableValueHandler getVariable(String identifier) {
-        VariableValueHandler variable = ( VariableValueHandler ) this.variables.get( identifier );
-        if ( identifier == null ) {
-            variable = new TempTokenVariable( identifier );
-            this.variables.put( identifier, variable );
-        }
-        return variable;
-    }
-    
-    public int getFunctionSize() {
-        return this.functions.size();
-    }
-    
-    public int getVariablesSize() {
-        return this.variables.size();
-    }
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionRegistry.java (from rev 10309, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionRegistry.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionRegistry.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,111 @@
+package org.drools.clp;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+public class FunctionRegistry {    
+    public Map functions;
+    
+    public BuiltinFunctions builtin;
+    
+    //public Map variables;        
+    
+    public FunctionRegistry(BuiltinFunctions builtin) {
+        this.functions = new HashMap();
+        //this.variables = new HashMap();
+        
+        this.builtin = builtin;
+        
+        try {
+            loadFunctions();
+        } catch ( IOException e ) {
+            throw new RuntimeException( e );
+        } catch ( ClassNotFoundException e ) {
+            throw new RuntimeException( e );
+        }
+    }        
+    
+    public void loadFunctions() throws IOException, ClassNotFoundException {        
+        BufferedReader reader = new BufferedReader( new InputStreamReader( getClass().getResourceAsStream( "functions.conf" ) ) );
+        loadFunctions( reader );
+    }
+    
+    public void loadFunctions(BufferedReader reader) throws IOException, ClassNotFoundException {
+        String line = null;       
+        
+        try {
+            while( (line = reader.readLine() ) != null ) {
+                Class clazz = getClass().getClassLoader().loadClass( line );
+                Function function = ( Function) clazz.newInstance();
+                addFunction( function );
+            }
+        } catch(IllegalAccessException e) {
+            throw new RuntimeException( e );            
+        } catch(InstantiationException e) {
+            throw new RuntimeException( e );
+        }
+    }
+    
+    public Function getFunction(String name) {
+        Function function = ( Function ) this.functions.get( name );
+        
+        if ( function == null ) {
+            // Allows for late binidng FunctionDelegators
+            function = new FunctionDelegator();
+            this.functions.put( name, function );            
+        }
+        return function;
+    }
+    
+//    public Function createFunction(String name) {
+//        try {
+//            Class clazz = ( Class ) this.functions.get( name );
+//            if ( clazz == null ) {
+//                throw new RuntimeException( "Function '" + name + "' does not exist" );
+//            }
+//            return (Function) clazz.newInstance();
+//        } catch ( InstantiationException e ) {
+//            throw new RuntimeException( e );
+//        } catch ( IllegalAccessException e ) {
+//            throw new RuntimeException( e );
+//        }
+//    }        
+    
+    public void addFunction(Function function) {
+        FunctionDelegator delegator = ( FunctionDelegator ) this.functions.get( function.getName() );
+        
+        if ( delegator == null ) {
+            delegator = new FunctionDelegator();
+            this.functions.put( function.getName(), delegator );
+        }
+        delegator.setFunction( function );
+    }
+    
+//    public void init() {
+//        this.variables.clear();
+//    }
+//    
+//    public void setVariable(LocalVariableValue variable) {
+//        this.variables.put( variable.getIdentifier(), variable );
+//    }
+//    
+//    public VariableValueHandler getVariable(String identifier) {
+//        VariableValueHandler variable = ( VariableValueHandler ) this.variables.get( identifier );
+//        if ( identifier == null ) {
+//            variable = new TempTokenVariable( identifier );
+//            this.variables.put( identifier, variable );
+//        }
+//        return variable;
+//    }
+    
+    public int getFunctionSize() {
+        return this.functions.size();
+    }
+    
+//    public int getVariablesSize() {
+//        return this.variables.size();
+//    }
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,34 +0,0 @@
-package org.drools.clp;
-
-import java.math.BigDecimal;
-
-import org.drools.FactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.Extractor;
-
-public class LessThanFunction extends BaseFunction implements Function {
-    private static final String name = "<";
-
-    public LessThanFunction() {
-        
-    }
-    
-    public LessThanFunction(ValueHandler[] parameters) {
-        super( parameters );
-    }
-
-    public Object getValue(ExecutionContext context) {
-        ValueHandler[] args = getParameters();                
-        return new Boolean( args[1].getBigDecimalValue( context ).compareTo( args[2].getBigDecimalValue( context ) ) < 0 );
-    }
-    
-    public boolean getBoolean(ExecutionContext context) {
-        ValueHandler[] args = getParameters();                
-        return args[1].getBigDecimalValue( context ).compareTo( args[2].getBigDecimalValue( context ) ) < 0;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LocalVariableValue.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LocalVariableValue.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LocalVariableValue.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -5,7 +5,7 @@
 
 import org.drools.base.ValueType;
 
-public class LocalVariableValue implements VariableValueHandler {
+public class LocalVariableValue extends BaseValueHandler implements VariableValueHandler {
     private static final long serialVersionUID = 320L;    
 
     /** The identifier for the variable. */
@@ -33,7 +33,6 @@
     }
     
     public ValueType getValueType() {
-        // TODO Auto-generated method stub
         return null;
     }
     
@@ -45,42 +44,6 @@
                          Object object) {
         context.setLocalVariable( this.index, object );        
     }        
-
-    public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
-        return (BigDecimal) getValue(context);
-    }
-
-    public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
-        return (BigInteger) getValue(context);
-    }
-
-    public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
-        return ((Boolean) getValue(context)).booleanValue();
-    }
-
-    public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
-        return ((Double) getValue(context)).doubleValue();
-    }
-
-    public float getFloatValue(ExecutionContext context) throws NumberFormatException {
-        return ((Float) getValue(context)).floatValue();
-    }
-
-    public int getIntValue(ExecutionContext context) throws NumberFormatException {
-        return ((Integer) getValue(context)).intValue();
-    }
-
-    public long getLongValue(ExecutionContext context) throws NumberFormatException {
-        return ((Long) getValue(context)).longValue();
-    }
-
-    public short getShortValue(ExecutionContext context) throws NumberFormatException {
-        return ((Short) getValue(context)).shortValue();
-    }
-
-    public String getStringValue(ExecutionContext context) {
-        return (String) getValue(context);
-    }
         
 }
 

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,44 +0,0 @@
-package org.drools.clp;
-
-public class ModifyFunction extends BaseFunction implements Function {
-    private static final String name = "+";
-    
-    private VariableValueHandler variable;
-    
-    private SlotNameValuePair[] pairs;
-    
-    public ModifyFunction(VariableValueHandler variable) {
-        this.variable = variable;
-    }
-    
-    public void setVariableValueHandler(VariableValueHandler variable) {
-        this.variable = variable;
-    }        
-    
-    public ModifyFunction() {
-    }
-    
-    public void addParameter(ValueHandler valueHandler) {
-        // we implement here rather than inheriting to save a runtime cast 
-        SlotNameValuePair[] temp = new SlotNameValuePair[ pairs.length ];
-        System.arraycopy( this.pairs, 0, temp, 0, this.pairs.length -1 );
-        temp[ temp.length - 1] = ( SlotNameValuePair) valueHandler;
-        this.pairs = temp;          
-    }    
-
-    public Object getValue(ExecutionContext context) {
-//        ValueHandler[] args = BaseFunction.resolveParameters( getParameters(), context );
-//        BigDecimal bdval = new BigDecimal(0);        
-        
-        for ( int i = 0, length = this.pairs.length; i < length; i++ ) {
-            
-        }
-                
-        return null; //bdval;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ValueHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ValueHandler.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ValueHandler.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -2,6 +2,7 @@
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.Map;
 
 import org.drools.base.ValueType;
 
@@ -31,5 +32,5 @@
     public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException;
 
     public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException;
-
+        
 }
\ No newline at end of file

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/AddFunction.java (from rev 10309, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/AddFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/AddFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,32 @@
+package org.drools.clp.functions;
+
+import java.math.BigDecimal;
+
+import org.drools.FactHandle;
+import org.drools.clp.ExecutionContext;
+import org.drools.clp.Function;
+import org.drools.clp.ValueHandler;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.Extractor;
+
+public class AddFunction implements Function {
+    private static final String name = "+";
+
+    public AddFunction() {
+        
+    }
+    
+    public Object execute(ValueHandler[] args, ExecutionContext context) {
+        BigDecimal bdval = new BigDecimal(0);        
+        for ( int i = 0, length = args.length; i < length; i++ ) {
+            bdval = bdval.add( args[i].getBigDecimalValue( context ) );
+        }                
+        return bdval;        
+    }
+    
+    
+    public String getName() {
+        return name;
+    }
+
+}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/BindFunction.java (from rev 10309, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/BindFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/BindFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,28 @@
+package org.drools.clp.functions;
+
+import java.math.BigDecimal;
+
+import org.drools.FactHandle;
+import org.drools.clp.BaseFunction;
+import org.drools.clp.ExecutionContext;
+import org.drools.clp.Function;
+import org.drools.clp.ValueHandler;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.Extractor;
+
+public class BindFunction implements Function {
+    private static final String name = "bind";
+
+    public BindFunction() {
+        
+    }
+    public Object execute(ValueHandler[] args, ExecutionContext context) {
+        args[0].setValue( context, args[1].getValue( context ) );        
+        return args[0];    
+    }
+    
+    public String getName() {
+        return name;
+    }
+
+}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/LessThanFunction.java (from rev 10309, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/LessThanFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/LessThanFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,22 @@
+package org.drools.clp.functions;
+
+import org.drools.clp.ExecutionContext;
+import org.drools.clp.Function;
+import org.drools.clp.ValueHandler;
+
+public class LessThanFunction implements Function {
+    private static final String name = "<";
+
+    public LessThanFunction() {
+        
+    }   
+
+    public Object execute(ValueHandler[] args, ExecutionContext context) {
+        return new Boolean( args[1].getBigDecimalValue( context ).compareTo( args[2].getBigDecimalValue( context ) ) < 0 );    
+    }
+    
+    public String getName() {
+        return name;
+    }
+
+}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/ModifyFunction.java (from rev 10309, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/ModifyFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/ModifyFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,54 @@
+package org.drools.clp.functions;
+
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.drools.clp.BaseFunction;
+import org.drools.clp.ExecutionContext;
+import org.drools.clp.Function;
+import org.drools.clp.SlotNameValuePair;
+import org.drools.clp.ValueHandler;
+import org.drools.clp.VariableValueHandler;
+
+public class ModifyFunction  implements Function {
+    private static final String name = "modify"; 
+    
+    public ModifyFunction() {
+    }
+
+
+    public Object execute(ValueHandler[] args, ExecutionContext context) {
+        // This is very slow, its just to get things working for now
+        Object object = args[0].getValue( context );
+        
+        try {
+            for ( int i = 1, length = args.length; i < length; i++ ) {
+                SlotNameValuePair pair = ( SlotNameValuePair ) args[i];
+                Method method = getField( object.getClass(), pair.getName() ); 
+                method.invoke( object, new Object[] { pair.getValueHandler().getValue( context ) } );
+            }
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }
+                
+        return null;
+    }
+    
+    public Method getField(Class clazz, String name) throws IntrospectionException {
+        PropertyDescriptor[] descrs = Introspector.getBeanInfo( clazz ).getPropertyDescriptors();
+        for ( int i = 0, length = descrs.length; i < length; i++ ) {
+            if ( descrs[i].getName().equals( name ) ) {
+                return descrs[i].getWriteMethod();
+            }
+        }
+        return null;
+    }
+    
+    public String getName() {
+        return name;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/MultiplyFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/MultiplyFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions/MultiplyFunction.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,32 @@
+package org.drools.clp.functions;
+
+import java.math.BigDecimal;
+
+import org.drools.FactHandle;
+import org.drools.clp.ExecutionContext;
+import org.drools.clp.Function;
+import org.drools.clp.ValueHandler;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.Extractor;
+
+public class MultiplyFunction implements Function {
+    private static final String name = "*";
+
+    public MultiplyFunction() {
+        
+    }
+    
+    public Object execute(ValueHandler[] args, ExecutionContext context) {
+        BigDecimal bdval = new BigDecimal(0);        
+        for ( int i = 0, length = args.length; i < length; i++ ) {
+            bdval = bdval.multiply( args[i].getBigDecimalValue( context ) );
+        }                
+        return bdval;        
+    }
+    
+    
+    public String getName() {
+        return name;
+    }
+
+}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/CLP.g
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/CLP.g	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/CLP.g	2007-03-22 11:44:41 UTC (rev 10428)
@@ -18,10 +18,17 @@
 	private int lineOffset = 0;
 	private DescrFactory factory = new DescrFactory();
 	private boolean parserDebug = false;
+	private FunctionRegistry functionRegistry;
 	
+    FunctionRegistry factoryRegistry;
+	
+	public void setFunctionRegistry(FunctionRegistry functionRegistry) {
+		this.functionRegistry = functionRegistry;
+	}
+	
 	public void setParserDebug(boolean parserDebug) {
 		this.parserDebug = parserDebug;
-	}
+	}		
 	
 	public void debug(String message) {
 		if ( parserDebug ) 
@@ -174,7 +181,7 @@
 statement
 	:
 	/* later we add the other possible statements here */
-	( rule /* do something with the returned rule here */)
+	( /* do something with the returned rule here */)
 	;
 		
 /* prolog
@@ -211,7 +218,11 @@
 	;	
 */
 
-rule returns [RuleDescr rule]
+deffunction
+	:
+	;
+
+defrule returns [RuleDescr rule]
 	@init { 
 	        rule = null; 
 	        AndDescr lhs = null;
@@ -225,18 +236,19 @@
 	  		debug( "start rule: " + ruleName.getText() );
 	  		String ruleStr = ruleName.getText();
 
-	        	if ( ruleStr.indexOf("::") >= 0 ) {
-	        	        String mod = ruleStr.substring(0, ruleStr.indexOf("::"));
-	        	        ruleStr = ruleStr.substring(ruleStr.indexOf("::")+2);
+	        if ( ruleStr.indexOf("::") >= 0 ) {
+	            String mod = ruleStr.substring(0, ruleStr.indexOf("::"));
+	            ruleStr = ruleStr.substring(ruleStr.indexOf("::")+2);
 				module = new AttributeDescr( "agenda-group", mod );
 				module.setLocation( offset(ruleName.getLine()), ruleName.getCharPositionInLine() );
 				module.setStartCharacter( ((CommonToken)ruleName).getStartIndex() );
 				module.setEndCharacter( ((CommonToken)ruleName).getStopIndex() );
 			}
-		        rule = new RuleDescr( ruleStr, null ); 
-		        if( module != null ) {
-		        	rule.addAttribute( module );
-		        }
+		    
+		    rule = new RuleDescr( ruleStr, null ); 
+		    if( module != null ) {
+		    	rule.addAttribute( module );
+		    }
 		        
 			rule.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
 			rule.setStartCharacter( ((CommonToken)loc).getStartIndex() ); 
@@ -494,37 +506,37 @@
 	    }
 	;		
 
-function[ExecutionBuildContext context] returns[Function f]
+function[ExecutionBuildContext context] returns[FunctionCaller fc]
 	@init {
-	    FunctionFactory factory = FunctionFactory.getInstance();
+		Function f = null;        
 	}
 	:	LEFT_PAREN
 		name=NAME {
 			if ( name.getText().equals("bind") ) {
 		  		context.createLocalVariable( name.getText() );
 			}
-		  	f = factory.createFunction( name.getText() );		  
+		  	f = functionRegistry.getFunction( name.getText() );		  
+			fc= new FunctionCaller( f );
 		}
 	    	
-		function_params[context, f]+ 
+		function_params[context, fc]+ 
 	    RIGHT_PAREN
-	    { context.addFunction( f ); }
+	    { context.addFunction( fc ); }
 	;
 
 
-modify_function[ExecutionBuildContext context] returns[Function f]
-	@init {
-	    FunctionFactory factory = FunctionFactory.getInstance();
-		f = factory.createFunction( "modify" );
-	}
+modify_function[ExecutionBuildContext context] returns[FunctionCaller fc]
 	:
 		LEFT_PAREN
-			'modify'
-			slot_name_value_pair[context, f]+
+			'modify' {
+				fc = new FunctionCaller( functionRegistry.getFunction( "modify" ) );
+			}
+			t=VAR		{ fc.addParameter( context.getVariableValueHandler( t.getText() ) ); }			
+			slot_name_value_pair[context, fchg]+
 		RIGHT_PAREN		
 	;	
 	
-function_params[ExecutionBuildContext context, Function f]
+function_params[ExecutionBuildContext context, FunctionCaller fc]
 	@init {
 		ValueHandler value  =  null;		
 	}
@@ -538,11 +550,11 @@
 			|	t=NULL      { value = ObjectLiteralValue.NULL; }
 			|	nf=function[context] { value = nf; }			
 		)	
-		{ f.addParameter( value ); }	
+		{ fc.addParameter( value ); }	
 		
 	;		
 	
-slot_name_value_pair[ExecutionBuildContext context, Function f]
+slot_name_value_pair[ExecutionBuildContext context, FunctionCaller fc]
 	@init {
 		SlotNameValuePair nameValuePair = null;
 		String name = null;
@@ -562,7 +574,7 @@
 			|	nf=function[context]
 			                { nameValuePair = new SlotNameValuePair(name, nf ); }
 		)	
-		{ f.addParameter( nameValuePair ); }		
+		{ fc.addParameter( nameValuePair ); }		
 		RIGHT_PAREN
 	;	
 	

Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/functions.conf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/functions.conf	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/functions.conf	2007-03-22 11:44:41 UTC (rev 10428)
@@ -1,3 +1,3 @@
-org.drools.clp.AddFunction
-org.drools.clp.LessThanFunction
-org.drools.clp.BindFunction
\ No newline at end of file
+org.drools.clp.functions.AddFunction
+org.drools.clp.functions.LessThanFunction
+org.drools.clp.functions.BindFunction
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/Person.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/Person.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/Person.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -78,6 +78,10 @@
         return this.name;
     }
 
+    public void setName(String name) {
+        this.name = name;
+    }
+    
     /* (non-Javadoc)
      * @see org.drools.PersonInterface#getAge()
      */

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/AddFunctionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/AddFunctionTest.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/AddFunctionTest.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -7,6 +7,7 @@
 import org.drools.RuleBase;
 import org.drools.RuleBaseFactory;
 import org.drools.base.ClassObjectType;
+import org.drools.clp.functions.AddFunction;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.reteoo.ReteTuple;
@@ -19,53 +20,93 @@
 
 public class AddFunctionTest extends TestCase {
     public void testAdd() {
-        ValueHandler val1 = new ObjectLiteralValue(new BigDecimal( 10 ));
-        ValueHandler val2 = new ObjectLiteralValue(new BigDecimal( 10 ));
-        AddFunction add = new AddFunction( new ValueHandler[] { val1, val2 } );
+        ValueHandler val1 = new ObjectLiteralValue( new BigDecimal( 10 ) );
+        ValueHandler val2 = new ObjectLiteralValue( new BigDecimal( 10 ) );
 
-        assertEquals( new BigDecimal( 20 ), add.getBigDecimalValue( null ) );        
+        ValueHandler[] params = new ValueHandler[]{val1, val2};
+        AddFunction add = new AddFunction();
+
+        assertEquals( new BigDecimal( 20 ),
+                      add.execute( params,
+                                   null ) );
     }
-    
+
     public void testNestedAdd() {
-        
-        ValueHandler val1 = new ObjectLiteralValue(new BigDecimal( 10 ));
-        ValueHandler val2 = new ObjectLiteralValue(new BigDecimal( 10 ));
-        ValueHandler val3 = new ObjectLiteralValue(new BigDecimal( 10 ));
-        
-        AddFunction add1 = new AddFunction( new ValueHandler[] { val1, val2 } );        
-        AddFunction add2 = new AddFunction( new ValueHandler[] { val3, add1 } );
+        ValueHandler val1 = new ObjectLiteralValue( new BigDecimal( 10 ) );
+        ValueHandler val2 = new ObjectLiteralValue( new BigDecimal( 10 ) );
+        ValueHandler val3 = new ObjectLiteralValue( new BigDecimal( 10 ) );
 
-        assertEquals( new BigDecimal( 30 ), add2.getBigDecimalValue( null ) );                  
+        FunctionCaller functionValue = new FunctionCaller( new AddFunction() );
+        functionValue.addParameter( val1 );
+        functionValue.addParameter( val2 );
+
+        ValueHandler[] params = new ValueHandler[]{val3, functionValue};
+
+        AddFunction add = new AddFunction();
+
+        assertEquals( new BigDecimal( 30 ),
+                      add.execute( params,
+                                   null ) );
     }
-    
+
     public void testNestedAddWithVars() {
         RuleBase ruleBase = RuleBaseFactory.newRuleBase();
-        InternalWorkingMemory workingMemory = ( InternalWorkingMemory ) ruleBase.newWorkingMemory();
-        
-        InternalFactHandle factHandle = ( InternalFactHandle ) workingMemory.assertObject( new BigDecimal( 10 ) );
+        InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newWorkingMemory();
+
+        InternalFactHandle factHandle = (InternalFactHandle) workingMemory.assertObject( new BigDecimal( 10 ) );
         ReteTuple tuple = new ReteTuple( factHandle );
-        
+
         ObjectType objectType = new ClassObjectType( BigDecimal.class );
-        Column column0 = new Column(0, objectType);
-        Column column1 = new Column(1, objectType);
+        Column column0 = new Column( 0,
+                                     objectType );
+        Column column1 = new Column( 1,
+                                     objectType );
         ColumnExtractor extractor = new ColumnExtractor( objectType );
-        
+
+        VariableValueHandler pd = new CLPPreviousDeclarationVariable( new Declaration( "pd",
+                                                                                       extractor,
+                                                                                       column0 ) );
+
+        VariableValueHandler ld = new CLPLocalDeclarationVariable( new Declaration( "ld",
+                                                                                    extractor,
+                                                                                    column1 ) );
+
         Map variables = new HashMap();
-        variables.put( "pd", new CLPPreviousDeclarationVariable( new Declaration("pd", extractor, column0) ) );
-        variables.put( "ld", new CLPLocalDeclarationVariable( new Declaration("ld", extractor, column1) ) );
-        
-        ValueHandler val1 = new TempTokenVariable("pd");                
-        ValueHandler val2 = new LocalVariableValue("lv", 0);                  
-        ValueHandler val3 = new TempTokenVariable("ld");
-        
-        ExecutionContext context = new ExecutionContext(workingMemory, tuple, new BigDecimal( 10 ), 1 );
-        context.setLocalVariable( 0, new BigDecimal( 10 ) );
-        
-        AddFunction add1 = new AddFunction( new ValueHandler[] { val1, val2 } );        
-        AddFunction add2 = new AddFunction( new ValueHandler[] { val3, add1 } );                
-        
-        add2.replaceTempTokens( variables );
+        variables.put( "pd",
+                       new CLPPreviousDeclarationVariable( new Declaration( "pd",
+                                                                            extractor,
+                                                                            column0 ) ) );
+        variables.put( "ld",
+                       new CLPLocalDeclarationVariable( new Declaration( "ld",
+                                                                         extractor,
+                                                                         column1 ) ) );
 
-        assertEquals( new BigDecimal( 30 ), add2.getBigDecimalValue( context ) );                  
-    }    
+        ValueHandler val1 = new TempTokenVariable( "pd" );
+        ValueHandler val2 = new LocalVariableValue( "lv",
+                                                    0 );
+        ValueHandler val3 = new TempTokenVariable( "ld" );
+
+        ExecutionContext context = new ExecutionContext( workingMemory,
+                                                         tuple,
+                                                         new BigDecimal( 10 ),
+                                                         1 );
+        context.setLocalVariable( 0,
+                                  new BigDecimal( 10 ) );
+
+        FunctionCaller functionValue = new FunctionCaller( new AddFunction() );
+        functionValue.addParameter( val1 );
+        functionValue.addParameter( val2 );
+
+        AddFunction add = new AddFunction();
+
+        FunctionCaller f = new FunctionCaller( add );
+        f.addParameter( val3 );
+        f.addParameter( functionValue );
+
+        f.replaceTempTokens( variables );
+
+        assertEquals( new BigDecimal( 30 ),
+                      f.getValue( context ) ); 
+
+    }
 }

Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/BlockExecutionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/BlockExecutionTest.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/BlockExecutionTest.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,45 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+
+import junit.framework.TestCase;
+
+import org.drools.Person;
+import org.drools.clp.functions.AddFunction;
+import org.drools.clp.functions.BindFunction;
+import org.drools.clp.functions.ModifyFunction;
+
+public class BlockExecutionTest extends TestCase {
+    public void test1() {
+        BlockExecutionEngine engine = new BlockExecutionEngine();        
+        ExecutionBuildContext build = new ExecutionBuildContext(engine);                
+        
+        FunctionCaller addCaller = new FunctionCaller( new AddFunction() );
+        addCaller.addParameter( new ObjectLiteralValue( new BigDecimal( 20) ) );
+        addCaller.addParameter( new LongLiteralValue( "11" ) );
+                
+        FunctionCaller bindCaller = new FunctionCaller( new BindFunction() );
+        bindCaller.addParameter( build.createLocalVariable( "?x" ) );
+        bindCaller.addParameter( addCaller );
+        
+        engine.addFunction( bindCaller );
+        
+        
+        FunctionCaller modifyCaller = new FunctionCaller( new ModifyFunction() );        
+        build.createLocalVariable( "?p" );        
+        modifyCaller.addParameter( build.getVariableValueHandler( "?p" ) );
+        modifyCaller.addParameter( new SlotNameValuePair("age", build.getVariableValueHandler( "?x" )) );
+        
+        ExecutionContext context = new ExecutionContext(null, null, 2);
+        Person p = new Person("mark");
+        context.setLocalVariable( 1, p );
+        
+        engine.addFunction( modifyCaller );
+        
+        engine.execute( context );
+        
+        assertEquals( 31, p.getAge() );
+        
+        
+    }
+}

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ClpParserTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ClpParserTest.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ClpParserTest.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -38,15 +38,15 @@
 
     public void testParseFunction() throws Exception {
         ExecutionBuildContext context = new ExecutionBuildContext( new CLPPredicate() );
-        Function f = parse( "(< 1 2)" ).function( context );
+        FunctionCaller fc = parse( "(< 1 2)" ).function( context );
         
-        assertEquals( "<", f.getName() );        
-        assertEquals( new LongLiteralValue( 1 ), f.getParameters()[0] );
-        assertEquals( new LongLiteralValue( 2 ), f.getParameters()[1] );
+        assertEquals( "<", fc.getName() );        
+        assertEquals( new LongLiteralValue( 1 ), fc.getParameters()[0] );
+        assertEquals( new LongLiteralValue( 2 ), fc.getParameters()[1] );
     }
     
     public void testPatternsRule() throws Exception {
-        RuleDescr rule = parse( "(defrule xxx ?b <- (person (name \"yyy\"&?bf|~\"zzz\"|~=(+ 2 3)&:(< 1 2)) ) ?c <- (hobby (type ?bf2&~iii) (rating fivestar) ) => )" ).rule();
+        RuleDescr rule = parse( "(defrule xxx ?b <- (person (name \"yyy\"&?bf|~\"zzz\"|~=(+ 2 3)&:(< 1 2)) ) ?c <- (hobby (type ?bf2&~iii) (rating fivestar) ) => )" ).defrule();
 
         assertEquals( "xxx",
                       rule.getName() );
@@ -109,17 +109,17 @@
         assertEquals( "!=",
                       retDescr.getEvaluator() );
         CLPReturnValue clprv = ( CLPReturnValue ) retDescr.getContent();
-        Function f = clprv.getFunctions()[0];
-        assertEquals( "+", f.getName() );        
-        assertEquals( new LongLiteralValue( 2 ), f.getParameters()[0] );
-        assertEquals( new LongLiteralValue( 3 ), f.getParameters()[1] );       
+        FunctionCaller fc = clprv.getFunctions()[0];
+        assertEquals( "+", fc.getName() );        
+        assertEquals( new LongLiteralValue( 2 ), fc.getParameters()[0] );
+        assertEquals( new LongLiteralValue( 3 ), fc.getParameters()[1] );       
 
         PredicateDescr predicateDescr = (PredicateDescr) colList.get( 1 );        
         CLPPredicate clpp = ( CLPPredicate ) predicateDescr.getContent();
-        f = clpp.getFunctions()[0];
-        assertEquals( "<", f.getName() );        
-        assertEquals( new LongLiteralValue( 1 ), f.getParameters()[0] );
-        assertEquals( new LongLiteralValue( 2 ), f.getParameters()[1] );        
+        fc = clpp.getFunctions()[0];
+        assertEquals( "<", fc.getName() );        
+        assertEquals( new LongLiteralValue( 1 ), fc.getParameters()[0] );
+        assertEquals( new LongLiteralValue( 2 ), fc.getParameters()[1] );        
 
         // Parse the second column
         col = (ColumnDescr) lhsList.get( 1 );
@@ -167,7 +167,7 @@
     }
 
     public void testNestedCERule() throws Exception {
-        RuleDescr rule = parse( "(defrule xxx ?b <- (person (name yyy)) (or (and (hobby1 (type qqq1)) (hobby2 (type ~qqq2))) (food (veg ~shroom) ) ) => )" ).rule();
+        RuleDescr rule = parse( "(defrule xxx ?b <- (person (name yyy)) (or (and (hobby1 (type qqq1)) (hobby2 (type ~qqq2))) (food (veg ~shroom) ) ) => )" ).defrule();
 
         assertEquals( "xxx",
                       rule.getName() );
@@ -235,7 +235,7 @@
     }
 
     public void testNotExistsRule() throws Exception {
-        RuleDescr rule = parse( "(defrule xxx (or (hobby1 (type qqq1)) (not (and (exists (person (name ppp))) (person (name yyy))))) => )" ).rule();
+        RuleDescr rule = parse( "(defrule xxx (or (hobby1 (type qqq1)) (not (and (exists (person (name ppp))) (person (name yyy))))) => )" ).defrule();
 
         assertEquals( "xxx",
                       rule.getName() );
@@ -294,7 +294,7 @@
     }
     
     public void testTestRule() throws Exception {
-        RuleDescr rule = parse( "(defrule xxx (test (< 9.0 1.3) ) => )" ).rule();
+        RuleDescr rule = parse( "(defrule xxx (test (< 9.0 1.3) ) => )" ).defrule();
 
         assertEquals( "xxx",
                       rule.getName() );
@@ -307,14 +307,14 @@
         EvalDescr evalDescr = (EvalDescr) lhsList.get( 0 );
         
         CLPEval clpe = ( CLPEval ) evalDescr.getContent();
-        Function f = clpe.getFunctions()[0];
+        FunctionCaller f = clpe.getFunctions()[0];
         assertEquals( "<", f.getName() );        
         assertEquals( new DoubleLiteralValue( 9.0 ), f.getParameters()[0] );
         assertEquals( new DoubleLiteralValue( 1.3 ), f.getParameters()[1] );          
     }
 
     public void testRuleHeader() throws Exception {
-        RuleDescr rule = parse( "(defrule MAIN::name \"docs\"(declare (salience -100) ) => )" ).rule();
+        RuleDescr rule = parse( "(defrule MAIN::name \"docs\"(declare (salience -100) ) => )" ).defrule();
         
         List attributes = rule.getAttributes();
         AttributeDescr module = ( AttributeDescr ) attributes.get( 0 );
@@ -382,6 +382,7 @@
 
     private CLPParser newParser(final TokenStream tokenStream) {
         final CLPParser p = new CLPParser( tokenStream );
+        p.setFunctionRegistry( new FunctionRegistry( BuiltinFunctions.getInstance() )  );
         //p.setParserDebug( true );
         return p;
     }

Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/DeffunctionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/DeffunctionTest.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/DeffunctionTest.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,37 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+
+import org.drools.clp.functions.AddFunction;
+
+import junit.framework.TestCase;
+
+public class DeffunctionTest extends TestCase {
+    public void test1() {
+        Deffunction function = new Deffunction("x");
+        
+        ValueHandler a = new LocalVariableValue("a", 0); 
+        function.addParameter( a );
+        
+        ValueHandler b = new LocalVariableValue("b", 1);
+        function.addParameter( b );
+        
+        Function add = new AddFunction();
+        FunctionCaller caller = new FunctionCaller(add);
+        caller.addParameter( a );
+        caller.addParameter( b );
+                
+        function.addFunction( caller );
+                
+        ExecutionContext context = new ExecutionContext(null, null, 2);
+        ValueHandler q = new LocalVariableValue("q", 0);
+        context.setLocalVariable( 0, new Integer( 10 ) );
+        
+        ValueHandler w = new LocalVariableValue("w", 1);
+        context.setLocalVariable( 1, new Integer( 7 ) );      
+        
+        assertEquals( new BigDecimal( 17 ), function.execute( new ValueHandler[] { q, w }, context ) );
+    }
+    
+    
+}

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/FunctionFactoryTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/FunctionFactoryTest.java	2007-03-22 01:03:12 UTC (rev 10427)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/FunctionFactoryTest.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -4,10 +4,10 @@
 
 public class FunctionFactoryTest extends TestCase {
     public void testInit() {
-        FunctionFactory factory = FunctionFactory.getInstance();
+        FunctionRegistry factory = new FunctionRegistry( BuiltinFunctions.getInstance() );
         assertEquals( 3, factory.getFunctionSize() );
         
-        assertSame( AddFunction.class , factory.createFunction( "+" ).getClass() );
-        assertSame( BindFunction.class , factory.createFunction( "bind" ).getClass() );
+        assertSame( "+", factory.getFunction( "+" ).getName() );
+        assertSame( "bind" , factory.getFunction( "bind" ).getName() );
     }
 }

Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ModifyFunctionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ModifyFunctionTest.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ModifyFunctionTest.java	2007-03-22 11:44:41 UTC (rev 10428)
@@ -0,0 +1,25 @@
+package org.drools.clp;
+
+import org.drools.Person;
+import org.drools.clp.functions.ModifyFunction;
+
+import junit.framework.TestCase;
+
+public class ModifyFunctionTest extends TestCase {
+    public void test1() {
+        Function function = new ModifyFunction();
+        
+       Person p = new Person("mark");
+       ExecutionContext context = new ExecutionContext(null, null, 1);
+       context.setLocalVariable( 0, p );
+       
+       LocalVariableValue var = new LocalVariableValue("p", 0);
+       var.setValue( context, p );
+       
+       SlotNameValuePair pair = new SlotNameValuePair("name", new ObjectLiteralValue( "bob" ) );
+       
+       function.execute( new ValueHandler[] { var, pair }, context );
+       
+       assertEquals( "bob", p.getName() );
+    }
+}




More information about the jboss-svn-commits mailing list