[jboss-svn-commits] JBL Code SVN: r18318 - in labs/jbossrules/trunk/drools-clips/src: main/java/org/drools/clips and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Feb 5 12:56:14 EST 2008


Author: mark.proctor at jboss.com
Date: 2008-02-05 12:56:14 -0500 (Tue, 05 Feb 2008)
New Revision: 18318

Added:
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/AssertFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/BindFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/CallFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/CreateListFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/EqFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/GetFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/NewFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/RetractFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/RunFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/SetFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsConsequenceBuilder.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsReturnValueBuilder.java
Removed:
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/base/clips/CLPConsequence.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CreateListFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/EqFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/MVELBuildContext.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/OldShell.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClpConsequenceBuilder.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/AddFunctionTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/BlockExecutionTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/DeffunctionTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/ModifyFunctionTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/mvel/
Modified:
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsLexer.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsParser.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Function.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/FunctionHandlers.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/LispForm.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/PrintRouterContext.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Shell.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/VariableContext.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/VariableLispAtom.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/BaseInfixFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/IfFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/ModifyFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/PrintoutFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/PrognFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/ReturnFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/SwitchFunction.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsDialect.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsDialectConfiguration.java
   labs/jbossrules/trunk/drools-clips/src/main/resources/META-INF/drools.default.packagebuilder.conf
   labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/Clips.g
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/Person.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/CompiledFunctionsTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/FunctionFactoryTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/LhsClpParserTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/ShellTest.java
Log:
JBRULES-720 Clips Parser
-First working version with MVEL underneath. Includes working rules and tests.

Deleted: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/base/clips/CLPConsequence.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/base/clips/CLPConsequence.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/base/clips/CLPConsequence.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,33 +0,0 @@
-package org.drools.base.clips;
-
-import org.drools.WorkingMemory;
-import org.drools.clips.BlockExecutionEngine;
-import org.drools.clips.ExecutionContext;
-import org.drools.clips.ExecutionContextImpl;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
-import org.drools.spi.Consequence;
-import org.drools.spi.KnowledgeHelper;
-
-public class CLPConsequence
-    implements
-    Consequence {
-
-    private final BlockExecutionEngine engine;
-    private final int                        varSize;
-
-    public CLPConsequence(BlockExecutionEngine engine,
-                          int varSize) {
-        this.engine = engine;
-        this.varSize = varSize;
-    }
-
-    public void evaluate(KnowledgeHelper knowledgeHelper,
-                         WorkingMemory workingMemory) throws Exception {
-        ExecutionContext context = new ExecutionContextImpl( (InternalWorkingMemory) workingMemory,
-                                                             (ReteTuple) knowledgeHelper.getTuple(),
-                                                             varSize );
-        engine.execute( context );
-    }
-
-}


Property changes on: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips
___________________________________________________________________
Name: svn:ignore
   + Clips__.g
Clips.tokens


Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsLexer.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsLexer.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsLexer.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,4 +1,4 @@
-// $ANTLR 3.0.1 C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g 2008-01-29 21:18:01
+// $ANTLR 3.0.1 C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g 2008-02-05 16:37:47
 
 	package org.drools.clips;
 
@@ -103,10 +103,10 @@
     public final void mWS() throws RecognitionException {
         try {
             int _type = WS;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:9: ( ( ' ' | '\\t' | '\\f' | EOL ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:17: ( ' ' | '\\t' | '\\f' | EOL )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:705:9: ( ( ' ' | '\\t' | '\\f' | EOL ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:705:17: ( ' ' | '\\t' | '\\f' | EOL )
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:17: ( ' ' | '\\t' | '\\f' | EOL )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:705:17: ( ' ' | '\\t' | '\\f' | EOL )
             int alt1=4;
             switch ( input.LA(1) ) {
             case ' ':
@@ -133,35 +133,35 @@
             default:
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("698:17: ( ' ' | '\\t' | '\\f' | EOL )", 1, 0, input);
+                    new NoViableAltException("705:17: ( ' ' | '\\t' | '\\f' | EOL )", 1, 0, input);
 
                 throw nvae;
             }
 
             switch (alt1) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:19: ' '
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:705:19: ' '
                     {
                     match(' '); if (failed) return ;
 
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:699:19: '\\t'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:706:19: '\\t'
                     {
                     match('\t'); if (failed) return ;
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:700:19: '\\f'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:707:19: '\\f'
                     {
                     match('\f'); if (failed) return ;
 
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:701:19: EOL
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:708:19: EOL
                     {
                     mEOL(); if (failed) return ;
 
@@ -187,8 +187,8 @@
     public final void mDEFRULE() throws RecognitionException {
         try {
             int _type = DEFRULE;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:706:10: ( 'defrule' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:706:12: 'defrule'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:713:10: ( 'defrule' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:713:12: 'defrule'
             {
             match("defrule"); if (failed) return ;
 
@@ -206,8 +206,8 @@
     public final void mDEFFUNCTION() throws RecognitionException {
         try {
             int _type = DEFFUNCTION;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:707:13: ( 'deffunction' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:707:15: 'deffunction'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:714:13: ( 'deffunction' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:714:15: 'deffunction'
             {
             match("deffunction"); if (failed) return ;
 
@@ -225,8 +225,8 @@
     public final void mOR() throws RecognitionException {
         try {
             int _type = OR;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:708:7: ( 'or' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:708:9: 'or'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:715:7: ( 'or' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:715:9: 'or'
             {
             match("or"); if (failed) return ;
 
@@ -244,8 +244,8 @@
     public final void mAND() throws RecognitionException {
         try {
             int _type = AND;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:709:7: ( 'and' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:709:9: 'and'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:716:7: ( 'and' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:716:9: 'and'
             {
             match("and"); if (failed) return ;
 
@@ -263,8 +263,8 @@
     public final void mNOT() throws RecognitionException {
         try {
             int _type = NOT;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:710:7: ( 'not' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:710:9: 'not'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:717:7: ( 'not' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:717:9: 'not'
             {
             match("not"); if (failed) return ;
 
@@ -282,8 +282,8 @@
     public final void mEXISTS() throws RecognitionException {
         try {
             int _type = EXISTS;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:711:10: ( 'exists' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:711:12: 'exists'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:718:10: ( 'exists' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:718:12: 'exists'
             {
             match("exists"); if (failed) return ;
 
@@ -301,8 +301,8 @@
     public final void mTEST() throws RecognitionException {
         try {
             int _type = TEST;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:712:8: ( 'test' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:712:10: 'test'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:719:8: ( 'test' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:719:10: 'test'
             {
             match("test"); if (failed) return ;
 
@@ -320,8 +320,8 @@
     public final void mNULL() throws RecognitionException {
         try {
             int _type = NULL;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:714:7: ( 'null' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:714:9: 'null'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:721:7: ( 'null' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:721:9: 'null'
             {
             match("null"); if (failed) return ;
 
@@ -339,8 +339,8 @@
     public final void mDECLARE() throws RecognitionException {
         try {
             int _type = DECLARE;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:716:10: ( 'declare' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:716:12: 'declare'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:723:10: ( 'declare' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:723:12: 'declare'
             {
             match("declare"); if (failed) return ;
 
@@ -358,8 +358,8 @@
     public final void mSALIENCE() throws RecognitionException {
         try {
             int _type = SALIENCE;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:718:10: ( 'salience' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:718:12: 'salience'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:725:10: ( 'salience' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:725:12: 'salience'
             {
             match("salience"); if (failed) return ;
 
@@ -376,10 +376,10 @@
     // $ANTLR start EOL
     public final void mEOL() throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:723:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:730:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
             int alt2=3;
             int LA2_0 = input.LA(1);
 
@@ -398,13 +398,13 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("724:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
+                    new NoViableAltException("731:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
 
                 throw nvae;
             }
             switch (alt2) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724:14: ( '\\r\\n' )=> '\\r\\n'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:14: ( '\\r\\n' )=> '\\r\\n'
                     {
                     match("\r\n"); if (failed) return ;
 
@@ -412,14 +412,14 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:725:25: '\\r'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:732:25: '\\r'
                     {
                     match('\r'); if (failed) return ;
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:726:25: '\\n'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:733:25: '\\n'
                     {
                     match('\n'); if (failed) return ;
 
@@ -441,10 +441,10 @@
     public final void mINT() throws RecognitionException {
         try {
             int _type = INT;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:2: ( ( '-' )? ( '0' .. '9' )+ )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:4: ( '-' )? ( '0' .. '9' )+
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:738:2: ( ( '-' )? ( '0' .. '9' )+ )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:738:4: ( '-' )? ( '0' .. '9' )+
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:4: ( '-' )?
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:738:4: ( '-' )?
             int alt3=2;
             int LA3_0 = input.LA(1);
 
@@ -453,7 +453,7 @@
             }
             switch (alt3) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:5: '-'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:738:5: '-'
                     {
                     match('-'); if (failed) return ;
 
@@ -462,7 +462,7 @@
 
             }
 
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:10: ( '0' .. '9' )+
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:738:10: ( '0' .. '9' )+
             int cnt4=0;
             loop4:
             do {
@@ -476,7 +476,7 @@
 
                 switch (alt4) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:11: '0' .. '9'
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:738:11: '0' .. '9'
             	    {
             	    matchRange('0','9'); if (failed) return ;
 
@@ -507,10 +507,10 @@
     public final void mFLOAT() throws RecognitionException {
         try {
             int _type = FLOAT;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:2: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:742:2: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:742:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:4: ( '-' )?
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:742:4: ( '-' )?
             int alt5=2;
             int LA5_0 = input.LA(1);
 
@@ -519,7 +519,7 @@
             }
             switch (alt5) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:5: '-'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:742:5: '-'
                     {
                     match('-'); if (failed) return ;
 
@@ -528,7 +528,7 @@
 
             }
 
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:10: ( '0' .. '9' )+
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:742:10: ( '0' .. '9' )+
             int cnt6=0;
             loop6:
             do {
@@ -542,7 +542,7 @@
 
                 switch (alt6) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:11: '0' .. '9'
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:742:11: '0' .. '9'
             	    {
             	    matchRange('0','9'); if (failed) return ;
 
@@ -560,7 +560,7 @@
             } while (true);
 
             match('.'); if (failed) return ;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:26: ( '0' .. '9' )+
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:742:26: ( '0' .. '9' )+
             int cnt7=0;
             loop7:
             do {
@@ -574,7 +574,7 @@
 
                 switch (alt7) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:27: '0' .. '9'
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:742:27: '0' .. '9'
             	    {
             	    matchRange('0','9'); if (failed) return ;
 
@@ -605,7 +605,7 @@
     public final void mSTRING() throws RecognitionException {
         try {
             int _type = STRING;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:5: ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:746:5: ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) )
             int alt10=2;
             int LA10_0 = input.LA(1);
 
@@ -618,19 +618,19 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("738:1: STRING : ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) );", 10, 0, input);
+                    new NoViableAltException("745:1: STRING : ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) );", 10, 0, input);
 
                 throw nvae;
             }
             switch (alt10) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:746:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
                     {
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:9: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:746:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:746:9: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
                     {
                     match('\"'); if (failed) return ;
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:13: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:746:13: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
                     loop8:
                     do {
                         int alt8=3;
@@ -646,14 +646,14 @@
 
                         switch (alt8) {
                     	case 1 :
-                    	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:15: EscapeSequence
+                    	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:746:15: EscapeSequence
                     	    {
                     	    mEscapeSequence(); if (failed) return ;
 
                     	    }
                     	    break;
                     	case 2 :
-                    	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:32: ~ ( '\\\\' | '\"' )
+                    	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:746:32: ~ ( '\\\\' | '\"' )
                     	    {
                     	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
                     	        input.consume();
@@ -683,13 +683,13 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:747:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
                     {
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:9: '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\''
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:747:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:747:9: '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\''
                     {
                     match('\''); if (failed) return ;
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:14: ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )*
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:747:14: ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )*
                     loop9:
                     do {
                         int alt9=3;
@@ -705,14 +705,14 @@
 
                         switch (alt9) {
                     	case 1 :
-                    	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:16: EscapeSequence
+                    	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:747:16: EscapeSequence
                     	    {
                     	    mEscapeSequence(); if (failed) return ;
 
                     	    }
                     	    break;
                     	case 2 :
-                    	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:33: ~ ( '\\\\' | '\\'' )
+                    	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:747:33: ~ ( '\\\\' | '\\'' )
                     	    {
                     	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
                     	        input.consume();
@@ -753,8 +753,8 @@
     // $ANTLR start HexDigit
     public final void mHexDigit() throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:744:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:744:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:751:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:751: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();
@@ -779,7 +779,7 @@
     // $ANTLR start EscapeSequence
     public final void mEscapeSequence() throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:748:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape )
             int alt11=3;
             int LA11_0 = input.LA(1);
 
@@ -817,7 +817,7 @@
                 default:
                     if (backtracking>0) {failed=true; return ;}
                     NoViableAltException nvae =
-                        new NoViableAltException("746:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 11, 1, input);
+                        new NoViableAltException("753:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 11, 1, input);
 
                     throw nvae;
                 }
@@ -826,13 +826,13 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("746:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 11, 0, input);
+                    new NoViableAltException("753:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 11, 0, input);
 
                 throw nvae;
             }
             switch (alt11) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:748:9: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755: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' ) {
@@ -850,14 +850,14 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:749:9: UnicodeEscape
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:9: UnicodeEscape
                     {
                     mUnicodeEscape(); if (failed) return ;
 
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:750:9: OctalEscape
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:757:9: OctalEscape
                     {
                     mOctalEscape(); if (failed) return ;
 
@@ -874,7 +874,7 @@
     // $ANTLR start OctalEscape
     public final void mOctalEscape() throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
             int alt12=3;
             int LA12_0 = input.LA(1);
 
@@ -908,7 +908,7 @@
                 else {
                     if (backtracking>0) {failed=true; return ;}
                     NoViableAltException nvae =
-                        new NoViableAltException("753:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 1, input);
+                        new NoViableAltException("760:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 1, input);
 
                     throw nvae;
                 }
@@ -916,31 +916,31 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("753:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 0, input);
+                    new NoViableAltException("760: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\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
                     {
                     match('\\'); if (failed) return ;
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:14: ( '0' .. '3' )
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:15: '0' .. '3'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:14: ( '0' .. '3' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:15: '0' .. '3'
                     {
                     matchRange('0','3'); if (failed) return ;
 
                     }
 
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:25: ( '0' .. '7' )
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:26: '0' .. '7'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:25: ( '0' .. '7' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:26: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
                     }
 
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:36: ( '0' .. '7' )
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:37: '0' .. '7'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:36: ( '0' .. '7' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:37: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
@@ -950,18 +950,18 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:763:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
                     {
                     match('\\'); if (failed) return ;
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:14: ( '0' .. '7' )
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:15: '0' .. '7'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:763:14: ( '0' .. '7' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:763:15: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
                     }
 
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:25: ( '0' .. '7' )
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:26: '0' .. '7'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:763:25: ( '0' .. '7' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:763:26: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
@@ -971,11 +971,11 @@
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:757:9: '\\\\' ( '0' .. '7' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:764:9: '\\\\' ( '0' .. '7' )
                     {
                     match('\\'); if (failed) return ;
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:757:14: ( '0' .. '7' )
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:757:15: '0' .. '7'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:764:14: ( '0' .. '7' )
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:764:15: '0' .. '7'
                     {
                     matchRange('0','7'); if (failed) return ;
 
@@ -995,8 +995,8 @@
     // $ANTLR start UnicodeEscape
     public final void mUnicodeEscape() throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
             {
             match('\\'); if (failed) return ;
             match('u'); if (failed) return ;
@@ -1017,10 +1017,10 @@
     public final void mBOOL() throws RecognitionException {
         try {
             int _type = BOOL;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:2: ( ( 'true' | 'false' ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:4: ( 'true' | 'false' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:2: ( ( 'true' | 'false' ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:4: ( 'true' | 'false' )
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:4: ( 'true' | 'false' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:4: ( 'true' | 'false' )
             int alt13=2;
             int LA13_0 = input.LA(1);
 
@@ -1033,13 +1033,13 @@
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("766:4: ( 'true' | 'false' )", 13, 0, input);
+                    new NoViableAltException("773:4: ( 'true' | 'false' )", 13, 0, input);
 
                 throw nvae;
             }
             switch (alt13) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:5: 'true'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:5: 'true'
                     {
                     match("true"); if (failed) return ;
 
@@ -1047,7 +1047,7 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:12: 'false'
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:12: 'false'
                     {
                     match("false"); if (failed) return ;
 
@@ -1071,11 +1071,11 @@
     public final void mVAR() throws RecognitionException {
         try {
             int _type = VAR;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:6: ( '?' ( SYMBOL_CHAR )+ )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:8: '?' ( SYMBOL_CHAR )+
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:776:6: ( '?' ( SYMBOL_CHAR )+ )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:776:8: '?' ( SYMBOL_CHAR )+
             {
             match('?'); if (failed) return ;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:12: ( SYMBOL_CHAR )+
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:776:12: ( SYMBOL_CHAR )+
             int cnt14=0;
             loop14:
             do {
@@ -1089,7 +1089,7 @@
 
                 switch (alt14) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:12: SYMBOL_CHAR
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:776:12: SYMBOL_CHAR
             	    {
             	    mSYMBOL_CHAR(); if (failed) return ;
 
@@ -1120,11 +1120,11 @@
     public final void mSH_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
         try {
             int _type = SH_STYLE_SINGLE_LINE_COMMENT;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:2: ( '#' ( options {greedy=false; } : . )* EOL )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:4: '#' ( options {greedy=false; } : . )* EOL
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:780:2: ( '#' ( options {greedy=false; } : . )* EOL )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:780:4: '#' ( options {greedy=false; } : . )* EOL
             {
             match('#'); if (failed) return ;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:8: ( options {greedy=false; } : . )*
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:780:8: ( options {greedy=false; } : . )*
             loop15:
             do {
                 int alt15=2;
@@ -1143,7 +1143,7 @@
 
                 switch (alt15) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:35: .
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:780:35: .
             	    {
             	    matchAny(); if (failed) return ;
 
@@ -1173,12 +1173,12 @@
     public final void mC_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
         try {
             int _type = C_STYLE_SINGLE_LINE_COMMENT;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:779:2: ( '//' ( options {greedy=false; } : . )* EOL )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:779:4: '//' ( options {greedy=false; } : . )* EOL
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:786:2: ( '//' ( options {greedy=false; } : . )* EOL )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:786:4: '//' ( options {greedy=false; } : . )* EOL
             {
             match("//"); if (failed) return ;
 
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:779:9: ( options {greedy=false; } : . )*
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:786:9: ( options {greedy=false; } : . )*
             loop16:
             do {
                 int alt16=2;
@@ -1197,7 +1197,7 @@
 
                 switch (alt16) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:779:36: .
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:786:36: .
             	    {
             	    matchAny(); if (failed) return ;
 
@@ -1227,8 +1227,8 @@
     public final void mLEFT_PAREN() throws RecognitionException {
         try {
             int _type = LEFT_PAREN;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:785:2: ( '(' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:785:4: '('
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:792:2: ( '(' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:792:4: '('
             {
             match('('); if (failed) return ;
 
@@ -1245,8 +1245,8 @@
     public final void mRIGHT_PAREN() throws RecognitionException {
         try {
             int _type = RIGHT_PAREN;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:789:2: ( ')' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:789:4: ')'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:796:2: ( ')' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:796:4: ')'
             {
             match(')'); if (failed) return ;
 
@@ -1263,8 +1263,8 @@
     public final void mLEFT_SQUARE() throws RecognitionException {
         try {
             int _type = LEFT_SQUARE;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:793:2: ( '[' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:793:4: '['
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:800:2: ( '[' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:800:4: '['
             {
             match('['); if (failed) return ;
 
@@ -1281,8 +1281,8 @@
     public final void mRIGHT_SQUARE() throws RecognitionException {
         try {
             int _type = RIGHT_SQUARE;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:797:2: ( ']' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:797:4: ']'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:804:2: ( ']' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:804:4: ']'
             {
             match(']'); if (failed) return ;
 
@@ -1299,8 +1299,8 @@
     public final void mLEFT_CURLY() throws RecognitionException {
         try {
             int _type = LEFT_CURLY;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:801:2: ( '{' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:801:4: '{'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:808:2: ( '{' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:808:4: '{'
             {
             match('{'); if (failed) return ;
 
@@ -1317,8 +1317,8 @@
     public final void mRIGHT_CURLY() throws RecognitionException {
         try {
             int _type = RIGHT_CURLY;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:805:2: ( '}' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:805:4: '}'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:812:2: ( '}' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:812:4: '}'
             {
             match('}'); if (failed) return ;
 
@@ -1335,8 +1335,8 @@
     public final void mTILDE() throws RecognitionException {
         try {
             int _type = TILDE;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:808:7: ( '~' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:808:9: '~'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:815:7: ( '~' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:815:9: '~'
             {
             match('~'); if (failed) return ;
 
@@ -1353,8 +1353,8 @@
     public final void mAMPERSAND() throws RecognitionException {
         try {
             int _type = AMPERSAND;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:812:2: ( '&' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:812:4: '&'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:819:2: ( '&' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:819:4: '&'
             {
             match('&'); if (failed) return ;
 
@@ -1371,8 +1371,8 @@
     public final void mPIPE() throws RecognitionException {
         try {
             int _type = PIPE;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:816:2: ( '|' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:816:4: '|'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:823:2: ( '|' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:823:4: '|'
             {
             match('|'); if (failed) return ;
 
@@ -1389,8 +1389,8 @@
     public final void mASSIGN_OP() throws RecognitionException {
         try {
             int _type = ASSIGN_OP;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:820:2: ( '<-' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:820:4: '<-'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:827:2: ( '<-' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:827:4: '<-'
             {
             match("<-"); if (failed) return ;
 
@@ -1408,8 +1408,8 @@
     public final void mCOLON() throws RecognitionException {
         try {
             int _type = COLON;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:823:7: ( ':' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:823:9: ':'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:830:7: ( ':' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:830:9: ':'
             {
             match(':'); if (failed) return ;
 
@@ -1426,8 +1426,8 @@
     public final void mEQUALS() throws RecognitionException {
         try {
             int _type = EQUALS;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:825:8: ( '=' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:825:10: '='
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:832:8: ( '=' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:832:10: '='
             {
             match('='); if (failed) return ;
 
@@ -1444,12 +1444,12 @@
     public final void mMULTI_LINE_COMMENT() throws RecognitionException {
         try {
             int _type = MULTI_LINE_COMMENT;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:828:2: ( '/*' ( options {greedy=false; } : . )* '*/' )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:828:4: '/*' ( options {greedy=false; } : . )* '*/'
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:2: ( '/*' ( options {greedy=false; } : . )* '*/' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:4: '/*' ( options {greedy=false; } : . )* '*/'
             {
             match("/*"); if (failed) return ;
 
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:828:9: ( options {greedy=false; } : . )*
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:9: ( options {greedy=false; } : . )*
             loop17:
             do {
                 int alt17=2;
@@ -1474,7 +1474,7 @@
 
                 switch (alt17) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:828:35: .
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:35: .
             	    {
             	    matchAny(); if (failed) return ;
 
@@ -1505,8 +1505,8 @@
     public final void mNAME() throws RecognitionException {
         try {
             int _type = NAME;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:832:6: ( SYMBOL )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:832:8: SYMBOL
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:839:6: ( SYMBOL )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:839:8: SYMBOL
             {
             mSYMBOL(); if (failed) return ;
 
@@ -1522,11 +1522,11 @@
     // $ANTLR start SYMBOL
     public final void mSYMBOL() throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:8: ( FIRST_SYMBOL_CHAR ( SYMBOL_CHAR )* )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:10: FIRST_SYMBOL_CHAR ( SYMBOL_CHAR )*
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:842:8: ( FIRST_SYMBOL_CHAR ( SYMBOL_CHAR )* )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:842:10: FIRST_SYMBOL_CHAR ( SYMBOL_CHAR )*
             {
             mFIRST_SYMBOL_CHAR(); if (failed) return ;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:28: ( SYMBOL_CHAR )*
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:842:28: ( SYMBOL_CHAR )*
             loop18:
             do {
                 int alt18=2;
@@ -1539,7 +1539,7 @@
 
                 switch (alt18) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:28: SYMBOL_CHAR
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:842:28: SYMBOL_CHAR
             	    {
             	    mSYMBOL_CHAR(); if (failed) return ;
 
@@ -1563,8 +1563,8 @@
     // $ANTLR start FIRST_SYMBOL_CHAR
     public final void mFIRST_SYMBOL_CHAR() throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:840:19: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | '<' | ',' | '.' | '[' | ']' | '{' | '}' ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:840:21: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | '<' | ',' | '.' | '[' | ']' | '{' | '}' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:847:19: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | '<' | ',' | '.' | '[' | ']' | '{' | '}' ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:847:21: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | '<' | ',' | '.' | '[' | ']' | '{' | '}' )
             {
             if ( 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)>='a' && input.LA(1)<='{')||input.LA(1)=='}' ) {
                 input.consume();
@@ -1589,8 +1589,8 @@
     // $ANTLR start SYMBOL_CHAR
     public final void mSYMBOL_CHAR() throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:845:13: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | ',' | '.' | '[' | ']' | '{' | '}' | '?' ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:845:15: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | ',' | '.' | '[' | ']' | '{' | '}' | '?' )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:852:13: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | ',' | '.' | '[' | ']' | '{' | '}' | '?' ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:852:15: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | ',' | '.' | '[' | ']' | '{' | '}' | '?' )
             {
             if ( input.LA(1)=='!'||(input.LA(1)>='#' && input.LA(1)<='%')||(input.LA(1)>='*' && input.LA(1)<=':')||(input.LA(1)>='=' && input.LA(1)<='_')||(input.LA(1)>='a' && input.LA(1)<='{')||input.LA(1)=='}' ) {
                 input.consume();
@@ -1862,8 +1862,8 @@
 
     // $ANTLR start synpred1
     public final void synpred1_fragment() throws RecognitionException {   
-        // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724:14: ( '\\r\\n' )
-        // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724:16: '\\r\\n'
+        // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:14: ( '\\r\\n' )
+        // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:16: '\\r\\n'
         {
         match("\r\n"); if (failed) return ;
 

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsParser.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsParser.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsParser.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,4 +1,4 @@
-// $ANTLR 3.0.1 C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g 2008-01-29 21:18:01
+// $ANTLR 3.0.1 C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g 2008-02-05 16:37:47
 
 	package org.drools.clips;
 
@@ -69,7 +69,7 @@
 
         public ClipsParser(TokenStream input) {
             super(input);
-            ruleMemo = new HashMap[26+1];
+            ruleMemo = new HashMap[27+1];
          }
         
 
@@ -82,7 +82,6 @@
     	private String source = "unknown";
     	private int lineOffset = 0;
     	private DescrFactory factory = new DescrFactory();
-    	private MVELBuildContext context;
     	private boolean parserDebug = false;
     	private Location location = new Location( Location.LOCATION_UNKNOWN );	
     	
@@ -226,8 +225,8 @@
 
 
     // $ANTLR start eval
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:223:1: eval[ParserHandler handler, MVELBuildContext context] : (i= importDescr | f= deffunction | r= defrule | form= lisp_form ) ;
-    public final void eval(ParserHandler handler, MVELBuildContext context) throws RecognitionException {
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:222:1: eval[ParserHandler handler] : (i= importDescr | f= deffunction | r= defrule | form= lisp_form )* ;
+    public final void eval(ParserHandler handler) throws RecognitionException {
         ImportDescr i = null;
 
         FunctionDescr f = null;
@@ -238,110 +237,102 @@
 
 
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:224:2: ( (i= importDescr | f= deffunction | r= defrule | form= lisp_form ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:225:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:223:2: ( (i= importDescr | f= deffunction | r= defrule | form= lisp_form )* )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:224:5: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )*
             {
-            if ( backtracking==0 ) {
-               this.context = context; 
-            }
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:226:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )
-            int alt1=4;
-            int LA1_0 = input.LA(1);
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:224:5: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )*
+            loop1:
+            do {
+                int alt1=5;
+                int LA1_0 = input.LA(1);
 
-            if ( (LA1_0==LEFT_PAREN) ) {
-                switch ( input.LA(2) ) {
-                case DEFFUNCTION:
-                    {
-                    alt1=2;
+                if ( (LA1_0==LEFT_PAREN) ) {
+                    switch ( input.LA(2) ) {
+                    case DEFFUNCTION:
+                        {
+                        alt1=2;
+                        }
+                        break;
+                    case DEFRULE:
+                        {
+                        alt1=3;
+                        }
+                        break;
+                    case 44:
+                        {
+                        alt1=1;
+                        }
+                        break;
+                    case NAME:
+                    case VAR:
+                        {
+                        alt1=4;
+                        }
+                        break;
+
                     }
-                    break;
-                case 44:
-                    {
-                    alt1=1;
-                    }
-                    break;
-                case DEFRULE:
-                    {
-                    alt1=3;
-                    }
-                    break;
-                case NAME:
-                case VAR:
-                    {
-                    alt1=4;
-                    }
-                    break;
-                default:
-                    if (backtracking>0) {failed=true; return ;}
-                    NoViableAltException nvae =
-                        new NoViableAltException("226:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )", 1, 1, input);
 
-                    throw nvae;
                 }
 
-            }
-            else {
-                if (backtracking>0) {failed=true; return ;}
-                NoViableAltException nvae =
-                    new NoViableAltException("226:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )", 1, 0, input);
 
-                throw nvae;
-            }
-            switch (alt1) {
-                case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:226:7: i= importDescr
-                    {
-                    pushFollow(FOLLOW_importDescr_in_eval60);
-                    i=importDescr();
-                    _fsp--;
-                    if (failed) return ;
-                    if ( backtracking==0 ) {
-                       handler.importHandler( i ); 
-                    }
+                switch (alt1) {
+            	case 1 :
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:224:10: i= importDescr
+            	    {
+            	    pushFollow(FOLLOW_importDescr_in_eval60);
+            	    i=importDescr();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       handler.importHandler( i ); 
+            	    }
 
-                    }
-                    break;
-                case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:227:7: f= deffunction
-                    {
-                    pushFollow(FOLLOW_deffunction_in_eval71);
-                    f=deffunction();
-                    _fsp--;
-                    if (failed) return ;
-                    if ( backtracking==0 ) {
-                       handler.functionHandler( f ); 
-                    }
+            	    }
+            	    break;
+            	case 2 :
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:225:7: f= deffunction
+            	    {
+            	    pushFollow(FOLLOW_deffunction_in_eval71);
+            	    f=deffunction();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       handler.functionHandler( f ); 
+            	    }
 
-                    }
-                    break;
-                case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:228:7: r= defrule
-                    {
-                    pushFollow(FOLLOW_defrule_in_eval84);
-                    r=defrule();
-                    _fsp--;
-                    if (failed) return ;
-                    if ( backtracking==0 ) {
-                       handler.ruleHandler( r ); 
-                    }
+            	    }
+            	    break;
+            	case 3 :
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:226:7: r= defrule
+            	    {
+            	    pushFollow(FOLLOW_defrule_in_eval84);
+            	    r=defrule();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       handler.ruleHandler( r ); 
+            	    }
 
-                    }
-                    break;
-                case 4 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:229:7: form= lisp_form
-                    {
-                    pushFollow(FOLLOW_lisp_form_in_eval96);
-                    form=lisp_form();
-                    _fsp--;
-                    if (failed) return ;
-                    if ( backtracking==0 ) {
-                       handler.lispFormHandler( form ); 
-                    }
+            	    }
+            	    break;
+            	case 4 :
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:227:7: form= lisp_form
+            	    {
+            	    pushFollow(FOLLOW_lisp_form_in_eval96);
+            	    form=lisp_form();
+            	    _fsp--;
+            	    if (failed) return ;
+            	    if ( backtracking==0 ) {
+            	       handler.lispFormHandler( form ); 
+            	    }
 
-                    }
-                    break;
+            	    }
+            	    break;
 
-            }
+            	default :
+            	    break loop1;
+                }
+            } while (true);
 
 
             }
@@ -359,24 +350,24 @@
 
 
     // $ANTLR start importDescr
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:246:1: importDescr returns [ImportDescr importDescr] : LEFT_PAREN 'import' importName= NAME RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:244:1: importDescr returns [ImportDescr importDescr] : LEFT_PAREN 'import' importName= NAME RIGHT_PAREN ;
     public final ImportDescr importDescr() throws RecognitionException {
         ImportDescr importDescr = null;
 
         Token importName=null;
 
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:247:2: ( LEFT_PAREN 'import' importName= NAME RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:247:4: LEFT_PAREN 'import' importName= NAME RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:245:2: ( LEFT_PAREN 'import' importName= NAME RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:245:4: LEFT_PAREN 'import' importName= NAME RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_importDescr123); if (failed) return importDescr;
-            match(input,44,FOLLOW_44_in_importDescr125); if (failed) return importDescr;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_importDescr124); if (failed) return importDescr;
+            match(input,44,FOLLOW_44_in_importDescr126); if (failed) return importDescr;
             importName=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_importDescr129); if (failed) return importDescr;
+            match(input,NAME,FOLLOW_NAME_in_importDescr130); if (failed) return importDescr;
             if ( backtracking==0 ) {
                importDescr = new ImportDescr( importName.getText() ); 
             }
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_importDescr133); if (failed) return importDescr;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_importDescr134); if (failed) return importDescr;
 
             }
 
@@ -393,7 +384,7 @@
 
 
     // $ANTLR start deffunction
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:295:1: deffunction returns [FunctionDescr functionDescr] : LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:293:1: deffunction returns [FunctionDescr functionDescr] : LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN ;
     public final FunctionDescr deffunction() throws RecognitionException {
         FunctionDescr functionDescr = null;
 
@@ -410,21 +401,21 @@
                 functionDescr = null;
             
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:300:2: ( LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:300:4: LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:298:2: ( LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:298:4: LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_deffunction168); if (failed) return functionDescr;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_deffunction169); if (failed) return functionDescr;
             t=(Token)input.LT(1);
-            match(input,DEFFUNCTION,FOLLOW_DEFFUNCTION_in_deffunction178); if (failed) return functionDescr;
-            pushFollow(FOLLOW_lisp_atom_in_deffunction188);
+            match(input,DEFFUNCTION,FOLLOW_DEFFUNCTION_in_deffunction179); if (failed) return functionDescr;
+            pushFollow(FOLLOW_lisp_atom_in_deffunction189);
             name=lisp_atom();
             _fsp--;
             if (failed) return functionDescr;
-            pushFollow(FOLLOW_lisp_form_in_deffunction198);
+            pushFollow(FOLLOW_lisp_form_in_deffunction199);
             params=lisp_form();
             _fsp--;
             if (failed) return functionDescr;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:304:3: (form= lisp_form )+
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:302:3: (form= lisp_form )+
             int cnt2=0;
             loop2:
             do {
@@ -438,9 +429,9 @@
 
                 switch (alt2) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:304:4: form= lisp_form
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:302:4: form= lisp_form
             	    {
-            	    pushFollow(FOLLOW_lisp_form_in_deffunction207);
+            	    pushFollow(FOLLOW_lisp_form_in_deffunction208);
             	    form=lisp_form();
             	    _fsp--;
             	    if (failed) return functionDescr;
@@ -461,7 +452,7 @@
                 cnt2++;
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_deffunction229); if (failed) return functionDescr;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_deffunction230); if (failed) return functionDescr;
             if ( backtracking==0 ) {
                functionDescr = FunctionHandlers.createFunctionDescr( name, params, content ); 
             }
@@ -481,14 +472,14 @@
 
 
     // $ANTLR start defrule
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:310:1: defrule returns [RuleDescr rule] : loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:308:1: defrule returns [RuleDescr rule] : loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' list= rule_consequence RIGHT_PAREN ;
     public final RuleDescr defrule() throws RecognitionException {
         RuleDescr rule = null;
 
         Token loc=null;
         Token ruleName=null;
         Token documentation=null;
-        LispForm t = null;
+        List list = null;
 
 
          
@@ -499,14 +490,14 @@
                     Set declarations = null;  
         	      
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:318:2: (loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:318:4: loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:316:2: (loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' list= rule_consequence RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:316:4: loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' list= rule_consequence RIGHT_PAREN
             {
             loc=(Token)input.LT(1);
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_defrule266); if (failed) return rule;
-            match(input,DEFRULE,FOLLOW_DEFRULE_in_defrule274); if (failed) return rule;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_defrule267); if (failed) return rule;
+            match(input,DEFRULE,FOLLOW_DEFRULE_in_defrule275); if (failed) return rule;
             ruleName=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_defrule278); if (failed) return rule;
+            match(input,NAME,FOLLOW_NAME_in_defrule279); if (failed) return rule;
             if ( backtracking==0 ) {
                	  			  		
               	  		debug( "start rule: " + ruleName.getText() );
@@ -541,17 +532,17 @@
               		
             }
             documentation=(Token)input.LT(1);
-            match(input,STRING,FOLLOW_STRING_in_defrule290); if (failed) return rule;
+            match(input,STRING,FOLLOW_STRING_in_defrule291); if (failed) return rule;
             if ( backtracking==0 ) {
               
               	    	// do nothing here for now
               		
             }
-            pushFollow(FOLLOW_ruleAttribute_in_defrule296);
+            pushFollow(FOLLOW_ruleAttribute_in_defrule297);
             ruleAttribute(rule);
             _fsp--;
             if (failed) return rule;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:357:3: ( ce[lhs, declarations] )*
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:355:3: ( ce[lhs, declarations] )*
             loop3:
             do {
                 int alt3=2;
@@ -564,9 +555,9 @@
 
                 switch (alt3) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:357:3: ce[lhs, declarations]
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:355:3: ce[lhs, declarations]
             	    {
-            	    pushFollow(FOLLOW_ce_in_defrule304);
+            	    pushFollow(FOLLOW_ce_in_defrule305);
             	    ce(lhs,  declarations);
             	    _fsp--;
             	    if (failed) return rule;
@@ -579,13 +570,13 @@
                 }
             } while (true);
 
-            match(input,45,FOLLOW_45_in_defrule313); if (failed) return rule;
-            pushFollow(FOLLOW_lisp_form_in_defrule322);
-            t=lisp_form();
+            match(input,45,FOLLOW_45_in_defrule314); if (failed) return rule;
+            pushFollow(FOLLOW_rule_consequence_in_defrule323);
+            list=rule_consequence();
             _fsp--;
             if (failed) return rule;
             if ( backtracking==0 ) {
-               rule.setConsequence( t ); 
+               rule.setConsequence( list ); 
             }
             match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_defrule331); if (failed) return rule;
 
@@ -603,60 +594,121 @@
     // $ANTLR end defrule
 
 
+    // $ANTLR start rule_consequence
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:364:1: rule_consequence returns [List list] : (l= lisp_form )* ;
+    public final List rule_consequence() throws RecognitionException {
+        List list = null;
+
+        LispForm l = null;
+
+
+        
+                list = null;
+            
+        try {
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:368:5: ( (l= lisp_form )* )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:3: (l= lisp_form )*
+            {
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:3: (l= lisp_form )*
+            loop4:
+            do {
+                int alt4=2;
+                int LA4_0 = input.LA(1);
+
+                if ( (LA4_0==LEFT_PAREN) ) {
+                    alt4=1;
+                }
+
+
+                switch (alt4) {
+            	case 1 :
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:4: l= lisp_form
+            	    {
+            	    pushFollow(FOLLOW_lisp_form_in_rule_consequence363);
+            	    l=lisp_form();
+            	    _fsp--;
+            	    if (failed) return list;
+            	    if ( backtracking==0 ) {
+            	       if ( list == null ) list = new ArrayList(); list.add( l ); 
+            	    }
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop4;
+                }
+            } while (true);
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+        }
+        return list;
+    }
+    // $ANTLR end rule_consequence
+
+
     // $ANTLR start ruleAttribute
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:367:1: ruleAttribute[RuleDescr rule] : ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:372:1: ruleAttribute[RuleDescr rule] : ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? ;
     public final void ruleAttribute(RuleDescr rule) throws RecognitionException {
         AttributeDescr d = null;
 
 
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:368:2: ( ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:373:2: ( ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:374:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
-            int alt5=2;
-            int LA5_0 = input.LA(1);
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:374:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
+            int alt6=2;
+            int LA6_0 = input.LA(1);
 
-            if ( (LA5_0==LEFT_PAREN) ) {
-                int LA5_1 = input.LA(2);
+            if ( (LA6_0==LEFT_PAREN) ) {
+                int LA6_1 = input.LA(2);
 
-                if ( (LA5_1==DECLARE) ) {
-                    alt5=1;
+                if ( (LA6_1==DECLARE) ) {
+                    alt6=1;
                 }
             }
-            switch (alt5) {
+            switch (alt6) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:5: LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:374:5: LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN
                     {
-                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute348); if (failed) return ;
-                    match(input,DECLARE,FOLLOW_DECLARE_in_ruleAttribute350); if (failed) return ;
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:370:4: ( LEFT_PAREN d= salience RIGHT_PAREN )?
-                    int alt4=2;
-                    int LA4_0 = input.LA(1);
+                    match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute396); if (failed) return ;
+                    match(input,DECLARE,FOLLOW_DECLARE_in_ruleAttribute398); if (failed) return ;
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:375:4: ( LEFT_PAREN d= salience RIGHT_PAREN )?
+                    int alt5=2;
+                    int LA5_0 = input.LA(1);
 
-                    if ( (LA4_0==LEFT_PAREN) ) {
-                        alt4=1;
+                    if ( (LA5_0==LEFT_PAREN) ) {
+                        alt5=1;
                     }
-                    switch (alt4) {
+                    switch (alt5) {
                         case 1 :
-                            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:370:6: LEFT_PAREN d= salience RIGHT_PAREN
+                            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:375:6: LEFT_PAREN d= salience RIGHT_PAREN
                             {
-                            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute357); if (failed) return ;
-                            pushFollow(FOLLOW_salience_in_ruleAttribute361);
+                            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute405); if (failed) return ;
+                            pushFollow(FOLLOW_salience_in_ruleAttribute409);
                             d=salience();
                             _fsp--;
                             if (failed) return ;
                             if ( backtracking==0 ) {
                                rule.addAttribute( d ); 
                             }
-                            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute365); if (failed) return ;
+                            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute413); if (failed) return ;
 
                             }
                             break;
 
                     }
 
-                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute372); if (failed) return ;
+                    match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute420); if (failed) return ;
 
                     }
                     break;
@@ -679,7 +731,7 @@
 
 
     // $ANTLR start salience
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:374:1: salience returns [AttributeDescr d ] : loc= SALIENCE i= INT ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:379:1: salience returns [AttributeDescr d ] : loc= SALIENCE i= INT ;
     public final AttributeDescr salience() throws RecognitionException {
         AttributeDescr d = null;
 
@@ -690,13 +742,13 @@
         		d = null;
         	
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:378:2: (loc= SALIENCE i= INT )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:379:3: loc= SALIENCE i= INT
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:383:2: (loc= SALIENCE i= INT )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:384:3: loc= SALIENCE i= INT
             {
             loc=(Token)input.LT(1);
-            match(input,SALIENCE,FOLLOW_SALIENCE_in_salience402); if (failed) return d;
+            match(input,SALIENCE,FOLLOW_SALIENCE_in_salience450); if (failed) return d;
             i=(Token)input.LT(1);
-            match(input,INT,FOLLOW_INT_in_salience406); if (failed) return d;
+            match(input,INT,FOLLOW_INT_in_salience454); if (failed) return d;
             if ( backtracking==0 ) {
               
               			d = new AttributeDescr( "salience", i.getText() );
@@ -721,72 +773,72 @@
 
 
     // $ANTLR start ce
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:389:1: ce[ConditionalElementDescr in_ce, Set declarations] : ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] ) ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:394:1: ce[ConditionalElementDescr in_ce, Set declarations] : ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] ) ;
     public final void ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:390:2: ( ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:390:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:395:2: ( ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:395:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:390:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )
-            int alt6=7;
-            int LA6_0 = input.LA(1);
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:395:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )
+            int alt7=7;
+            int LA7_0 = input.LA(1);
 
-            if ( (LA6_0==LEFT_PAREN) ) {
+            if ( (LA7_0==LEFT_PAREN) ) {
                 switch ( input.LA(2) ) {
-                case NOT:
+                case NAME:
                     {
-                    alt6=3;
+                    alt7=6;
                     }
                     break;
-                case EXISTS:
+                case OR:
                     {
-                    alt6=4;
+                    alt7=2;
                     }
                     break;
-                case OR:
+                case AND:
                     {
-                    alt6=2;
+                    alt7=1;
                     }
                     break;
-                case AND:
+                case TEST:
                     {
-                    alt6=1;
+                    alt7=5;
                     }
                     break;
-                case NAME:
+                case EXISTS:
                     {
-                    alt6=6;
+                    alt7=4;
                     }
                     break;
-                case TEST:
+                case NOT:
                     {
-                    alt6=5;
+                    alt7=3;
                     }
                     break;
                 default:
                     if (backtracking>0) {failed=true; return ;}
                     NoViableAltException nvae =
-                        new NoViableAltException("390:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )", 6, 1, input);
+                        new NoViableAltException("395:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )", 7, 1, input);
 
                     throw nvae;
                 }
 
             }
-            else if ( (LA6_0==VAR) ) {
-                alt6=7;
+            else if ( (LA7_0==VAR) ) {
+                alt7=7;
             }
             else {
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("390:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )", 6, 0, input);
+                    new NoViableAltException("395:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )", 7, 0, input);
 
                 throw nvae;
             }
-            switch (alt6) {
+            switch (alt7) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:390:8: and_ce[in_ce, declarations]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:395:8: and_ce[in_ce, declarations]
                     {
-                    pushFollow(FOLLOW_and_ce_in_ce432);
+                    pushFollow(FOLLOW_and_ce_in_ce480);
                     and_ce(in_ce,  declarations);
                     _fsp--;
                     if (failed) return ;
@@ -794,9 +846,9 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:391:7: or_ce[in_ce, declarations]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:396:7: or_ce[in_ce, declarations]
                     {
-                    pushFollow(FOLLOW_or_ce_in_ce442);
+                    pushFollow(FOLLOW_or_ce_in_ce490);
                     or_ce(in_ce,  declarations);
                     _fsp--;
                     if (failed) return ;
@@ -804,9 +856,9 @@
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:392:7: not_ce[in_ce, declarations]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:397:7: not_ce[in_ce, declarations]
                     {
-                    pushFollow(FOLLOW_not_ce_in_ce451);
+                    pushFollow(FOLLOW_not_ce_in_ce499);
                     not_ce(in_ce,  declarations);
                     _fsp--;
                     if (failed) return ;
@@ -814,9 +866,9 @@
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:393:7: exists_ce[in_ce, declarations]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:398:7: exists_ce[in_ce, declarations]
                     {
-                    pushFollow(FOLLOW_exists_ce_in_ce460);
+                    pushFollow(FOLLOW_exists_ce_in_ce508);
                     exists_ce(in_ce,  declarations);
                     _fsp--;
                     if (failed) return ;
@@ -824,9 +876,9 @@
                     }
                     break;
                 case 5 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:394:8: eval_ce[in_ce, declarations]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:399:8: eval_ce[in_ce, declarations]
                     {
-                    pushFollow(FOLLOW_eval_ce_in_ce474);
+                    pushFollow(FOLLOW_eval_ce_in_ce522);
                     eval_ce(in_ce,  declarations);
                     _fsp--;
                     if (failed) return ;
@@ -834,9 +886,9 @@
                     }
                     break;
                 case 6 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:395:7: normal_pattern[in_ce, declarations]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:400:7: normal_pattern[in_ce, declarations]
                     {
-                    pushFollow(FOLLOW_normal_pattern_in_ce488);
+                    pushFollow(FOLLOW_normal_pattern_in_ce536);
                     normal_pattern(in_ce,  declarations);
                     _fsp--;
                     if (failed) return ;
@@ -844,9 +896,9 @@
                     }
                     break;
                 case 7 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:396:7: bound_pattern[in_ce, declarations]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:401:7: bound_pattern[in_ce, declarations]
                     {
-                    pushFollow(FOLLOW_bound_pattern_in_ce497);
+                    pushFollow(FOLLOW_bound_pattern_in_ce545);
                     bound_pattern(in_ce,  declarations);
                     _fsp--;
                     if (failed) return ;
@@ -872,40 +924,40 @@
 
 
     // $ANTLR start and_ce
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:400:1: and_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:405:1: and_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN ;
     public final void and_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
         
                 AndDescr andDescr= null;        
             
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:404:2: ( LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:404:4: LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:409:2: ( LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:409:4: LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_and_ce524); if (failed) return ;
-            match(input,AND,FOLLOW_AND_in_and_ce529); if (failed) return ;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_and_ce572); if (failed) return ;
+            match(input,AND,FOLLOW_AND_in_and_ce577); if (failed) return ;
             if ( backtracking==0 ) {
               
               	    	andDescr = new AndDescr();
               			in_ce.addDescr( andDescr );
               		
             }
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:409:3: ( ce[andDescr, declarations] )+
-            int cnt7=0;
-            loop7:
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:414:3: ( ce[andDescr, declarations] )+
+            int cnt8=0;
+            loop8:
             do {
-                int alt7=2;
-                int LA7_0 = input.LA(1);
+                int alt8=2;
+                int LA8_0 = input.LA(1);
 
-                if ( (LA7_0==LEFT_PAREN||LA7_0==VAR) ) {
-                    alt7=1;
+                if ( (LA8_0==LEFT_PAREN||LA8_0==VAR) ) {
+                    alt8=1;
                 }
 
 
-                switch (alt7) {
+                switch (alt8) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:409:3: ce[andDescr, declarations]
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:414:3: ce[andDescr, declarations]
             	    {
-            	    pushFollow(FOLLOW_ce_in_and_ce535);
+            	    pushFollow(FOLLOW_ce_in_and_ce583);
             	    ce(andDescr,  declarations);
             	    _fsp--;
             	    if (failed) return ;
@@ -914,16 +966,16 @@
             	    break;
 
             	default :
-            	    if ( cnt7 >= 1 ) break loop7;
+            	    if ( cnt8 >= 1 ) break loop8;
             	    if (backtracking>0) {failed=true; return ;}
                         EarlyExitException eee =
-                            new EarlyExitException(7, input);
+                            new EarlyExitException(8, input);
                         throw eee;
                 }
-                cnt7++;
+                cnt8++;
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_and_ce544); if (failed) return ;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_and_ce592); if (failed) return ;
 
             }
 
@@ -940,40 +992,40 @@
 
 
     // $ANTLR start or_ce
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:413:1: or_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:418:1: or_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN ;
     public final void or_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
         
                 OrDescr orDescr= null;         
             
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:417:2: ( LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:417:4: LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:422:2: ( LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:422:4: LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_or_ce572); if (failed) return ;
-            match(input,OR,FOLLOW_OR_in_or_ce577); if (failed) return ;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_or_ce620); if (failed) return ;
+            match(input,OR,FOLLOW_OR_in_or_ce625); if (failed) return ;
             if ( backtracking==0 ) {
               
               	    	orDescr = new OrDescr();
               			in_ce.addDescr( orDescr );
               		
             }
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:422:3: ( ce[orDescr, declarations] )+
-            int cnt8=0;
-            loop8:
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:427:3: ( ce[orDescr, declarations] )+
+            int cnt9=0;
+            loop9:
             do {
-                int alt8=2;
-                int LA8_0 = input.LA(1);
+                int alt9=2;
+                int LA9_0 = input.LA(1);
 
-                if ( (LA8_0==LEFT_PAREN||LA8_0==VAR) ) {
-                    alt8=1;
+                if ( (LA9_0==LEFT_PAREN||LA9_0==VAR) ) {
+                    alt9=1;
                 }
 
 
-                switch (alt8) {
+                switch (alt9) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:422:3: ce[orDescr, declarations]
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:427:3: ce[orDescr, declarations]
             	    {
-            	    pushFollow(FOLLOW_ce_in_or_ce583);
+            	    pushFollow(FOLLOW_ce_in_or_ce631);
             	    ce(orDescr,  declarations);
             	    _fsp--;
             	    if (failed) return ;
@@ -982,16 +1034,16 @@
             	    break;
 
             	default :
-            	    if ( cnt8 >= 1 ) break loop8;
+            	    if ( cnt9 >= 1 ) break loop9;
             	    if (backtracking>0) {failed=true; return ;}
                         EarlyExitException eee =
-                            new EarlyExitException(8, input);
+                            new EarlyExitException(9, input);
                         throw eee;
                 }
-                cnt8++;
+                cnt9++;
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_or_ce592); if (failed) return ;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_or_ce640); if (failed) return ;
 
             }
 
@@ -1008,28 +1060,28 @@
 
 
     // $ANTLR start not_ce
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:426:1: not_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:431:1: not_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN ;
     public final void not_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
         
                 NotDescr notDescr= null;         
             
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:430:2: ( LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:430:4: LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:435:2: ( LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:435:4: LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_not_ce620); if (failed) return ;
-            match(input,NOT,FOLLOW_NOT_in_not_ce625); if (failed) return ;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_not_ce668); if (failed) return ;
+            match(input,NOT,FOLLOW_NOT_in_not_ce673); if (failed) return ;
             if ( backtracking==0 ) {
               
               			notDescr = new NotDescr();
               		    in_ce.addDescr( notDescr );
               		
             }
-            pushFollow(FOLLOW_ce_in_not_ce631);
+            pushFollow(FOLLOW_ce_in_not_ce679);
             ce(notDescr,  declarations);
             _fsp--;
             if (failed) return ;
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_not_ce639); if (failed) return ;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_not_ce687); if (failed) return ;
 
             }
 
@@ -1046,28 +1098,28 @@
 
 
     // $ANTLR start exists_ce
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:439:1: exists_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:444:1: exists_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN ;
     public final void exists_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
         
                 ExistsDescr existsDescr= null;        
             
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:443:2: ( LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:443:4: LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:448:2: ( LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:448:4: LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_exists_ce668); if (failed) return ;
-            match(input,EXISTS,FOLLOW_EXISTS_in_exists_ce673); if (failed) return ;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_exists_ce716); if (failed) return ;
+            match(input,EXISTS,FOLLOW_EXISTS_in_exists_ce721); if (failed) return ;
             if ( backtracking==0 ) {
               
               		    existsDescr = new ExistsDescr();
               		    in_ce.addDescr( existsDescr );
               		
             }
-            pushFollow(FOLLOW_ce_in_exists_ce679);
+            pushFollow(FOLLOW_ce_in_exists_ce727);
             ce(existsDescr,  declarations);
             _fsp--;
             if (failed) return ;
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_exists_ce687); if (failed) return ;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_exists_ce735); if (failed) return ;
 
             }
 
@@ -1084,25 +1136,25 @@
 
 
     // $ANTLR start eval_ce
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:452:1: eval_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN TEST t= lisp_form RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:457:1: eval_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN TEST t= lisp_form RIGHT_PAREN ;
     public final void eval_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
         LispForm t = null;
 
 
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:453:2: ( LEFT_PAREN TEST t= lisp_form RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:453:4: LEFT_PAREN TEST t= lisp_form RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:458:2: ( LEFT_PAREN TEST t= lisp_form RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:458:4: LEFT_PAREN TEST t= lisp_form RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce706); if (failed) return ;
-            match(input,TEST,FOLLOW_TEST_in_eval_ce711); if (failed) return ;
-            pushFollow(FOLLOW_lisp_form_in_eval_ce718);
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce754); if (failed) return ;
+            match(input,TEST,FOLLOW_TEST_in_eval_ce759); if (failed) return ;
+            pushFollow(FOLLOW_lisp_form_in_eval_ce766);
             t=lisp_form();
             _fsp--;
             if (failed) return ;
             if ( backtracking==0 ) {
                EvalDescr evalDescr = new EvalDescr(); evalDescr.setContent( t ); in_ce.addDescr( evalDescr ); 
             }
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce728); if (failed) return ;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce776); if (failed) return ;
 
             }
 
@@ -1119,7 +1171,7 @@
 
 
     // $ANTLR start normal_pattern
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:459:1: normal_pattern[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:464:1: normal_pattern[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN ;
     public final void normal_pattern(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
         Token name=null;
 
@@ -1128,12 +1180,12 @@
                 ConditionalElementDescr top = null;
             
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:464:2: ( LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:464:4: LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:469:2: ( LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:469:4: LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_normal_pattern756); if (failed) return ;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_normal_pattern804); if (failed) return ;
             name=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_normal_pattern763); if (failed) return ;
+            match(input,NAME,FOLLOW_NAME_in_normal_pattern811); if (failed) return ;
             if ( backtracking==0 ) {
               
               			pattern = new PatternDescr(name.getText());
@@ -1142,22 +1194,22 @@
               			
               		
             }
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:471:3: ( field_constriant[top, declarations] )*
-            loop9:
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:476:3: ( field_constriant[top, declarations] )*
+            loop10:
             do {
-                int alt9=2;
-                int LA9_0 = input.LA(1);
+                int alt10=2;
+                int LA10_0 = input.LA(1);
 
-                if ( (LA9_0==LEFT_PAREN) ) {
-                    alt9=1;
+                if ( (LA10_0==LEFT_PAREN) ) {
+                    alt10=1;
                 }
 
 
-                switch (alt9) {
+                switch (alt10) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:471:3: field_constriant[top, declarations]
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:476:3: field_constriant[top, declarations]
             	    {
-            	    pushFollow(FOLLOW_field_constriant_in_normal_pattern769);
+            	    pushFollow(FOLLOW_field_constriant_in_normal_pattern817);
             	    field_constriant(top,  declarations);
             	    _fsp--;
             	    if (failed) return ;
@@ -1166,11 +1218,11 @@
             	    break;
 
             	default :
-            	    break loop9;
+            	    break loop10;
                 }
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_normal_pattern779); if (failed) return ;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_normal_pattern827); if (failed) return ;
 
             }
 
@@ -1187,7 +1239,7 @@
 
 
     // $ANTLR start bound_pattern
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:477:1: bound_pattern[ConditionalElementDescr in_ce, Set declarations] : var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:482:1: bound_pattern[ConditionalElementDescr in_ce, Set declarations] : var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN ;
     public final void bound_pattern(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
         Token var=null;
         Token name=null;
@@ -1198,44 +1250,44 @@
                 ConditionalElementDescr top = null;        
             
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:483:2: (var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:483:4: var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:488:2: (var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:488:4: var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN
             {
             var=(Token)input.LT(1);
-            match(input,VAR,FOLLOW_VAR_in_bound_pattern807); if (failed) return ;
+            match(input,VAR,FOLLOW_VAR_in_bound_pattern855); if (failed) return ;
             if ( backtracking==0 ) {
               
               			identifier = var.getText();
               		
             }
-            match(input,ASSIGN_OP,FOLLOW_ASSIGN_OP_in_bound_pattern813); if (failed) return ;
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_bound_pattern815); if (failed) return ;
+            match(input,ASSIGN_OP,FOLLOW_ASSIGN_OP_in_bound_pattern861); if (failed) return ;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_bound_pattern863); if (failed) return ;
             name=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_bound_pattern819); if (failed) return ;
+            match(input,NAME,FOLLOW_NAME_in_bound_pattern867); if (failed) return ;
             if ( backtracking==0 ) {
               
               			pattern = new PatternDescr(name.getText());
-              			pattern.setIdentifier( identifier );
+              			pattern.setIdentifier( identifier.replace( '?', '$') );
               			in_ce.addDescr( pattern );
               			top = pattern.getConstraint();				    
               		
             }
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:493:3: ( field_constriant[top, declarations] )*
-            loop10:
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:498:3: ( field_constriant[top, declarations] )*
+            loop11:
             do {
-                int alt10=2;
-                int LA10_0 = input.LA(1);
+                int alt11=2;
+                int LA11_0 = input.LA(1);
 
-                if ( (LA10_0==LEFT_PAREN) ) {
-                    alt10=1;
+                if ( (LA11_0==LEFT_PAREN) ) {
+                    alt11=1;
                 }
 
 
-                switch (alt10) {
+                switch (alt11) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:493:3: field_constriant[top, declarations]
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:498:3: field_constriant[top, declarations]
             	    {
-            	    pushFollow(FOLLOW_field_constriant_in_bound_pattern828);
+            	    pushFollow(FOLLOW_field_constriant_in_bound_pattern876);
             	    field_constriant(top,  declarations);
             	    _fsp--;
             	    if (failed) return ;
@@ -1244,11 +1296,11 @@
             	    break;
 
             	default :
-            	    break loop10;
+            	    break loop11;
                 }
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_bound_pattern835); if (failed) return ;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_bound_pattern883); if (failed) return ;
 
             }
 
@@ -1265,7 +1317,7 @@
 
 
     // $ANTLR start field_constriant
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:497:1: field_constriant[ConditionalElementDescr base, Set declarations] : LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:502:1: field_constriant[ConditionalElementDescr base, Set declarations] : LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN ;
     public final void field_constriant(ConditionalElementDescr base, Set declarations) throws RecognitionException {
         Token f=null;
 
@@ -1277,12 +1329,12 @@
         		String op = "==";
         	
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:505:2: ( LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:506:3: LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:510:2: ( LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:511:3: LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_field_constriant866); if (failed) return ;
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_field_constriant914); if (failed) return ;
             f=(Token)input.LT(1);
-            match(input,NAME,FOLLOW_NAME_in_field_constriant870); if (failed) return ;
+            match(input,NAME,FOLLOW_NAME_in_field_constriant918); if (failed) return ;
             if ( backtracking==0 ) {
               
               			fc = new FieldConstraintDescr(f.getText());
@@ -1292,11 +1344,11 @@
               			top = fc.getRestriction();		
               		
             }
-            pushFollow(FOLLOW_or_restr_connective_in_field_constriant885);
+            pushFollow(FOLLOW_or_restr_connective_in_field_constriant933);
             or_restr_connective(top,  base,  fc,  declarations);
             _fsp--;
             if (failed) return ;
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_field_constriant891); if (failed) return ;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_field_constriant939); if (failed) return ;
 
             }
 
@@ -1313,41 +1365,41 @@
 
 
     // $ANTLR start or_restr_connective
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:533:1: or_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] options {backtrack=true; } : and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )* ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:538:1: or_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] options {backtrack=true; } : and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )* ;
     public final void or_restr_connective(RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
         
         		RestrictionConnectiveDescr or = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
         	
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:540:2: ( and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )* )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:541:3: and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )*
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:545:2: ( and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )* )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:546:3: and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )*
             {
-            pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective930);
+            pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective978);
             and_restr_connective(or,  ceBase,  fcBase,  declarations);
             _fsp--;
             if (failed) return ;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:542:3: ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )*
-            loop11:
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:547:3: ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )*
+            loop12:
             do {
-                int alt11=2;
-                int LA11_0 = input.LA(1);
+                int alt12=2;
+                int LA12_0 = input.LA(1);
 
-                if ( (LA11_0==PIPE) ) {
-                    alt11=1;
+                if ( (LA12_0==PIPE) ) {
+                    alt12=1;
                 }
 
 
-                switch (alt11) {
+                switch (alt12) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:544:6: PIPE and_restr_connective[or, ceBase, fcBase, declarations]
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:549:6: PIPE and_restr_connective[or, ceBase, fcBase, declarations]
             	    {
-            	    match(input,PIPE,FOLLOW_PIPE_in_or_restr_connective954); if (failed) return ;
+            	    match(input,PIPE,FOLLOW_PIPE_in_or_restr_connective1002); if (failed) return ;
             	    if ( backtracking==0 ) {
             	      
             	      				location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
             	      			
             	    }
-            	    pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective964);
+            	    pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective1012);
             	    and_restr_connective(or,  ceBase,  fcBase,  declarations);
             	    _fsp--;
             	    if (failed) return ;
@@ -1356,7 +1408,7 @@
             	    break;
 
             	default :
-            	    break loop11;
+            	    break loop12;
                 }
             } while (true);
 
@@ -1383,36 +1435,36 @@
 
 
     // $ANTLR start and_restr_connective
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:559:1: and_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] : restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )* ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:564:1: and_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] : restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )* ;
     public final void and_restr_connective(RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
         
         		RestrictionConnectiveDescr and = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
         	
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:563:2: ( restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )* )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:564:3: restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:568:2: ( restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )* )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:569:3: restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
             {
-            pushFollow(FOLLOW_restriction_in_and_restr_connective996);
+            pushFollow(FOLLOW_restriction_in_and_restr_connective1044);
             restriction(and,  ceBase,  fcBase,  declarations);
             _fsp--;
             if (failed) return ;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:565:3: ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
-            loop12:
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:570:3: ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
+            loop13:
             do {
-                int alt12=2;
-                int LA12_0 = input.LA(1);
+                int alt13=2;
+                int LA13_0 = input.LA(1);
 
-                if ( (LA12_0==AMPERSAND) ) {
-                    alt12=1;
+                if ( (LA13_0==AMPERSAND) ) {
+                    alt13=1;
                 }
 
 
-                switch (alt12) {
+                switch (alt13) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:565:5: AMPERSAND restriction[and, ceBase, fcBase, declarations]
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:570:5: AMPERSAND restriction[and, ceBase, fcBase, declarations]
             	    {
-            	    match(input,AMPERSAND,FOLLOW_AMPERSAND_in_and_restr_connective1004); if (failed) return ;
-            	    pushFollow(FOLLOW_restriction_in_and_restr_connective1006);
+            	    match(input,AMPERSAND,FOLLOW_AMPERSAND_in_and_restr_connective1052); if (failed) return ;
+            	    pushFollow(FOLLOW_restriction_in_and_restr_connective1054);
             	    restriction(and,  ceBase,  fcBase,  declarations);
             	    _fsp--;
             	    if (failed) return ;
@@ -1421,7 +1473,7 @@
             	    break;
 
             	default :
-            	    break loop12;
+            	    break loop13;
                 }
             } while (true);
 
@@ -1448,7 +1500,7 @@
 
 
     // $ANTLR start restriction
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:584:1: restriction[RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations ] : ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction ) ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:589:1: restriction[RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations ] : ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction ) ;
     public final void restriction(RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
         String lc = null;
 
@@ -1457,21 +1509,21 @@
         			String op = "==";
         	
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:588:2: ( ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:588:4: ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:593:2: ( ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:593:4: ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:588:4: ( TILDE )?
-            int alt13=2;
-            int LA13_0 = input.LA(1);
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:593:4: ( TILDE )?
+            int alt14=2;
+            int LA14_0 = input.LA(1);
 
-            if ( (LA13_0==TILDE) ) {
-                alt13=1;
+            if ( (LA14_0==TILDE) ) {
+                alt14=1;
             }
-            switch (alt13) {
+            switch (alt14) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:588:5: TILDE
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:593:5: TILDE
                     {
-                    match(input,TILDE,FOLLOW_TILDE_in_restriction1039); if (failed) return ;
+                    match(input,TILDE,FOLLOW_TILDE_in_restriction1087); if (failed) return ;
                     if ( backtracking==0 ) {
                       op = "!=";
                     }
@@ -1481,22 +1533,22 @@
 
             }
 
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:589:3: ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )
-            int alt14=4;
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:594:3: ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )
+            int alt15=4;
             switch ( input.LA(1) ) {
             case COLON:
                 {
-                alt14=1;
+                alt15=1;
                 }
                 break;
             case EQUALS:
                 {
-                alt14=2;
+                alt15=2;
                 }
                 break;
             case VAR:
                 {
-                alt14=3;
+                alt15=3;
                 }
                 break;
             case NAME:
@@ -1506,22 +1558,22 @@
             case BOOL:
             case NULL:
                 {
-                alt14=4;
+                alt15=4;
                 }
                 break;
             default:
                 if (backtracking>0) {failed=true; return ;}
                 NoViableAltException nvae =
-                    new NoViableAltException("589:3: ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )", 14, 0, input);
+                    new NoViableAltException("594:3: ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )", 15, 0, input);
 
                 throw nvae;
             }
 
-            switch (alt14) {
+            switch (alt15) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:589:5: predicate_constraint[rc, op, base]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:594:5: predicate_constraint[rc, op, base]
                     {
-                    pushFollow(FOLLOW_predicate_constraint_in_restriction1055);
+                    pushFollow(FOLLOW_predicate_constraint_in_restriction1103);
                     predicate_constraint(rc,  op,  base);
                     _fsp--;
                     if (failed) return ;
@@ -1529,9 +1581,9 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:590:7: return_value_restriction[op, rc]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:595:7: return_value_restriction[op, rc]
                     {
-                    pushFollow(FOLLOW_return_value_restriction_in_restriction1071);
+                    pushFollow(FOLLOW_return_value_restriction_in_restriction1119);
                     return_value_restriction(op,  rc);
                     _fsp--;
                     if (failed) return ;
@@ -1539,9 +1591,9 @@
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:591:7: variable_restriction[op, rc, base, fcBase, declarations]
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:596:7: variable_restriction[op, rc, base, fcBase, declarations]
                     {
-                    pushFollow(FOLLOW_variable_restriction_in_restriction1080);
+                    pushFollow(FOLLOW_variable_restriction_in_restriction1128);
                     variable_restriction(op,  rc,  base,  fcBase,  declarations);
                     _fsp--;
                     if (failed) return ;
@@ -1549,9 +1601,9 @@
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:592:8: lc= literal_restriction
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:597:8: lc= literal_restriction
                     {
-                    pushFollow(FOLLOW_literal_restriction_in_restriction1092);
+                    pushFollow(FOLLOW_literal_restriction_in_restriction1140);
                     lc=literal_restriction();
                     _fsp--;
                     if (failed) return ;
@@ -1583,17 +1635,17 @@
 
 
     // $ANTLR start predicate_constraint
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:599:1: predicate_constraint[RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base] : COLON t= lisp_form ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:604:1: predicate_constraint[RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base] : COLON t= lisp_form ;
     public final void predicate_constraint(RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base) throws RecognitionException {
         LispForm t = null;
 
 
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:600:2: ( COLON t= lisp_form )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:600:4: COLON t= lisp_form
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:605:2: ( COLON t= lisp_form )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:605:4: COLON t= lisp_form
             {
-            match(input,COLON,FOLLOW_COLON_in_predicate_constraint1125); if (failed) return ;
-            pushFollow(FOLLOW_lisp_form_in_predicate_constraint1131);
+            match(input,COLON,FOLLOW_COLON_in_predicate_constraint1173); if (failed) return ;
+            pushFollow(FOLLOW_lisp_form_in_predicate_constraint1179);
             t=lisp_form();
             _fsp--;
             if (failed) return ;
@@ -1616,17 +1668,17 @@
 
 
     // $ANTLR start return_value_restriction
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:606:1: return_value_restriction[String op, RestrictionConnectiveDescr rc] : EQUALS t= lisp_form ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:611:1: return_value_restriction[String op, RestrictionConnectiveDescr rc] : EQUALS t= lisp_form ;
     public final void return_value_restriction(String op, RestrictionConnectiveDescr rc) throws RecognitionException {
         LispForm t = null;
 
 
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:607:2: ( EQUALS t= lisp_form )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:607:4: EQUALS t= lisp_form
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:612:2: ( EQUALS t= lisp_form )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:612:4: EQUALS t= lisp_form
             {
-            match(input,EQUALS,FOLLOW_EQUALS_in_return_value_restriction1150); if (failed) return ;
-            pushFollow(FOLLOW_lisp_form_in_return_value_restriction1157);
+            match(input,EQUALS,FOLLOW_EQUALS_in_return_value_restriction1198); if (failed) return ;
+            pushFollow(FOLLOW_lisp_form_in_return_value_restriction1205);
             t=lisp_form();
             _fsp--;
             if (failed) return ;
@@ -1649,26 +1701,28 @@
 
 
     // $ANTLR start variable_restriction
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:612:1: variable_restriction[String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] : VAR ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:617:1: variable_restriction[String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] : VAR ;
     public final void variable_restriction(String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
         Token VAR1=null;
 
+         String identifier = null;
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:613:2: ( VAR )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:613:4: VAR
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:619:2: ( VAR )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:619:4: VAR
             {
             VAR1=(Token)input.LT(1);
-            match(input,VAR,FOLLOW_VAR_in_variable_restriction1176); if (failed) return ;
+            match(input,VAR,FOLLOW_VAR_in_variable_restriction1233); if (failed) return ;
             if ( backtracking==0 ) {
               
-              	        if ( declarations.contains( VAR1.getText() ) ) {
-              				rc.addRestriction( new VariableRestrictionDescr(op, VAR1.getText()) );
+              	        identifier =  VAR1.getText().replace( '?', '$');
+              	        if ( declarations.contains( identifier) ) {
+              				rc.addRestriction( new VariableRestrictionDescr(op, identifier ) );
               		 	} else {
               		 		FieldBindingDescr fbd = new FieldBindingDescr();
-              		 		fbd.setIdentifier( VAR1.getText() );		
+              		 		fbd.setIdentifier( identifier );		
               		 		fbd.setFieldName( fcBase.getFieldName() ); 		
               		 		ceBase.insertBeforeLast( FieldConstraintDescr.class, fbd );
-              		 		declarations.add( VAR1.getText() );
+              		 		declarations.add( identifier );
               		 	}
               		
             }
@@ -1688,7 +1742,7 @@
 
 
     // $ANTLR start literal_restriction
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:627:1: literal_restriction returns [String text] : t= literal ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:634:1: literal_restriction returns [String text] : t= literal ;
     public final String literal_restriction() throws RecognitionException {
         String text = null;
 
@@ -1699,10 +1753,10 @@
         		text = null;
         	
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:631:2: (t= literal )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:632:6: t= literal
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:638:2: (t= literal )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:639:6: t= literal
             {
-            pushFollow(FOLLOW_literal_in_literal_restriction1209);
+            pushFollow(FOLLOW_literal_in_literal_restriction1266);
             t=literal();
             _fsp--;
             if (failed) return text;
@@ -1727,7 +1781,7 @@
 
 
     // $ANTLR start lisp_form
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:649:1: lisp_form returns [LispForm lispForm] : LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:656:1: lisp_form returns [LispForm lispForm] : LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN ;
     public final LispForm lisp_form() throws RecognitionException {
         LispForm lispForm = null;
 
@@ -1742,33 +1796,33 @@
                 lispForm = null;
             
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:654:2: ( LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:654:4: LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:661:2: ( LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:661:4: LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN
             {
-            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lisp_form1237); if (failed) return lispForm;
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:656:3: (t= NAME | t= VAR )
-            int alt15=2;
-            int LA15_0 = input.LA(1);
+            match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lisp_form1294); if (failed) return lispForm;
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:663:3: (t= NAME | t= VAR )
+            int alt16=2;
+            int LA16_0 = input.LA(1);
 
-            if ( (LA15_0==NAME) ) {
-                alt15=1;
+            if ( (LA16_0==NAME) ) {
+                alt16=1;
             }
-            else if ( (LA15_0==VAR) ) {
-                alt15=2;
+            else if ( (LA16_0==VAR) ) {
+                alt16=2;
             }
             else {
                 if (backtracking>0) {failed=true; return lispForm;}
                 NoViableAltException nvae =
-                    new NoViableAltException("656:3: (t= NAME | t= VAR )", 15, 0, input);
+                    new NoViableAltException("663:3: (t= NAME | t= VAR )", 16, 0, input);
 
                 throw nvae;
             }
-            switch (alt15) {
+            switch (alt16) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:657:7: t= NAME
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:664:7: t= NAME
                     {
                     t=(Token)input.LT(1);
-                    match(input,NAME,FOLLOW_NAME_in_lisp_form1254); if (failed) return lispForm;
+                    match(input,NAME,FOLLOW_NAME_in_lisp_form1311); if (failed) return lispForm;
                     if ( backtracking==0 ) {
                        list.add( new SymbolLispAtom( t.getText() ) ); 
                     }
@@ -1776,12 +1830,12 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:659:7: t= VAR
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:666:7: t= VAR
                     {
                     t=(Token)input.LT(1);
-                    match(input,VAR,FOLLOW_VAR_in_lisp_form1274); if (failed) return lispForm;
+                    match(input,VAR,FOLLOW_VAR_in_lisp_form1331); if (failed) return lispForm;
                     if ( backtracking==0 ) {
-                       list.add( new VariableLispAtom( t.getText(), context ) ); 
+                       list.add( new VariableLispAtom( t.getText() ) ); 
                     }
 
                     }
@@ -1789,25 +1843,25 @@
 
             }
 
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:661:3: (a= lisp_atom | l= lisp_form )*
-            loop16:
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:668:3: (a= lisp_atom | l= lisp_form )*
+            loop17:
             do {
-                int alt16=3;
-                int LA16_0 = input.LA(1);
+                int alt17=3;
+                int LA17_0 = input.LA(1);
 
-                if ( (LA16_0==NAME||LA16_0==STRING||LA16_0==INT||LA16_0==VAR||(LA16_0>=FLOAT && LA16_0<=NULL)) ) {
-                    alt16=1;
+                if ( (LA17_0==NAME||LA17_0==STRING||LA17_0==INT||LA17_0==VAR||(LA17_0>=FLOAT && LA17_0<=NULL)) ) {
+                    alt17=1;
                 }
-                else if ( (LA16_0==LEFT_PAREN) ) {
-                    alt16=2;
+                else if ( (LA17_0==LEFT_PAREN) ) {
+                    alt17=2;
                 }
 
 
-                switch (alt16) {
+                switch (alt17) {
             	case 1 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:661:6: a= lisp_atom
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:668:6: a= lisp_atom
             	    {
-            	    pushFollow(FOLLOW_lisp_atom_in_lisp_form1297);
+            	    pushFollow(FOLLOW_lisp_atom_in_lisp_form1354);
             	    a=lisp_atom();
             	    _fsp--;
             	    if (failed) return lispForm;
@@ -1818,9 +1872,9 @@
             	    }
             	    break;
             	case 2 :
-            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:662:6: l= lisp_form
+            	    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:669:6: l= lisp_form
             	    {
-            	    pushFollow(FOLLOW_lisp_form_in_lisp_form1308);
+            	    pushFollow(FOLLOW_lisp_form_in_lisp_form1365);
             	    l=lisp_form();
             	    _fsp--;
             	    if (failed) return lispForm;
@@ -1832,11 +1886,11 @@
             	    break;
 
             	default :
-            	    break loop16;
+            	    break loop17;
                 }
             } while (true);
 
-            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lisp_form1335); if (failed) return lispForm;
+            match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lisp_form1392); if (failed) return lispForm;
             if ( backtracking==0 ) {
                lispForm = new LispForm( ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ) ); 
             }
@@ -1856,7 +1910,7 @@
 
 
     // $ANTLR start lisp_atom
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:668:1: lisp_atom returns [SExpression sExpression] : (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME ) ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:675:1: lisp_atom returns [SExpression sExpression] : (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME ) ;
     public final SExpression lisp_atom() throws RecognitionException {
         SExpression sExpression = null;
 
@@ -1866,72 +1920,72 @@
         		sExpression  =  null;		
         	
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:672:2: ( (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:673:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:679:2: ( (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:680:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:673:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )
-            int alt17=7;
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:680:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )
+            int alt18=7;
             switch ( input.LA(1) ) {
             case VAR:
                 {
-                alt17=1;
+                alt18=1;
                 }
                 break;
             case STRING:
                 {
-                alt17=2;
+                alt18=2;
                 }
                 break;
             case FLOAT:
                 {
-                alt17=3;
+                alt18=3;
                 }
                 break;
             case INT:
                 {
-                alt17=4;
+                alt18=4;
                 }
                 break;
             case BOOL:
                 {
-                alt17=5;
+                alt18=5;
                 }
                 break;
             case NULL:
                 {
-                alt17=6;
+                alt18=6;
                 }
                 break;
             case NAME:
                 {
-                alt17=7;
+                alt18=7;
                 }
                 break;
             default:
                 if (backtracking>0) {failed=true; return sExpression;}
                 NoViableAltException nvae =
-                    new NoViableAltException("673:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )", 17, 0, input);
+                    new NoViableAltException("680:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )", 18, 0, input);
 
                 throw nvae;
             }
 
-            switch (alt17) {
+            switch (alt18) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:674:6: t= VAR
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:681:6: t= VAR
                     {
                     t=(Token)input.LT(1);
-                    match(input,VAR,FOLLOW_VAR_in_lisp_atom1379); if (failed) return sExpression;
+                    match(input,VAR,FOLLOW_VAR_in_lisp_atom1436); if (failed) return sExpression;
                     if ( backtracking==0 ) {
-                       sExpression = new VariableLispAtom( t.getText(), context ); 
+                       sExpression = new VariableLispAtom( t.getText() ); 
                     }
 
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:675:6: t= STRING
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:682:6: t= STRING
                     {
                     t=(Token)input.LT(1);
-                    match(input,STRING,FOLLOW_STRING_in_lisp_atom1391); if (failed) return sExpression;
+                    match(input,STRING,FOLLOW_STRING_in_lisp_atom1448); if (failed) return sExpression;
                     if ( backtracking==0 ) {
                        sExpression = new StringLispAtom( getString( t ) ); 
                     }
@@ -1939,10 +1993,10 @@
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:676:6: t= FLOAT
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:683:6: t= FLOAT
                     {
                     t=(Token)input.LT(1);
-                    match(input,FLOAT,FOLLOW_FLOAT_in_lisp_atom1413); if (failed) return sExpression;
+                    match(input,FLOAT,FOLLOW_FLOAT_in_lisp_atom1470); if (failed) return sExpression;
                     if ( backtracking==0 ) {
                        sExpression = new FloatLispAtom( t.getText() ); 
                     }
@@ -1950,10 +2004,10 @@
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:677:6: t= INT
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:684:6: t= INT
                     {
                     t=(Token)input.LT(1);
-                    match(input,INT,FOLLOW_INT_in_lisp_atom1425); if (failed) return sExpression;
+                    match(input,INT,FOLLOW_INT_in_lisp_atom1482); if (failed) return sExpression;
                     if ( backtracking==0 ) {
                        sExpression = new IntLispAtom( t.getText() ); 
                     }
@@ -1961,10 +2015,10 @@
                     }
                     break;
                 case 5 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:678:7: t= BOOL
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:685:7: t= BOOL
                     {
                     t=(Token)input.LT(1);
-                    match(input,BOOL,FOLLOW_BOOL_in_lisp_atom1438); if (failed) return sExpression;
+                    match(input,BOOL,FOLLOW_BOOL_in_lisp_atom1495); if (failed) return sExpression;
                     if ( backtracking==0 ) {
                        sExpression = new BoolLispAtom( t.getText() ); 
                     }
@@ -1972,10 +2026,10 @@
                     }
                     break;
                 case 6 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:679:7: t= NULL
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:686:7: t= NULL
                     {
                     t=(Token)input.LT(1);
-                    match(input,NULL,FOLLOW_NULL_in_lisp_atom1454); if (failed) return sExpression;
+                    match(input,NULL,FOLLOW_NULL_in_lisp_atom1511); if (failed) return sExpression;
                     if ( backtracking==0 ) {
                        sExpression = new NullLispAtom( null ); 
                     }
@@ -1983,10 +2037,10 @@
                     }
                     break;
                 case 7 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:680:14: t= NAME
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:687:14: t= NAME
                     {
                     t=(Token)input.LT(1);
-                    match(input,NAME,FOLLOW_NAME_in_lisp_atom1480); if (failed) return sExpression;
+                    match(input,NAME,FOLLOW_NAME_in_lisp_atom1537); if (failed) return sExpression;
                     if ( backtracking==0 ) {
                        sExpression = new SymbolLispAtom( "\"" +t.getText() + "\""); 
                     }
@@ -2012,7 +2066,7 @@
 
 
     // $ANTLR start literal
-    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:685:1: literal returns [String text] : (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
+    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:692:1: literal returns [String text] : (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
     public final String literal() throws RecognitionException {
         String text = null;
 
@@ -2022,56 +2076,56 @@
         		text = null;
         	
         try {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:689:2: ( (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:689:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:696:2: ( (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:696:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
             {
-            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:689:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
-            int alt18=6;
+            // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:696:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
+            int alt19=6;
             switch ( input.LA(1) ) {
             case STRING:
                 {
-                alt18=1;
+                alt19=1;
                 }
                 break;
             case NAME:
                 {
-                alt18=2;
+                alt19=2;
                 }
                 break;
             case INT:
                 {
-                alt18=3;
+                alt19=3;
                 }
                 break;
             case FLOAT:
                 {
-                alt18=4;
+                alt19=4;
                 }
                 break;
             case BOOL:
                 {
-                alt18=5;
+                alt19=5;
                 }
                 break;
             case NULL:
                 {
-                alt18=6;
+                alt19=6;
                 }
                 break;
             default:
                 if (backtracking>0) {failed=true; return text;}
                 NoViableAltException nvae =
-                    new NoViableAltException("689:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )", 18, 0, input);
+                    new NoViableAltException("696:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )", 19, 0, input);
 
                 throw nvae;
             }
 
-            switch (alt18) {
+            switch (alt19) {
                 case 1 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:689:8: t= STRING
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:696:8: t= STRING
                     {
                     t=(Token)input.LT(1);
-                    match(input,STRING,FOLLOW_STRING_in_literal1524); if (failed) return text;
+                    match(input,STRING,FOLLOW_STRING_in_literal1581); if (failed) return text;
                     if ( backtracking==0 ) {
                        text = getString( t ); 
                     }
@@ -2079,10 +2133,10 @@
                     }
                     break;
                 case 2 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:690:7: t= NAME
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:697:7: t= NAME
                     {
                     t=(Token)input.LT(1);
-                    match(input,NAME,FOLLOW_NAME_in_literal1537); if (failed) return text;
+                    match(input,NAME,FOLLOW_NAME_in_literal1594); if (failed) return text;
                     if ( backtracking==0 ) {
                        text = t.getText(); 
                     }
@@ -2090,10 +2144,10 @@
                     }
                     break;
                 case 3 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:691:7: t= INT
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:7: t= INT
                     {
                     t=(Token)input.LT(1);
-                    match(input,INT,FOLLOW_INT_in_literal1553); if (failed) return text;
+                    match(input,INT,FOLLOW_INT_in_literal1610); if (failed) return text;
                     if ( backtracking==0 ) {
                        text = t.getText(); 
                     }
@@ -2101,10 +2155,10 @@
                     }
                     break;
                 case 4 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:692:7: t= FLOAT
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:699:7: t= FLOAT
                     {
                     t=(Token)input.LT(1);
-                    match(input,FLOAT,FOLLOW_FLOAT_in_literal1568); if (failed) return text;
+                    match(input,FLOAT,FOLLOW_FLOAT_in_literal1625); if (failed) return text;
                     if ( backtracking==0 ) {
                        text = t.getText(); 
                     }
@@ -2112,10 +2166,10 @@
                     }
                     break;
                 case 5 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:693:7: t= BOOL
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:700:7: t= BOOL
                     {
                     t=(Token)input.LT(1);
-                    match(input,BOOL,FOLLOW_BOOL_in_literal1581); if (failed) return text;
+                    match(input,BOOL,FOLLOW_BOOL_in_literal1638); if (failed) return text;
                     if ( backtracking==0 ) {
                        text = t.getText(); 
                     }
@@ -2123,10 +2177,10 @@
                     }
                     break;
                 case 6 :
-                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:694:7: t= NULL
+                    // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:701:7: t= NULL
                     {
                     t=(Token)input.LT(1);
-                    match(input,NULL,FOLLOW_NULL_in_literal1595); if (failed) return text;
+                    match(input,NULL,FOLLOW_NULL_in_literal1652); if (failed) return text;
                     if ( backtracking==0 ) {
                        text = null; 
                     }
@@ -2153,113 +2207,114 @@
 
  
 
-    public static final BitSet FOLLOW_importDescr_in_eval60 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_deffunction_in_eval71 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_defrule_in_eval84 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_lisp_form_in_eval96 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_importDescr123 = new BitSet(new long[]{0x0000100000000000L});
-    public static final BitSet FOLLOW_44_in_importDescr125 = new BitSet(new long[]{0x0000000000000020L});
-    public static final BitSet FOLLOW_NAME_in_importDescr129 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_importDescr133 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_deffunction168 = new BitSet(new long[]{0x0000000000000080L});
-    public static final BitSet FOLLOW_DEFFUNCTION_in_deffunction178 = new BitSet(new long[]{0x0000000007020A20L});
-    public static final BitSet FOLLOW_lisp_atom_in_deffunction188 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_lisp_form_in_deffunction198 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_lisp_form_in_deffunction207 = new BitSet(new long[]{0x0000000000000050L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_deffunction229 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_defrule266 = new BitSet(new long[]{0x0000000000000100L});
-    public static final BitSet FOLLOW_DEFRULE_in_defrule274 = new BitSet(new long[]{0x0000000000000020L});
-    public static final BitSet FOLLOW_NAME_in_defrule278 = new BitSet(new long[]{0x0000000000000200L});
-    public static final BitSet FOLLOW_STRING_in_defrule290 = new BitSet(new long[]{0x0000200000020010L});
-    public static final BitSet FOLLOW_ruleAttribute_in_defrule296 = new BitSet(new long[]{0x0000200000020010L});
-    public static final BitSet FOLLOW_ce_in_defrule304 = new BitSet(new long[]{0x0000200000020010L});
-    public static final BitSet FOLLOW_45_in_defrule313 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_lisp_form_in_defrule322 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_importDescr_in_eval60 = new BitSet(new long[]{0x0000000000000012L});
+    public static final BitSet FOLLOW_deffunction_in_eval71 = new BitSet(new long[]{0x0000000000000012L});
+    public static final BitSet FOLLOW_defrule_in_eval84 = new BitSet(new long[]{0x0000000000000012L});
+    public static final BitSet FOLLOW_lisp_form_in_eval96 = new BitSet(new long[]{0x0000000000000012L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_importDescr124 = new BitSet(new long[]{0x0000100000000000L});
+    public static final BitSet FOLLOW_44_in_importDescr126 = new BitSet(new long[]{0x0000000000000020L});
+    public static final BitSet FOLLOW_NAME_in_importDescr130 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_importDescr134 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_deffunction169 = new BitSet(new long[]{0x0000000000000080L});
+    public static final BitSet FOLLOW_DEFFUNCTION_in_deffunction179 = new BitSet(new long[]{0x0000000007020A20L});
+    public static final BitSet FOLLOW_lisp_atom_in_deffunction189 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_lisp_form_in_deffunction199 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_lisp_form_in_deffunction208 = new BitSet(new long[]{0x0000000000000050L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_deffunction230 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_defrule267 = new BitSet(new long[]{0x0000000000000100L});
+    public static final BitSet FOLLOW_DEFRULE_in_defrule275 = new BitSet(new long[]{0x0000000000000020L});
+    public static final BitSet FOLLOW_NAME_in_defrule279 = new BitSet(new long[]{0x0000000000000200L});
+    public static final BitSet FOLLOW_STRING_in_defrule291 = new BitSet(new long[]{0x0000200000020010L});
+    public static final BitSet FOLLOW_ruleAttribute_in_defrule297 = new BitSet(new long[]{0x0000200000020010L});
+    public static final BitSet FOLLOW_ce_in_defrule305 = new BitSet(new long[]{0x0000200000020010L});
+    public static final BitSet FOLLOW_45_in_defrule314 = new BitSet(new long[]{0x0000000000000050L});
+    public static final BitSet FOLLOW_rule_consequence_in_defrule323 = new BitSet(new long[]{0x0000000000000040L});
     public static final BitSet FOLLOW_RIGHT_PAREN_in_defrule331 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute348 = new BitSet(new long[]{0x0000000020000000L});
-    public static final BitSet FOLLOW_DECLARE_in_ruleAttribute350 = new BitSet(new long[]{0x0000000000000050L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute357 = new BitSet(new long[]{0x0000000000000400L});
-    public static final BitSet FOLLOW_salience_in_ruleAttribute361 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute365 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute372 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_SALIENCE_in_salience402 = new BitSet(new long[]{0x0000000000000800L});
-    public static final BitSet FOLLOW_INT_in_salience406 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_and_ce_in_ce432 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_or_ce_in_ce442 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_not_ce_in_ce451 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_exists_ce_in_ce460 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_eval_ce_in_ce474 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_normal_pattern_in_ce488 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_bound_pattern_in_ce497 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_and_ce524 = new BitSet(new long[]{0x0000000000001000L});
-    public static final BitSet FOLLOW_AND_in_and_ce529 = new BitSet(new long[]{0x0000000000020010L});
-    public static final BitSet FOLLOW_ce_in_and_ce535 = new BitSet(new long[]{0x0000000000020050L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_and_ce544 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_or_ce572 = new BitSet(new long[]{0x0000000000002000L});
-    public static final BitSet FOLLOW_OR_in_or_ce577 = new BitSet(new long[]{0x0000000000020010L});
-    public static final BitSet FOLLOW_ce_in_or_ce583 = new BitSet(new long[]{0x0000000000020050L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_or_ce592 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_not_ce620 = new BitSet(new long[]{0x0000000000004000L});
-    public static final BitSet FOLLOW_NOT_in_not_ce625 = new BitSet(new long[]{0x0000000000020010L});
-    public static final BitSet FOLLOW_ce_in_not_ce631 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_not_ce639 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_exists_ce668 = new BitSet(new long[]{0x0000000000008000L});
-    public static final BitSet FOLLOW_EXISTS_in_exists_ce673 = new BitSet(new long[]{0x0000000000020010L});
-    public static final BitSet FOLLOW_ce_in_exists_ce679 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_exists_ce687 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce706 = new BitSet(new long[]{0x0000000000010000L});
-    public static final BitSet FOLLOW_TEST_in_eval_ce711 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_lisp_form_in_eval_ce718 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce728 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_normal_pattern756 = new BitSet(new long[]{0x0000000000000020L});
-    public static final BitSet FOLLOW_NAME_in_normal_pattern763 = new BitSet(new long[]{0x0000000000000050L});
-    public static final BitSet FOLLOW_field_constriant_in_normal_pattern769 = new BitSet(new long[]{0x0000000000000050L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_normal_pattern779 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_VAR_in_bound_pattern807 = new BitSet(new long[]{0x0000000000040000L});
-    public static final BitSet FOLLOW_ASSIGN_OP_in_bound_pattern813 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_bound_pattern815 = new BitSet(new long[]{0x0000000000000020L});
-    public static final BitSet FOLLOW_NAME_in_bound_pattern819 = new BitSet(new long[]{0x0000000000000050L});
-    public static final BitSet FOLLOW_field_constriant_in_bound_pattern828 = new BitSet(new long[]{0x0000000000000050L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_bound_pattern835 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_field_constriant866 = new BitSet(new long[]{0x0000000000000020L});
-    public static final BitSet FOLLOW_NAME_in_field_constriant870 = new BitSet(new long[]{0x0000000007E20A20L});
-    public static final BitSet FOLLOW_or_restr_connective_in_field_constriant885 = new BitSet(new long[]{0x0000000000000040L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_field_constriant891 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective930 = new BitSet(new long[]{0x0000000000080002L});
-    public static final BitSet FOLLOW_PIPE_in_or_restr_connective954 = new BitSet(new long[]{0x0000000007E20A20L});
-    public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective964 = new BitSet(new long[]{0x0000000000080002L});
-    public static final BitSet FOLLOW_restriction_in_and_restr_connective996 = new BitSet(new long[]{0x0000000000100002L});
-    public static final BitSet FOLLOW_AMPERSAND_in_and_restr_connective1004 = new BitSet(new long[]{0x0000000007E20A20L});
-    public static final BitSet FOLLOW_restriction_in_and_restr_connective1006 = new BitSet(new long[]{0x0000000000100002L});
-    public static final BitSet FOLLOW_TILDE_in_restriction1039 = new BitSet(new long[]{0x0000000007C20A20L});
-    public static final BitSet FOLLOW_predicate_constraint_in_restriction1055 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_return_value_restriction_in_restriction1071 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_variable_restriction_in_restriction1080 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_literal_restriction_in_restriction1092 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_COLON_in_predicate_constraint1125 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_lisp_form_in_predicate_constraint1131 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_EQUALS_in_return_value_restriction1150 = new BitSet(new long[]{0x0000000000000010L});
-    public static final BitSet FOLLOW_lisp_form_in_return_value_restriction1157 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_VAR_in_variable_restriction1176 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_literal_in_literal_restriction1209 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LEFT_PAREN_in_lisp_form1237 = new BitSet(new long[]{0x0000000000020020L});
-    public static final BitSet FOLLOW_NAME_in_lisp_form1254 = new BitSet(new long[]{0x0000000007020A70L});
-    public static final BitSet FOLLOW_VAR_in_lisp_form1274 = new BitSet(new long[]{0x0000000007020A70L});
-    public static final BitSet FOLLOW_lisp_atom_in_lisp_form1297 = new BitSet(new long[]{0x0000000007020A70L});
-    public static final BitSet FOLLOW_lisp_form_in_lisp_form1308 = new BitSet(new long[]{0x0000000007020A70L});
-    public static final BitSet FOLLOW_RIGHT_PAREN_in_lisp_form1335 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_VAR_in_lisp_atom1379 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_STRING_in_lisp_atom1391 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_FLOAT_in_lisp_atom1413 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_INT_in_lisp_atom1425 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_BOOL_in_lisp_atom1438 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NULL_in_lisp_atom1454 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NAME_in_lisp_atom1480 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_STRING_in_literal1524 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NAME_in_literal1537 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_INT_in_literal1553 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_FLOAT_in_literal1568 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_BOOL_in_literal1581 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NULL_in_literal1595 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_lisp_form_in_rule_consequence363 = new BitSet(new long[]{0x0000000000000012L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute396 = new BitSet(new long[]{0x0000000020000000L});
+    public static final BitSet FOLLOW_DECLARE_in_ruleAttribute398 = new BitSet(new long[]{0x0000000000000050L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute405 = new BitSet(new long[]{0x0000000000000400L});
+    public static final BitSet FOLLOW_salience_in_ruleAttribute409 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute413 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute420 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_SALIENCE_in_salience450 = new BitSet(new long[]{0x0000000000000800L});
+    public static final BitSet FOLLOW_INT_in_salience454 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_and_ce_in_ce480 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_or_ce_in_ce490 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_not_ce_in_ce499 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_exists_ce_in_ce508 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_eval_ce_in_ce522 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_normal_pattern_in_ce536 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_bound_pattern_in_ce545 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_and_ce572 = new BitSet(new long[]{0x0000000000001000L});
+    public static final BitSet FOLLOW_AND_in_and_ce577 = new BitSet(new long[]{0x0000000000020010L});
+    public static final BitSet FOLLOW_ce_in_and_ce583 = new BitSet(new long[]{0x0000000000020050L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_and_ce592 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_or_ce620 = new BitSet(new long[]{0x0000000000002000L});
+    public static final BitSet FOLLOW_OR_in_or_ce625 = new BitSet(new long[]{0x0000000000020010L});
+    public static final BitSet FOLLOW_ce_in_or_ce631 = new BitSet(new long[]{0x0000000000020050L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_or_ce640 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_not_ce668 = new BitSet(new long[]{0x0000000000004000L});
+    public static final BitSet FOLLOW_NOT_in_not_ce673 = new BitSet(new long[]{0x0000000000020010L});
+    public static final BitSet FOLLOW_ce_in_not_ce679 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_not_ce687 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_exists_ce716 = new BitSet(new long[]{0x0000000000008000L});
+    public static final BitSet FOLLOW_EXISTS_in_exists_ce721 = new BitSet(new long[]{0x0000000000020010L});
+    public static final BitSet FOLLOW_ce_in_exists_ce727 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_exists_ce735 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce754 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_TEST_in_eval_ce759 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_lisp_form_in_eval_ce766 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce776 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_normal_pattern804 = new BitSet(new long[]{0x0000000000000020L});
+    public static final BitSet FOLLOW_NAME_in_normal_pattern811 = new BitSet(new long[]{0x0000000000000050L});
+    public static final BitSet FOLLOW_field_constriant_in_normal_pattern817 = new BitSet(new long[]{0x0000000000000050L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_normal_pattern827 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_VAR_in_bound_pattern855 = new BitSet(new long[]{0x0000000000040000L});
+    public static final BitSet FOLLOW_ASSIGN_OP_in_bound_pattern861 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_bound_pattern863 = new BitSet(new long[]{0x0000000000000020L});
+    public static final BitSet FOLLOW_NAME_in_bound_pattern867 = new BitSet(new long[]{0x0000000000000050L});
+    public static final BitSet FOLLOW_field_constriant_in_bound_pattern876 = new BitSet(new long[]{0x0000000000000050L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_bound_pattern883 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_field_constriant914 = new BitSet(new long[]{0x0000000000000020L});
+    public static final BitSet FOLLOW_NAME_in_field_constriant918 = new BitSet(new long[]{0x0000000007E20A20L});
+    public static final BitSet FOLLOW_or_restr_connective_in_field_constriant933 = new BitSet(new long[]{0x0000000000000040L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_field_constriant939 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective978 = new BitSet(new long[]{0x0000000000080002L});
+    public static final BitSet FOLLOW_PIPE_in_or_restr_connective1002 = new BitSet(new long[]{0x0000000007E20A20L});
+    public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective1012 = new BitSet(new long[]{0x0000000000080002L});
+    public static final BitSet FOLLOW_restriction_in_and_restr_connective1044 = new BitSet(new long[]{0x0000000000100002L});
+    public static final BitSet FOLLOW_AMPERSAND_in_and_restr_connective1052 = new BitSet(new long[]{0x0000000007E20A20L});
+    public static final BitSet FOLLOW_restriction_in_and_restr_connective1054 = new BitSet(new long[]{0x0000000000100002L});
+    public static final BitSet FOLLOW_TILDE_in_restriction1087 = new BitSet(new long[]{0x0000000007C20A20L});
+    public static final BitSet FOLLOW_predicate_constraint_in_restriction1103 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_return_value_restriction_in_restriction1119 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_variable_restriction_in_restriction1128 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_literal_restriction_in_restriction1140 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_COLON_in_predicate_constraint1173 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_lisp_form_in_predicate_constraint1179 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_EQUALS_in_return_value_restriction1198 = new BitSet(new long[]{0x0000000000000010L});
+    public static final BitSet FOLLOW_lisp_form_in_return_value_restriction1205 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_VAR_in_variable_restriction1233 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_literal_in_literal_restriction1266 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_LEFT_PAREN_in_lisp_form1294 = new BitSet(new long[]{0x0000000000020020L});
+    public static final BitSet FOLLOW_NAME_in_lisp_form1311 = new BitSet(new long[]{0x0000000007020A70L});
+    public static final BitSet FOLLOW_VAR_in_lisp_form1331 = new BitSet(new long[]{0x0000000007020A70L});
+    public static final BitSet FOLLOW_lisp_atom_in_lisp_form1354 = new BitSet(new long[]{0x0000000007020A70L});
+    public static final BitSet FOLLOW_lisp_form_in_lisp_form1365 = new BitSet(new long[]{0x0000000007020A70L});
+    public static final BitSet FOLLOW_RIGHT_PAREN_in_lisp_form1392 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_VAR_in_lisp_atom1436 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_STRING_in_lisp_atom1448 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FLOAT_in_lisp_atom1470 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_INT_in_lisp_atom1482 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_BOOL_in_lisp_atom1495 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NULL_in_lisp_atom1511 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NAME_in_lisp_atom1537 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_STRING_in_literal1581 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NAME_in_literal1594 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_INT_in_literal1610 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_FLOAT_in_literal1625 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_BOOL_in_literal1638 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_NULL_in_literal1652 = new BitSet(new long[]{0x0000000000000002L});
 
 }
\ No newline at end of file

Deleted: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CreateListFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CreateListFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CreateListFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,25 +0,0 @@
-package org.drools.clips;
-
-public class CreateListFunction implements Function {
-    private static final String name = "create$";
-
-    public String getName() {
-        return name;
-    }
-    
-    public void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context) {
-        SExpression[] sExpressions = lispForm.getSExpressions();
-        
-        appendable.append("[");
-        
-        for ( int i = 1, length = sExpressions.length; i < length; i++) {
-            
-            FunctionHandlers.dump( sExpressions[i], appendable, context );        
-            
-            if ( i != length -1 ) { 
-                appendable.append( "," );
-            }
-        }
-        appendable.append("]");
-    }
-}

Deleted: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/EqFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/EqFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/EqFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,16 +0,0 @@
-package org.drools.clips;
-
-import org.drools.clips.functions.BaseInfixFunction;
-
-public class EqFunction  extends BaseInfixFunction  {
-    private static final String name = "eq";
-    private static final String mappedSymbol = "==";
-        
-    public String getName() {
-        return name;
-    }
-
-    public String getMappedSymbol() {
-        return mappedSymbol;
-    }
-}

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Function.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Function.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Function.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -4,6 +4,6 @@
 
     public abstract String getName();
 
-    public abstract void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context);
+    public abstract void dump(LispForm lispForm, Appendable appendable);
 
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/FunctionHandlers.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/FunctionHandlers.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/FunctionHandlers.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -27,7 +27,7 @@
         this.map.put( function.getName(), function );
     }
     
-    public static void dump(SExpression sExpression, Appendable appendable, MVELBuildContext context) {              
+    public static void dump(SExpression sExpression, Appendable appendable) {              
         if ( sExpression instanceof LispAtom ) {
             appendable.append( ( ( LispAtom ) sExpression).getValue() );
         } else {
@@ -35,12 +35,16 @@
             String functionName =  ( (LispAtom) form.getSExpressions()[0]).getValue();
             Function function = FunctionHandlers.getInstance().getFunction( functionName );
             if ( function != null ) {
-                function.dump(form, appendable, context );                
+                function.dump(form, appendable );                
+            } else if ( form.getSExpressions()[0] instanceof VariableLispAtom ){
+                // try and execute this as a java call
+                function = FunctionHandlers.getInstance().getFunction( "call" );
+                function.dump(form, appendable );                
             } else {
                 // execute as user function
                 appendable.append( functionName + "(" );
                 for ( int i = 1, length = form.getSExpressions().length; i < length; i++ ) {
-                    dump( form.getSExpressions()[i], appendable, context );
+                    dump( form.getSExpressions()[i], appendable );
                     if ( i < length -1 ) {
                         appendable.append( ", " );
                     }

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/LispForm.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/LispForm.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/LispForm.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -36,8 +36,11 @@
         StringBuilder builder = new StringBuilder();
         
         builder.append("(");
-        for ( SExpression sExpression : sExpressions) {
-            builder.append(" " + sExpression + " ");
+        for ( int i = 0, length = sExpressions.length; i < length; i++ ) {
+            builder.append(sExpressions[i]);
+            if ( i < length - 1 ) {
+                builder.append( " " );
+            }
         }
         builder.append(")");
         return builder.toString();

Deleted: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/MVELBuildContext.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/MVELBuildContext.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/MVELBuildContext.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,9 +0,0 @@
-package org.drools.clips;
-
-import java.util.Map;
-
-public interface MVELBuildContext {
-    Map<String, String> getVariableNameMap();
-    
-    String makeValid(String var);
-}

Deleted: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/OldShell.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/OldShell.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/OldShell.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,282 +0,0 @@
-package org.drools.clips;
-
-import java.io.PrintStream;
-import java.io.Reader;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.antlr.runtime.ANTLRReaderStream;
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CharStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.Lexer;
-import org.antlr.runtime.TokenStream;
-import org.drools.RuleBase;
-import org.drools.RuleBaseFactory;
-import org.drools.StatefulSession;
-import org.drools.clips.valuehandlers.FunctionCaller;
-import org.drools.clips.valuehandlers.IndexedLocalVariableValue;
-import org.drools.clips.valuehandlers.TempTokenVariable;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.compiler.PackageBuilder;
-import org.drools.lang.DRLLexer;
-import org.drools.lang.descr.AttributeDescr;
-import org.drools.lang.descr.ImportDescr;
-import org.drools.lang.descr.PackageDescr;
-import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
-import org.drools.spi.GlobalResolver;
-
-public class OldShell
-    implements
-    ParserHandler,
-    //GlobalResolver,
-    BuildContext,
-    ExecutionContext {
-    private static final long serialVersionUID = 1L;
-    private XFunctionRegistry registry;
-
-    private ValueHandler[]   variables;
-    private Map              vars       = new HashMap();
-
-    private Map              properties = Collections.EMPTY_MAP;
-
-    private RuleBase         ruleBase;
-    private StatefulSession  session;
-
-    private Map              printoutRouters;
-    
-    private Set              imports;
-    
-    private int              index;
-
-    public OldShell() {
-        this.ruleBase = RuleBaseFactory.newRuleBase();
-        this.session = this.ruleBase.newStatefulSession();
-        //this.session.setGlobalResolver( this );
-        this.variables = new ValueHandler[50];
-        
-        this.imports = new HashSet();
-
-        this.registry = new XFunctionRegistry( BuiltinFunctions.getInstance() );
-    }
-
-    public void evalReader(Reader reader) {
-        try {
-            CLPParser parser = new CLPParser( new CommonTokenStream( new DRLLexer( new ANTLRReaderStream( reader ) ) ) );
-            evalParser( parser );
-        } catch ( Exception e ) {
-            throw new RuntimeException( "Unable to parser Reader",
-                                        e );
-        }
-    }
-
-    public void evalString(String text) {
-        CLPParser parser = new CLPParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
-        evalParser( parser );
-    }
-
-    private void evalParser(CLPParser parser) {
-        parser.setFunctionRegistry( this.registry );
-        try {
-            parser.eval_script( this );
-        } catch ( Exception e ) {
-            throw new RuntimeException( e );
-        }
-        
-        //parser.setF
-    }
-
-    //    public void functionHandler(FunctionDescr ruleDescr) {
-    //        throw new RuntimeException( "Drools Clips does not support FunctionDescr" );
-    //    }    
-
-    //    public void functionHandler(FunctionCaller functionCaller) {
-    //        
-    //    }
-
-    public void lispFormHandler(ValueHandler valueHandler) {
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                          null,
-                                                          0 );
-        valueHandler.getValue( context );
-    }
-
-    public void ruleDescrHandler(RuleDescr ruleDescr) {        
-        String module = getModuleName( ruleDescr.getAttributes() );
-
-        PackageDescr pkg = new PackageDescr( module );
-        
-        for ( Iterator it = this.imports.iterator(); it.hasNext(); ) {
-            pkg.addImport( (ImportDescr) it.next() );
-        }
-        
-        pkg.addRule( ruleDescr );
-
-        PackageBuilder builder = new PackageBuilder();
-        builder.addPackage( pkg );                
-        
-        try {
-            this.ruleBase.addPackage( builder.getPackage() );
-        } catch ( Exception e ) {
-            e.printStackTrace();
-        }
-    }
-    
-    public void importDescrHandler(ImportDescr importDescr) {        
-        this.imports.add( importDescr );
-    }
-
-    public String getModuleName(List list) {
-        for ( Iterator it = list.iterator(); it.hasNext(); ) {
-            AttributeDescr attr = (AttributeDescr) it.next();
-            if ( attr.getName().equals( "agenda-group" ) ) {
-                return attr.getValue();
-            }
-        }
-        return "MAIN";
-    }
-
-    //    public PackageBuilder getBuilder(String namespace) {
-    //        PackageBuilder builder = (PackageBuilder) this.packageBulders.get( namespace );
-    //        if ( builder == null ) {
-    //            builder = new PackageBuilder();
-    //            this.packageBulders.put( namespace, builder );
-    //        }
-    //        return builder;
-    //        
-    //    }
-
-    private CharStream newCharStream(final String text) {
-        return new ANTLRStringStream( text );
-    }
-
-    private CLPLexer newLexer(final CharStream charStream) {
-        return new CLPLexer( charStream );
-    }
-
-    private TokenStream newTokenStream(final Lexer lexer) {
-        return new CommonTokenStream( lexer );
-    }
-
-    public void addFunction(FunctionCaller function) {
-        //function.getValue( this );
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.drools.clp.ExecutionContext#getLocalVariable(int)
-     */
-    public ValueHandler getLocalVariable(int index) {
-        return variables[index];
-    }
-
-    /* (non-Javadoc)
-     * @see org.drools.clp.ExecutionContext#setLocalVariable(int, org.drools.clp.ValueHandler)
-     */
-    public void setLocalVariable(int index,
-                                 ValueHandler valueHandler) {
-        this.variables[index] = valueHandler;
-    }
-
-    public XFunctionRegistry getFunctionRegistry() {
-        return this.registry;
-    }
-
-    /* (non-Javadoc)
-     * @see org.drools.clp.BuildContext#setProperty(java.lang.Object, java.lang.Object)
-     */
-    public Object setProperty(Object key,
-                              Object value) {
-        if ( this.properties == Collections.EMPTY_MAP ) {
-            this.properties = new HashMap();
-        }
-        return this.properties.put( key,
-                                    value );
-    }
-
-    /* (non-Javadoc)
-     * @see org.drools.clp.BuildContext#getProperty(java.lang.Object)
-     */
-    public Object getProperty(Object key) {
-        return this.properties.get( key );
-    }
-
-    public Object getObject() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public InternalWorkingMemory getWorkingMemory() {
-        return ( InternalWorkingMemory) this.session;
-    }
-
-    /* (non-Javadoc)
-     * @see org.drools.clp.ExecutionContext#setPrintoutRouters(java.util.Map)
-     */
-    public void setPrintoutRouters(Map printoutRouters) {
-        this.printoutRouters = printoutRouters;
-    }
-
-    /* (non-Javadoc)
-     * @see org.drools.clp.ExecutionContext#addPrintoutRouter(java.lang.String, java.io.PrintStream)
-     */
-    public void addPrintoutRouter(String identifier,
-                                  PrintStream stream) {
-        this.printoutRouters.put( identifier,
-                                  stream );
-    }
-
-    /* (non-Javadoc)
-     * @see org.drools.clp.ExecutionContext#getPrintoutRouters(java.lang.String)
-     */
-    public PrintStream getPrintoutRouters(String identifier) {
-        return (PrintStream) this.printoutRouters.get( identifier );
-    }
-    
-    public ValueHandler createLocalVariable(String identifier) {
-        return new IndexedLocalVariableValue( identifier,
-                                              this.index++ );
-    }
-    
-    public void addVariable(VariableValueHandler var) {
-        this.vars.put( var.getIdentifier(), var);
-    }
-
-    /* (non-Javadoc)
-     * @see org.drools.clp.BuildContext#getVariableValueHandler(java.lang.String)
-     */
-    public ValueHandler getVariableValueHandler(String identifier) {
-        ValueHandler var = (ValueHandler) this.vars.get( identifier );
-        if ( var == null ) {
-            var = new TempTokenVariable( identifier );
-        }
-        return var;
-    }
-
-    public Object resolve(String identifier) {
-        ValueHandler var = (ValueHandler) this.vars.get( identifier );
-        return var.getObject( this );
-    }
-
-//    public Object resolveGlobal(String arg0) {
-//        // TODO Auto-generated method stub
-//        return null;
-//    }
-//
-//    public void setGlobal(String arg0,
-//                          Object arg1) {
-//        // TODO Auto-generated method stub
-//        
-//    }
-
-    public ReteTuple getTuple() {
-        return null;
-    }    
-
-}

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/PrintRouterContext.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/PrintRouterContext.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/PrintRouterContext.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -11,6 +11,6 @@
 
     public abstract boolean removeRouter(String name);
 
-    public abstract Map<String, PrintStream> getRouters();
+//    public abstract Map<String, PrintStream> getRouters();
 
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Shell.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Shell.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Shell.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -8,17 +8,31 @@
 import java.io.Serializable;
 import java.io.StringReader;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.Map.Entry;
 
 import org.antlr.runtime.ANTLRReaderStream;
 import org.antlr.runtime.CommonTokenStream;
+import org.drools.FactHandle;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.base.ClassTypeResolver;
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.common.InternalRuleBase;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.AttributeDescr;
 import org.drools.lang.descr.FunctionDescr;
 import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.PackageDescr;
 import org.drools.lang.descr.RuleDescr;
+import org.drools.spi.GlobalResolver;
 import org.mvel.MVEL;
+import org.mvel.ParserContext;
 import org.mvel.ast.Function;
 import org.mvel.compiler.CompiledExpression;
 import org.mvel.compiler.ExpressionCompiler;
@@ -29,21 +43,95 @@
     ParserHandler,
     VariableContext,
     FunctionContext,
-    PrintRouterContext,
-    MVELBuildContext {
+    PrintRouterContext {
     private Map<String, Object> vars;
-    private Map<String, String> varNameMap;
 
+    private RuleBase            ruleBase;
+    private StatefulSession     session;
+
+    // private Map                 functions;
+
+    private Map                 directImports;
+    private Set                 dynamicImports;
+
+    private ClassTypeResolver   typeResolver;
+
+    private String              moduleName;
+    private static final String MAIN = "MAIN";
+
+    private DroolsMVELFactory   factory;
+
     public Shell() {
+        this( RuleBaseFactory.newRuleBase() );
+    }
+
+    public Shell(RuleBase ruleBase) {
+        this.moduleName = MAIN;
+        this.ruleBase = ruleBase;
+        this.session = this.ruleBase.newStatefulSession();
+        // this.functions = new HashMap();
+        this.directImports = new HashMap();
+        this.dynamicImports = new HashSet();
+
+        this.typeResolver = new ClassTypeResolver( new HashSet(),
+                                                   ((InternalRuleBase) this.ruleBase).getConfiguration().getClassLoader() );
+
+        this.factory = (DroolsMVELFactory) new DroolsMVELFactory( null,
+                                                                  null,
+                                                                  ((InternalRuleBase) this.ruleBase).getGlobals() );
+
         this.vars = new HashMap<String, Object>();
-        this.varNameMap = new HashMap<String, String>();
+        GlobalResolver2 globalResolver = new GlobalResolver2( this.vars,
+                                                              this.session.getGlobalResolver() );
+        this.session.setGlobalResolver( globalResolver );
+
+        this.factory.setContext( null,
+                                 null,
+                                 null,
+                                 this.session,
+                                 this.vars );
+
+        addRouter( "t",
+                   System.out );
     }
+    
+    public StatefulSession getStatefulSession() {
+        return this.session;
+    }
 
-    public void functionHandler(FunctionDescr ruleDescr) {
+    public static class GlobalResolver2
+        implements
+        GlobalResolver {
+        private Map<String, Object> vars;
+        private GlobalResolver      resolver;
+
+        public GlobalResolver2(Map<String, Object> vars,
+                               GlobalResolver resolver) {
+            this.vars = vars;
+            this.resolver = resolver;
+        }
+
+        public Object resolveGlobal(String identifier) {
+            Object object = this.vars.get( identifier );
+            if ( object == null ) {
+                object = resolver.resolveGlobal( identifier );
+            }
+            return object;
+        }
+
+        public void setGlobal(String identifier,
+                              Object value) {
+            this.resolver.setGlobal( identifier,
+                                     value );
+
+        }
+    }
+
+    public void functionHandler(FunctionDescr functionDescr) {
         Appendable builder = new StringBuilderAppendable();
 
         // strip lead/trailing quotes
-        String name = ruleDescr.getName().trim();
+        String name = functionDescr.getName().trim();
         if ( name.charAt( 0 ) == '"' ) {
             name = name.substring( 1 );
         }
@@ -54,19 +142,18 @@
         }
         builder.append( "function " + name + "(" );
 
-        for ( int i = 0, length = ruleDescr.getParameterNames().size(); i < length; i++ ) {
-            builder.append( ruleDescr.getParameterNames().get( i ) );
+        for ( int i = 0, length = functionDescr.getParameterNames().size(); i < length; i++ ) {
+            builder.append( functionDescr.getParameterNames().get( i ) );
             if ( i < length - 1 ) {
                 builder.append( ", " );
             }
         }
 
         builder.append( ") {\n" );
-        List list = (List) ruleDescr.getContent();
+        List list = (List) functionDescr.getContent();
         for ( Iterator it = list.iterator(); it.hasNext(); ) {
             FunctionHandlers.dump( (LispForm) it.next(),
-                                   builder,
-                                   this );
+                                   builder );
         }
         builder.append( "}" );
 
@@ -80,25 +167,78 @@
     }
 
     public void importHandler(ImportDescr descr) {
-        // TODO Auto-generated method stub
+        String importText = descr.getTarget().trim();
 
+        this.typeResolver.addImport( descr.getTarget() );
+
+        if ( importText.endsWith( "*" ) ) {
+            this.dynamicImports.add( importText );
+        } else {
+            Class cls;
+            try {
+                cls = this.typeResolver.resolveType( importText );
+            } catch ( ClassNotFoundException e ) {
+                throw new RuntimeException( "Unable to resolve : " + importText );
+            }
+            this.directImports.put( cls.getSimpleName(),
+                                    cls );
+        }
     }
 
     public void lispFormHandler(LispForm lispForm) {
         StringBuilderAppendable appendable = new StringBuilderAppendable();
         FunctionHandlers.dump( lispForm,
-                               appendable,
-                               this );
-        MVEL.eval( appendable.toString(),
-                   this.vars );
+                               appendable );
 
+        ParserContext context = new ParserContext();
+
+        for ( Iterator it = this.directImports.entrySet().iterator(); it.hasNext(); ) {
+            Entry entry = (Entry) it.next();
+            context.addImport( (String) entry.getKey(),
+                               (Class) entry.getValue() );
+        }
+
+        for ( Iterator it = this.dynamicImports.iterator(); it.hasNext(); ) {
+            String importText = ((String) it.next()).trim();
+            context.addPackageImport( importText.substring( 0,
+                                                            importText.length() - 2 ) );
+        }
+
+        ExpressionCompiler expr = new ExpressionCompiler( appendable.toString() );
+        Serializable executable = expr.compile( context );
+
+        MVEL.executeExpression( executable,
+                                this,
+                                this.factory );
+
     }
 
     public void ruleHandler(RuleDescr ruleDescr) {
-        // TODO Auto-generated method stub
+        String module = getModuleName( ruleDescr.getAttributes() );
 
+        PackageDescr pkg = createPackageDescr( module );
+        pkg.addRule( ruleDescr );
+
+        PackageBuilder builder = new PackageBuilder();
+        builder.addPackage( pkg );
+
+        try {
+            this.ruleBase.addPackage( builder.getPackage() );
+        } catch ( Exception e ) {
+            e.printStackTrace();
+        }
     }
 
+    public String getModuleName(List list) {
+        for ( Iterator it = list.iterator(); it.hasNext(); ) {
+            AttributeDescr attr = (AttributeDescr) it.next();
+            if ( attr.getName().equals( "agenda-group" ) ) {
+                return attr.getValue();
+            }
+        }
+        return "MAIN";
+    }
+
     public void eval(String string) {
         eval( new StringReader( string ) );
     }
@@ -107,31 +247,46 @@
         ClipsParser parser;
         try {
             parser = new ClipsParser( new CommonTokenStream( new ClipsLexer( new ANTLRReaderStream( reader ) ) ) );
-            parser.eval( this,
-                         this );
+            parser.eval( this );
         } catch ( Exception e ) {
             e.printStackTrace();
         }
     }
 
+    public void run() {
+        this.session.fireAllRules();
+    }
+
+    public void run(int fireLimit) {
+        this.session.fireAllRules( fireLimit );
+    }
+
+    public FactHandle insert(Object object) {
+        return this.session.insert( object );
+    }
+
+    public void importEntry(String importEntry) {
+
+    }
+
     public void addFunction(Function function) {
-        this.vars.put( function.getAbsoluteName(),
-                       function );
+        this.factory.createVariable( function.getAbsoluteName(),
+                                     function );
     }
 
     public boolean removeFunction(String functionName) {
-        return (this.vars.remove( functionName ) != null);
+        return false; //(this.vars.remove( functionName ) != null);
     }
 
     public Map<String, Function> getFunctions() {
         Map<String, Function> map = new HashMap<String, Function>();
-        for ( Iterator it = this.vars.entrySet().iterator(); it.hasNext(); ) {
-            Entry entry = (Entry) it.next();
-            if ( entry.getValue() instanceof Function ) {
-                map.put( (String) entry.getKey(),
-                         (Function) entry.getValue() );
-            }
-        }
+        //        for ( Iterator it = this.vars.entrySet().iterator(); it.hasNext(); ) {
+        //            Entry entry = (Entry) it.next();
+        //            if ( entry.getValue() instanceof Function ) {
+        //                map.put( (String) entry.getKey(),
+        //                         (Function) entry.getValue() );
+        //            }
+        //        }
         return map;
     }
 
@@ -141,60 +296,57 @@
         Map routers = (Map) this.vars.get( "printrouters" );
         if ( routers == null ) {
             routers = new HashMap();
-            this.vars.put( "printrouters",
-                           routers );
+            this.factory.createVariable( "printrouters",
+                                         routers );
         }
+
         routers.put( name,
                      out );
 
     }
 
     public boolean removeRouter(String name) {
-        return (this.vars.remove( name ) != null);
+        return false; //(this.vars.remove( name ) != null);
     }
 
-    public Map<String, PrintStream> getRouters() {
-        Map<String, PrintStream> map = new HashMap<String, PrintStream>();
-        for ( Iterator it = this.vars.entrySet().iterator(); it.hasNext(); ) {
-            Entry entry = (Entry) it.next();
-            if ( entry.getValue() instanceof Function ) {
-                map.put( (String) entry.getKey(),
-                         (PrintStream) entry.getValue() );
-            }
-        }
-        return map;
-    }
+    //    public Map<String, PrintStream> getRouters() {
+    //        Map<String, PrintStream> map = new HashMap<String, PrintStream>();
+    //        for ( Iterator it = this.vars.entrySet().iterator(); it.hasNext(); ) {
+    //            Entry entry = (Entry) it.next();
+    //            if ( entry.getValue() instanceof Function ) {
+    //                map.put( (String) entry.getKey(),
+    //                         (PrintStream) entry.getValue() );
+    //            }
+    //        }
+    //        return map;
+    //    }
 
     public void addVariable(String name,
                             Object value) {
-        String temp = this.varNameMap.get( name );
-        if ( temp == null ) {
-            temp = makeValid( name );
-            if ( !temp.equals( name ) ) {
-                this.varNameMap.put( name,
-                                     temp );
-            }
+        if ( name.startsWith( "?" ) ) {
+            name = name.substring( 1 );
         }
-        this.vars.put( temp,
-                       value );
+        this.factory.createVariable( name,
+                                     value );
+        //        this.session.setGlobal( name,
+        //                                value );
     }
 
-    public void removeVariable(String name) {
-        String temp = this.varNameMap.get( name );
-        if ( temp != null ) {
-            name = temp;
+    //    public void removeVariable(String name) {
+    //        String temp = this.varNameMap.get( name );
+    //        if ( temp != null ) {
+    //            name = temp;
+    //        }
+    //        this.session.getGlobal( identifier ).remove( name );
+    //    }
+
+    private PackageDescr createPackageDescr(String moduleName) {
+        PackageDescr pkg = new PackageDescr( moduleName );
+
+        for ( Iterator it = this.typeResolver.getImports().iterator(); it.hasNext(); ) {
+            pkg.addImport( new ImportDescr( (String) it.next() ) );
         }
-        this.vars.remove( name );
-    }
 
-    public Map<String, String> getVariableNameMap() {
-        return this.varNameMap;
+        return pkg;
     }
-
-    public String makeValid(String var) {
-        var = var.replaceAll( "\\?",
-                              "_Q_" );
-        return var;
-    }
-
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/VariableContext.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/VariableContext.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/VariableContext.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -3,5 +3,5 @@
 public interface VariableContext {
     public void addVariable(String name, Object value);
     
-    public void removeVariable(String name);
+    //public void removeVariable(String name);
 }

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/VariableLispAtom.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/VariableLispAtom.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/VariableLispAtom.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -3,21 +3,12 @@
  */
 package org.drools.clips;
 
-import java.util.Map;
 
 public class VariableLispAtom extends LispAtom {
     
-    public VariableLispAtom(String var, MVELBuildContext context) {
-        super(var);
-        Map<String, String> map = context.getVariableNameMap();
-        String temp = map.get( var );
-        if ( temp == null ) {
-            temp = context.makeValid( var );
-            if ( !temp.equals( var ) ) {
-                map.put( var, temp );
-            }
-        } 
-        setValue( temp );        
+    public VariableLispAtom(String var) {
+        super( var.replace( '?', '$' ) );
+        //super( ( var.startsWith( "?" ) ) ? var.substring( 1 ) : var ); // strip leading ?   
     }
 
     

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/AssertFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/AssertFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/AssertFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,39 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispAtom;
+import org.drools.clips.LispForm;
+import org.drools.clips.SExpression;
+
+public class AssertFunction implements Function {
+    private static final String name = "assert";
+
+    public String getName() {
+        return name;
+    }
+    
+    public void dump(LispForm lispForm, Appendable appendable) {
+        LispForm form = ( LispForm) lispForm.getSExpressions()[1];
+        
+        String type = ((LispAtom) form.getSExpressions()[0]).getValue();
+        
+        appendable.append("insert( with ( new " + type + "() ) {");        
+        
+        for ( int i = 1, length = form.getSExpressions().length; i < length; i++) {
+            LispForm slot =  ( LispForm) form.getSExpressions()[i];
+                                                                                
+            appendable.append( ( ( LispAtom ) slot.getSExpressions()[0]).getValue() );            
+            
+            appendable.append( " = " );
+            
+            FunctionHandlers.dump( slot.getSExpressions()[1], appendable);  
+            
+            if ( i != length -1 ) { 
+                appendable.append( "," );
+            }
+        }
+        appendable.append("} );\n");
+    }
+}

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/BaseInfixFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/BaseInfixFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/BaseInfixFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -4,19 +4,18 @@
 import org.drools.clips.Function;
 import org.drools.clips.FunctionHandlers;
 import org.drools.clips.LispForm;
-import org.drools.clips.MVELBuildContext;
 import org.drools.clips.SExpression;
 
 public abstract class BaseInfixFunction implements Function {
     public abstract String getMappedSymbol();
     
-    public void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context) {
+    public void dump(LispForm lispForm, Appendable appendable) {
         SExpression[] sExpressions = lispForm.getSExpressions();        
         
         appendable.append("(");
         for ( int i = 1, length = sExpressions.length; i < length; i++) {
             
-            FunctionHandlers.dump( sExpressions[i], appendable, context );          
+            FunctionHandlers.dump( sExpressions[i], appendable );          
             
             if ( i != length -1 ) { 
                 appendable.append( getMappedSymbol() );

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/BindFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/BindFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/BindFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,24 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispAtom;
+import org.drools.clips.LispForm;
+import org.drools.clips.SExpression;
+
+public class BindFunction implements Function {
+    private static final String name = "bind";
+
+    public String getName() {
+        return name;
+    }
+    
+    public void dump(LispForm lispForm, Appendable appendable) {
+        SExpression[] sExpressions = lispForm.getSExpressions();
+        
+        appendable.append(( (LispAtom) lispForm.getSExpressions()[1]).getValue() + " = " );
+        FunctionHandlers.dump( lispForm.getSExpressions()[2], appendable);
+        appendable.append(";\n");
+    }
+}

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/CallFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/CallFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/CallFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,47 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispAtom;
+import org.drools.clips.LispForm;
+import org.drools.clips.SExpression;
+
+public class CallFunction
+    implements
+    Function {
+    private static final String name = "call";
+
+    public String getName() {
+        return name;
+    }
+
+    public void dump(LispForm lispForm,
+                     Appendable appendable) {
+        SExpression[] sExpressions = lispForm.getSExpressions();
+
+        int offset = 0;
+        if ( !"call".equals( ((LispAtom) sExpressions[0]).getValue().trim()) ) {
+            offset = -1;
+        }
+        
+        String name = ((LispAtom) sExpressions[offset+1]).getValue();
+
+        String field = ((LispAtom) sExpressions[offset+2]).getValue().trim();
+        field = field.substring( 1, field.length() -1  );                
+
+        appendable.append( name );
+        appendable.append( "." );
+        appendable.append( field );
+        
+        appendable.append( "(" );
+        for ( int i = offset+3, length = sExpressions.length; i < length; i++) {            
+            FunctionHandlers.dump( sExpressions[i], appendable );         
+            
+            if ( i != length -1 ) { 
+                appendable.append( ", " );
+            }
+        }        
+        appendable.append( ");" );        
+    }
+}

Copied: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/CreateListFunction.java (from rev 18259, labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CreateListFunction.java)
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/CreateListFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/CreateListFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,31 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispForm;
+import org.drools.clips.SExpression;
+
+public class CreateListFunction implements Function {
+    private static final String name = "create$";
+
+    public String getName() {
+        return name;
+    }
+    
+    public void dump(LispForm lispForm, Appendable appendable) {
+        SExpression[] sExpressions = lispForm.getSExpressions();
+        
+        appendable.append("[");
+        
+        for ( int i = 1, length = sExpressions.length; i < length; i++) {
+            
+            FunctionHandlers.dump( sExpressions[i], appendable );        
+            
+            if ( i != length -1 ) { 
+                appendable.append( "," );
+            }
+        }
+        appendable.append("]");
+    }
+}

Copied: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/EqFunction.java (from rev 18259, labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/EqFunction.java)
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/EqFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/EqFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,15 @@
+package org.drools.clips.functions;
+
+
+public class EqFunction  extends BaseInfixFunction  {
+    private static final String name = "eq";
+    private static final String mappedSymbol = "==";
+        
+    public String getName() {
+        return name;
+    }
+
+    public String getMappedSymbol() {
+        return mappedSymbol;
+    }
+}

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/GetFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/GetFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/GetFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,32 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispAtom;
+import org.drools.clips.LispForm;
+import org.drools.clips.SExpression;
+
+public class GetFunction
+    implements
+    Function {
+    private static final String name = "get";
+
+    public String getName() {
+        return name;
+    }
+
+    public void dump(LispForm lispForm,
+                     Appendable appendable) {
+        SExpression[] sExpressions = lispForm.getSExpressions();
+
+        String name = ((LispAtom) sExpressions[1]).getValue();
+
+        String field = ((LispAtom) sExpressions[2]).getValue().trim();
+        field = field.substring( 1, field.length() -1  );                
+
+        appendable.append( name );
+        appendable.append( "." );
+        appendable.append( field );
+    }
+}

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/IfFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/IfFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/IfFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -5,7 +5,6 @@
 import org.drools.clips.FunctionHandlers;
 import org.drools.clips.LispAtom;
 import org.drools.clips.LispForm;
-import org.drools.clips.MVELBuildContext;
 import org.drools.clips.SExpression;
 
 public class IfFunction implements Function {
@@ -15,12 +14,12 @@
         return name;
     }
     
-    public void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context) {
+    public void dump(LispForm lispForm, Appendable appendable) {
         SExpression[] sExpressions = lispForm.getSExpressions();
 
         appendable.append( "if " );
         
-        FunctionHandlers.dump( sExpressions[1], appendable, context );
+        FunctionHandlers.dump( sExpressions[1], appendable );
         
         appendable.append( "{" );
         int i = 3;
@@ -30,7 +29,7 @@
                 i++;
                 break;
             }
-            FunctionHandlers.dump( sExpressions[i], appendable, context );
+            FunctionHandlers.dump( sExpressions[i], appendable );
         }  
         appendable.append( "}" );
         
@@ -43,7 +42,7 @@
                     i++;
                     break;
                 }
-                FunctionHandlers.dump( sExpressions[i], appendable, context );
+                FunctionHandlers.dump( sExpressions[i], appendable );
             }        
             appendable.append( "}" );  
         }             

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/ModifyFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/ModifyFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/ModifyFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -5,7 +5,6 @@
 import org.drools.clips.FunctionHandlers;
 import org.drools.clips.LispAtom;
 import org.drools.clips.LispForm;
-import org.drools.clips.MVELBuildContext;
 import org.drools.clips.SExpression;
 
 public class ModifyFunction implements Function {
@@ -15,7 +14,7 @@
         return name;
     }
     
-    public void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context) {
+    public void dump(LispForm lispForm, Appendable appendable) {
         SExpression[] sExpressions = lispForm.getSExpressions();
         
         appendable.append("modify (" + ( (LispAtom) lispForm.getSExpressions()[1]).getValue() + ") {");
@@ -26,7 +25,7 @@
             
             appendable.append( " = " );
             
-            FunctionHandlers.dump( setter.getSExpressions()[1], appendable, context);  
+            FunctionHandlers.dump( setter.getSExpressions()[1], appendable);  
             
             if ( i != length -1 ) { 
                 appendable.append( "," );

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/NewFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/NewFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/NewFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,35 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispAtom;
+import org.drools.clips.LispForm;
+import org.drools.clips.SExpression;
+
+public class NewFunction implements Function {
+    private static final String name = "new";    
+
+    public String getName() {
+        return name;
+    }
+    
+    public void dump(LispForm lispForm, Appendable appendable) {
+        SExpression[] sExpressions = lispForm.getSExpressions();
+        appendable.append( "new " );
+        
+        String name = ( ( LispAtom ) sExpressions[1] ).getValue().trim();
+        name = name.substring( 1, name.length() -1  );                
+        appendable.append( name );
+        appendable.append( "(" );
+        
+        for ( int i = 2, length = sExpressions.length; i < length; i++) {            
+            FunctionHandlers.dump( sExpressions[i], appendable );         
+            
+            if ( i != length -1 ) { 
+                appendable.append( ", " );
+            }
+        }        
+        appendable.append( ");" );
+    }
+}

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/PrintoutFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/PrintoutFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/PrintoutFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -5,7 +5,6 @@
 import org.drools.clips.FunctionHandlers;
 import org.drools.clips.LispAtom;
 import org.drools.clips.LispForm;
-import org.drools.clips.MVELBuildContext;
 import org.drools.clips.SExpression;
 
 public class PrintoutFunction implements Function {
@@ -17,12 +16,12 @@
         return name;
     }
     
-    public void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context) {
+    public void dump(LispForm lispForm, Appendable appendable) {
         SExpression[] sExpressions = lispForm.getSExpressions();
         appendable.append( "printrouters.get(" + ( ( LispAtom ) lispForm.getSExpressions()[route]).getValue()+ ").print(" );
         //appendable.append( "routers.get(" + ( ( LispAtom2 ) lispForm.getSExpressions()[route]).getValue()+ ").print(" );
         for ( int i = 2, length = sExpressions.length; i < length; i++) {            
-            FunctionHandlers.dump( sExpressions[i], appendable, context );         
+            FunctionHandlers.dump( sExpressions[i], appendable );         
             
             if ( i != length -1 ) { 
                 appendable.append( "+" );

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/PrognFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/PrognFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/PrognFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -5,7 +5,6 @@
 import org.drools.clips.FunctionHandlers;
 import org.drools.clips.LispAtom;
 import org.drools.clips.LispForm;
-import org.drools.clips.MVELBuildContext;
 import org.drools.clips.SExpression;
 
 public class PrognFunction implements Function {
@@ -15,7 +14,7 @@
         return name;
     }
     
-    public void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context) {
+    public void dump(LispForm lispForm, Appendable appendable) {
         Function createList = FunctionHandlers.getInstance().getFunction( "create$" );
         
         SExpression[] sExpressions = lispForm.getSExpressions();
@@ -26,12 +25,12 @@
         
         appendable.append( "foreach( " + var + " : " );        
         
-        createList.dump( (LispForm) listSpec.getSExpressions()[1], appendable, context );
+        createList.dump( (LispForm) listSpec.getSExpressions()[1], appendable );
         
         appendable.append( " ) {" );
         
         for ( int i = 2, length = sExpressions.length; i < length; i++ ) {
-            FunctionHandlers.dump( sExpressions[i], appendable, context );
+            FunctionHandlers.dump( sExpressions[i], appendable );
         }          
         
         appendable.append( "}" );

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/RetractFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/RetractFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/RetractFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,24 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispAtom;
+import org.drools.clips.LispForm;
+import org.drools.clips.SExpression;
+
+public class RetractFunction implements Function {
+    private static final String name = "retract";
+
+    public String getName() {
+        return name;
+    }
+    
+    public void dump(LispForm lispForm, Appendable appendable) {
+        LispForm form = ( LispForm) lispForm.getSExpressions()[1];
+        
+        String var = ((LispAtom) form.getSExpressions()[0]).getValue();
+        
+        appendable.append("retract( " + var + " );\n");
+    }
+}

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/ReturnFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/ReturnFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/ReturnFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -4,7 +4,6 @@
 import org.drools.clips.Function;
 import org.drools.clips.FunctionHandlers;
 import org.drools.clips.LispForm;
-import org.drools.clips.MVELBuildContext;
 
 public class ReturnFunction implements Function {
     private static final String name = "return";
@@ -13,9 +12,9 @@
         return name;
     }
     
-    public void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context) {
+    public void dump(LispForm lispForm, Appendable appendable) {
         appendable.append( "return " );
-        FunctionHandlers.dump( lispForm.getSExpressions()[1], appendable, context );
+        FunctionHandlers.dump( lispForm.getSExpressions()[1], appendable );
         appendable.append( ";\n" );
     }
 }

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/RunFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/RunFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/RunFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,23 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispAtom;
+import org.drools.clips.LispForm;
+
+public class RunFunction implements Function {
+    private static final String name = "run";
+
+    public String getName() {
+        return name;
+    }
+    
+    public void dump(LispForm lispForm, Appendable appendable) {
+        if ( lispForm.getSExpressions().length == 3 ) {
+            appendable.append( "run(" + ((LispAtom)lispForm.getSExpressions()[2]).getValue() + ");\n " );
+        } else {
+            appendable.append( "run();\n " );
+        }
+    }
+}

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/SetFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/SetFunction.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/SetFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,38 @@
+package org.drools.clips.functions;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.Function;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispAtom;
+import org.drools.clips.LispForm;
+import org.drools.clips.SExpression;
+
+public class SetFunction
+    implements
+    Function {
+    private static final String name = "set";
+
+    public String getName() {
+        return name;
+    }
+
+    public void dump(LispForm lispForm,
+                     Appendable appendable) {
+        SExpression[] sExpressions = lispForm.getSExpressions();
+
+        String name = ((LispAtom) sExpressions[1]).getValue();
+
+        String field = ((LispAtom) sExpressions[2]).getValue().trim();
+        field = field.substring( 1, field.length() -1  );                
+
+        appendable.append( name );
+        appendable.append( "." );
+        appendable.append( field );
+        appendable.append( " = " );
+
+        FunctionHandlers.dump( sExpressions[3],
+                               appendable );
+
+        appendable.append( ";\n" );
+    }
+}

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/SwitchFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/SwitchFunction.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/functions/SwitchFunction.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -5,7 +5,6 @@
 import org.drools.clips.FunctionHandlers;
 import org.drools.clips.LispAtom;
 import org.drools.clips.LispForm;
-import org.drools.clips.MVELBuildContext;
 import org.drools.clips.SExpression;
 
 public class SwitchFunction implements Function {     
@@ -15,15 +14,15 @@
         return name;
     }
     
-    public void dump(LispForm lispForm, Appendable appendable, MVELBuildContext context) {
+    public void dump(LispForm lispForm, Appendable appendable) {
         SExpression[] sExpressions = lispForm.getSExpressions();
 
         appendable.append( "switchvar = " );
         LispForm expr = ( LispForm ) sExpressions[1];
         if ( expr.getSExpressions().length > 1 ) {
-            FunctionHandlers.dump( expr, appendable, context );
+            FunctionHandlers.dump( expr, appendable );
         } else {
-            FunctionHandlers.dump( expr.getSExpressions()[0], appendable, context );
+            FunctionHandlers.dump( expr.getSExpressions()[0], appendable );
         }
         appendable.append( ";\n" );
         
@@ -31,10 +30,10 @@
         
         appendable.append( "if ( switchvar == " );            
         
-        FunctionHandlers.dump( caseForm.getSExpressions()[1], appendable, context );            
+        FunctionHandlers.dump( caseForm.getSExpressions()[1], appendable );            
         appendable.append( ") {" );
         for ( int j = 3, jlength = caseForm.getSExpressions().length; j < jlength; j++ ) {
-            FunctionHandlers.dump( caseForm.getSExpressions()[j], appendable, context );
+            FunctionHandlers.dump( caseForm.getSExpressions()[j], appendable );
         }        
         appendable.append( "}" );
         
@@ -42,11 +41,11 @@
             caseForm = ( LispForm ) sExpressions[i];
             
             appendable.append( " else if ( switchvar == " );            
-            FunctionHandlers.dump( caseForm.getSExpressions()[1], appendable, context );            
+            FunctionHandlers.dump( caseForm.getSExpressions()[1], appendable );            
             appendable.append( ") {" );
             
             for ( int j = 3, jlength = caseForm.getSExpressions().length; j < jlength; j++ ) {
-                FunctionHandlers.dump( caseForm.getSExpressions()[j], appendable, context );
+                FunctionHandlers.dump( caseForm.getSExpressions()[j], appendable );
             }
             appendable.append( "}" );
         }
@@ -54,16 +53,16 @@
         caseForm = ( LispForm ) sExpressions[ sExpressions.length-1 ];
         if ( "case".equals( ((LispAtom)caseForm.getSExpressions()[0]).getValue() ) ) {
             appendable.append( " else if ( switchvar == " );            
-            FunctionHandlers.dump( caseForm.getSExpressions()[1], appendable, context );            
+            FunctionHandlers.dump( caseForm.getSExpressions()[1], appendable );            
             appendable.append( ") {" );
             for ( int j = 3, length = caseForm.getSExpressions().length; j < length; j++ ) {
-                FunctionHandlers.dump( caseForm.getSExpressions()[j], appendable, context );
+                FunctionHandlers.dump( caseForm.getSExpressions()[j], appendable );
             }        
             appendable.append( "}" );            
         } else {
             appendable.append( " else { " ); 
             for ( int j = 1, length = caseForm.getSExpressions().length; j < length; j++ ) {
-                FunctionHandlers.dump( caseForm.getSExpressions()[j], appendable, context );
+                FunctionHandlers.dump( caseForm.getSExpressions()[j], appendable );
             }        
             appendable.append( "}" );            
         }        

Copied: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsConsequenceBuilder.java (from rev 18198, labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClpConsequenceBuilder.java)
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsConsequenceBuilder.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsConsequenceBuilder.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,45 @@
+package org.drools.rule.builder.dialect.clips;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispForm;
+import org.drools.clips.StringBuilderAppendable;
+import org.drools.rule.Declaration;
+import org.drools.rule.Rule;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilder;
+
+public class ClipsConsequenceBuilder extends MVELConsequenceBuilder  {
+
+    public void build(RuleBuildContext context) {  
+        Appendable builder = new StringBuilderAppendable();
+        
+        List list = (List) context.getRuleDescr().getConsequence();
+        for ( Iterator it = list.iterator(); it.hasNext(); ) {
+            FunctionHandlers.dump( (LispForm) it.next(),
+                                   builder );
+        }
+        
+        context.getRuleDescr().setConsequence( builder.toString() );
+        
+        super.build(  context );
+        
+//        Rule rule = context.getRule();
+//        BlockExecutionEngine rhs = ( BlockExecutionEngine ) context.getRuleDescr().getConsequence();
+//        Map vars = new HashMap();
+//        
+//        for(Declaration declaration : rule.getDeclarations() ) {
+//            vars.put( declaration.getIdentifier(), declaration );
+//        }
+//        
+//        rhs.replaceTempTokens( vars );
+//        rule.setConsequence( rhs );        
+    }
+
+}

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsDialect.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsDialect.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsDialect.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,291 +1,24 @@
 package org.drools.rule.builder.dialect.clips;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.drools.base.ClassFieldExtractorCache;
-import org.drools.base.TypeResolver;
-import org.drools.compiler.Dialect;
-import org.drools.compiler.PackageBuilder;
-import org.drools.lang.descr.AccumulateDescr;
-import org.drools.lang.descr.AndDescr;
-import org.drools.lang.descr.BaseDescr;
-import org.drools.lang.descr.CollectDescr;
-import org.drools.lang.descr.EvalDescr;
-import org.drools.lang.descr.ExistsDescr;
-import org.drools.lang.descr.ForallDescr;
-import org.drools.lang.descr.FromDescr;
-import org.drools.lang.descr.FunctionDescr;
-import org.drools.lang.descr.NotDescr;
-import org.drools.lang.descr.OrDescr;
-import org.drools.lang.descr.PatternDescr;
-import org.drools.lang.descr.ProcessDescr;
-import org.drools.lang.descr.QueryDescr;
-import org.drools.lang.descr.RuleDescr;
-import org.drools.rule.Package;
-import org.drools.rule.builder.AccumulateBuilder;
-import org.drools.rule.builder.ActionBuilder;
 import org.drools.rule.builder.ConsequenceBuilder;
-import org.drools.rule.builder.EntryPointBuilder;
-import org.drools.rule.builder.FromBuilder;
-import org.drools.rule.builder.GroupElementBuilder;
-import org.drools.rule.builder.PackageBuildContext;
-import org.drools.rule.builder.PatternBuilder;
-import org.drools.rule.builder.PredicateBuilder;
-import org.drools.rule.builder.ProcessBuildContext;
-import org.drools.rule.builder.ProcessClassBuilder;
-import org.drools.rule.builder.QueryBuilder;
-import org.drools.rule.builder.ReturnValueBuilder;
-import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
-import org.drools.rule.builder.RuleBuildContext;
-import org.drools.rule.builder.RuleClassBuilder;
-import org.drools.rule.builder.RuleConditionBuilder;
-import org.drools.rule.builder.SalienceBuilder;
-import org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration;
-public class ClipsDialect implements Dialect {
+import org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilder;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
 
-    public final static String                ID                      = "clips";
-
-    private final static String               EXPRESSION_DIALECT_NAME = "mvel";    
+public class ClipsDialect extends MVELDialect {
     
-    private final PatternBuilder              pattern                 = new PatternBuilder();    
-    private final ClpConsequenceBuilder      consequence             = new ClpConsequenceBuilder();    
+    private static final ClipsConsequenceBuilder          consequence                 = new ClipsConsequenceBuilder();
     
-    private Package                           pkg;
-    private ClipsDialectConfiguration          configuration;
-    private TypeResolver                      typeResolver;
-    private ClassFieldExtractorCache          classFieldExtractorCache;
+    public final static String ID = "clips";
 
-    // a map of registered builders
-    private Map builders;    
-    
-    public void init(PackageBuilder builder) {
-        this.pkg = builder.getPackage();
-        this.configuration = (ClipsDialectConfiguration) builder.getPackageBuilderConfiguration().getDialectConfiguration( "clips" );
-        this.typeResolver = builder.getTypeResolver();
-        this.classFieldExtractorCache = builder.getClassFieldExtractorCache();           
-        
-        initBuilder();
+    public ClipsDialect() {
+        super();
     }
-    
-    public void initBuilder() {
-        // statically adding all builders to the map
-        // but in the future we can move that to a configuration
-        // if we want to
-        this.builders = new HashMap();
 
-        final GroupElementBuilder gebuilder = new GroupElementBuilder();
-
-        this.builders.put( AndDescr.class,
-                           gebuilder );
-
-        this.builders.put( OrDescr.class,
-                           gebuilder );
-
-        this.builders.put( NotDescr.class,
-                           gebuilder );
-
-        this.builders.put( ExistsDescr.class,
-                           gebuilder );
-
-        this.builders.put( PatternDescr.class,
-                           getPatternBuilder() );
-
-//        this.builders.put( FromDescr.class,
-//                           getFromBuilder() );
-//
-//        this.builders.put( QueryDescr.class,
-//                           getQueryBuilder() );
-//
-//        this.builders.put( AccumulateDescr.class,
-//                           getAccumulateBuilder() );
-//
-//        this.builders.put( EvalDescr.class,
-//                           getEvalBuilder() );
-//        
-//        this.builders.put( CollectDescr.class,
-//                           collect );
-//
-//        this.builders.put( ForallDescr.class,
-//                           forall );
-//
-//        this.builders.put( FunctionDescr.class,
-//                           function );
-   }    
-
-    public void init(Package pkg) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void init(RuleDescr ruleDescr) {
-        // TODO Auto-generated method stub
-        
-    }    
-    
-    public void addFunction(FunctionDescr functionDescr,
-                            TypeResolver typeResolver) {
-        // TODO Auto-generated method stub        
-    }
-
-    public void addImport(String importEntry) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void addRule(RuleBuildContext context) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void addStaticImport(String importEntry) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public AnalysisResult analyzeBlock(RuleBuildContext context,
-                                       BaseDescr descr,
-                                       String text) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public AnalysisResult analyzeExpression(RuleBuildContext context,
-                                            BaseDescr descr,
-                                            Object content) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public void compileAll() {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public AccumulateBuilder getAccumulateBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public RuleConditionBuilder getBuilder(final Class clazz) {
-        return (RuleConditionBuilder) this.builders.get( clazz );
-    }
-
-    public Map getBuilders() {
-        return this.builders;
-    }
-
-    public ClassFieldExtractorCache getClassFieldExtractorCache() {
-        return this.classFieldExtractorCache;
-    }
-
-    public ConsequenceBuilder getConsequenceBuilder() {
-        return consequence;
-    }
-
-    public RuleConditionBuilder getEvalBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public String getExpressionDialectName() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public FromBuilder getFromBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
     public String getId() {
         return ID;
     }
-
-    public PatternBuilder getPatternBuilder() {
-        return this.pattern;
-    }
-
-    public PredicateBuilder getPredicateBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public QueryBuilder getQueryBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public List getResults() {
-        return new ArrayList();
-    }
-
-    public ReturnValueBuilder getReturnValueBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public RuleClassBuilder getRuleClassBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public SalienceBuilder getSalienceBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public TypeResolver getTypeResolver() {
-        return this.typeResolver;
-    }
-
-    public void addProcess(ProcessBuildContext context) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public AnalysisResult analyzeBlock(PackageBuildContext context,
-                                       BaseDescr descr,
-                                       String text,
-                                       Set[] availableIdentifiers) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public AnalysisResult analyzeExpression(PackageBuildContext context,
-                                            BaseDescr descr,
-                                            Object content,
-                                            Set[] availableIdentifiers) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public ActionBuilder getActionBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public EntryPointBuilder getEntryPointBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public ProcessClassBuilder getProcessClassBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public ReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public void init(ProcessDescr processDescr) {
-        // TODO Auto-generated method stub
-        
-    }
-
+    
+    public ConsequenceBuilder getConsequenceBuilder() {
+        return this.consequence;
+    }    
 }

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsDialectConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsDialectConfiguration.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsDialectConfiguration.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -4,6 +4,8 @@
 import org.drools.compiler.DialectConfiguration;
 import org.drools.compiler.PackageBuilder;
 import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration;
 
 /**
  * The Clips dialect.
@@ -11,25 +13,10 @@
  *
  */
 public class ClipsDialectConfiguration
-    implements
-    DialectConfiguration {
-
-    private ClipsDialect                dialect;
-    private PackageBuilderConfiguration conf;
-
+    extends MVELDialectConfiguration {
+    
     public Dialect getDialect() {
-        if ( this.dialect == null ) {
-            this.dialect = new ClipsDialect();
-        }
-        return this.dialect;
-    }
+        return new ClipsDialect();
+    }    
 
-    public void init(PackageBuilderConfiguration conf) {
-        this.conf = conf;
-    }
-
-    public PackageBuilderConfiguration getPackageBuilderConfiguration() {
-        return this.conf;
-    }
-
 }

Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsReturnValueBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsReturnValueBuilder.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClipsReturnValueBuilder.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -0,0 +1,36 @@
+package org.drools.rule.builder.dialect.clips;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.clips.Appendable;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.LispForm;
+import org.drools.clips.StringBuilderAppendable;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.ReturnValueRestriction;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.dialect.mvel.MVELReturnValueBuilder;
+
+public class ClipsReturnValueBuilder extends MVELReturnValueBuilder {
+    public void build(final RuleBuildContext context,
+                      final List[] usedIdentifiers,
+                      final Declaration[] previousDeclarations,
+                      final Declaration[] localDeclarations,
+                      final ReturnValueRestriction returnValueRestriction,
+                      final ReturnValueRestrictionDescr returnValueRestrictionDescr) {
+        Appendable builder = new StringBuilderAppendable();
+        
+        List list = (List) context.getRuleDescr().getConsequence();
+        for ( Iterator it = list.iterator(); it.hasNext(); ) {
+            FunctionHandlers.dump( (LispForm) it.next(),
+                                   builder );
+        }
+        
+        returnValueRestrictionDescr.setContent( builder.toString() );
+        context.getRuleDescr().setConsequence( builder.toString() );
+        
+        super.build(context, usedIdentifiers, previousDeclarations, localDeclarations, returnValueRestriction, returnValueRestrictionDescr );
+    }
+}

Deleted: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClpConsequenceBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClpConsequenceBuilder.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/rule/builder/dialect/clips/ClpConsequenceBuilder.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,28 +0,0 @@
-package org.drools.rule.builder.dialect.clips;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.drools.clips.BlockExecutionEngine;
-import org.drools.clips.ExecutionEngine;
-import org.drools.rule.Declaration;
-import org.drools.rule.Rule;
-import org.drools.rule.builder.ConsequenceBuilder;
-import org.drools.rule.builder.RuleBuildContext;
-
-public class ClpConsequenceBuilder implements ConsequenceBuilder {
-
-    public void build(RuleBuildContext context) {
-        Rule rule = context.getRule();
-        BlockExecutionEngine rhs = ( BlockExecutionEngine ) context.getRuleDescr().getConsequence();
-        Map vars = new HashMap();
-        
-        for(Declaration declaration : rule.getDeclarations() ) {
-            vars.put( declaration.getIdentifier(), declaration );
-        }
-        
-        rhs.replaceTempTokens( vars );
-        rule.setConsequence( rhs );        
-    }
-
-}

Modified: labs/jbossrules/trunk/drools-clips/src/main/resources/META-INF/drools.default.packagebuilder.conf
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/resources/META-INF/drools.default.packagebuilder.conf	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/resources/META-INF/drools.default.packagebuilder.conf	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1 +1,2 @@
-drools.dialect.clips = org.drools.rule.builder.dialect.clp.ClipsDialectConfiguration
\ No newline at end of file
+drools.dialect.clips = org.drools.rule.builder.dialect.clips.ClipsDialectConfiguration
+drools.dialect.mvel.strict = false
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/Clips.g
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/Clips.g	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/Clips.g	2008-02-05 17:56:14 UTC (rev 18318)
@@ -22,7 +22,6 @@
 	private String source = "unknown";
 	private int lineOffset = 0;
 	private DescrFactory factory = new DescrFactory();
-	private MVELBuildContext context;
 	private boolean parserDebug = false;
 	private Location location = new Location( Location.LOCATION_UNKNOWN );	
 	
@@ -220,14 +219,13 @@
 	;	
 */
 
-eval[ParserHandler handler, MVELBuildContext context]
+eval[ParserHandler handler]
 	:	
-	{ this.context = context; }
-	(		  i=importDescr{ handler.importHandler( i ); }
+	   (		  i=importDescr{ handler.importHandler( i ); }
 				| f=deffunction { handler.functionHandler( f ); }	
 				| r=defrule { handler.ruleHandler( r ); }
 				| form=lisp_form { handler.lispFormHandler( form ); }
-		)
+		)*
 	;
 	
 	/*
@@ -358,11 +356,18 @@
 		
 		'=>'
 		
-		t=lisp_form { rule.setConsequence( t ); }
+		list=rule_consequence{ rule.setConsequence( list ); }
 		
 		RIGHT_PAREN
 	;
 
+rule_consequence returns[List list]
+    @init {
+        list = null;
+    }
+    :	
+		(l=lisp_form	{ if ( list == null ) list = new ArrayList(); list.add( l ); })*								    	
+	;
 
 ruleAttribute[RuleDescr rule]
 	:
@@ -486,7 +491,7 @@
 		ASSIGN_OP LEFT_PAREN name=NAME 
 		{
 			pattern = new PatternDescr(name.getText());
-			pattern.setIdentifier( identifier );
+			pattern.setIdentifier( identifier.replace( '?', '$') );
 			in_ce.addDescr( pattern );
 			top = pattern.getConstraint();				    
 		}
@@ -610,15 +615,17 @@
 		
 //will add a declaration field binding, if this is the first time the name  is used		
 variable_restriction[String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ]
+    @init { String identifier = null;}
 	:	VAR {
-	        if ( declarations.contains( $VAR.text ) ) {
-				rc.addRestriction( new VariableRestrictionDescr(op, $VAR.text) );
+	        identifier =  $VAR.text.replace( '?', '$');
+	        if ( declarations.contains( identifier) ) {
+				rc.addRestriction( new VariableRestrictionDescr(op, identifier ) );
 		 	} else {
 		 		FieldBindingDescr fbd = new FieldBindingDescr();
-		 		fbd.setIdentifier( $VAR.text );		
+		 		fbd.setIdentifier( identifier );		
 		 		fbd.setFieldName( fcBase.getFieldName() ); 		
 		 		ceBase.insertBeforeLast( FieldConstraintDescr.class, fbd );
-		 		declarations.add( $VAR.text );
+		 		declarations.add( identifier );
 		 	}
 		}
 	;	
@@ -656,7 +663,7 @@
 		(
 		    t=NAME { list.add( new SymbolLispAtom( t.getText() ) ); }
 		    |
-		    t=VAR { list.add( new VariableLispAtom( t.getText(), context ) ); }	    
+		    t=VAR { list.add( new VariableLispAtom( t.getText() ) ); }	    
 	    )
 		(		a=lisp_atom	{ list.add( a ); }
 			|	l=lisp_form	{ list.add( l ); }
@@ -671,7 +678,7 @@
 	}
 	:		
 		(		
-			 	t=VAR		{ sExpression = new VariableLispAtom( t.getText(), context ); }
+			 	t=VAR		{ sExpression = new VariableLispAtom( t.getText() ); }
 			|	t=STRING	{ sExpression = new StringLispAtom( getString( t ) ); }											
 			|	t=FLOAT		{ sExpression = new FloatLispAtom( t.getText() ); }
 			|	t=INT		{ sExpression = new IntLispAtom( t.getText() ); }

Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/Person.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/Person.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/Person.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -51,6 +51,12 @@
         this.likes = likes;
         this.age = age;
     }
+    
+    public void setFields(String name, String likes, int age) {
+        this.name = name;
+        this.likes = likes;
+        this.age = age;
+    }
 
     /* (non-Javadoc)
      * @see org.drools.PersonInterface#getStatus()
@@ -131,6 +137,10 @@
         this.hair = hair;
     }
 
+    public String toLongString() {
+        return "[Person name='" + this.name + "' likes='" + this.likes + "' age='" + this.age + "']";
+    }
+    
     public String toString() {
         return "[Person name='" + this.name + "']";
     }

Deleted: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/AddFunctionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/AddFunctionTest.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/AddFunctionTest.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,111 +0,0 @@
-package org.drools.clips;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.drools.RuleBase;
-import org.drools.RuleBaseFactory;
-import org.drools.base.ClassObjectType;
-import org.drools.clips.functions.PlusFunction;
-import org.drools.clips.valuehandlers.CLPLocalDeclarationVariable;
-import org.drools.clips.valuehandlers.CLPPreviousDeclarationVariable;
-import org.drools.clips.valuehandlers.FunctionCaller;
-import org.drools.clips.valuehandlers.IndexedLocalVariableValue;
-import org.drools.clips.valuehandlers.ObjectValueHandler;
-import org.drools.clips.valuehandlers.TempTokenVariable;
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
-import org.drools.rule.Pattern;
-import org.drools.rule.Declaration;
-import org.drools.spi.PatternExtractor;
-import org.drools.spi.ObjectType;
-
-import junit.framework.TestCase;
-
-public class AddFunctionTest extends TestCase {
-    public void testAdd() {
-        ValueHandler val1 = new ObjectValueHandler( new BigDecimal( 10 ) );
-        ValueHandler val2 = new ObjectValueHandler( new BigDecimal( 10 ) );
-
-        ValueHandler[] params = new ValueHandler[]{val1, val2};
-        PlusFunction add = new PlusFunction();
-
-        assertEquals( new BigDecimal( 20 ),
-                      add.execute( params,
-                                   null ).getObject( null ) );
-    }
-
-    public void testNestedAdd() {
-        ValueHandler val1 = new ObjectValueHandler( new BigDecimal( 10 ) );
-        ValueHandler val2 = new ObjectValueHandler( new BigDecimal( 10 ) );
-        ValueHandler val3 = new ObjectValueHandler( new BigDecimal( 10 ) );
-
-        FunctionCaller functionValue = new FunctionCaller( new PlusFunction() );
-        functionValue.addParameter( val1 );
-        functionValue.addParameter( val2 );
-
-        ValueHandler[] params = new ValueHandler[]{val3, functionValue};
-
-        PlusFunction add = new PlusFunction();
-
-        assertEquals( new BigDecimal( 30 ),
-                      add.execute( params,
-                                   null ).getObject( null ) );
-    }
-
-    public void testNestedAddWithVars() {
-        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
-        InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();
-
-        InternalFactHandle factHandle = (InternalFactHandle) workingMemory.insert( new BigDecimal( 10 ) );
-        ReteTuple tuple = new ReteTuple( factHandle );
-
-        ObjectType objectType = new ClassObjectType( BigDecimal.class );
-        Pattern pattern0 = new Pattern( 0,
-                                        objectType );
-        Pattern pattern1 = new Pattern( 1,
-                                        objectType );
-        PatternExtractor extractor = new PatternExtractor( objectType );
-
-        Map variables = new HashMap();
-        variables.put( "pd",
-                       new CLPPreviousDeclarationVariable( new Declaration( "pd",
-                                                                            extractor,
-                                                                            pattern0 ), workingMemory ) );
-        variables.put( "ld",
-                       new CLPLocalDeclarationVariable( new Declaration( "ld",
-                                                                         extractor,
-                                                                         pattern1
-                                                                         ), workingMemory ) );
-
-        ValueHandler val1 = new TempTokenVariable( "pd" );
-        ValueHandler val2 = new IndexedLocalVariableValue( "lv",
-                                                    0 );
-        ValueHandler val3 = new TempTokenVariable( "ld" );
-
-        ExecutionContext context = new ExecutionContextImpl( workingMemory,
-                                                         tuple,
-                                                         new BigDecimal( 10 ),
-                                                         1 );
-        context.setLocalVariable( 0,
-                                  new ObjectValueHandler( new BigDecimal( 10 ) ) );
-
-        FunctionCaller functionValue = new FunctionCaller( new PlusFunction() );
-        functionValue.addParameter( val1 );
-        functionValue.addParameter( val2 );
-
-        PlusFunction add = new PlusFunction();
-
-        FunctionCaller f = new FunctionCaller( add );
-        f.addParameter( val3 );
-        f.addParameter( functionValue );
-
-        f.replaceTempTokens( variables );
-
-        assertEquals( new BigDecimal( 30 ),
-                      f.getBigDecimalValue( context ) );
-
-    }
-}

Deleted: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/BlockExecutionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/BlockExecutionTest.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/BlockExecutionTest.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,60 +0,0 @@
-package org.drools.clips;
-
-import java.math.BigDecimal;
-
-import junit.framework.TestCase;
-
-import org.drools.Person;
-import org.drools.clips.functions.BindFunction;
-import org.drools.clips.functions.ModifyFunction;
-import org.drools.clips.functions.PlusFunction;
-import org.drools.clips.valuehandlers.FunctionCaller;
-import org.drools.clips.valuehandlers.ListValueHandler;
-import org.drools.clips.valuehandlers.LongValueHandler;
-import org.drools.clips.valuehandlers.ObjectValueHandler;
-
-public class BlockExecutionTest extends TestCase {
-    
-    XFunctionRegistry registry;
-    
-    public void setUp() {
-        this.registry = new XFunctionRegistry( BuiltinFunctions.getInstance() );
-    }    
-    
-    public void testAddWithModify() {
-        BlockExecutionEngine engine = new BlockExecutionEngine();        
-        BuildContext build = new ExecutionBuildContext(engine, this.registry );                
-        
-        FunctionCaller addCaller = new FunctionCaller( new PlusFunction() );
-        addCaller.addParameter( new ObjectValueHandler( new BigDecimal( 20) ) );
-        addCaller.addParameter( new LongValueHandler( "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" ) );
-        
-        ListValueHandler list = new ListValueHandler();
-        list.add( new ObjectValueHandler( "age") );
-        list.add( build.getVariableValueHandler( "?x" ) );
-        modifyCaller.addParameter( list );
-        
-        ExecutionContext context = new ExecutionContextImpl(null, null, 2);
-        Person p = new Person("mark");
-        context.setLocalVariable( 1, new ObjectValueHandler( p ) );
-        
-        engine.addFunction( modifyCaller );
-        
-        engine.execute( context );
-        
-        assertEquals( 31, p.getAge() );
-        
-        
-    }
-}

Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/CompiledFunctionsTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/CompiledFunctionsTest.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/CompiledFunctionsTest.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -17,328 +17,324 @@
 import org.antlr.runtime.Lexer;
 import org.antlr.runtime.TokenStream;
 import org.drools.Person;
-import org.drools.clips.valuehandlers.IndexedLocalVariableValue;
-import org.drools.clips.valuehandlers.ListValueHandler;
-import org.drools.clips.valuehandlers.LongValueHandler;
-import org.drools.clips.valuehandlers.ObjectValueHandler;
 
 public class CompiledFunctionsTest extends TestCase {
-    private CLPParser parser;
-
-    public void testPrintout() throws Exception {        
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(printout d xx (eq 1 1) ?c (create$ (+ 1 1) x y) zzz)" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         1 );
-
-        Map vars = new HashMap();
-        vars.put( "?c",
-                  new ObjectValueHandler( "brie" ) );
-        engine.replaceTempTokens( vars );
-
-        ByteArrayOutputStream bais = new ByteArrayOutputStream();                
-        context.addPrintoutRouter( "d", new PrintStream(bais) );
-        
-        engine.execute( context );
-        
-        assertEquals( "xxtruebrie2xyzzz", new String( bais.toByteArray() ) );
-    }
-    
-    public void testBindAndModify() throws Exception {
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?x (+ 20 11) ) (modify ?p (age ?x) )" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         2 );
-
-        Map vars = new HashMap();
-        Person p = new Person( "mark" );
-        vars.put( "?p",
-                  new ObjectValueHandler( p ) );
-        engine.replaceTempTokens( vars );
-
-        engine.execute( context );
-
-        assertEquals( 31,
-                      p.getAge() );
-    }
-
-    public void testSimpleCreate$() throws Exception {
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?x (create$ 1 2 3) )" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         1 );
-        engine.execute( context );
-
-        ListValueHandler list = (ListValueHandler) context.getLocalVariable( 0 );
-
-        assertEquals( 3,
-                      list.size() );
-
-        assertEquals( 1,
-                      list.getList()[0].getIntValue( context ) );
-        assertEquals( 2,
-                      list.getList()[1].getIntValue( context ) );
-        assertEquals( 3,
-                      list.getList()[2].getIntValue( context ) );
-    }
-
-    public void testNestedCreate$() throws Exception {
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?x (create$ 1 2 (+ 1 2) ) ) (bind ?y (create$ (+ 1 0) ?x (create$ a b ?x (+ 1 1) ) 3) )" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         2 );
-        engine.execute( context );
-
-        // check ?x
-        ListValueHandler list = (ListValueHandler) context.getLocalVariable( 0 );
-        assertEquals( 3,
-                      list.size() );
-        assertEquals( 1,
-                      list.getList()[0].getIntValue( context ) );
-        assertEquals( 2,
-                      list.getList()[1].getIntValue( context ) );
-        assertEquals( new BigDecimal( 3 ),
-                      list.getList()[2].getBigDecimalValue( context ) );
-
-        // check ?y
-        list = (ListValueHandler) context.getLocalVariable( 1 );
-        assertEquals( 11,
-                      list.size() );
-
-        assertEquals( new BigDecimal( 1 ),
-                      list.getList()[0].getBigDecimalValue( context ) );
-        assertEquals( 1,
-                      list.getList()[1].getIntValue( context ) );
-        assertEquals( 2,
-                      list.getList()[2].getIntValue( context ) );
-        assertEquals( new BigDecimal( 3 ),
-                      list.getList()[3].getBigDecimalValue( context ) );
-        assertEquals( "a",
-                      list.getList()[4].getStringValue( context ) );
-        assertEquals( "b",
-                      list.getList()[5].getStringValue( context ) );
-        assertEquals( 1,
-                      list.getList()[6].getIntValue( context ) );
-        assertEquals( 2,
-                      list.getList()[7].getIntValue( context ) );
-        assertEquals( new BigDecimal( 3 ),
-                      list.getList()[8].getBigDecimalValue( context ) );
-        assertEquals( new BigDecimal( 2 ),
-                      list.getList()[9].getBigDecimalValue( context ) );
-        assertEquals( 3,
-                      list.getList()[10].getIntValue( context ) );
-    }
-
-    public void testIf() throws Exception {
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(if (< ?x ?y ) then (modify ?p (age 15) ) (printout d 15) else (modify ?p (age 5)) (printout d 5) )" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         2 );
-
-        Person p = new Person( "mark" );
-        Map vars = new HashMap();
-
-        vars.put( "?x",
-                  new LongValueHandler( 10 ) );
-        vars.put( "?y",
-                  new IndexedLocalVariableValue( "?y",
-                                          0 ) );
-        vars.put( "?p",
-                  new ObjectValueHandler( p ) );
-        engine.replaceTempTokens( vars );
-
-        context.setLocalVariable( 0,
-                                  new LongValueHandler( 20 ) );        
-        ByteArrayOutputStream bais = new ByteArrayOutputStream();                
-        context.addPrintoutRouter( "d", new PrintStream(bais) );        
-        engine.execute( context );
-        assertEquals( 15,
-                      p.getAge() );
-        assertEquals( "15", new String( bais.toByteArray() ) );
-        
-        
-        context.setLocalVariable( 0,
-                                  new LongValueHandler( 7 ) );
-        bais = new ByteArrayOutputStream();                
-        context.addPrintoutRouter( "d", new PrintStream(bais) );          
-        engine.execute( context );
-        assertEquals( 5,
-                      p.getAge() );
-        assertEquals( "5", new String( bais.toByteArray() ) );
-    }
-
-    public void testWhile() throws Exception {               
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(while (< ?x ?y) do (bind ?x (+ ?x 1)) (printout d ?x \" \") )" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         2 );
-
-        Map vars = new HashMap();
-
-        vars.put( "?x",
-                  new IndexedLocalVariableValue( "?x",
-                                          0 ) );
-        vars.put( "?y",
-                  new IndexedLocalVariableValue( "?y",
-                                          1 ) );
-        engine.replaceTempTokens( vars );
-
-        context.setLocalVariable( 0,
-                                  new LongValueHandler( 0 ) );
-        context.setLocalVariable( 1,
-                                  new LongValueHandler( 10 ) );
-        
-        ByteArrayOutputStream bais = new ByteArrayOutputStream();              
-        context.addPrintoutRouter( "d", new PrintStream(bais) );                                
-
-        engine.execute( context );
-        assertEquals( new BigDecimal( 10 ),
-                      context.getLocalVariable( 0 ).getBigDecimalValue( context ) );
-        
-        assertEquals( "1 2 3 4 5 6 7 8 9 10 ", new String( bais.toByteArray() ) );        
-    }
-
-    public void testForeach() throws Exception {
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?x 0) (foreach ?e (create$ 1 2 3) (bind ?x (+ ?x ?e) ) (printout d ?x \" \") )" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         2 );
-        
-        ByteArrayOutputStream bais = new ByteArrayOutputStream();              
-        context.addPrintoutRouter( "d", new PrintStream(bais) );         
-        
-        engine.execute( context );
-        assertEquals( new BigDecimal( 6 ),
-                      context.getLocalVariable( 0 ).getBigDecimalValue( context ) );
-        
-        assertEquals( "1 3 6 ", new String( bais.toByteArray() ) );          
-    }
-    
-    public void testSwitch() throws Exception {
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?cheese ?var) (switch ?cheese (case stilton then (bind ?x ?cheese ) (break) ) (case cheddar then (bind ?x ?cheese ) (break) ) (default (bind ?x \"default\" ) ) )" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         3 );
-
-        Map vars = new HashMap();
-
-        vars.put( "?var",
-                  new IndexedLocalVariableValue( "?var",
-                                          2 ) );        
-        engine.replaceTempTokens( vars );
-
-        // try it with stilton
-        context.setLocalVariable( 2,
-                                  new ObjectValueHandler( "stilton" ) );
-        engine.execute( context );        
-        assertEquals( "stilton" ,
-                      context.getLocalVariable( 1 ).getObject( context ) );
-
-        // try it with cheddar        
-        context.setLocalVariable( 2,
-                                  new ObjectValueHandler( "cheddar" ) );
-        engine.execute( context );        
-        assertEquals( "cheddar" ,
-                      context.getLocalVariable( 1 ).getObject( context ) );        
-        
-        // try it with a brie, which has no matching case        
-        context.setLocalVariable( 2,
-                                  new ObjectValueHandler( "brie" ) );
-        engine.execute( context );        
-        assertEquals( "default" ,
-                      context.getLocalVariable( 1 ).getObject( context ) );                          
-    }    
-    
-    public void testProgn() throws Exception {
-        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?n 2) (while (progn (bind ?n (* ?n ?n)) (< ?n 1000)) do (printout d ?n) )" ).execution_block();
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         2 );
-        
-        ByteArrayOutputStream bais = new ByteArrayOutputStream();              
-        context.addPrintoutRouter( "d", new PrintStream(bais) );                                
-
-        engine.execute( context );
-        
-        assertEquals( "416256", new String( bais.toByteArray() ) );          
-    }
-    
-    public void testDefTemplate() throws Exception {
-        Deffunction engine = (Deffunction) parse( "(deffunction factorial (?n) (if (>= ?n 1) then (* ?n (factorial (- ?n 1))) else 1)) " ).deffunction();
-        
-        ExecutionContext context = new ExecutionContextImpl( null,
-                                                         null,
-                                                         1 );
-
-        ByteArrayOutputStream bais = new ByteArrayOutputStream();              
-        context.addPrintoutRouter( "d", new PrintStream(bais) );                                              
-        
-        assertEquals( 720,engine.execute( new ValueHandler[] { new LongValueHandler( 6 ) }, context ).getBigDecimalValue( context ).longValue() );    
-    }    
-
-    private CLPParser parse(final String text) throws Exception {
-        this.parser = newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
-        return this.parser;
-    }
-
-    private CLPParser parse(final String source,
-                            final String text) throws Exception {
-        this.parser = newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
-        this.parser.setSource( source );
-        return this.parser;
-    }
-
-    private Reader getReader(final String name) throws Exception {
-        final InputStream in = getClass().getResourceAsStream( name );
-
-        return new InputStreamReader( in );
-    }
-
-    private CLPParser parseResource(final String name) throws Exception {
-        Reader reader = getReader( name );
-
-        final StringBuffer text = new StringBuffer();
-
-        final char[] buf = new char[1024];
-        int len = 0;
-
-        while ( (len = reader.read( buf )) >= 0 ) {
-            text.append( buf,
-                         0,
-                         len );
-        }
-
-        return parse( name,
-                      text.toString() );
-    }
-
-    private CharStream newCharStream(final String text) {
-        return new ANTLRStringStream( text );
-    }
-
-    private CLPLexer newLexer(final CharStream charStream) {
-        return new CLPLexer( charStream );
-    }
-
-    private TokenStream newTokenStream(final Lexer lexer) {
-        return new CommonTokenStream( lexer );
-    }
-
-    private CLPParser newParser(final TokenStream tokenStream) {
-        final CLPParser p = new CLPParser( tokenStream );
-        p.setFunctionRegistry( new XFunctionRegistry( BuiltinFunctions.getInstance() ) );
-        //p.setParserDebug( true );
-        return p;
-    }
-
-    private void assertEqualsIgnoreWhitespace(final String expected,
-                                              final String actual) {
-        final String cleanExpected = expected.replaceAll( "\\s+",
-                                                          "" );
-        final String cleanActual = actual.replaceAll( "\\s+",
-                                                      "" );
-
-        assertEquals( cleanExpected,
-                      cleanActual );
-    }
+//    private CLPParser parser;
+//
+//    public void testPrintout() throws Exception {        
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(printout d xx (eq 1 1) ?c (create$ (+ 1 1) x y) zzz)" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         1 );
+//
+//        Map vars = new HashMap();
+//        vars.put( "?c",
+//                  new ObjectValueHandler( "brie" ) );
+//        engine.replaceTempTokens( vars );
+//
+//        ByteArrayOutputStream bais = new ByteArrayOutputStream();                
+//        context.addPrintoutRouter( "d", new PrintStream(bais) );
+//        
+//        engine.execute( context );
+//        
+//        assertEquals( "xxtruebrie2xyzzz", new String( bais.toByteArray() ) );
+//    }
+//    
+//    public void testBindAndModify() throws Exception {
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?x (+ 20 11) ) (modify ?p (age ?x) )" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         2 );
+//
+//        Map vars = new HashMap();
+//        Person p = new Person( "mark" );
+//        vars.put( "?p",
+//                  new ObjectValueHandler( p ) );
+//        engine.replaceTempTokens( vars );
+//
+//        engine.execute( context );
+//
+//        assertEquals( 31,
+//                      p.getAge() );
+//    }
+//
+//    public void testSimpleCreate$() throws Exception {
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?x (create$ 1 2 3) )" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         1 );
+//        engine.execute( context );
+//
+//        ListValueHandler list = (ListValueHandler) context.getLocalVariable( 0 );
+//
+//        assertEquals( 3,
+//                      list.size() );
+//
+//        assertEquals( 1,
+//                      list.getList()[0].getIntValue( context ) );
+//        assertEquals( 2,
+//                      list.getList()[1].getIntValue( context ) );
+//        assertEquals( 3,
+//                      list.getList()[2].getIntValue( context ) );
+//    }
+//
+//    public void testNestedCreate$() throws Exception {
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?x (create$ 1 2 (+ 1 2) ) ) (bind ?y (create$ (+ 1 0) ?x (create$ a b ?x (+ 1 1) ) 3) )" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         2 );
+//        engine.execute( context );
+//
+//        // check ?x
+//        ListValueHandler list = (ListValueHandler) context.getLocalVariable( 0 );
+//        assertEquals( 3,
+//                      list.size() );
+//        assertEquals( 1,
+//                      list.getList()[0].getIntValue( context ) );
+//        assertEquals( 2,
+//                      list.getList()[1].getIntValue( context ) );
+//        assertEquals( new BigDecimal( 3 ),
+//                      list.getList()[2].getBigDecimalValue( context ) );
+//
+//        // check ?y
+//        list = (ListValueHandler) context.getLocalVariable( 1 );
+//        assertEquals( 11,
+//                      list.size() );
+//
+//        assertEquals( new BigDecimal( 1 ),
+//                      list.getList()[0].getBigDecimalValue( context ) );
+//        assertEquals( 1,
+//                      list.getList()[1].getIntValue( context ) );
+//        assertEquals( 2,
+//                      list.getList()[2].getIntValue( context ) );
+//        assertEquals( new BigDecimal( 3 ),
+//                      list.getList()[3].getBigDecimalValue( context ) );
+//        assertEquals( "a",
+//                      list.getList()[4].getStringValue( context ) );
+//        assertEquals( "b",
+//                      list.getList()[5].getStringValue( context ) );
+//        assertEquals( 1,
+//                      list.getList()[6].getIntValue( context ) );
+//        assertEquals( 2,
+//                      list.getList()[7].getIntValue( context ) );
+//        assertEquals( new BigDecimal( 3 ),
+//                      list.getList()[8].getBigDecimalValue( context ) );
+//        assertEquals( new BigDecimal( 2 ),
+//                      list.getList()[9].getBigDecimalValue( context ) );
+//        assertEquals( 3,
+//                      list.getList()[10].getIntValue( context ) );
+//    }
+//
+//    public void testIf() throws Exception {
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(if (< ?x ?y ) then (modify ?p (age 15) ) (printout d 15) else (modify ?p (age 5)) (printout d 5) )" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         2 );
+//
+//        Person p = new Person( "mark" );
+//        Map vars = new HashMap();
+//
+//        vars.put( "?x",
+//                  new LongValueHandler( 10 ) );
+//        vars.put( "?y",
+//                  new IndexedLocalVariableValue( "?y",
+//                                          0 ) );
+//        vars.put( "?p",
+//                  new ObjectValueHandler( p ) );
+//        engine.replaceTempTokens( vars );
+//
+//        context.setLocalVariable( 0,
+//                                  new LongValueHandler( 20 ) );        
+//        ByteArrayOutputStream bais = new ByteArrayOutputStream();                
+//        context.addPrintoutRouter( "d", new PrintStream(bais) );        
+//        engine.execute( context );
+//        assertEquals( 15,
+//                      p.getAge() );
+//        assertEquals( "15", new String( bais.toByteArray() ) );
+//        
+//        
+//        context.setLocalVariable( 0,
+//                                  new LongValueHandler( 7 ) );
+//        bais = new ByteArrayOutputStream();                
+//        context.addPrintoutRouter( "d", new PrintStream(bais) );          
+//        engine.execute( context );
+//        assertEquals( 5,
+//                      p.getAge() );
+//        assertEquals( "5", new String( bais.toByteArray() ) );
+//    }
+//
+//    public void testWhile() throws Exception {               
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(while (< ?x ?y) do (bind ?x (+ ?x 1)) (printout d ?x \" \") )" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         2 );
+//
+//        Map vars = new HashMap();
+//
+//        vars.put( "?x",
+//                  new IndexedLocalVariableValue( "?x",
+//                                          0 ) );
+//        vars.put( "?y",
+//                  new IndexedLocalVariableValue( "?y",
+//                                          1 ) );
+//        engine.replaceTempTokens( vars );
+//
+//        context.setLocalVariable( 0,
+//                                  new LongValueHandler( 0 ) );
+//        context.setLocalVariable( 1,
+//                                  new LongValueHandler( 10 ) );
+//        
+//        ByteArrayOutputStream bais = new ByteArrayOutputStream();              
+//        context.addPrintoutRouter( "d", new PrintStream(bais) );                                
+//
+//        engine.execute( context );
+//        assertEquals( new BigDecimal( 10 ),
+//                      context.getLocalVariable( 0 ).getBigDecimalValue( context ) );
+//        
+//        assertEquals( "1 2 3 4 5 6 7 8 9 10 ", new String( bais.toByteArray() ) );        
+//    }
+//
+//    public void testForeach() throws Exception {
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?x 0) (foreach ?e (create$ 1 2 3) (bind ?x (+ ?x ?e) ) (printout d ?x \" \") )" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         2 );
+//        
+//        ByteArrayOutputStream bais = new ByteArrayOutputStream();              
+//        context.addPrintoutRouter( "d", new PrintStream(bais) );         
+//        
+//        engine.execute( context );
+//        assertEquals( new BigDecimal( 6 ),
+//                      context.getLocalVariable( 0 ).getBigDecimalValue( context ) );
+//        
+//        assertEquals( "1 3 6 ", new String( bais.toByteArray() ) );          
+//    }
+//    
+//    public void testSwitch() throws Exception {
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?cheese ?var) (switch ?cheese (case stilton then (bind ?x ?cheese ) (break) ) (case cheddar then (bind ?x ?cheese ) (break) ) (default (bind ?x \"default\" ) ) )" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         3 );
+//
+//        Map vars = new HashMap();
+//
+//        vars.put( "?var",
+//                  new IndexedLocalVariableValue( "?var",
+//                                          2 ) );        
+//        engine.replaceTempTokens( vars );
+//
+//        // try it with stilton
+//        context.setLocalVariable( 2,
+//                                  new ObjectValueHandler( "stilton" ) );
+//        engine.execute( context );        
+//        assertEquals( "stilton" ,
+//                      context.getLocalVariable( 1 ).getObject( context ) );
+//
+//        // try it with cheddar        
+//        context.setLocalVariable( 2,
+//                                  new ObjectValueHandler( "cheddar" ) );
+//        engine.execute( context );        
+//        assertEquals( "cheddar" ,
+//                      context.getLocalVariable( 1 ).getObject( context ) );        
+//        
+//        // try it with a brie, which has no matching case        
+//        context.setLocalVariable( 2,
+//                                  new ObjectValueHandler( "brie" ) );
+//        engine.execute( context );        
+//        assertEquals( "default" ,
+//                      context.getLocalVariable( 1 ).getObject( context ) );                          
+//    }    
+//    
+//    public void testProgn() throws Exception {
+//        BlockExecutionEngine engine = (BlockExecutionEngine) parse( "(bind ?n 2) (while (progn (bind ?n (* ?n ?n)) (< ?n 1000)) do (printout d ?n) )" ).execution_block();
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         2 );
+//        
+//        ByteArrayOutputStream bais = new ByteArrayOutputStream();              
+//        context.addPrintoutRouter( "d", new PrintStream(bais) );                                
+//
+//        engine.execute( context );
+//        
+//        assertEquals( "416256", new String( bais.toByteArray() ) );          
+//    }
+//    
+//    public void testDefTemplate() throws Exception {
+//        Deffunction engine = (Deffunction) parse( "(deffunction factorial (?n) (if (>= ?n 1) then (* ?n (factorial (- ?n 1))) else 1)) " ).deffunction();
+//        
+//        ExecutionContext context = new ExecutionContextImpl( null,
+//                                                         null,
+//                                                         1 );
+//
+//        ByteArrayOutputStream bais = new ByteArrayOutputStream();              
+//        context.addPrintoutRouter( "d", new PrintStream(bais) );                                              
+//        
+//        assertEquals( 720,engine.execute( new ValueHandler[] { new LongValueHandler( 6 ) }, context ).getBigDecimalValue( context ).longValue() );    
+//    }    
+//
+//    private CLPParser parse(final String text) throws Exception {
+//        this.parser = newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
+//        return this.parser;
+//    }
+//
+//    private CLPParser parse(final String source,
+//                            final String text) throws Exception {
+//        this.parser = newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
+//        this.parser.setSource( source );
+//        return this.parser;
+//    }
+//
+//    private Reader getReader(final String name) throws Exception {
+//        final InputStream in = getClass().getResourceAsStream( name );
+//
+//        return new InputStreamReader( in );
+//    }
+//
+//    private CLPParser parseResource(final String name) throws Exception {
+//        Reader reader = getReader( name );
+//
+//        final StringBuffer text = new StringBuffer();
+//
+//        final char[] buf = new char[1024];
+//        int len = 0;
+//
+//        while ( (len = reader.read( buf )) >= 0 ) {
+//            text.append( buf,
+//                         0,
+//                         len );
+//        }
+//
+//        return parse( name,
+//                      text.toString() );
+//    }
+//
+//    private CharStream newCharStream(final String text) {
+//        return new ANTLRStringStream( text );
+//    }
+//
+//    private CLPLexer newLexer(final CharStream charStream) {
+//        return new CLPLexer( charStream );
+//    }
+//
+//    private TokenStream newTokenStream(final Lexer lexer) {
+//        return new CommonTokenStream( lexer );
+//    }
+//
+//    private CLPParser newParser(final TokenStream tokenStream) {
+//        final CLPParser p = new CLPParser( tokenStream );
+//        p.setFunctionRegistry( new XFunctionRegistry( BuiltinFunctions.getInstance() ) );
+//        //p.setParserDebug( true );
+//        return p;
+//    }
+//
+//    private void assertEqualsIgnoreWhitespace(final String expected,
+//                                              final String actual) {
+//        final String cleanExpected = expected.replaceAll( "\\s+",
+//                                                          "" );
+//        final String cleanActual = actual.replaceAll( "\\s+",
+//                                                      "" );
+//
+//        assertEquals( cleanExpected,
+//                      cleanActual );
+//    }
 }

Deleted: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/DeffunctionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/DeffunctionTest.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/DeffunctionTest.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,36 +0,0 @@
-package org.drools.clips;
-
-import java.math.BigDecimal;
-
-import org.drools.clips.Function;
-import org.drools.clips.functions.PlusFunction;
-import org.drools.clips.valuehandlers.FunctionCaller;
-import org.drools.clips.valuehandlers.IndexedLocalVariableValue;
-import org.drools.clips.valuehandlers.LongValueHandler;
-
-import junit.framework.TestCase;
-
-public class DeffunctionTest extends TestCase {
-    public void testSimpleDeffunction() {
-        Deffunction function = new Deffunction("x");
-         
-        ValueHandler a = function.addParameter( "a" );        
-        ValueHandler b =function.addParameter( "b" );
-        
-        Function add = new PlusFunction();
-        FunctionCaller caller = new FunctionCaller(add);
-        caller.addParameter( a );
-        caller.addParameter( b );
-                
-        function.addFunction( caller );
-                
-        ExecutionContext context = new ExecutionContextImpl(null, null, 2);
-        ValueHandler q = new IndexedLocalVariableValue("q", 0);
-        q.setValue( context, new LongValueHandler( 10 ) );
-        
-        ValueHandler w = new IndexedLocalVariableValue("w", 1);
-        w.setValue( context,  new LongValueHandler( 7 ) );
-        
-        assertEquals( new BigDecimal( 17 ), function.execute( new ValueHandler[] { q, w }, context ).getBigDecimalValue( context ) );
-    }      
-}

Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/FunctionFactoryTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/FunctionFactoryTest.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/FunctionFactoryTest.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -4,11 +4,11 @@
 
 public class FunctionFactoryTest extends TestCase {
     public void testInit() {
-        XFunctionRegistry factory = new XFunctionRegistry( BuiltinFunctions.getInstance() );
-        
-        // make sure some core functions are there
-        assertSame( "+", factory.getFunction( "+" ).getName() );
-        assertSame( "bind" , factory.getFunction( "bind" ).getName() );
-        assertSame( "modify" , factory.getFunction( "modify" ).getName() );
+//        XFunctionRegistry factory = new XFunctionRegistry( BuiltinFunctions.getInstance() );
+//        
+//        // make sure some core functions are there
+//        assertSame( "+", factory.getFunction( "+" ).getName() );
+//        assertSame( "bind" , factory.getFunction( "bind" ).getName() );
+//        assertSame( "modify" , factory.getFunction( "modify" ).getName() );
     }
 }

Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/LhsClpParserTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/LhsClpParserTest.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/LhsClpParserTest.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -10,11 +10,6 @@
 import org.antlr.runtime.ANTLRStringStream;
 import org.antlr.runtime.CharStream;
 import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.Lexer;
-import org.antlr.runtime.TokenStream;
-import org.drools.clips.valuehandlers.DoubleValueHandler;
-import org.drools.clips.valuehandlers.FunctionCaller;
-import org.drools.clips.valuehandlers.LongValueHandler;
 import org.drools.lang.descr.AndDescr;
 import org.drools.lang.descr.AttributeDescr;
 import org.drools.lang.descr.EvalDescr;
@@ -29,29 +24,30 @@
 import org.drools.lang.descr.RestrictionConnectiveDescr;
 import org.drools.lang.descr.ReturnValueRestrictionDescr;
 import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.builder.BuildContext;
 
 public class LhsClpParserTest extends TestCase {
 
-    private CLPParser parser;
+    private ClipsParser parser;
     
-    XFunctionRegistry registry;
+    //XFunctionRegistry registry;
     
     public void setUp() {
-        this.registry = new XFunctionRegistry( BuiltinFunctions.getInstance() );
+        //this.registry = new XFunctionRegistry( BuiltinFunctions.getInstance() );
     }
     
     protected void tearDown() throws Exception {
         super.tearDown();
-        this.parser = null;
+        //this.parser = null;
     }
 
     public void testParseFunction() throws Exception {        
-        BuildContext context = new ExecutionBuildContext( new CLPPredicate(), this.registry );
-        FunctionCaller fc = ( FunctionCaller ) parse( "(< 1 2)" ).lisp_list( context, new LispForm2(context) );
-        
-        assertEquals( "<", fc.getName() );        
-        assertEquals( new LongValueHandler( 1 ), fc.getParameters()[0] );
-        assertEquals( new LongValueHandler( 2 ), fc.getParameters()[1] );
+//        BuildContext context = new ExecutionBuildContext( new CLPPredicate(), this.registry );
+//        FunctionCaller fc = ( FunctionCaller ) parse( "(< 1 2)" ).lisp_list( context, new LispForm2(context) );
+//        
+//        assertEquals( "<", fc.getName() );        
+//        assertEquals( new LongValueHandler( 1 ), fc.getParameters()[0] );
+//        assertEquals( new LongValueHandler( 2 ), fc.getParameters()[1] );
     }
     
     public void testPatternsRule() throws Exception {
@@ -82,7 +78,7 @@
 
         // Parse the first pattern
         PatternDescr personPattern = (PatternDescr) lhsList.get( 0 );
-        assertEquals( "?b",
+        assertEquals( "$b",
                       personPattern.getIdentifier() );
         assertEquals( "person",
                       personPattern.getObjectType() );
@@ -93,7 +89,7 @@
         
         // first, we have a field binding
         FieldBindingDescr fbd = (FieldBindingDescr) colList.get( 0 );
-        assertEquals( "?bf",
+        assertEquals( "$bf",
                       fbd.getIdentifier() );
         assertEquals( "name",
                       fbd.getFieldName() );
@@ -138,25 +134,21 @@
         ReturnValueRestrictionDescr retDescr = (ReturnValueRestrictionDescr) and.getRestrictions().get( 0 );
         assertEquals( "!=",
                       retDescr.getEvaluator() );
-        CLPReturnValue clprv = ( CLPReturnValue ) retDescr.getContent();
-        FunctionCaller fc = clprv.getFunctions()[0];
-        assertEquals( "+", fc.getName() );        
-        assertEquals( new LongValueHandler( 2 ), fc.getParameters()[0] );
-        assertEquals( new LongValueHandler( 3 ), fc.getParameters()[1] );       
+        
+        LispForm lispForm = ( LispForm ) retDescr.getContent();
+        assertEquals("(+ 2 3)", lispForm.toString() );                         
 
         // ----------------
         // this is how it would be compatible to our core engine
-        PredicateDescr predicateDescr = (PredicateDescr) and.getRestrictions().get( 1 );        
-        CLPPredicate clpp = ( CLPPredicate ) predicateDescr.getContent();
-        fc = clpp.getFunctions()[0];
-        assertEquals( "<", fc.getName() );        
-        assertEquals( new LongValueHandler( 1 ), fc.getParameters()[0] );
-        assertEquals( new LongValueHandler( 2 ), fc.getParameters()[1] );        
+        PredicateDescr predicateDescr = (PredicateDescr) and.getRestrictions().get( 1 );
+        
+        lispForm = ( LispForm ) predicateDescr.getContent();
+        assertEquals("(< 1 2)", lispForm.toString() );                
 
         // -----------------
         // Parse the second column
         PatternDescr hobbyPattern = (PatternDescr) lhsList.get( 1 );
-        assertEquals( "?c",
+        assertEquals( "$c",
                       hobbyPattern.getIdentifier() );
         assertEquals( "hobby",
                       hobbyPattern.getObjectType() );
@@ -166,7 +158,7 @@
                       colList.size() );
 
         fbd = (FieldBindingDescr) colList.get( 0 );
-        assertEquals( "?bf2",
+        assertEquals( "$bf2",
                       fbd.getIdentifier() );
         assertEquals( "type",
                       fbd.getFieldName() );
@@ -212,7 +204,7 @@
 
         // Parse the first column
         PatternDescr col = (PatternDescr) lhsList.get( 0 );
-        assertEquals( "?b",
+        assertEquals( "$b",
                       col.getIdentifier() );
         assertEquals( "person",
                       col.getObjectType() );
@@ -338,12 +330,8 @@
                       lhsList.size() );
 
         EvalDescr evalDescr = (EvalDescr) lhsList.get( 0 );
-        
-        CLPEval clpe = ( CLPEval ) evalDescr.getContent();
-        FunctionCaller f = clpe.getFunctions()[0];
-        assertEquals( "<", f.getName() );        
-        assertEquals( new DoubleValueHandler( 9.0 ), f.getParameters()[0] );
-        assertEquals( new DoubleValueHandler( 1.3 ), f.getParameters()[1] );          
+        LispForm lispForm = ( LispForm ) evalDescr.getContent();
+        assertEquals("(< 9.0 1.3)", lispForm.toString() );                          
     }
 
     public void testRuleHeader() throws Exception {
@@ -367,14 +355,13 @@
         
     }
     
-    private CLPParser parse(final String text) throws Exception {
-        this.parser = newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
-        return this.parser;
+    private ClipsParser parse(final String text) throws Exception {
+        return new ClipsParser( new CommonTokenStream( new ClipsLexer( new ANTLRStringStream( text ) ) ) );
     }
 
-    private CLPParser parse(final String source,
+    private ClipsParser parse(final String source,
                             final String text) throws Exception {
-        this.parser = newParser( newTokenStream( newLexer( newCharStream( text ) ) ) );
+        this.parser =  new ClipsParser( new CommonTokenStream( new ClipsLexer( new ANTLRStringStream( text ) ) ) );
         this.parser.setSource( source );
         return this.parser;
     }
@@ -385,9 +372,7 @@
         return new InputStreamReader( in );
     }
 
-    private CLPParser parseResource(final String name) throws Exception {
-
-        //        System.err.println( getClass().getResource( name ) );
+    private ClipsParser parseResource(final String name) throws Exception {
         Reader reader = getReader( name );
 
         final StringBuffer text = new StringBuffer();
@@ -409,21 +394,7 @@
         return new ANTLRStringStream( text );
     }
 
-    private CLPLexer newLexer(final CharStream charStream) {
-        return new CLPLexer( charStream );
-    }
 
-    private TokenStream newTokenStream(final Lexer lexer) {
-        return new CommonTokenStream( lexer );
-    }
-
-    private CLPParser newParser(final TokenStream tokenStream) {
-        final CLPParser p = new CLPParser( tokenStream );
-        p.setFunctionRegistry( new XFunctionRegistry( BuiltinFunctions.getInstance() )  );
-        //p.setParserDebug( true );
-        return p;
-    }
-
     private void assertEqualsIgnoreWhitespace(final String expected,
                                               final String actual) {
         final String cleanExpected = expected.replaceAll( "\\s+",

Deleted: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/ModifyFunctionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/ModifyFunctionTest.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/ModifyFunctionTest.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,32 +0,0 @@
-package org.drools.clips;
-
-import org.drools.Person;
-import org.drools.clips.Function;
-import org.drools.clips.functions.ModifyFunction;
-import org.drools.clips.valuehandlers.IndexedLocalVariableValue;
-import org.drools.clips.valuehandlers.ListValueHandler;
-import org.drools.clips.valuehandlers.ObjectValueHandler;
-
-import junit.framework.TestCase;
-
-public class ModifyFunctionTest extends TestCase {
-    public void testSimpleModifyFunction() {
-        Function function = new ModifyFunction();
-        
-       Person p = new Person("mark");
-       ExecutionContext context = new ExecutionContextImpl(null, null, 1);
-       //context.setLocalVariable( 0, p );
-       
-       IndexedLocalVariableValue var = new IndexedLocalVariableValue("p", 0);
-       var.setValue( context, new ObjectValueHandler( p ) );
-       
-       ListValueHandler list = new ListValueHandler();
-       list.add( new ObjectValueHandler( "name") );
-       list.add( new ObjectValueHandler( "bob") );
-       
-       
-       function.execute( new ValueHandler[] { var, list }, context );
-       
-       assertEquals( "bob", p.getName() );
-    }
-}

Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/ShellTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/ShellTest.java	2008-02-05 17:16:08 UTC (rev 18317)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/ShellTest.java	2008-02-05 17:56:14 UTC (rev 18318)
@@ -1,70 +1,283 @@
 package org.drools.clips;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
 import junit.framework.TestCase;
 
 import org.drools.Person;
-import org.drools.RuleBase;
 import org.drools.WorkingMemory;
-import org.drools.clips.OldShell;
+import org.drools.clips.FunctionHandlers;
+import org.drools.clips.Shell;
+import org.drools.clips.functions.AssertFunction;
+import org.drools.clips.functions.BindFunction;
+import org.drools.clips.functions.CallFunction;
+import org.drools.clips.functions.CreateListFunction;
+import org.drools.clips.functions.EqFunction;
+import org.drools.clips.functions.GetFunction;
+import org.drools.clips.functions.IfFunction;
+import org.drools.clips.functions.LessThanFunction;
+import org.drools.clips.functions.ModifyFunction;
+import org.drools.clips.functions.MoreThanFunction;
+import org.drools.clips.functions.MultiplyFunction;
+import org.drools.clips.functions.NewFunction;
+import org.drools.clips.functions.PlusFunction;
+import org.drools.clips.functions.PrintoutFunction;
+import org.drools.clips.functions.PrognFunction;
+import org.drools.clips.functions.ReturnFunction;
+import org.drools.clips.functions.RunFunction;
+import org.drools.clips.functions.SetFunction;
+import org.drools.clips.functions.SwitchFunction;
 import org.drools.rule.Package;
 import org.drools.rule.Rule;
 
 public class ShellTest extends TestCase {
-    public void test1() {
-        OldShell shell = new OldShell();
-        
-        shell.evalString( "(import org.drools.Person)" );
-        
-        shell.evalString( "(defrule yyy  => (printout t yy \" \" (eq 1 1) ) ) )" );        
-        Package pkg = shell.getWorkingMemory().getRuleBase().getPackage( "MAIN" );
-        
-        Rule rule = pkg.getRule( "yyy" );
-        assertEquals( "yyy", rule.getName() );
-        
-        shell.evalString( "(defrule xxx (Person (name ?name&bob) (age 30) ) (Person  (name ?name) (age 35)) => (printout t xx \" \" (eq 1 1) ) )" );
-        
-        
-        rule = pkg.getRule( "xxx" );
-        assertEquals( "xxx", rule.getName() );
-        
+    private ByteArrayOutputStream baos;
 
-        
-        assertEquals( 2, pkg.getRules().length );
-        
-        assertTrue( pkg.getImports().containsKey( "org.drools.Person" ) );
-        
-        WorkingMemory wm = shell.getWorkingMemory();
-        wm.insert( new Person("bob", "cheddar", 30) );
-        wm.insert( new Person("bob", "stilton", 35) );        
-        wm.fireAllRules();        
+    Shell                         shell;
+
+    public void setUp() {
+        FunctionHandlers handlers = FunctionHandlers.getInstance();
+        handlers.registerFunction( new PlusFunction() );
+        handlers.registerFunction( new MultiplyFunction() );
+        handlers.registerFunction( new ModifyFunction() );
+        handlers.registerFunction( new CreateListFunction() );
+        handlers.registerFunction( new PrintoutFunction() );
+        handlers.registerFunction( new PrognFunction() );
+        handlers.registerFunction( new IfFunction() );
+        handlers.registerFunction( new LessThanFunction() );
+        handlers.registerFunction( new MoreThanFunction() );
+        handlers.registerFunction( new EqFunction() );
+        handlers.registerFunction( new SwitchFunction() );
+        //handlers.registerFunction( new DeffunctionFunction() );    
+        handlers.registerFunction( new ReturnFunction() );
+        handlers.registerFunction( new RunFunction() );
+        handlers.registerFunction( new BindFunction() );
+        handlers.registerFunction( new NewFunction() );
+        handlers.registerFunction( new SetFunction() );
+        handlers.registerFunction( new GetFunction() );
+        handlers.registerFunction( new CallFunction() );
+        handlers.registerFunction( new AssertFunction() );
+
+        this.shell = new Shell();
+
+        this.baos = new ByteArrayOutputStream();
+        shell.addRouter( "t",
+                         new PrintStream( baos ) );
     }
+
+    //    public void test1() {
+    //        String expr = "(* (+ 4 4 ) 2) (create$ 10 20 (+ 10 10) a) (modify ?p (name mark) (location \"london\")(age (+ 16 16) ) ) (printout t a b c (+ 4 4) )";
+    //        
+    //        SExpression[] lisplists = evalString( expr );
+    //
+    //        StringBuilderAppendable appendable = new StringBuilderAppendable();        
+    //        MVELClipsContext context = new MVELClipsContext();         
+    //        for ( SExpression sExpression : lisplists ) {
+    //            FunctionHandlers.dump( sExpression, appendable, context );
+    //        }
+    //        
+    //        System.out.println( appendable );
+    //    }
+
+    public void testBind() {
+        String expr = "(bind ?x (create$ 10 20 30) ) (printout t ?x)";
+
+        this.shell.eval( expr );
+
+        assertEquals( "[10, 20, 30]",
+                      new String( baos.toByteArray() ) );
+    }
+
+    public void testProgn() {
+        String expr = "(progn (?x (create$ 10 20 30) ) (printout t ?x) )";
+
+        this.shell.eval( expr );
+
+        assertEquals( "102030",
+                      new String( baos.toByteArray() ) );
+    }
+
+    public void testIf() {
+        String expr = "(if (< 1 3) then (printout t hello) (printout t hello) )";
+
+        this.shell.eval( expr );
+
+        assertEquals( "hellohello",
+                      new String( baos.toByteArray() ) );
+    }
+
+    public void testIfElse() {
+        String expr = "(if (eq 1 3) then (printout t hello)  (printout t 1) else (printout t hello)  (printout t 2))";
+
+        this.shell.eval( expr );
+
+        assertEquals( "hello2",
+                      new String( baos.toByteArray() ) );
+    }
+
+    public void testSwitch() throws IOException {
+        String expr = "(switch (?x) (case a then (printout t hello)(printout t 1)) (case b then (printout t hello)(printout t 2)) (default (printout t hello)(printout t 3)) )";
+
+        // check case a
+        this.shell.addVariable( "$x",
+                                "a" );
+        this.shell.eval( expr );
+        assertEquals( "hello1",
+                      new String( baos.toByteArray() ) );
+
+        // check default
+        this.shell.addVariable( "$x",
+                                "M" );
+        this.shell.eval( expr );
+        assertEquals( "hello1hello3",
+                      new String( baos.toByteArray() ) );
+
+        // check case b
+        this.shell.addVariable( "$x",
+                                "b" );
+        this.shell.eval( expr );
+        assertEquals( "hello1hello3hello2",
+                      new String( baos.toByteArray() ) );
+    }
+
+    public void testDeffunction() {
+        String function = "(deffunction max (?a ?b) (if (> ?a ?b) then (return ?a) else (return ?b) ) )";
+        this.shell.eval( function );
+
+        String expr = "(if (eq (max 3 5) 5) then (printout t hello) )";
+        this.shell.eval( expr );
+        assertEquals( "hello",
+                      new String( baos.toByteArray() ) );
+
+        expr = "(if (eq (max ?a ?b) 5) then (printout t hello) )";
+        this.shell.addVariable( "$a",
+                                "3" );
+        this.shell.addVariable( "$b",
+                                "5" );
+        this.shell.eval( expr );
+        assertEquals( "hellohello",
+                      new String( baos.toByteArray() ) );
+    }
+
+    public void testDirectImportAndNew() {
+        String t = "(import org.drools.Person) (bind ?p (new Person mark cheddar) ) (printout t ?p)";
+        this.shell.eval( t );
+        assertEquals( "[Person name='mark']",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+    public void testDynamicImportAndNew() {
+        String t = "(import org.drools.*) (bind ?p (new Person mark cheddar) ) (printout t ?p)";
+        this.shell.eval( t );
+        assertEquals( "[Person name='mark']",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+    public void testSet() {
+        String t = "(import org.drools.*) (bind ?p (new Person mark cheddar) ) (set ?p name bob) (printout t ?p)";
+        this.shell.eval( t );
+        assertEquals( "[Person name='bob']",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+    public void testGet() {
+        String t = "(import org.drools.*) (bind ?p (new Person mark cheddar) )(printout t (get ?p name))";
+        this.shell.eval( t );
+        assertEquals( "mark",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+
+    public void testExplicitCall() {
+        String t = "(import org.drools.*) (bind ?p (new Person mark cheddar) ) (call ?p setFields bob stilton 35)  (printout t (call ?p toLongString))";
+        this.shell.eval( t );
+        assertEquals( "[Person name='bob' likes='stilton' age='35']",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+    public void testImplicitCall() {
+        String t = "(import org.drools.*) (bind ?p (new Person mark cheddar) ) (?p setFields bob stilton 35)  (printout t (call ?p toLongString))";
+        this.shell.eval( t );
+        assertEquals( "[Person name='bob' likes='stilton' age='35']",
+                      new String( this.baos.toByteArray() ) );
+    }
     
-    public void test2() {
-        OldShell shell = new OldShell();
-        
-        shell.evalString( "(import org.drools.Person)" );
-        
-        shell.evalString( "(defrule yyy  => (printout t yy \" \" (eq 1 1) \"\n\" ) ) )" );        
-        Package pkg = shell.getWorkingMemory().getRuleBase().getPackage( "MAIN" );
-        
+    public void testRuleCreation() {
+        this.shell.eval( "(import org.drools.Person)" );
+
+        this.shell.eval( "(defrule yyy  => (printout t yy \" \" (eq 1 1) ) ) )" );
+        Package pkg = shell.getStatefulSession().getRuleBase().getPackage( "MAIN" );
+
         Rule rule = pkg.getRule( "yyy" );
-        assertEquals( "yyy", rule.getName() );
-        
-        shell.evalString( "(defrule xxx (Person (name ?name&bob) (age 30) ) (Person  (name ?name) (age 35)) => (printout t ?name \" \" (eq 1 1) \"\n\" ) )" );
-        
-        
+        assertEquals( "yyy",
+                      rule.getName() );
+
+        this.shell.eval( "(defrule xxx (Person (name ?name&bob) (age 30) ) (Person  (name ?name) (age 35)) => (printout t xx \" \" (eq 1 1) ) )" );
+
         rule = pkg.getRule( "xxx" );
-        assertEquals( "xxx", rule.getName() );
-        
+        assertEquals( "xxx",
+                      rule.getName() );
 
-        
-        assertEquals( 2, pkg.getRules().length );
-        
+        assertEquals( 2,
+                      pkg.getRules().length );
+
         assertTrue( pkg.getImports().containsKey( "org.drools.Person" ) );
-        
-        WorkingMemory wm = shell.getWorkingMemory();
-        wm.insert( new Person("bob", "cheddar", 30) );
-        wm.insert( new Person("bob", "stilton", 35) );        
-        wm.fireAllRules();        
+
+        WorkingMemory wm = shell.getStatefulSession();
+        wm.insert( new Person( "bob",
+                               "cheddar",
+                               30 ) );
+        wm.insert( new Person( "bob",
+                               "stilton",
+                               35 ) );
+        wm.fireAllRules();
+        assertEquals( "yy truexx true",
+                      new String( this.baos.toByteArray() ) );        
     }    
+
+    public void testEmptyLHSRule() {
+        String rule1 = "(defrule testRule => (printout t hello) (printout t goodbye))";
+        this.shell.eval( rule1 );
+        assertEquals( "hellogoodbye",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+    public void testSimpleLHSRule() {
+        this.shell.eval( "(import org.drools.*)" );
+        this.shell.eval( "(defrule testRule (Person (name ?name&mark) ) => (printout t hello) (printout t \" \" ?name))" );
+        this.shell.eval( "(assert (Person (name mark) ) )" );
+        this.shell.eval( "(run)" );
+        assertEquals( "hello mark",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+    public void testTwoSimpleRulesWithModify() {
+        this.shell.eval( "(import org.drools.*)" );
+        this.shell.eval( "(defrule testRule ?p <- (Person (name ?name&mark) ) => (printout t hello) (printout t \" \" ?name) (modify ?p (name bob) ) )" );
+        this.shell.eval( "(defrule testRule (Person (name ?name&bob) ) => (printout t hello) (printout t \" \" ?name))" );
+        this.shell.eval( "(assert (Person (name mark) ) )" );
+        this.shell.eval( "(run)" );
+        assertEquals( "hello markhello bob",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+    public void testBlockEval() {
+        String text = "(import org.drools.*)";
+        text += "(defrule testRule ?p <- (Person (name ?name&mark) ) => (printout t hello) (printout t \" \" ?name) (modify ?p (name bob) ) )";
+        text += "(defrule testRule (Person (name ?name&bob) ) => (printout t hello) (printout t \" \" ?name))";
+        text += "(assert (Person (name mark) ) )";
+        text += "(run)";
+        this.shell.eval( text );
+        assertEquals( "hello markhello bob",
+                      new String( this.baos.toByteArray() ) );
+    }
+
+    public void testRun() {
+        this.shell.eval( "(run)" );
+    }
+
 }




More information about the jboss-svn-commits mailing list