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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 13 01:18:48 EDT 2007


Author: fmeyer
Date: 2007-07-13 01:18:48 -0400 (Fri, 13 Jul 2007)
New Revision: 13431

Modified:
   labs/jbossrules/trunk/drools-clips/.classpath
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/CLPFactory.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/CLPParser.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/Shell.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/valuehandlers/CLPLocalDeclarationVariable.java
   labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/valuehandlers/CLPPreviousDeclarationVariable.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/AddFunctionTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/CompiledFunctionsTest.java
   labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/LhsClpParserTest.java
Log:
JBRULES-720 - Clips Parser

Modified: labs/jbossrules/trunk/drools-clips/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-clips/.classpath	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/.classpath	2007-07-13 05:18:48 UTC (rev 13431)
@@ -5,17 +5,15 @@
   <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
   <classpathentry kind="output" path="target/classes"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
-  <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta23/mvel14-1.2beta23.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.7/janino-2.5.7.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0/antlr-3.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/antlr/stringtemplate/3.0/stringtemplate-3.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
-  <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.4.0/xercesImpl-2.4.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/drools/drools-compiler/4.0.0.SNAPSHOT/drools-compiler-4.0.0.SNAPSHOT.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.jar"/>
+  <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar" sourcepath="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.3.v_686_R32x/core-3.2.3.v_686_R32x.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/drools/drools-core/4.0.0.SNAPSHOT/drools-core-4.0.0.SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/drools/drools-compiler/4.0.0.SNAPSHOT/drools-compiler-4.0.0.SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0/antlr-runtime-3.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar" sourcepath="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2pre2/mvel14-1.2pre2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.7/janino-2.5.7.jar"/>
+  <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.4.0/xercesImpl-2.4.0.jar" sourcepath="M2_REPO/xerces/xercesImpl/2.4.0/xercesImpl-2.4.0-sources.jar"/>
 </classpath>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/CLPFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/CLPFactory.java	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/CLPFactory.java	2007-07-13 05:18:48 UTC (rev 13431)
@@ -9,6 +9,7 @@
 import org.drools.clp.valuehandlers.CLPGlobalVariable;
 import org.drools.clp.valuehandlers.CLPLocalDeclarationVariable;
 import org.drools.clp.valuehandlers.CLPPreviousDeclarationVariable;
+import org.drools.common.InternalWorkingMemory;
 import org.drools.rule.Declaration;
 import org.drools.spi.Tuple;
 import org.mvel.integration.VariableResolver;
@@ -22,7 +23,7 @@
 
     private Map           resolvers;
     //private
-    private WorkingMemory workingMemory;
+    private InternalWorkingMemory workingMemory;
 
     public CLPFactory() {
         this.resolvers = Collections.EMPTY_MAP;
@@ -52,7 +53,7 @@
 
     public void setContext(Tuple tuple,
                            Object object,
-                           WorkingMemory workingMemory) {
+                           InternalWorkingMemory workingMemory) {
         this.tuple = tuple;
         this.object = object;
         this.workingMemory = workingMemory;
@@ -88,9 +89,9 @@
         }
 
         if ( this.previousDeclarations != null && this.previousDeclarations.containsKey( name ) ) {
-            resolver = new CLPPreviousDeclarationVariable( (Declaration) this.previousDeclarations.get( name ) );
+            resolver = new CLPPreviousDeclarationVariable( (Declaration) this.previousDeclarations.get( name ), workingMemory);
         } else if ( this.localDeclarations != null && this.localDeclarations.containsKey( name ) ) {
-            resolver = new CLPLocalDeclarationVariable( (Declaration) this.localDeclarations.get( name ) );
+            resolver = new CLPLocalDeclarationVariable( (Declaration) this.localDeclarations.get( name ), workingMemory );
         } else {
             Class clazz = (Class) this.globals.get( name );
             resolver = new CLPGlobalVariable( name,

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/CLPParser.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/CLPParser.java	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/CLPParser.java	2007-07-13 05:18:48 UTC (rev 13431)
@@ -2,21 +2,47 @@
 
 	package org.drools.clp;
 	
-	import org.drools.clp.valuehandlers.*;
-	import java.util.List;
 	import java.util.ArrayList;
-	import java.util.Iterator;
-	import java.util.HashMap;	
-	import java.util.StringTokenizer;
-	import org.drools.lang.descr.*;
-	import org.drools.compiler.SwitchingCommonTokenStream;
+import java.util.Iterator;
+import java.util.List;
 
+import org.antlr.runtime.BitSet;
+import org.antlr.runtime.CommonToken;
+import org.antlr.runtime.EarlyExitException;
+import org.antlr.runtime.FailedPredicateException;
+import org.antlr.runtime.MismatchedNotSetException;
+import org.antlr.runtime.MismatchedSetException;
+import org.antlr.runtime.MismatchedTokenException;
+import org.antlr.runtime.MismatchedTreeNodeException;
+import org.antlr.runtime.NoViableAltException;
+import org.antlr.runtime.Parser;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.Token;
+import org.antlr.runtime.TokenStream;
+import org.drools.clp.valuehandlers.BooleanValueHandler;
+import org.drools.clp.valuehandlers.DoubleValueHandler;
+import org.drools.clp.valuehandlers.FunctionCaller;
+import org.drools.clp.valuehandlers.LongValueHandler;
+import org.drools.clp.valuehandlers.ObjectValueHandler;
+import org.drools.lang.descr.AndDescr;
+import org.drools.lang.descr.AttributeDescr;
+import org.drools.lang.descr.ConditionalElementDescr;
+import org.drools.lang.descr.DescrFactory;
+import org.drools.lang.descr.EvalDescr;
+import org.drools.lang.descr.ExistsDescr;
+import org.drools.lang.descr.FieldBindingDescr;
+import org.drools.lang.descr.FieldConstraintDescr;
+import org.drools.lang.descr.LiteralRestrictionDescr;
+import org.drools.lang.descr.NotDescr;
+import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.PatternDescr;
+import org.drools.lang.descr.PredicateDescr;
+import org.drools.lang.descr.RestrictionConnectiveDescr;
+import org.drools.lang.descr.ReturnValueRestrictionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.lang.descr.VariableRestrictionDescr;
 
-import org.antlr.runtime.*;
-import java.util.Stack;
-import java.util.List;
-import java.util.ArrayList;
-
 public class CLPParser extends Parser {
     public static final String[] tokenNames = new String[] {
         "<invalid>", "<EOR>", "<DOWN>", "<UP>", "LEFT_PAREN", "DEFFUNCTION", "NAME", "VAR", "RIGHT_PAREN", "DEFRULE", "STRING", "SALIENCE", "INT", "AND", "OR", "NOT", "EXISTS", "TEST", "ASSIGN_OP", "AMPERSAND", "PIPE", "TILDE", "COLON", "EQUALS", "FLOAT", "BOOL", "NULL", "EOL", "WS", "DECLARE", "EscapeSequence", "HexDigit", "UnicodeEscape", "OctalEscape", "SYMBOL", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "LEFT_SQUARE", "RIGHT_SQUARE", "LEFT_CURLY", "RIGHT_CURLY", "MULTI_LINE_COMMENT", "'=>'"

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/Shell.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/Shell.java	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/Shell.java	2007-07-13 05:18:48 UTC (rev 13431)
@@ -10,16 +10,15 @@
 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.WorkingMemory;
 import org.drools.clp.valuehandlers.FunctionCaller;
 import org.drools.clp.valuehandlers.NamedShellVariableValue;
 import org.drools.compiler.PackageBuilder;
-import org.drools.compiler.SwitchingCommonTokenStream;
 import org.drools.lang.DRLLexer;
 import org.drools.lang.descr.AttributeDescr;
 import org.drools.lang.descr.PackageDescr;
@@ -27,7 +26,8 @@
 import org.drools.spi.GlobalResolver;
 
 public class  Shell implements ParserHandler, GlobalResolver, BuildContext {
-    private FunctionRegistry registry;
+	private static final long serialVersionUID = 1L;
+	private FunctionRegistry registry;
     private Map variables;
     private Map              properties = Collections.EMPTY_MAP;
     
@@ -43,7 +43,7 @@
     
     public void evalReader(Reader reader)  {
         try {
-            CLPParser parser = new CLPParser( new SwitchingCommonTokenStream( new DRLLexer( new ANTLRReaderStream( reader ) ) ) );
+            CLPParser parser = new CLPParser( new CommonTokenStream( new DRLLexer( new ANTLRReaderStream( reader ) ) ) );
             evalParser( parser );    
         } catch (Exception e) {
             throw new RuntimeException( "Unable to parser Reader", e);
@@ -112,7 +112,7 @@
     }
 
     private TokenStream newTokenStream(final Lexer lexer) {
-        return new SwitchingCommonTokenStream( lexer );
+        return new CommonTokenStream( lexer );
     }
 
     public Object resolve(String name) {
@@ -165,4 +165,14 @@
         this.variables.put( var.getIdentifier(), var );
     }
 
+	public Object resolveGlobal(String identifier) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void setGlobal(String identifier, Object value) {
+		// TODO Auto-generated method stub
+		
+	}
+
 }

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/valuehandlers/CLPLocalDeclarationVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/valuehandlers/CLPLocalDeclarationVariable.java	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/valuehandlers/CLPLocalDeclarationVariable.java	2007-07-13 05:18:48 UTC (rev 13431)
@@ -6,13 +6,16 @@
 import org.drools.clp.ExecutionContext;
 import org.drools.clp.ValueHandler;
 import org.drools.clp.VariableValueHandler;
+import org.drools.common.InternalWorkingMemory;
 import org.drools.rule.Declaration;
 
 public class CLPLocalDeclarationVariable implements VariableValueHandler {
     
     private Declaration declaration;
+	private InternalWorkingMemory workingmemory;
        
-    public CLPLocalDeclarationVariable(Declaration declaration) {
+    public CLPLocalDeclarationVariable(Declaration declaration, InternalWorkingMemory workingMemory) {
+    	this.workingmemory = workingMemory;
         this.declaration = declaration;
     }  
     
@@ -38,11 +41,11 @@
     }
     
     public Object getObject(ExecutionContext context) {
-        return declaration.getValue( context.getObject() );
+        return declaration.getValue(workingmemory, context.getObject());
     }
     
     public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
-        Object object = declaration.getValue( context.getObject() );
+        Object object = declaration.getValue(workingmemory, context.getObject() );
         if ( object instanceof BigDecimal ) {
             return (BigDecimal) object;
         } else {
@@ -51,7 +54,7 @@
     }
 
     public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
-        Object object = declaration.getValue( context.getObject() );
+        Object object = declaration.getValue(workingmemory, context.getObject() );
         if ( object instanceof BigInteger ) {
             return (BigInteger) object;
         } else {
@@ -60,31 +63,31 @@
     }    
 
     public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
-        return declaration.getBooleanValue( context.getObject() );
+        return declaration.getBooleanValue(workingmemory, context.getObject() );
     }
 
     public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
-        return declaration.getDoubleValue( context.getObject() );
+        return declaration.getDoubleValue(workingmemory, context.getObject() );
     }
 
     public float getFloatValue(ExecutionContext context) throws NumberFormatException {
-        return declaration.getFloatValue( context.getObject() );
+        return declaration.getFloatValue( workingmemory,context.getObject() );
     }
 
     public int getIntValue(ExecutionContext context) throws NumberFormatException {
-        return declaration.getIntValue( context.getObject() );
+        return declaration.getIntValue( workingmemory, context.getObject() );
     }
 
     public long getLongValue(ExecutionContext context) throws NumberFormatException {
-        return declaration.getLongValue( context.getObject() );
+        return declaration.getLongValue(workingmemory, context.getObject() );
     }
 
     public short getShortValue(ExecutionContext context) throws NumberFormatException {
-        return declaration.getShortValue( context.getObject() );
+        return declaration.getShortValue(workingmemory, context.getObject() );
     }
 
     public String getStringValue(ExecutionContext context) {
-        return (String) declaration.getValue( context.getObject() );
+        return (String) declaration.getValue(workingmemory, context.getObject() );
     }
     
     public String toString() {

Modified: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/valuehandlers/CLPPreviousDeclarationVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/valuehandlers/CLPPreviousDeclarationVariable.java	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clp/valuehandlers/CLPPreviousDeclarationVariable.java	2007-07-13 05:18:48 UTC (rev 13431)
@@ -7,14 +7,17 @@
 import org.drools.clp.ValueHandler;
 import org.drools.clp.VariableValueHandler;
 import org.drools.common.InternalFactHandle;
+import org.drools.common.InternalWorkingMemory;
 import org.drools.rule.Declaration;
 
 public class CLPPreviousDeclarationVariable implements VariableValueHandler {
 
     private Declaration declaration;
+	private InternalWorkingMemory workingmemory;
     
-    public CLPPreviousDeclarationVariable(Declaration declaration) {
+    public CLPPreviousDeclarationVariable(Declaration declaration, InternalWorkingMemory workingmemory) {
         this.declaration = declaration;
+        this.workingmemory = workingmemory;
     }
     
     public ValueHandler getValue(ExecutionContext context) {
@@ -40,12 +43,12 @@
     
     public Object getObject(ExecutionContext context) {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return declaration.getValue( handle.getObject() );
+        return declaration.getValue( workingmemory, handle.getObject() );
     }
     
     public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        Object object = declaration.getValue(  handle.getObject() );
+        Object object = declaration.getValue(workingmemory,  handle.getObject() );
         if ( object instanceof BigDecimal ) {
             return (BigDecimal) object;
         } else {
@@ -55,7 +58,7 @@
 
     public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        Object object = declaration.getValue(  handle.getObject() );
+        Object object = declaration.getValue(workingmemory,  handle.getObject() );
         if ( object instanceof BigInteger ) {
             return (BigInteger) object;
         } else {
@@ -65,37 +68,37 @@
 
     public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return declaration.getBooleanValue( handle.getObject() );
+        return declaration.getBooleanValue(workingmemory, handle.getObject() );
     }
 
     public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return declaration.getDoubleValue( handle.getObject() );
+        return declaration.getDoubleValue(workingmemory, handle.getObject() );
     }
 
     public float getFloatValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return declaration.getFloatValue( handle.getObject() );
+        return declaration.getFloatValue(workingmemory, handle.getObject() );
     }
 
     public int getIntValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return declaration.getIntValue( handle.getObject() );
+        return declaration.getIntValue(workingmemory, handle.getObject() );
     }
 
     public long getLongValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return declaration.getLongValue( handle.getObject() );
+        return declaration.getLongValue(workingmemory, handle.getObject() );
     }
 
     public short getShortValue(ExecutionContext context) throws NumberFormatException {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return declaration.getShortValue( handle.getObject() );
+        return declaration.getShortValue(workingmemory, handle.getObject() );
     }
 
     public String getStringValue(ExecutionContext context) {
         InternalFactHandle handle = context.getTuple().get( this.declaration );
-        return (String) declaration.getValue( handle.getObject() );
+        return (String) declaration.getValue(workingmemory, handle.getObject() );
     }
     
     public String toString() {

Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/AddFunctionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/AddFunctionTest.java	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/AddFunctionTest.java	2007-07-13 05:18:48 UTC (rev 13431)
@@ -59,7 +59,7 @@
         RuleBase ruleBase = RuleBaseFactory.newRuleBase();
         InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();
 
-        InternalFactHandle factHandle = (InternalFactHandle) workingMemory.assertObject( new BigDecimal( 10 ) );
+        InternalFactHandle factHandle = (InternalFactHandle) workingMemory.insert( new BigDecimal( 10 ) );
         ReteTuple tuple = new ReteTuple( factHandle );
 
         ObjectType objectType = new ClassObjectType( BigDecimal.class );
@@ -69,23 +69,16 @@
                                         objectType );
         PatternExtractor extractor = new PatternExtractor( objectType );
 
-        //        VariableValueHandler pd = new CLPPreviousDeclarationVariable( new Declaration( "pd",
-        //                                                                                       extractor,
-        //                                                                                       column0 ) );
-        //
-        //        VariableValueHandler ld = new CLPLocalDeclarationVariable( new Declaration( "ld",
-        //                                                                                    extractor,
-        //                                                                                    column1 ) );
-
         Map variables = new HashMap();
         variables.put( "pd",
                        new CLPPreviousDeclarationVariable( new Declaration( "pd",
                                                                             extractor,
-                                                                            pattern0 ) ) );
+                                                                            pattern0 ), workingMemory ) );
         variables.put( "ld",
                        new CLPLocalDeclarationVariable( new Declaration( "ld",
                                                                          extractor,
-                                                                         pattern1 ) ) );
+                                                                         pattern1
+                                                                         ), workingMemory ) );
 
         ValueHandler val1 = new TempTokenVariable( "pd" );
         ValueHandler val2 = new IndexedLocalVariableValue( "lv",

Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/CompiledFunctionsTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/CompiledFunctionsTest.java	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/CompiledFunctionsTest.java	2007-07-13 05:18:48 UTC (rev 13431)
@@ -6,24 +6,22 @@
 import java.io.PrintStream;
 import java.io.Reader;
 import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
+import junit.framework.TestCase;
+
 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.Person;
-import org.drools.clp.valuehandlers.ListValueHandler;
 import org.drools.clp.valuehandlers.IndexedLocalVariableValue;
+import org.drools.clp.valuehandlers.ListValueHandler;
 import org.drools.clp.valuehandlers.LongValueHandler;
 import org.drools.clp.valuehandlers.ObjectValueHandler;
-import org.drools.compiler.SwitchingCommonTokenStream;
 
-import junit.framework.TestCase;
-
 public class CompiledFunctionsTest extends TestCase {
     private CLPParser parser;
 
@@ -323,7 +321,7 @@
     }
 
     private TokenStream newTokenStream(final Lexer lexer) {
-        return new SwitchingCommonTokenStream( lexer );
+        return new CommonTokenStream( lexer );
     }
 
     private CLPParser newParser(final TokenStream tokenStream) {

Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/LhsClpParserTest.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/LhsClpParserTest.java	2007-07-13 03:23:47 UTC (rev 13430)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clp/LhsClpParserTest.java	2007-07-13 05:18:48 UTC (rev 13431)
@@ -9,21 +9,21 @@
 
 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.clp.valuehandlers.DoubleValueHandler;
 import org.drools.clp.valuehandlers.FunctionCaller;
 import org.drools.clp.valuehandlers.LongValueHandler;
-import org.drools.compiler.SwitchingCommonTokenStream;
 import org.drools.lang.descr.AndDescr;
 import org.drools.lang.descr.AttributeDescr;
-import org.drools.lang.descr.PatternDescr;
 import org.drools.lang.descr.EvalDescr;
 import org.drools.lang.descr.ExistsDescr;
 import org.drools.lang.descr.FieldConstraintDescr;
 import org.drools.lang.descr.LiteralRestrictionDescr;
 import org.drools.lang.descr.NotDescr;
 import org.drools.lang.descr.OrDescr;
+import org.drools.lang.descr.PatternDescr;
 import org.drools.lang.descr.PredicateDescr;
 import org.drools.lang.descr.RestrictionConnectiveDescr;
 import org.drools.lang.descr.ReturnValueRestrictionDescr;
@@ -386,7 +386,7 @@
     }
 
     private TokenStream newTokenStream(final Lexer lexer) {
-        return new SwitchingCommonTokenStream( lexer );
+        return new CommonTokenStream( lexer );
     }
 
     private CLPParser newParser(final TokenStream tokenStream) {




More information about the jboss-svn-commits mailing list