[jboss-svn-commits] JBL Code SVN: r10137 - in labs/jbossrules/trunk/drools-compiler/src: main/java/org/drools/lang and 11 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Mar 12 19:22:22 EDT 2007
Author: mark.proctor at jboss.com
Date: 2007-03-12 19:22:22 -0400 (Mon, 12 Mar 2007)
New Revision: 10137
Added:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ActionBlock.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseFunction.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseValueHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BlockExecutionEngine.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BooleanLiteralValue.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPEval.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPFactory.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPGlobalVariable.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLocalDeclarationVariable.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPredicate.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPreviousDeclarationVariable.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPReturnValue.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/DoubleLiteralValue.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionBuildContext.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionContext.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionEngine.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExpressionExecutionEngine.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Function.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LocalVariableValue.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LongLiteralValue.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ObjectLiteralValue.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/SlotNameValuePair.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/TempTokenVariable.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ValueHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/VariableValueHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions.conf
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/AddFunctionTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/FunctionFactoryTest.java
Modified:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLexer.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPParser.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/clp.tokens
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/clp__.g
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/DRLParser.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/DrlDumper.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/EvalDescr.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/PredicateDescr.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/ReturnValueRestrictionDescr.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/RuleDescr.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ColumnBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/BuildUtils.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaEvalBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaPredicateBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/EvalHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/PredicateHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ReturnValueRestrictionHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlDumper.java
labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/CLP.g
labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/DRL.g
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ClpParserTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/XmlPackageReaderTest.java
Log:
JBRULES-720 Clips Parser
-Almost working, just trying to figure out how to match function names
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ActionBlock.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ActionBlock.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ActionBlock.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,5 @@
+package org.drools.clp;
+
+public class ActionBlock {
+ private LocalVariableValue[] vars;
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/AddFunction.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,34 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+
+import org.drools.FactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.Extractor;
+
+public class AddFunction extends BaseFunction implements Function {
+ private static final String name = "+";
+
+ public AddFunction() {
+
+ }
+
+ public AddFunction(ValueHandler[] parameters) {
+ super( parameters );
+ }
+
+ public Object getValue(ExecutionContext context) {
+ BigDecimal bdval = new BigDecimal(0);
+ ValueHandler[] args = getParameters();
+ for ( int i = 0, length = args.length; i < length; i++ ) {
+ bdval = bdval.add( args[i].getBigDecimalValue( context ) );
+ }
+
+ return bdval;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseFunction.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseFunction.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,45 @@
+package org.drools.clp;
+
+import java.util.Map;
+
+public abstract class BaseFunction extends BaseValueHandler implements Function {
+
+ protected ValueHandler[] parameters;
+
+ public BaseFunction() {
+
+ }
+
+ public BaseFunction(ValueHandler[] parameters) {
+ this.parameters = parameters;
+ }
+
+ public void addParameter(ValueHandler valueHandler) {
+ ValueHandler[] temp = new ValueHandler[ parameters.length ];
+ System.arraycopy( this.parameters, 0, temp, 0, this.parameters.length -1 );
+ temp[ temp.length - 1] = valueHandler;
+ this.parameters = temp;
+ }
+
+ public ValueHandler[] getParameters() {
+ return this.parameters;
+ }
+
+ public void setValue(ExecutionContext context,
+ Object object) {
+ throw new RuntimeException( "You cannot set the value on a Function" );
+ }
+
+ public void replaceTempTokens(Map variables) {
+ for ( int i = 0; i < this.parameters.length; i++ ) {
+ if ( this.parameters[i] instanceof TempTokenVariable ) {
+ TempTokenVariable var = ( TempTokenVariable ) this.parameters[i];
+ this.parameters[i] = ( ValueHandler ) variables.get( var.getIdentifier() );
+ } else if ( this.parameters[i] instanceof Function ) {
+ Function function = ( Function ) this.parameters[i];
+ function.replaceTempTokens( variables );
+ }
+ }
+
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseValueHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseValueHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BaseValueHandler.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,47 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.drools.base.ValueType;
+
+public abstract class BaseValueHandler implements ValueHandler {
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ return (BigDecimal) getValue(context);
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ return (BigInteger) getValue(context);
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ return ((Boolean) getValue(context)).booleanValue();
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ return ((Double) getValue(context)).doubleValue();
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ return ((Float) getValue(context)).floatValue();
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ return ((Integer) getValue(context)).intValue();
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ return ((Long) getValue(context)).longValue();
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ return ((Short) getValue(context)).shortValue();
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ return (String) getValue(context);
+ }
+
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BindFunction.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,32 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+
+import org.drools.FactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.Extractor;
+
+public class BindFunction extends BaseFunction implements Function {
+ private static final String name = "bind";
+
+ public BindFunction() {
+
+ }
+
+ public BindFunction(ValueHandler[] parameters) {
+ super( parameters );
+ }
+
+ public Object getValue(ExecutionContext context) {
+ ValueHandler args[] = getParameters();
+
+ args[0].setValue( context, args[1].getValue( context ) );
+
+ return args[0];
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BlockExecutionEngine.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BlockExecutionEngine.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BlockExecutionEngine.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,75 @@
+package org.drools.clp;
+
+import org.drools.WorkingMemory;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.spi.Consequence;
+import org.drools.spi.EvalExpression;
+import org.drools.spi.FieldValue;
+import org.drools.spi.KnowledgeHelper;
+import org.drools.spi.PredicateExpression;
+import org.drools.spi.ReturnValueExpression;
+import org.drools.spi.Tuple;
+
+public class BlockExecutionEngine
+ implements
+ Consequence,
+ ExecutionEngine {
+ //private Map variableMap = new HashMap();
+
+ private Function[] functions;
+
+ private int index;
+
+ public void addFunction(Function function) {
+ Function[] temp = new Function[functions.length];
+ System.arraycopy( this.functions,
+ 0,
+ temp,
+ 0,
+ this.functions.length - 1 );
+ temp[temp.length - 1] = function;
+ this.functions = temp;
+ }
+
+ public int getNextIndex() {
+ return this.index++;
+ }
+
+ public void execute(InternalWorkingMemory workingMemory,
+ ReteTuple tuple,
+ Object object) {
+ execute( new ExecutionContext( workingMemory,
+ tuple,
+ object,
+ this.index - 1 ) );
+ }
+
+ public void execute(InternalWorkingMemory workingMemory,
+ ReteTuple tuple) {
+ execute( new ExecutionContext( workingMemory,
+ tuple,
+ this.index - 1 ) );
+ }
+
+ public void execute(ExecutionContext context) {
+ for ( int i = 0, length = functions.length; i < length; i++ ) {
+ this.functions[i].getValue( context );
+ }
+ }
+
+ public void evaluate(KnowledgeHelper knowledgeHelper,
+ WorkingMemory workingMemory) throws Exception {
+ ExecutionContext context = new ExecutionContext( (InternalWorkingMemory) workingMemory,
+ (ReteTuple) knowledgeHelper.getTuple(),
+ this.index -1 );
+ execute( context );
+ }
+
+ public void getVariableValueHandler(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BooleanLiteralValue.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BooleanLiteralValue.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/BooleanLiteralValue.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,60 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public class BooleanLiteralValue extends BaseValueHandler {
+ private boolean booleanValue;
+
+ public BooleanLiteralValue(String booleanValue) {
+ this.booleanValue = Boolean.valueOf( booleanValue ).booleanValue();
+ }
+
+ public BooleanLiteralValue(boolean booleanValue) {
+ this.booleanValue = booleanValue;
+ }
+
+ public void setValue(ExecutionContext context, Object value) {
+ throw new RuntimeException( "LiteralValues cannot be set");
+ }
+
+ public Object getValue(ExecutionContext context) {
+ return new Boolean( this.booleanValue );
+ }
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "Boolean format exception, cannot be cast to BitDecimal" );
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "Boolean format exception, cannot be cast to BitInteger" );
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ return this.booleanValue;
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "Boolean format exception, cannot be cast to double" );
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "Boolean format exception, cannot be cast to float" );
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "Boolean format exception, cannot be cast to int" );
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "Boolean format exception, cannot be cast to long" );
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "Boolean format exception, cannot be cast to short" );
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ return Boolean.toString( this.booleanValue );
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPEval.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPEval.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPEval.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,49 @@
+/**
+ *
+ */
+package org.drools.clp;
+
+import org.drools.WorkingMemory;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.spi.EvalExpression;
+import org.drools.spi.Tuple;
+
+public class CLPEval
+ implements
+ EvalExpression,
+ ExecutionEngine {
+ private Function function;
+ private int index;
+
+ public CLPEval() {
+
+ }
+
+ public CLPEval(Function function) {
+ this.function = function;
+ }
+
+ public void setFunction(Function function) {
+ this.function = function;
+ }
+
+ public void addFunction(Function function) {
+ setFunction( function );
+ }
+
+ public int getNextIndex() {
+ return this.index++;
+ }
+
+ public boolean evaluate(Tuple tuple,
+ Declaration[] requiredDeclarations,
+ WorkingMemory workingMemory) throws Exception {
+ ExecutionContext context = new ExecutionContext( (InternalWorkingMemory) workingMemory,
+ (ReteTuple) tuple,
+ this.index-1 );
+ return this.function.getBooleanValue( context );
+ }
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPFactory.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPFactory.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,134 @@
+package org.drools.clp;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.WorkingMemory;
+import org.drools.rule.Declaration;
+import org.drools.spi.Tuple;
+import org.mvel.integration.VariableResolver;
+import org.mvel.integration.VariableResolverFactory;
+
+public class CLPFactory {
+ private Tuple tuple;
+ private Object object;
+ private Map localDeclarations;
+ private Map previousDeclarations;
+ private Map globals;
+
+ private Map resolvers;
+ //private
+ private WorkingMemory workingMemory;
+
+ public CLPFactory() {
+ this.resolvers = Collections.EMPTY_MAP;
+ }
+
+ public CLPFactory(Map previousDeclarations,
+ Map localDeclarations,
+ Map globals) {
+
+ }
+
+ public void setPreviousDeclarationMap(Map declarations) {
+ this.previousDeclarations = declarations;
+ }
+
+ public void setLocalDeclarationMap(Map declarations) {
+ this.localDeclarations = declarations;
+ }
+
+ public void setGlobalsMap(Map globals) {
+ this.globals = globals;
+ }
+
+
+ public Object getObject() {
+ return this.object;
+ }
+
+ public void setContext(Tuple tuple,
+ Object object,
+ WorkingMemory workingMemory) {
+ this.tuple = tuple;
+ this.object = object;
+ this.workingMemory = workingMemory;
+ }
+
+ public Object getValue(Declaration declaration) {
+ return tuple.get( declaration ).getObject();
+ }
+
+ public Object getValue(String identifier) {
+ return this.workingMemory.getGlobal( identifier );
+ }
+
+ public VariableResolver createVariable(String name,
+ Object value) {
+ throw new UnsupportedOperationException( "Variables cannot be created here" );
+ }
+
+// public ValueHandler getVariableResolver(String name) {
+// return (ValueHandler) this.resolvers.get( name );
+// }
+
+ public ValueHandler getVariableResolver(String name) {
+ //return this.declarations.containsKey( name ) || this.globals.containsKey( name );
+ if ( this.resolvers == Collections.EMPTY_MAP ) {
+ this.resolvers = new HashMap();
+ }
+
+ ValueHandler resolver = (ValueHandler) this.resolvers.get( name );
+
+ if ( resolver != null ) {
+ return null;
+ }
+
+ if ( this.previousDeclarations != null && this.previousDeclarations.containsKey( name ) ) {
+ resolver = new CLPPreviousDeclarationVariable( (Declaration) this.previousDeclarations.get( name ) );
+ } else if ( this.localDeclarations != null && this.localDeclarations.containsKey( name ) ) {
+ resolver = new CLPLocalDeclarationVariable( (Declaration) this.localDeclarations.get( name ) );
+ } else {
+ resolver = new CLPGlobalVariable( name,
+ (Class) this.globals.get( name ),
+ this );
+ }
+
+ if ( resolver != null ) {
+ this.resolvers.put( name,
+ resolver );
+ return resolver;
+ } else {
+ return null;
+ }
+ }
+
+// public boolean isTarget(String name) {
+// return this.resolvers.containsKey( name );
+// }
+
+ // public ValueHandler createExternalVariable(String identifier) {
+ // registerExternalVariable( identifier );
+ // ValueHandler variable;
+ // if ( this.declarations.containsKey( identifier )) {
+ // variable = new DroolsMVELDeclarationVariable( (Declaration) this.declarations.get( identifier ), this );
+ // } else {
+ // variable = new DroolsMVELGlobalVariable( identifier, (Class) this.globals.get( identifier ), this );
+ // }
+ // return variable;
+ // return null;
+ // }
+ //
+ // public boolean isValidVariable(String identifier) {
+ // return this.declarations.containsKey( identifier );
+ // }
+ //
+ // public Declaration[] getRequiredDeclarations() {
+ // List list = new ArrayList();
+ // for (int i = 0, length = this.requiredVariables.length; i < length; i++) {
+ // list.add( this.declarations.get( this.requiredVariables[i] ) );
+ // }
+ // return (Declaration[]) list.toArray( new Declaration[list.size() ] );
+ // }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPGlobalVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPGlobalVariable.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPGlobalVariable.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,35 @@
+package org.drools.clp;
+
+import org.mvel.integration.VariableResolver;
+
+public class CLPGlobalVariable extends BaseValueHandler {
+
+ private String name;
+ private Class knownType;
+ private CLPFactory factory;
+
+ public CLPGlobalVariable(String identifier,
+ Class knownType,
+ CLPFactory factory ) {
+ this.name = identifier;
+ this.factory = factory;
+ this.knownType = knownType;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public Class getKnownType() {
+ return this.knownType;
+ }
+
+ public Object getValue(ExecutionContext context) {
+ return this.factory.getValue( this.name );
+ }
+
+ public void setValue(ExecutionContext context, Object value) {
+ throw new UnsupportedOperationException( "External Variable identifer='" + getName() + "' type='" + getKnownType() + "' is final, it cannot be set" );
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLexer.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLexer.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLexer.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -1,4 +1,4 @@
-// $ANTLR 3.0b7 C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g 2007-03-06 05:09:16
+// $ANTLR 3.0b7 C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g 2007-03-12 19:19:14
package org.drools.clp;
@@ -10,56 +10,57 @@
import java.util.Map;
import java.util.HashMap;
public class CLPLexer extends Lexer {
+ public static final int EXISTS=10;
public static final int LEFT_PAREN=4;
- public static final int RIGHT_CURLY=24;
- public static final int T29=29;
- public static final int BOOL=11;
+ public static final int RIGHT_CURLY=30;
+ public static final int BOOL=16;
public static final int T33=33;
- public static final int HexDigit=16;
+ public static final int DEFRULE=18;
+ public static final int HexDigit=22;
public static final int T36=36;
- public static final int WS=14;
- public static final int MISC=26;
- public static final int STRING=8;
- public static final int FLOAT=10;
- public static final int T28=28;
+ public static final int WS=20;
+ public static final int MISC=32;
+ public static final int STRING=13;
+ public static final int FLOAT=14;
+ public static final int T40=40;
public static final int T35=35;
+ public static final int OR=8;
public static final int T34=34;
- public static final int VAR=7;
- public static final int UnicodeEscape=17;
+ public static final int VAR=12;
+ public static final int UnicodeEscape=23;
+ public static final int AND=7;
public static final int T37=37;
- public static final int EscapeSequence=15;
- public static final int INT=9;
+ public static final int EscapeSequence=21;
+ public static final int INT=15;
public static final int EOF=-1;
- public static final int T32=32;
- public static final int NULL=12;
- public static final int EOL=13;
- public static final int LEFT_SQUARE=21;
- public static final int Tokens=40;
- public static final int T31=31;
- public static final int SH_STYLE_SINGLE_LINE_COMMENT=19;
- public static final int OctalEscape=18;
- public static final int MULTI_LINE_COMMENT=25;
+ public static final int EOL=19;
+ public static final int NULL=17;
+ public static final int LEFT_SQUARE=27;
+ public static final int Tokens=41;
+ public static final int OctalEscape=24;
+ public static final int SH_STYLE_SINGLE_LINE_COMMENT=25;
+ public static final int MULTI_LINE_COMMENT=31;
+ public static final int TEST=11;
public static final int T38=38;
- public static final int T27=27;
+ public static final int NOT=9;
public static final int RIGHT_PAREN=6;
- public static final int T30=30;
- public static final int LEFT_CURLY=23;
+ public static final int LEFT_CURLY=29;
public static final int T39=39;
- public static final int RIGHT_SQUARE=22;
+ public static final int RIGHT_SQUARE=28;
public static final int ID=5;
- public static final int C_STYLE_SINGLE_LINE_COMMENT=20;
+ public static final int C_STYLE_SINGLE_LINE_COMMENT=26;
public CLPLexer() {;}
public CLPLexer(CharStream input) {
super(input);
- ruleMemo = new HashMap[38+1];
+ ruleMemo = new HashMap[39+1];
}
public String getGrammarFileName() { return "C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g"; }
- // $ANTLR start T27
- public void mT27() throws RecognitionException {
+ // $ANTLR start T33
+ public void mT33() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T27;
+ int _type = T33;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
@@ -85,21 +86,21 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T27
+ // $ANTLR end T33
- // $ANTLR start T28
- public void mT28() throws RecognitionException {
+ // $ANTLR start T34
+ public void mT34() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T28;
+ int _type = T34;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:7:7: ( 'defrule' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:7:7: 'defrule'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:7:7: ( '<-' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:7:7: '<-'
{
- match("defrule"); if (failed) return ;
+ match("<-"); if (failed) return ;
}
@@ -118,23 +119,22 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T28
+ // $ANTLR end T34
- // $ANTLR start T29
- public void mT29() throws RecognitionException {
+ // $ANTLR start T35
+ public void mT35() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T29;
+ int _type = T35;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:8:7: ( 'and' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:8:7: 'and'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:8:7: ( '&' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:8:7: '&'
{
- match("and"); if (failed) return ;
+ match('&'); if (failed) return ;
-
}
@@ -151,23 +151,22 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T29
+ // $ANTLR end T35
- // $ANTLR start T30
- public void mT30() throws RecognitionException {
+ // $ANTLR start T36
+ public void mT36() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T30;
+ int _type = T36;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:9:7: ( 'or' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:9:7: 'or'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:9:7: ( '|' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:9:7: '|'
{
- match("or"); if (failed) return ;
+ match('|'); if (failed) return ;
-
}
@@ -184,23 +183,22 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T30
+ // $ANTLR end T36
- // $ANTLR start T31
- public void mT31() throws RecognitionException {
+ // $ANTLR start T37
+ public void mT37() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T31;
+ int _type = T37;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:10:7: ( 'not' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:10:7: 'not'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:10:7: ( '~' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:10:7: '~'
{
- match("not"); if (failed) return ;
+ match('~'); if (failed) return ;
-
}
@@ -217,26 +215,57 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T31
+ // $ANTLR end T37
- // $ANTLR start T32
- public void mT32() throws RecognitionException {
+ // $ANTLR start T38
+ public void mT38() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T32;
+ int _type = T38;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:11:7: ( 'exists' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:11:7: 'exists'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:11:7: ( ':' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:11:7: ':'
{
- match("exists"); if (failed) return ;
+ match(':'); if (failed) return ;
+ }
+
+ if ( backtracking==0 ) {
+
+ if ( token==null && ruleNestingLevel==1 ) {
+ emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1);
+ }
+
+
}
+ }
+ finally {
+ ruleNestingLevel--;
+ }
+ }
+ // $ANTLR end T38
+ // $ANTLR start T39
+ public void mT39() throws RecognitionException {
+ try {
+ ruleNestingLevel++;
+ int _type = T39;
+ int _start = getCharIndex();
+ int _line = getLine();
+ int _charPosition = getCharPositionInLine();
+ int _channel = Token.DEFAULT_CHANNEL;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:12:7: ( '=' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:12:7: '='
+ {
+ match('='); if (failed) return ;
+ }
+
+
if ( backtracking==0 ) {
if ( token==null && ruleNestingLevel==1 ) {
@@ -250,21 +279,21 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T32
+ // $ANTLR end T39
- // $ANTLR start T33
- public void mT33() throws RecognitionException {
+ // $ANTLR start T40
+ public void mT40() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T33;
+ int _type = T40;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:12:7: ( 'test' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:12:7: 'test'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:13:7: ( 'modify' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:13:7: 'modify'
{
- match("test"); if (failed) return ;
+ match("modify"); if (failed) return ;
}
@@ -283,21 +312,21 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T33
+ // $ANTLR end T40
- // $ANTLR start T34
- public void mT34() throws RecognitionException {
+ // $ANTLR start DEFRULE
+ public void mDEFRULE() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T34;
+ int _type = DEFRULE;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:13:7: ( '<-' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:13:7: '<-'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:533:11: ( 'defrule' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:533:11: 'defrule'
{
- match("<-"); if (failed) return ;
+ match("defrule"); if (failed) return ;
}
@@ -316,22 +345,23 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T34
+ // $ANTLR end DEFRULE
- // $ANTLR start T35
- public void mT35() throws RecognitionException {
+ // $ANTLR start OR
+ public void mOR() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T35;
+ int _type = OR;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:14:7: ( '&' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:14:7: '&'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:534:8: ( 'or' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:534:8: 'or'
{
- match('&'); if (failed) return ;
+ match("or"); if (failed) return ;
+
}
@@ -348,22 +378,23 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T35
+ // $ANTLR end OR
- // $ANTLR start T36
- public void mT36() throws RecognitionException {
+ // $ANTLR start AND
+ public void mAND() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T36;
+ int _type = AND;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:15:7: ( '|' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:15:7: '|'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:535:8: ( 'and' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:535:8: 'and'
{
- match('|'); if (failed) return ;
+ match("and"); if (failed) return ;
+
}
@@ -380,22 +411,23 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T36
+ // $ANTLR end AND
- // $ANTLR start T37
- public void mT37() throws RecognitionException {
+ // $ANTLR start NOT
+ public void mNOT() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T37;
+ int _type = NOT;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:16:7: ( '~' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:16:7: '~'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:536:8: ( 'not' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:536:8: 'not'
{
- match('~'); if (failed) return ;
+ match("not"); if (failed) return ;
+
}
@@ -412,22 +444,23 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T37
+ // $ANTLR end NOT
- // $ANTLR start T38
- public void mT38() throws RecognitionException {
+ // $ANTLR start EXISTS
+ public void mEXISTS() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T38;
+ int _type = EXISTS;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:17:7: ( ':' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:17:7: ':'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:537:11: ( 'exists' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:537:11: 'exists'
{
- match(':'); if (failed) return ;
+ match("exists"); if (failed) return ;
+
}
@@ -444,22 +477,23 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T38
+ // $ANTLR end EXISTS
- // $ANTLR start T39
- public void mT39() throws RecognitionException {
+ // $ANTLR start TEST
+ public void mTEST() throws RecognitionException {
try {
ruleNestingLevel++;
- int _type = T39;
+ int _type = TEST;
int _start = getCharIndex();
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:18:7: ( '=' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:18:7: '='
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:538:9: ( 'test' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:538:9: 'test'
{
- match('='); if (failed) return ;
+ match("test"); if (failed) return ;
+
}
@@ -476,7 +510,7 @@
ruleNestingLevel--;
}
}
- // $ANTLR end T39
+ // $ANTLR end TEST
// $ANTLR start VAR
public void mVAR() throws RecognitionException {
@@ -487,8 +521,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:461:8: ( '?' ID )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:461:8: '?' ID
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:540:8: ( '?' ID )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:540:8: '?' ID
{
match('?'); if (failed) return ;
mID(); if (failed) return ;
@@ -520,8 +554,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:465:4: ( ('a'..'z'|'A'..'Z'|'_'|'$'|'\\u00c0'..'\\u00ff') ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\\u00c0'..'\\u00ff'))* )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:465:4: ('a'..'z'|'A'..'Z'|'_'|'$'|'\\u00c0'..'\\u00ff') ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\\u00c0'..'\\u00ff'))*
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:544:4: ( ('a'..'z'|'A'..'Z'|'_'|'$'|'\\u00c0'..'\\u00ff') ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\\u00c0'..'\\u00ff'))* )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:544:4: ('a'..'z'|'A'..'Z'|'_'|'$'|'\\u00c0'..'\\u00ff') ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\\u00c0'..'\\u00ff'))*
{
if ( input.LA(1)=='$'||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')||(input.LA(1)>='\u00C0' && input.LA(1)<='\u00FF') ) {
input.consume();
@@ -534,7 +568,7 @@
recover(mse); throw mse;
}
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:465:50: ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\\u00c0'..'\\u00ff'))*
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:544:50: ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\\u00c0'..'\\u00ff'))*
loop1:
do {
int alt1=2;
@@ -546,7 +580,7 @@
switch (alt1) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:465:51: ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\\u00c0'..'\\u00ff')
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:544:51: ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\\u00c0'..'\\u00ff')
{
if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')||(input.LA(1)>='\u00C0' && input.LA(1)<='\u00FF') ) {
input.consume();
@@ -596,8 +630,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:468:8: ( 'null' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:468:8: 'null'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:547:8: ( 'null' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:547:8: 'null'
{
match("null"); if (failed) return ;
@@ -629,10 +663,10 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:470:17: ( ( ' ' | '\\t' | '\\f' | EOL ) )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:470:17: ( ' ' | '\\t' | '\\f' | EOL )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:549:17: ( ( ' ' | '\\t' | '\\f' | EOL ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:549:17: ( ' ' | '\\t' | '\\f' | EOL )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:470:17: ( ' ' | '\\t' | '\\f' | EOL )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:549:17: ( ' ' | '\\t' | '\\f' | EOL )
int alt2=4;
switch ( input.LA(1) ) {
case ' ':
@@ -651,35 +685,35 @@
default:
if (backtracking>0) {failed=true; return ;}
NoViableAltException nvae =
- new NoViableAltException("470:17: ( ' ' | '\\t' | '\\f' | EOL )", 2, 0, input);
+ new NoViableAltException("549:17: ( ' ' | '\\t' | '\\f' | EOL )", 2, 0, input);
throw nvae;
}
switch (alt2) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:470:19: ' '
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:549:19: ' '
{
match(' '); if (failed) return ;
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:471:19: '\\t'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:550:19: '\\t'
{
match('\t'); if (failed) return ;
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:472:19: '\\f'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:551:19: '\\f'
{
match('\f'); if (failed) return ;
}
break;
case 4 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:473:19: EOL
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:552:19: EOL
{
mEOL(); if (failed) return ;
@@ -714,10 +748,10 @@
public void mEOL() throws RecognitionException {
try {
ruleNestingLevel++;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:480:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:480:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:559:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:559:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:480:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:559:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
int alt3=3;
int LA3_0 = input.LA(1);
if ( (LA3_0=='\r') ) {
@@ -734,13 +768,13 @@
else {
if (backtracking>0) {failed=true; return ;}
NoViableAltException nvae =
- new NoViableAltException("480:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 3, 0, input);
+ new NoViableAltException("559:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 3, 0, input);
throw nvae;
}
switch (alt3) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:480:14: ( '\\r\\n' )=> '\\r\\n'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:559:14: ( '\\r\\n' )=> '\\r\\n'
{
match("\r\n"); if (failed) return ;
@@ -748,14 +782,14 @@
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:481:25: '\\r'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:560:25: '\\r'
{
match('\r'); if (failed) return ;
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:482:25: '\\n'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:561:25: '\\n'
{
match('\n'); if (failed) return ;
@@ -783,10 +817,10 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:487:4: ( ( '-' )? ( '0' .. '9' )+ )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:487:4: ( '-' )? ( '0' .. '9' )+
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:566:4: ( ( '-' )? ( '0' .. '9' )+ )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:566:4: ( '-' )? ( '0' .. '9' )+
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:487:4: ( '-' )?
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:566:4: ( '-' )?
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0=='-') ) {
@@ -794,7 +828,7 @@
}
switch (alt4) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:487:5: '-'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:566:5: '-'
{
match('-'); if (failed) return ;
@@ -803,7 +837,7 @@
}
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:487:10: ( '0' .. '9' )+
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:566:10: ( '0' .. '9' )+
int cnt5=0;
loop5:
do {
@@ -816,7 +850,7 @@
switch (alt5) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:487:11: '0' .. '9'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:566:11: '0' .. '9'
{
matchRange('0','9'); if (failed) return ;
@@ -861,10 +895,10 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:491:4: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:491:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:4: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:491:4: ( '-' )?
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:4: ( '-' )?
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0=='-') ) {
@@ -872,7 +906,7 @@
}
switch (alt6) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:491:5: '-'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:5: '-'
{
match('-'); if (failed) return ;
@@ -881,7 +915,7 @@
}
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:491:10: ( '0' .. '9' )+
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:10: ( '0' .. '9' )+
int cnt7=0;
loop7:
do {
@@ -894,7 +928,7 @@
switch (alt7) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:491:11: '0' .. '9'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:11: '0' .. '9'
{
matchRange('0','9'); if (failed) return ;
@@ -912,7 +946,7 @@
} while (true);
match('.'); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:491:26: ( '0' .. '9' )+
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:26: ( '0' .. '9' )+
int cnt8=0;
loop8:
do {
@@ -925,7 +959,7 @@
switch (alt8) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:491:27: '0' .. '9'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:570:27: '0' .. '9'
{
matchRange('0','9'); if (failed) return ;
@@ -970,7 +1004,7 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:495:8: ( ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' ) | ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:8: ( ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' ) | ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' ) )
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0=='\"') ) {
@@ -982,19 +1016,19 @@
else {
if (backtracking>0) {failed=true; return ;}
NoViableAltException nvae =
- new NoViableAltException("494:1: STRING : ( ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' ) | ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' ) );", 11, 0, input);
+ new NoViableAltException("573:1: STRING : ( ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' ) | ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' ) );", 11, 0, input);
throw nvae;
}
switch (alt11) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:495:8: ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:8: ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:495:8: ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:495:9: '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:8: ( '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:9: '\"' ( EscapeSequence | ~ ('\\\\'|'\"'))* '\"'
{
match('\"'); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:495:13: ( EscapeSequence | ~ ('\\\\'|'\"'))*
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:13: ( EscapeSequence | ~ ('\\\\'|'\"'))*
loop9:
do {
int alt9=3;
@@ -1009,14 +1043,14 @@
switch (alt9) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:495:15: EscapeSequence
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:15: EscapeSequence
{
mEscapeSequence(); if (failed) return ;
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:495:32: ~ ('\\\\'|'\"')
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:574:32: ~ ('\\\\'|'\"')
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
input.consume();
@@ -1046,13 +1080,13 @@
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:496:8: ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:575:8: ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:496:8: ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:496:9: '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\''
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:575:8: ( '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\'' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:575:9: '\\'' ( EscapeSequence | ~ ('\\\\'|'\\''))* '\\''
{
match('\''); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:496:14: ( EscapeSequence | ~ ('\\\\'|'\\''))*
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:575:14: ( EscapeSequence | ~ ('\\\\'|'\\''))*
loop10:
do {
int alt10=3;
@@ -1067,14 +1101,14 @@
switch (alt10) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:496:16: EscapeSequence
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:575:16: EscapeSequence
{
mEscapeSequence(); if (failed) return ;
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:496:33: ~ ('\\\\'|'\\'')
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:575:33: ~ ('\\\\'|'\\'')
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
input.consume();
@@ -1125,8 +1159,8 @@
public void mHexDigit() throws RecognitionException {
try {
ruleNestingLevel++;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:500:12: ( ('0'..'9'|'a'..'f'|'A'..'F'))
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:500:12: ('0'..'9'|'a'..'f'|'A'..'F')
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:579:12: ( ('0'..'9'|'a'..'f'|'A'..'F'))
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:579: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();
@@ -1153,7 +1187,7 @@
public void mEscapeSequence() throws RecognitionException {
try {
ruleNestingLevel++;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:504:9: ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:583:9: ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape )
int alt12=3;
int LA12_0 = input.LA(1);
if ( (LA12_0=='\\') ) {
@@ -1184,7 +1218,7 @@
default:
if (backtracking>0) {failed=true; return ;}
NoViableAltException nvae =
- new NoViableAltException("502:1: fragment EscapeSequence : ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape );", 12, 1, input);
+ new NoViableAltException("581:1: fragment EscapeSequence : ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape );", 12, 1, input);
throw nvae;
}
@@ -1193,13 +1227,13 @@
else {
if (backtracking>0) {failed=true; return ;}
NoViableAltException nvae =
- new NoViableAltException("502:1: fragment EscapeSequence : ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape );", 12, 0, input);
+ new NoViableAltException("581:1: fragment EscapeSequence : ( '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\') | UnicodeEscape | OctalEscape );", 12, 0, input);
throw nvae;
}
switch (alt12) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:504:9: '\\\\' ('b'|'t'|'n'|'f'|'r'|'\\\"'|'\\''|'\\\\')
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:583: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' ) {
@@ -1217,14 +1251,14 @@
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:505:9: UnicodeEscape
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:584:9: UnicodeEscape
{
mUnicodeEscape(); if (failed) return ;
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:506:9: OctalEscape
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:585:9: OctalEscape
{
mOctalEscape(); if (failed) return ;
@@ -1243,7 +1277,7 @@
public void mOctalEscape() throws RecognitionException {
try {
ruleNestingLevel++;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:9: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:9: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
int alt13=3;
int LA13_0 = input.LA(1);
if ( (LA13_0=='\\') ) {
@@ -1272,7 +1306,7 @@
else {
if (backtracking>0) {failed=true; return ;}
NoViableAltException nvae =
- new NoViableAltException("509:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 13, 1, input);
+ new NoViableAltException("588:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 13, 1, input);
throw nvae;
}
@@ -1280,31 +1314,31 @@
else {
if (backtracking>0) {failed=true; return ;}
NoViableAltException nvae =
- new NoViableAltException("509:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 13, 0, input);
+ new NoViableAltException("588:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 13, 0, input);
throw nvae;
}
switch (alt13) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
{
match('\\'); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:14: ( '0' .. '3' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:15: '0' .. '3'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:14: ( '0' .. '3' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:15: '0' .. '3'
{
matchRange('0','3'); if (failed) return ;
}
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:25: ( '0' .. '7' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:26: '0' .. '7'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:25: ( '0' .. '7' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:26: '0' .. '7'
{
matchRange('0','7'); if (failed) return ;
}
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:36: ( '0' .. '7' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:37: '0' .. '7'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:36: ( '0' .. '7' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:590:37: '0' .. '7'
{
matchRange('0','7'); if (failed) return ;
@@ -1314,18 +1348,18 @@
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:512:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:591:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
{
match('\\'); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:512:14: ( '0' .. '7' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:512:15: '0' .. '7'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:591:14: ( '0' .. '7' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:591:15: '0' .. '7'
{
matchRange('0','7'); if (failed) return ;
}
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:512:25: ( '0' .. '7' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:512:26: '0' .. '7'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:591:25: ( '0' .. '7' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:591:26: '0' .. '7'
{
matchRange('0','7'); if (failed) return ;
@@ -1335,11 +1369,11 @@
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:513:9: '\\\\' ( '0' .. '7' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:592:9: '\\\\' ( '0' .. '7' )
{
match('\\'); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:513:14: ( '0' .. '7' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:513:15: '0' .. '7'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:592:14: ( '0' .. '7' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:592:15: '0' .. '7'
{
matchRange('0','7'); if (failed) return ;
@@ -1361,8 +1395,8 @@
public void mUnicodeEscape() throws RecognitionException {
try {
ruleNestingLevel++;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:518:9: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:518:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:597:9: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:597:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
{
match('\\'); if (failed) return ;
match('u'); if (failed) return ;
@@ -1389,10 +1423,10 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:522:4: ( ( 'true' | 'false' ) )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:522:4: ( 'true' | 'false' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:601:4: ( ( 'true' | 'false' ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:601:4: ( 'true' | 'false' )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:522:4: ( 'true' | 'false' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:601:4: ( 'true' | 'false' )
int alt14=2;
int LA14_0 = input.LA(1);
if ( (LA14_0=='t') ) {
@@ -1404,13 +1438,13 @@
else {
if (backtracking>0) {failed=true; return ;}
NoViableAltException nvae =
- new NoViableAltException("522:4: ( 'true' | 'false' )", 14, 0, input);
+ new NoViableAltException("601:4: ( 'true' | 'false' )", 14, 0, input);
throw nvae;
}
switch (alt14) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:522:5: 'true'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:601:5: 'true'
{
match("true"); if (failed) return ;
@@ -1418,7 +1452,7 @@
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:522:12: 'false'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:601:12: 'false'
{
match("false"); if (failed) return ;
@@ -1456,11 +1490,11 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:526:4: ( '#' ( options {greedy=false; } : . )* EOL )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:526:4: '#' ( options {greedy=false; } : . )* EOL
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:4: ( '#' ( options {greedy=false; } : . )* EOL )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:4: '#' ( options {greedy=false; } : . )* EOL
{
match('#'); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:526:8: ( options {greedy=false; } : . )*
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:8: ( options {greedy=false; } : . )*
loop15:
do {
int alt15=2;
@@ -1478,7 +1512,7 @@
switch (alt15) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:526:35: .
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:605:35: .
{
matchAny(); if (failed) return ;
@@ -1522,12 +1556,12 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:532:4: ( '//' ( options {greedy=false; } : . )* EOL )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:532:4: '//' ( options {greedy=false; } : . )* EOL
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:611:4: ( '//' ( options {greedy=false; } : . )* EOL )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:611:4: '//' ( options {greedy=false; } : . )* EOL
{
match("//"); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:532:9: ( options {greedy=false; } : . )*
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:611:9: ( options {greedy=false; } : . )*
loop16:
do {
int alt16=2;
@@ -1545,7 +1579,7 @@
switch (alt16) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:532:36: .
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:611:36: .
{
matchAny(); if (failed) return ;
@@ -1589,8 +1623,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:538:4: ( '(' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:538:4: '('
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:617:4: ( '(' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:617:4: '('
{
match('('); if (failed) return ;
@@ -1621,8 +1655,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:542:4: ( ')' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:542:4: ')'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:621:4: ( ')' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:621:4: ')'
{
match(')'); if (failed) return ;
@@ -1653,8 +1687,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:546:4: ( '[' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:546:4: '['
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:625:4: ( '[' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:625:4: '['
{
match('['); if (failed) return ;
@@ -1685,8 +1719,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:550:4: ( ']' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:550:4: ']'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:629:4: ( ']' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:629:4: ']'
{
match(']'); if (failed) return ;
@@ -1717,8 +1751,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:554:4: ( '{' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:554:4: '{'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:633:4: ( '{' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:633:4: '{'
{
match('{'); if (failed) return ;
@@ -1749,8 +1783,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:558:4: ( '}' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:558:4: '}'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:4: ( '}' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:637:4: '}'
{
match('}'); if (failed) return ;
@@ -1781,12 +1815,12 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:562:4: ( '/*' ( options {greedy=false; } : . )* '*/' )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:562:4: '/*' ( options {greedy=false; } : . )* '*/'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:641:4: ( '/*' ( options {greedy=false; } : . )* '*/' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:641:4: '/*' ( options {greedy=false; } : . )* '*/'
{
match("/*"); if (failed) return ;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:562:9: ( options {greedy=false; } : . )*
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:641:9: ( options {greedy=false; } : . )*
loop17:
do {
int alt17=2;
@@ -1809,7 +1843,7 @@
switch (alt17) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:562:35: .
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:641:35: .
{
matchAny(); if (failed) return ;
@@ -1854,8 +1888,8 @@
int _line = getLine();
int _charPosition = getCharPositionInLine();
int _channel = Token.DEFAULT_CHANNEL;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:566:7: ( ('!'|'@'|'$'|'%'|'^'|'&'|'*'|'_'|'-'|'+'|'?'|'|'|','|'='|'/'|'\\''|'\\\\'))
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:567:3: ('!'|'@'|'$'|'%'|'^'|'&'|'*'|'_'|'-'|'+'|'?'|'|'|','|'='|'/'|'\\''|'\\\\')
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:645:7: ( ('!'|'@'|'$'|'%'|'^'|'&'|'*'|'_'|'-'|'+'|'?'|'|'|','|'='|'/'|'\\''|'\\\\'))
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:646:3: ('!'|'@'|'$'|'%'|'^'|'&'|'*'|'_'|'-'|'+'|'?'|'|'|','|'='|'/'|'\\''|'\\\\')
{
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)=='\\'||(input.LA(1)>='^' && input.LA(1)<='_')||input.LA(1)=='|' ) {
input.consume();
@@ -1888,223 +1922,230 @@
// $ANTLR end MISC
public void mTokens() throws RecognitionException {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:10: ( T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | VAR | ID | NULL | WS | INT | FLOAT | STRING | BOOL | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | MULTI_LINE_COMMENT | MISC )
- int alt18=31;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:10: ( T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | DEFRULE | OR | AND | NOT | EXISTS | TEST | VAR | ID | NULL | WS | INT | FLOAT | STRING | BOOL | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | MULTI_LINE_COMMENT | MISC )
+ int alt18=32;
alt18 = dfa18.predict(input);
switch (alt18) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:10: T27
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:10: T33
{
- mT27(); if (failed) return ;
+ mT33(); if (failed) return ;
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:14: T28
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:14: T34
{
- mT28(); if (failed) return ;
+ mT34(); if (failed) return ;
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:18: T29
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:18: T35
{
- mT29(); if (failed) return ;
+ mT35(); if (failed) return ;
}
break;
case 4 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:22: T30
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:22: T36
{
- mT30(); if (failed) return ;
+ mT36(); if (failed) return ;
}
break;
case 5 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:26: T31
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:26: T37
{
- mT31(); if (failed) return ;
+ mT37(); if (failed) return ;
}
break;
case 6 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:30: T32
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:30: T38
{
- mT32(); if (failed) return ;
+ mT38(); if (failed) return ;
}
break;
case 7 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:34: T33
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:34: T39
{
- mT33(); if (failed) return ;
+ mT39(); if (failed) return ;
}
break;
case 8 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:38: T34
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:38: T40
{
- mT34(); if (failed) return ;
+ mT40(); if (failed) return ;
}
break;
case 9 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:42: T35
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:42: DEFRULE
{
- mT35(); if (failed) return ;
+ mDEFRULE(); if (failed) return ;
}
break;
case 10 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:46: T36
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:50: OR
{
- mT36(); if (failed) return ;
+ mOR(); if (failed) return ;
}
break;
case 11 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:50: T37
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:53: AND
{
- mT37(); if (failed) return ;
+ mAND(); if (failed) return ;
}
break;
case 12 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:54: T38
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:57: NOT
{
- mT38(); if (failed) return ;
+ mNOT(); if (failed) return ;
}
break;
case 13 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:58: T39
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:61: EXISTS
{
- mT39(); if (failed) return ;
+ mEXISTS(); if (failed) return ;
}
break;
case 14 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:62: VAR
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:68: TEST
{
- mVAR(); if (failed) return ;
+ mTEST(); if (failed) return ;
}
break;
case 15 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:66: ID
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:73: VAR
{
- mID(); if (failed) return ;
+ mVAR(); if (failed) return ;
}
break;
case 16 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:69: NULL
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:77: ID
{
- mNULL(); if (failed) return ;
+ mID(); if (failed) return ;
}
break;
case 17 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:74: WS
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:80: NULL
{
- mWS(); if (failed) return ;
+ mNULL(); if (failed) return ;
}
break;
case 18 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:77: INT
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:85: WS
{
- mINT(); if (failed) return ;
+ mWS(); if (failed) return ;
}
break;
case 19 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:81: FLOAT
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:88: INT
{
- mFLOAT(); if (failed) return ;
+ mINT(); if (failed) return ;
}
break;
case 20 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:87: STRING
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:92: FLOAT
{
- mSTRING(); if (failed) return ;
+ mFLOAT(); if (failed) return ;
}
break;
case 21 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:94: BOOL
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:98: STRING
{
- mBOOL(); if (failed) return ;
+ mSTRING(); if (failed) return ;
}
break;
case 22 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:99: SH_STYLE_SINGLE_LINE_COMMENT
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:105: BOOL
{
- mSH_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
+ mBOOL(); if (failed) return ;
}
break;
case 23 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:128: C_STYLE_SINGLE_LINE_COMMENT
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:110: SH_STYLE_SINGLE_LINE_COMMENT
{
- mC_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
+ mSH_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
}
break;
case 24 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:156: LEFT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:139: C_STYLE_SINGLE_LINE_COMMENT
{
- mLEFT_PAREN(); if (failed) return ;
+ mC_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
}
break;
case 25 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:167: RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:167: LEFT_PAREN
{
- mRIGHT_PAREN(); if (failed) return ;
+ mLEFT_PAREN(); if (failed) return ;
}
break;
case 26 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:179: LEFT_SQUARE
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:178: RIGHT_PAREN
{
- mLEFT_SQUARE(); if (failed) return ;
+ mRIGHT_PAREN(); if (failed) return ;
}
break;
case 27 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:191: RIGHT_SQUARE
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:190: LEFT_SQUARE
{
- mRIGHT_SQUARE(); if (failed) return ;
+ mLEFT_SQUARE(); if (failed) return ;
}
break;
case 28 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:204: LEFT_CURLY
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:202: RIGHT_SQUARE
{
- mLEFT_CURLY(); if (failed) return ;
+ mRIGHT_SQUARE(); if (failed) return ;
}
break;
case 29 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:215: RIGHT_CURLY
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:215: LEFT_CURLY
{
- mRIGHT_CURLY(); if (failed) return ;
+ mLEFT_CURLY(); if (failed) return ;
}
break;
case 30 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:227: MULTI_LINE_COMMENT
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:226: RIGHT_CURLY
{
- mMULTI_LINE_COMMENT(); if (failed) return ;
+ mRIGHT_CURLY(); if (failed) return ;
}
break;
case 31 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:246: MISC
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:238: MULTI_LINE_COMMENT
{
+ mMULTI_LINE_COMMENT(); if (failed) return ;
+
+ }
+ break;
+ case 32 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:1:257: MISC
+ {
mMISC(); if (failed) return ;
}
@@ -2117,62 +2158,64 @@
protected DFA18 dfa18 = new DFA18(this);
public static final String DFA18_eotS =
- "\2\uffff\6\36\6\uffff\1\37\1\36\1\uffff\1\37\1\55\1\uffff\1\37\2"+
- "\uffff\1\37\10\uffff\2\36\1\63\5\36\4\uffff\1\36\4\uffff\1\36\1"+
- "\73\1\uffff\1\36\1\75\5\36\3\uffff\1\36\1\uffff\1\104\3\36\2\uffff"+
- "\1\36\1\111\1\112\2\uffff";
+ "\10\uffff\7\37\1\40\1\37\1\uffff\1\40\1\57\1\uffff\1\40\2\uffff"+
+ "\1\40\13\uffff\2\37\1\65\6\37\1\uffff\1\37\4\uffff\2\37\1\uffff"+
+ "\1\77\1\100\7\37\3\uffff\1\37\1\111\1\uffff\4\37\2\uffff\1\116\1"+
+ "\37\1\120\1\uffff\1\121\2\uffff";
public static final String DFA18_eofS =
- "\113\uffff";
+ "\122\uffff";
public static final String DFA18_minS =
- "\1\11\1\uffff\1\145\1\156\1\162\1\157\1\170\1\145\6\uffff\1\44\1"+
- "\141\1\uffff\1\60\1\56\1\uffff\1\0\2\uffff\1\52\10\uffff\1\146\1"+
- "\144\1\60\1\154\1\164\1\151\1\165\1\163\4\uffff\1\154\4\uffff\1"+
- "\162\1\60\1\uffff\1\154\1\60\1\163\1\145\1\164\1\163\1\165\3\uffff"+
- "\1\164\1\uffff\1\60\1\145\1\154\1\163\2\uffff\1\145\2\60\2\uffff";
+ "\1\11\7\uffff\1\157\1\145\1\162\1\156\1\157\1\170\1\145\1\44\1\141"+
+ "\1\uffff\1\60\1\56\1\uffff\1\0\2\uffff\1\52\13\uffff\1\144\1\146"+
+ "\1\60\1\144\1\164\1\154\1\151\1\163\1\165\1\uffff\1\154\4\uffff"+
+ "\1\151\1\162\1\uffff\2\60\1\154\1\163\1\164\1\145\1\163\1\146\1"+
+ "\165\3\uffff\1\164\1\60\1\uffff\1\145\1\171\1\154\1\163\2\uffff"+
+ "\1\60\1\145\1\60\1\uffff\1\60\2\uffff";
public static final String DFA18_maxS =
- "\1\u00ff\1\uffff\1\145\1\156\1\162\1\165\1\170\1\162\6\uffff\1\u00ff"+
- "\1\141\1\uffff\2\71\1\uffff\1\ufffe\2\uffff\1\57\10\uffff\1\146"+
- "\1\144\1\u00ff\1\154\1\164\1\151\1\165\1\163\4\uffff\1\154\4\uffff"+
- "\1\162\1\u00ff\1\uffff\1\154\1\u00ff\1\163\1\145\1\164\1\163\1\165"+
- "\3\uffff\1\164\1\uffff\1\u00ff\1\145\1\154\1\163\2\uffff\1\145\2"+
- "\u00ff\2\uffff";
+ "\1\u00ff\7\uffff\1\157\1\145\1\162\1\156\1\165\1\170\1\162\1\u00ff"+
+ "\1\141\1\uffff\2\71\1\uffff\1\ufffe\2\uffff\1\57\13\uffff\1\144"+
+ "\1\146\1\u00ff\1\144\1\164\1\154\1\151\1\163\1\165\1\uffff\1\154"+
+ "\4\uffff\1\151\1\162\1\uffff\2\u00ff\1\154\1\163\1\164\1\145\1\163"+
+ "\1\146\1\165\3\uffff\1\164\1\u00ff\1\uffff\1\145\1\171\1\154\1\163"+
+ "\2\uffff\1\u00ff\1\145\1\u00ff\1\uffff\1\u00ff\2\uffff";
public static final String DFA18_acceptS =
- "\1\uffff\1\1\6\uffff\1\10\1\11\1\12\1\13\1\14\1\15\2\uffff\1\21"+
- "\2\uffff\1\24\1\uffff\1\17\1\26\1\uffff\1\30\1\31\1\32\1\33\1\34"+
- "\1\35\1\17\1\37\10\uffff\1\11\1\12\1\15\1\16\1\uffff\1\22\1\23\1"+
- "\36\1\27\2\uffff\1\4\7\uffff\1\3\1\17\1\5\1\uffff\1\17\4\uffff\1"+
- "\7\1\17\3\uffff\1\6\1\2";
+ "\1\uffff\1\1\1\2\1\3\1\4\1\5\1\6\1\7\11\uffff\1\22\2\uffff\1\25"+
+ "\1\uffff\1\20\1\27\1\uffff\1\31\1\32\1\33\1\34\1\35\1\36\1\20\1"+
+ "\40\1\3\1\4\1\7\11\uffff\1\17\1\uffff\1\23\1\24\1\30\1\37\2\uffff"+
+ "\1\12\11\uffff\1\13\1\14\1\20\2\uffff\1\20\4\uffff\1\16\1\20\3\uffff"+
+ "\1\10\1\uffff\1\15\1\11";
public static final String DFA18_specialS =
- "\113\uffff}>";
+ "\122\uffff}>";
public static final String[] DFA18_transition = {
- "\2\20\1\uffff\2\20\22\uffff\1\20\1\37\1\23\1\26\1\25\1\37\1\11\1"+
- "\24\1\30\1\31\3\37\1\21\1\uffff\1\27\12\22\1\14\1\1\1\10\1\15\1"+
- "\uffff\1\16\1\37\32\36\1\32\1\37\1\33\1\37\1\25\1\uffff\1\3\2\36"+
- "\1\2\1\6\1\17\7\36\1\5\1\4\4\36\1\7\6\36\1\34\1\12\1\35\1\13\101"+
- "\uffff\100\36",
+ "\2\21\1\uffff\2\21\22\uffff\1\21\1\40\1\24\1\27\1\26\1\40\1\3\1"+
+ "\25\1\31\1\32\3\40\1\22\1\uffff\1\30\12\23\1\6\1\1\1\2\1\7\1\uffff"+
+ "\1\17\1\40\32\37\1\33\1\40\1\34\1\40\1\26\1\uffff\1\13\2\37\1\11"+
+ "\1\15\1\20\6\37\1\10\1\14\1\12\4\37\1\16\6\37\1\35\1\4\1\36\1\5"+
+ "\101\uffff\100\37",
"",
- "\1\40",
- "\1\41",
- "\1\42",
- "\1\44\5\uffff\1\43",
- "\1\45",
- "\1\47\14\uffff\1\46",
"",
"",
"",
"",
"",
"",
- "\1\53\34\uffff\32\53\4\uffff\1\53\1\uffff\32\53\105\uffff\100\53",
- "\1\54",
+ "\1\44",
+ "\1\45",
+ "\1\46",
+ "\1\47",
+ "\1\50\5\uffff\1\51",
+ "\1\52",
+ "\1\53\14\uffff\1\54",
+ "\1\55\34\uffff\32\55\4\uffff\1\55\1\uffff\32\55\105\uffff\100\55",
+ "\1\56",
"",
- "\12\22",
- "\1\56\1\uffff\12\22",
+ "\12\23",
+ "\1\60\1\uffff\12\23",
"",
- "\uffff\23",
+ "\uffff\24",
"",
"",
- "\1\57\4\uffff\1\60",
+ "\1\62\4\uffff\1\61",
"",
"",
"",
@@ -2181,48 +2224,54 @@
"",
"",
"",
- "\1\61",
- "\1\62",
- "\12\36\7\uffff\32\36\4\uffff\1\36\1\uffff\32\36\105\uffff\100\36",
+ "",
+ "",
+ "",
+ "\1\63",
"\1\64",
- "\1\65",
+ "\12\37\7\uffff\32\37\4\uffff\1\37\1\uffff\32\37\105\uffff\100\37",
"\1\66",
"\1\67",
"\1\70",
- "",
- "",
- "",
- "",
"\1\71",
+ "\1\72",
+ "\1\73",
"",
+ "\1\74",
"",
"",
"",
- "\1\72",
- "\12\36\7\uffff\32\36\4\uffff\1\36\1\uffff\32\36\105\uffff\100\36",
"",
- "\1\74",
- "\12\36\7\uffff\32\36\4\uffff\1\36\1\uffff\32\36\105\uffff\100\36",
+ "\1\75",
"\1\76",
- "\1\77",
- "\1\100",
+ "",
+ "\12\37\7\uffff\32\37\4\uffff\1\37\1\uffff\32\37\105\uffff\100\37",
+ "\12\37\7\uffff\32\37\4\uffff\1\37\1\uffff\32\37\105\uffff\100\37",
"\1\101",
"\1\102",
- "",
- "",
- "",
"\1\103",
- "",
- "\12\36\7\uffff\32\36\4\uffff\1\36\1\uffff\32\36\105\uffff\100\36",
+ "\1\104",
"\1\105",
"\1\106",
"\1\107",
"",
"",
+ "",
"\1\110",
- "\12\36\7\uffff\32\36\4\uffff\1\36\1\uffff\32\36\105\uffff\100\36",
- "\12\36\7\uffff\32\36\4\uffff\1\36\1\uffff\32\36\105\uffff\100\36",
+ "\12\37\7\uffff\32\37\4\uffff\1\37\1\uffff\32\37\105\uffff\100\37",
"",
+ "\1\112",
+ "\1\113",
+ "\1\114",
+ "\1\115",
+ "",
+ "",
+ "\12\37\7\uffff\32\37\4\uffff\1\37\1\uffff\32\37\105\uffff\100\37",
+ "\1\117",
+ "\12\37\7\uffff\32\37\4\uffff\1\37\1\uffff\32\37\105\uffff\100\37",
+ "",
+ "\12\37\7\uffff\32\37\4\uffff\1\37\1\uffff\32\37\105\uffff\100\37",
+ "",
""
};
@@ -2243,7 +2292,7 @@
}
}
public String getDescription() {
- return "1:1: Tokens : ( T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | VAR | ID | NULL | WS | INT | FLOAT | STRING | BOOL | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | MULTI_LINE_COMMENT | MISC );";
+ return "1:1: Tokens : ( T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | DEFRULE | OR | AND | NOT | EXISTS | TEST | VAR | ID | NULL | WS | INT | FLOAT | STRING | BOOL | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | MULTI_LINE_COMMENT | MISC );";
}
}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLocalDeclarationVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLocalDeclarationVariable.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPLocalDeclarationVariable.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,75 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.drools.base.ValueType;
+import org.drools.common.InternalFactHandle;
+import org.drools.rule.Declaration;
+import org.mvel.integration.VariableResolver;
+
+public class CLPLocalDeclarationVariable implements VariableValueHandler {
+
+ private Declaration declaration;
+
+ public CLPLocalDeclarationVariable(Declaration declaration) {
+ this.declaration = declaration;
+ }
+ public String getIdentifier() {
+ return this.declaration.getIdentifier();
+ }
+
+ public Class getKnownType() {
+ return declaration.getExtractor().getExtractToClass();
+ }
+
+ public ValueType getValueType() {
+ return this.declaration.getValueType();
+ }
+
+ public void setValue(ExecutionContext context,
+ Object object) {
+ throw new UnsupportedOperationException( "External Variable identifer='" + getIdentifier() + "' type='" + getKnownType() + "' is final, it cannot be set" );
+ }
+
+ public Object getValue(ExecutionContext context) {
+ return declaration.getValue( context.getObject() );
+ }
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ return (BigDecimal) declaration.getValue( context.getObject() );
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ return (BigInteger) declaration.getValue( context.getObject() );
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ return declaration.getBooleanValue( context.getObject() );
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ return declaration.getDoubleValue( context.getObject() );
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ return declaration.getFloatValue( context.getObject() );
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ return declaration.getIntValue( context.getObject() );
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ return declaration.getLongValue( context.getObject() );
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ return declaration.getShortValue( context.getObject() );
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ return (String) declaration.getValue( context.getObject() );
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPParser.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPParser.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPParser.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -1,4 +1,4 @@
-// $ANTLR 3.0b7 C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g 2007-03-06 05:09:16
+// $ANTLR 3.0b7 C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g 2007-03-12 19:19:14
package org.drools.clp;
import java.util.List;
@@ -17,31 +17,37 @@
public class CLPParser extends Parser {
public static final String[] tokenNames = new String[] {
- "<invalid>", "<EOR>", "<DOWN>", "<UP>", "LEFT_PAREN", "ID", "RIGHT_PAREN", "VAR", "STRING", "INT", "FLOAT", "BOOL", "NULL", "EOL", "WS", "EscapeSequence", "HexDigit", "UnicodeEscape", "OctalEscape", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "LEFT_SQUARE", "RIGHT_SQUARE", "LEFT_CURLY", "RIGHT_CURLY", "MULTI_LINE_COMMENT", "MISC", "';'", "'defrule'", "'and'", "'or'", "'not'", "'exists'", "'test'", "'<-'", "'&'", "'|'", "'~'", "':'", "'='"
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>", "LEFT_PAREN", "ID", "RIGHT_PAREN", "AND", "OR", "NOT", "EXISTS", "TEST", "VAR", "STRING", "FLOAT", "INT", "BOOL", "NULL", "DEFRULE", "EOL", "WS", "EscapeSequence", "HexDigit", "UnicodeEscape", "OctalEscape", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "LEFT_SQUARE", "RIGHT_SQUARE", "LEFT_CURLY", "RIGHT_CURLY", "MULTI_LINE_COMMENT", "MISC", "';'", "'<-'", "'&'", "'|'", "'~'", "':'", "'='", "'modify'"
};
+ public static final int EXISTS=10;
public static final int LEFT_PAREN=4;
- public static final int RIGHT_CURLY=24;
- public static final int BOOL=11;
- public static final int HexDigit=16;
- public static final int WS=14;
- public static final int MISC=26;
- public static final int STRING=8;
- public static final int FLOAT=10;
- public static final int VAR=7;
- public static final int UnicodeEscape=17;
- public static final int EscapeSequence=15;
- public static final int INT=9;
+ public static final int RIGHT_CURLY=30;
+ public static final int BOOL=16;
+ public static final int DEFRULE=18;
+ public static final int HexDigit=22;
+ public static final int WS=20;
+ public static final int MISC=32;
+ public static final int STRING=13;
+ public static final int FLOAT=14;
+ public static final int OR=8;
+ public static final int VAR=12;
+ public static final int UnicodeEscape=23;
+ public static final int AND=7;
+ public static final int EscapeSequence=21;
+ public static final int INT=15;
public static final int EOF=-1;
- public static final int NULL=12;
- public static final int EOL=13;
- public static final int LEFT_SQUARE=21;
- public static final int OctalEscape=18;
- public static final int SH_STYLE_SINGLE_LINE_COMMENT=19;
- public static final int MULTI_LINE_COMMENT=25;
+ public static final int NULL=17;
+ public static final int EOL=19;
+ public static final int LEFT_SQUARE=27;
+ public static final int SH_STYLE_SINGLE_LINE_COMMENT=25;
+ public static final int OctalEscape=24;
+ public static final int MULTI_LINE_COMMENT=31;
+ public static final int TEST=11;
public static final int RIGHT_PAREN=6;
- public static final int LEFT_CURLY=23;
- public static final int RIGHT_SQUARE=22;
- public static final int C_STYLE_SINGLE_LINE_COMMENT=20;
+ public static final int NOT=9;
+ public static final int LEFT_CURLY=29;
+ public static final int RIGHT_SQUARE=28;
+ public static final int C_STYLE_SINGLE_LINE_COMMENT=26;
public static final int ID=5;
public CLPParser(TokenStream input) {
@@ -212,14 +218,14 @@
// C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:168:4: ( ';' )?
int alt1=2;
int LA1_0 = input.LA(1);
- if ( (LA1_0==27) ) {
+ if ( (LA1_0==33) ) {
alt1=1;
}
switch (alt1) {
case 1 :
// C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:168:4: ';'
{
- match(input,27,FOLLOW_27_in_opt_semicolon38);
+ match(input,33,FOLLOW_33_in_opt_semicolon38);
}
break;
@@ -242,7 +248,7 @@
// $ANTLR start rule
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:210:1: rule returns [RuleDescr rule] : loc= LEFT_PAREN 'defrule' ruleName= ID ( lhs[lhs] )* RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:210:1: rule returns [RuleDescr rule] : loc= LEFT_PAREN 'defrule' ruleName= ID ( lhs[lhs] )* ( function[context] )* RIGHT_PAREN ;
public RuleDescr rule() throws RecognitionException {
RuleDescr rule = null;
@@ -253,14 +259,16 @@
rule = null;
AndDescr lhs = null;
ColumnDescr colum = null;
+ ExecutionEngine engine = new BlockExecutionEngine();
+ ExecutionBuildContext context = new ExecutionBuildContext( engine );
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:216:4: (loc= LEFT_PAREN 'defrule' ruleName= ID ( lhs[lhs] )* RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:216:4: loc= LEFT_PAREN 'defrule' ruleName= ID ( lhs[lhs] )* RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:218:4: (loc= LEFT_PAREN 'defrule' ruleName= ID ( lhs[lhs] )* ( function[context] )* RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:218:4: loc= LEFT_PAREN 'defrule' ruleName= ID ( lhs[lhs] )* ( function[context] )* RIGHT_PAREN
{
loc=(Token)input.LT(1);
match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_rule64);
- match(input,28,FOLLOW_28_in_rule66);
+ match(input,DEFRULE,FOLLOW_DEFRULE_in_rule66);
ruleName=(Token)input.LT(1);
match(input,ID,FOLLOW_ID_in_rule74);
@@ -275,19 +283,14 @@
lhs.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
lhs.setStartCharacter( ((CommonToken)loc).getStartIndex() );
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:230:4: ( lhs[lhs] )*
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:232:4: ( lhs[lhs] )*
loop2:
do {
int alt2=2;
- int LA2_0 = input.LA(1);
- if ( (LA2_0==LEFT_PAREN||LA2_0==VAR) ) {
- alt2=1;
- }
-
-
+ alt2 = dfa2.predict(input);
switch (alt2) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:230:4: lhs[lhs]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:232:4: lhs[lhs]
{
pushFollow(FOLLOW_lhs_in_rule85);
lhs(lhs);
@@ -302,8 +305,36 @@
}
} while (true);
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_rule92);
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:233:4: ( function[context] )*
+ loop3:
+ do {
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+ if ( (LA3_0==LEFT_PAREN) ) {
+ alt3=1;
+ }
+
+ switch (alt3) {
+ case 1 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:233:4: function[context]
+ {
+ pushFollow(FOLLOW_function_in_rule92);
+ function(context);
+ _fsp--;
+
+
+ }
+ break;
+
+ default :
+ break loop3;
+ }
+ } while (true);
+
+ rule.setConsequence( engine );
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_rule101);
+
}
}
@@ -319,57 +350,57 @@
// $ANTLR start lhs
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:235:1: lhs[ConditionalElementDescr in_ce] : ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] ) ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:239:1: lhs[ConditionalElementDescr in_ce] : ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] ) ;
public void lhs(ConditionalElementDescr in_ce) throws RecognitionException {
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:236:4: ( ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] ) )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:236:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:240:4: ( ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:240:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:236:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )
- int alt3=7;
- int LA3_0 = input.LA(1);
- if ( (LA3_0==LEFT_PAREN) ) {
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:240:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )
+ int alt4=7;
+ int LA4_0 = input.LA(1);
+ if ( (LA4_0==LEFT_PAREN) ) {
switch ( input.LA(2) ) {
- case 30:
- alt3=2;
+ case AND:
+ alt4=1;
break;
- case 32:
- alt3=4;
+ case EXISTS:
+ alt4=4;
break;
case ID:
- alt3=6;
+ alt4=6;
break;
- case 29:
- alt3=1;
+ case OR:
+ alt4=2;
break;
- case 31:
- alt3=3;
+ case NOT:
+ alt4=3;
break;
- case 33:
- alt3=5;
+ case TEST:
+ alt4=5;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("236:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )", 3, 1, input);
+ new NoViableAltException("240:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )", 4, 1, input);
throw nvae;
}
}
- else if ( (LA3_0==VAR) ) {
- alt3=7;
+ else if ( (LA4_0==VAR) ) {
+ alt4=7;
}
else {
NoViableAltException nvae =
- new NoViableAltException("236:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )", 3, 0, input);
+ new NoViableAltException("240:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] | bound_pattern[in_ce] )", 4, 0, input);
throw nvae;
}
- switch (alt3) {
+ switch (alt4) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:236:8: and_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:240:8: and_ce[in_ce]
{
- pushFollow(FOLLOW_and_ce_in_lhs109);
+ pushFollow(FOLLOW_and_ce_in_lhs120);
and_ce(in_ce);
_fsp--;
@@ -377,9 +408,9 @@
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:237:7: or_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:241:7: or_ce[in_ce]
{
- pushFollow(FOLLOW_or_ce_in_lhs119);
+ pushFollow(FOLLOW_or_ce_in_lhs130);
or_ce(in_ce);
_fsp--;
@@ -387,9 +418,9 @@
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:238:7: not_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:242:7: not_ce[in_ce]
{
- pushFollow(FOLLOW_not_ce_in_lhs128);
+ pushFollow(FOLLOW_not_ce_in_lhs139);
not_ce(in_ce);
_fsp--;
@@ -397,9 +428,9 @@
}
break;
case 4 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:239:7: exists_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:243:7: exists_ce[in_ce]
{
- pushFollow(FOLLOW_exists_ce_in_lhs137);
+ pushFollow(FOLLOW_exists_ce_in_lhs148);
exists_ce(in_ce);
_fsp--;
@@ -407,9 +438,9 @@
}
break;
case 5 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:240:8: eval_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:244:8: eval_ce[in_ce]
{
- pushFollow(FOLLOW_eval_ce_in_lhs151);
+ pushFollow(FOLLOW_eval_ce_in_lhs162);
eval_ce(in_ce);
_fsp--;
@@ -417,9 +448,9 @@
}
break;
case 6 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:241:7: normal_pattern[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:245:7: normal_pattern[in_ce]
{
- pushFollow(FOLLOW_normal_pattern_in_lhs165);
+ pushFollow(FOLLOW_normal_pattern_in_lhs176);
normal_pattern(in_ce);
_fsp--;
@@ -427,9 +458,9 @@
}
break;
case 7 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:242:7: bound_pattern[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:246:7: bound_pattern[in_ce]
{
- pushFollow(FOLLOW_bound_pattern_in_lhs174);
+ pushFollow(FOLLOW_bound_pattern_in_lhs185);
bound_pattern(in_ce);
_fsp--;
@@ -455,38 +486,38 @@
// $ANTLR start ce
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:246:1: ce[ConditionalElementDescr in_ce] : ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] ) ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:250:1: ce[ConditionalElementDescr in_ce] : ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] ) ;
public void ce(ConditionalElementDescr in_ce) throws RecognitionException {
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:247:4: ( ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] ) )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:247:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:251:4: ( ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:251:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:247:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] )
- int alt4=6;
- int LA4_0 = input.LA(1);
- if ( (LA4_0==LEFT_PAREN) ) {
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:251:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] )
+ int alt5=6;
+ int LA5_0 = input.LA(1);
+ if ( (LA5_0==LEFT_PAREN) ) {
switch ( input.LA(2) ) {
- case 29:
- alt4=1;
+ case NOT:
+ alt5=3;
break;
- case 31:
- alt4=3;
+ case EXISTS:
+ alt5=4;
break;
- case ID:
- alt4=6;
+ case AND:
+ alt5=1;
break;
- case 33:
- alt4=5;
+ case OR:
+ alt5=2;
break;
- case 30:
- alt4=2;
+ case ID:
+ alt5=6;
break;
- case 32:
- alt4=4;
+ case TEST:
+ alt5=5;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("247:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] )", 4, 1, input);
+ new NoViableAltException("251:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] )", 5, 1, input);
throw nvae;
}
@@ -494,15 +525,15 @@
}
else {
NoViableAltException nvae =
- new NoViableAltException("247:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] )", 4, 0, input);
+ new NoViableAltException("251:4: ( and_ce[in_ce] | or_ce[in_ce] | not_ce[in_ce] | exists_ce[in_ce] | eval_ce[in_ce] | normal_pattern[in_ce] )", 5, 0, input);
throw nvae;
}
- switch (alt4) {
+ switch (alt5) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:247:8: and_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:251:8: and_ce[in_ce]
{
- pushFollow(FOLLOW_and_ce_in_ce196);
+ pushFollow(FOLLOW_and_ce_in_ce207);
and_ce(in_ce);
_fsp--;
@@ -510,9 +541,9 @@
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:248:10: or_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:252:10: or_ce[in_ce]
{
- pushFollow(FOLLOW_or_ce_in_ce209);
+ pushFollow(FOLLOW_or_ce_in_ce220);
or_ce(in_ce);
_fsp--;
@@ -520,9 +551,9 @@
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:249:7: not_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:253:7: not_ce[in_ce]
{
- pushFollow(FOLLOW_not_ce_in_ce218);
+ pushFollow(FOLLOW_not_ce_in_ce229);
not_ce(in_ce);
_fsp--;
@@ -530,9 +561,9 @@
}
break;
case 4 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:250:7: exists_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:254:7: exists_ce[in_ce]
{
- pushFollow(FOLLOW_exists_ce_in_ce227);
+ pushFollow(FOLLOW_exists_ce_in_ce238);
exists_ce(in_ce);
_fsp--;
@@ -540,9 +571,9 @@
}
break;
case 5 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:251:8: eval_ce[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:255:8: eval_ce[in_ce]
{
- pushFollow(FOLLOW_eval_ce_in_ce241);
+ pushFollow(FOLLOW_eval_ce_in_ce252);
eval_ce(in_ce);
_fsp--;
@@ -550,9 +581,9 @@
}
break;
case 6 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:252:10: normal_pattern[in_ce]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:256:10: normal_pattern[in_ce]
{
- pushFollow(FOLLOW_normal_pattern_in_ce265);
+ pushFollow(FOLLOW_normal_pattern_in_ce276);
normal_pattern(in_ce);
_fsp--;
@@ -578,36 +609,36 @@
// $ANTLR start and_ce
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:257:1: and_ce[ConditionalElementDescr in_ce] : LEFT_PAREN 'and' ( ce[andDescr] )* RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:261:1: and_ce[ConditionalElementDescr in_ce] : LEFT_PAREN AND ( ce[andDescr] )* RIGHT_PAREN ;
public void and_ce(ConditionalElementDescr in_ce) throws RecognitionException {
AndDescr andDescr= null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:261:4: ( LEFT_PAREN 'and' ( ce[andDescr] )* RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:261:4: LEFT_PAREN 'and' ( ce[andDescr] )* RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:265:4: ( LEFT_PAREN AND ( ce[andDescr] )* RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:265:4: LEFT_PAREN AND ( ce[andDescr] )* RIGHT_PAREN
{
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_and_ce297);
- match(input,29,FOLLOW_29_in_and_ce302);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_and_ce308);
+ match(input,AND,FOLLOW_AND_in_and_ce313);
andDescr = new AndDescr();
in_ce.addDescr( andDescr );
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:266:3: ( ce[andDescr] )*
- loop5:
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:270:3: ( ce[andDescr] )*
+ loop6:
do {
- int alt5=2;
- int LA5_0 = input.LA(1);
- if ( (LA5_0==LEFT_PAREN) ) {
- alt5=1;
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+ if ( (LA6_0==LEFT_PAREN) ) {
+ alt6=1;
}
- switch (alt5) {
+ switch (alt6) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:266:3: ce[andDescr]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:270:3: ce[andDescr]
{
- pushFollow(FOLLOW_ce_in_and_ce308);
+ pushFollow(FOLLOW_ce_in_and_ce319);
ce(andDescr);
_fsp--;
@@ -616,11 +647,11 @@
break;
default :
- break loop5;
+ break loop6;
}
} while (true);
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_and_ce317);
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_and_ce328);
}
@@ -637,36 +668,36 @@
// $ANTLR start or_ce
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:270:1: or_ce[ConditionalElementDescr in_ce] : LEFT_PAREN 'or' ( ce[orDescr] )* RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:274:1: or_ce[ConditionalElementDescr in_ce] : LEFT_PAREN OR ( ce[orDescr] )* RIGHT_PAREN ;
public void or_ce(ConditionalElementDescr in_ce) throws RecognitionException {
OrDescr orDescr= null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:274:4: ( LEFT_PAREN 'or' ( ce[orDescr] )* RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:274:4: LEFT_PAREN 'or' ( ce[orDescr] )* RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:278:4: ( LEFT_PAREN OR ( ce[orDescr] )* RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:278:4: LEFT_PAREN OR ( ce[orDescr] )* RIGHT_PAREN
{
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_or_ce345);
- match(input,30,FOLLOW_30_in_or_ce350);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_or_ce356);
+ match(input,OR,FOLLOW_OR_in_or_ce361);
orDescr = new OrDescr();
in_ce.addDescr( orDescr );
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:279:3: ( ce[orDescr] )*
- loop6:
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:283:3: ( ce[orDescr] )*
+ loop7:
do {
- int alt6=2;
- int LA6_0 = input.LA(1);
- if ( (LA6_0==LEFT_PAREN) ) {
- alt6=1;
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+ if ( (LA7_0==LEFT_PAREN) ) {
+ alt7=1;
}
- switch (alt6) {
+ switch (alt7) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:279:3: ce[orDescr]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:283:3: ce[orDescr]
{
- pushFollow(FOLLOW_ce_in_or_ce356);
+ pushFollow(FOLLOW_ce_in_or_ce367);
ce(orDescr);
_fsp--;
@@ -675,11 +706,11 @@
break;
default :
- break loop6;
+ break loop7;
}
} while (true);
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_or_ce365);
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_or_ce376);
}
@@ -696,32 +727,32 @@
// $ANTLR start not_ce
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:283:1: not_ce[ConditionalElementDescr in_ce] : LEFT_PAREN 'not' ( ce[notDescr] )? RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:287:1: not_ce[ConditionalElementDescr in_ce] : LEFT_PAREN NOT ( ce[notDescr] )? RIGHT_PAREN ;
public void not_ce(ConditionalElementDescr in_ce) throws RecognitionException {
NotDescr notDescr= null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:287:4: ( LEFT_PAREN 'not' ( ce[notDescr] )? RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:287:4: LEFT_PAREN 'not' ( ce[notDescr] )? RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:291:4: ( LEFT_PAREN NOT ( ce[notDescr] )? RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:291:4: LEFT_PAREN NOT ( ce[notDescr] )? RIGHT_PAREN
{
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_not_ce393);
- match(input,31,FOLLOW_31_in_not_ce398);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_not_ce404);
+ match(input,NOT,FOLLOW_NOT_in_not_ce409);
notDescr = new NotDescr();
in_ce.addDescr( notDescr );
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:292:3: ( ce[notDescr] )?
- int alt7=2;
- int LA7_0 = input.LA(1);
- if ( (LA7_0==LEFT_PAREN) ) {
- alt7=1;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:296:3: ( ce[notDescr] )?
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+ if ( (LA8_0==LEFT_PAREN) ) {
+ alt8=1;
}
- switch (alt7) {
+ switch (alt8) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:292:3: ce[notDescr]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:296:3: ce[notDescr]
{
- pushFollow(FOLLOW_ce_in_not_ce404);
+ pushFollow(FOLLOW_ce_in_not_ce415);
ce(notDescr);
_fsp--;
@@ -731,7 +762,7 @@
}
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_not_ce413);
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_not_ce424);
}
@@ -748,32 +779,32 @@
// $ANTLR start exists_ce
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:296:1: exists_ce[ConditionalElementDescr in_ce] : LEFT_PAREN 'exists' ( ce[existsDescr] )? RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:300:1: exists_ce[ConditionalElementDescr in_ce] : LEFT_PAREN EXISTS ( ce[existsDescr] )? RIGHT_PAREN ;
public void exists_ce(ConditionalElementDescr in_ce) throws RecognitionException {
- ExistsDescr existsDescr= null;
+ ExistsDescr existsDescr= null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:300:4: ( LEFT_PAREN 'exists' ( ce[existsDescr] )? RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:300:4: LEFT_PAREN 'exists' ( ce[existsDescr] )? RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:304:4: ( LEFT_PAREN EXISTS ( ce[existsDescr] )? RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:304:4: LEFT_PAREN EXISTS ( ce[existsDescr] )? RIGHT_PAREN
{
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_exists_ce442);
- match(input,32,FOLLOW_32_in_exists_ce447);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_exists_ce453);
+ match(input,EXISTS,FOLLOW_EXISTS_in_exists_ce458);
existsDescr = new ExistsDescr();
in_ce.addDescr( existsDescr );
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:305:3: ( ce[existsDescr] )?
- int alt8=2;
- int LA8_0 = input.LA(1);
- if ( (LA8_0==LEFT_PAREN) ) {
- alt8=1;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:309:3: ( ce[existsDescr] )?
+ int alt9=2;
+ int LA9_0 = input.LA(1);
+ if ( (LA9_0==LEFT_PAREN) ) {
+ alt9=1;
}
- switch (alt8) {
+ switch (alt9) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:305:3: ce[existsDescr]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:309:3: ce[existsDescr]
{
- pushFollow(FOLLOW_ce_in_exists_ce453);
+ pushFollow(FOLLOW_ce_in_exists_ce464);
ce(existsDescr);
_fsp--;
@@ -783,7 +814,7 @@
}
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_exists_ce462);
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_exists_ce473);
}
@@ -800,31 +831,31 @@
// $ANTLR start eval_ce
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:309:1: eval_ce[ConditionalElementDescr in_ce] : LEFT_PAREN 'test' LEFT_PAREN t= ID RIGHT_PAREN RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:313:1: eval_ce[ConditionalElementDescr in_ce] : LEFT_PAREN TEST function[context] RIGHT_PAREN ;
public void eval_ce(ConditionalElementDescr in_ce) throws RecognitionException {
- Token t=null;
-
- EvalDescr evalDescr= null;
+ EvalDescr evalDescr= null;
+ ExecutionEngine engine = new CLPEval();
+ ExecutionBuildContext context = new ExecutionBuildContext( engine );
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:313:4: ( LEFT_PAREN 'test' LEFT_PAREN t= ID RIGHT_PAREN RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:313:4: LEFT_PAREN 'test' LEFT_PAREN t= ID RIGHT_PAREN RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:319:4: ( LEFT_PAREN TEST function[context] RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:319:4: LEFT_PAREN TEST function[context] RIGHT_PAREN
{
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce490);
- match(input,33,FOLLOW_33_in_eval_ce495);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce501);
+ match(input,TEST,FOLLOW_TEST_in_eval_ce506);
evalDescr = new EvalDescr();
in_ce.addDescr( evalDescr );
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce501);
- t=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_eval_ce510);
-
- evalDescr.setText( t.getText() );
+ pushFollow(FOLLOW_function_in_eval_ce512);
+ function(context);
+ _fsp--;
+
+
+ evalDescr.setContent( engine );
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce516);
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce520);
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce523);
}
@@ -841,7 +872,7 @@
// $ANTLR start normal_pattern
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:326:1: normal_pattern[ConditionalElementDescr in_ce] : LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:330:1: normal_pattern[ConditionalElementDescr in_ce] : LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN ;
public void normal_pattern(ConditionalElementDescr in_ce) throws RecognitionException {
Token name=null;
@@ -849,31 +880,31 @@
ColumnDescr column = null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:330:4: ( LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:330:4: LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:334:4: ( LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:334:4: LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN
{
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_normal_pattern548);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_normal_pattern551);
name=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_normal_pattern555);
+ match(input,ID,FOLLOW_ID_in_normal_pattern558);
column = new ColumnDescr(name.getText());
in_ce.addDescr( column );
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:335:3: ( field_constriant[column] )*
- loop9:
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:339:3: ( field_constriant[column] )*
+ loop10:
do {
- int alt9=2;
- int LA9_0 = input.LA(1);
- if ( (LA9_0==LEFT_PAREN) ) {
- alt9=1;
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+ if ( (LA10_0==LEFT_PAREN) ) {
+ alt10=1;
}
- switch (alt9) {
+ switch (alt10) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:335:3: field_constriant[column]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:339:3: field_constriant[column]
{
- pushFollow(FOLLOW_field_constriant_in_normal_pattern561);
+ pushFollow(FOLLOW_field_constriant_in_normal_pattern564);
field_constriant(column);
_fsp--;
@@ -882,11 +913,11 @@
break;
default :
- break loop9;
+ break loop10;
}
} while (true);
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_normal_pattern571);
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_normal_pattern574);
}
@@ -903,7 +934,7 @@
// $ANTLR start bound_pattern
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:341:1: bound_pattern[ConditionalElementDescr in_ce] : var= VAR '<-' LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:345:1: bound_pattern[ConditionalElementDescr in_ce] : var= VAR '<-' LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN ;
public void bound_pattern(ConditionalElementDescr in_ce) throws RecognitionException {
Token var=null;
Token name=null;
@@ -913,38 +944,38 @@
String identifier = null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:346:4: (var= VAR '<-' LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:346:4: var= VAR '<-' LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:350:4: (var= VAR '<-' LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:350:4: var= VAR '<-' LEFT_PAREN name= ID ( field_constriant[column] )* RIGHT_PAREN
{
var=(Token)input.LT(1);
- match(input,VAR,FOLLOW_VAR_in_bound_pattern599);
+ match(input,VAR,FOLLOW_VAR_in_bound_pattern602);
identifier = var.getText();
- match(input,34,FOLLOW_34_in_bound_pattern605);
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_bound_pattern610);
+ match(input,34,FOLLOW_34_in_bound_pattern608);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_bound_pattern613);
name=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_bound_pattern617);
+ match(input,ID,FOLLOW_ID_in_bound_pattern620);
column = new ColumnDescr(name.getText());
column.setIdentifier( identifier );
in_ce.addDescr( column );
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:356:3: ( field_constriant[column] )*
- loop10:
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:360:3: ( field_constriant[column] )*
+ loop11:
do {
- int alt10=2;
- int LA10_0 = input.LA(1);
- if ( (LA10_0==LEFT_PAREN) ) {
- alt10=1;
+ int alt11=2;
+ int LA11_0 = input.LA(1);
+ if ( (LA11_0==LEFT_PAREN) ) {
+ alt11=1;
}
- switch (alt10) {
+ switch (alt11) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:356:3: field_constriant[column]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:360:3: field_constriant[column]
{
- pushFollow(FOLLOW_field_constriant_in_bound_pattern623);
+ pushFollow(FOLLOW_field_constriant_in_bound_pattern626);
field_constriant(column);
_fsp--;
@@ -953,11 +984,11 @@
break;
default :
- break loop10;
+ break loop11;
}
} while (true);
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_bound_pattern630);
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_bound_pattern633);
}
@@ -974,7 +1005,7 @@
// $ANTLR start field_constriant
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:360:1: field_constriant[ColumnDescr column] : LEFT_PAREN f= ID restriction[fc, column] ( connective[fc] restriction[fc, column] )* RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:364:1: field_constriant[ColumnDescr column] : LEFT_PAREN f= ID restriction[fc, column] ( connective[fc] restriction[fc, column] )* RIGHT_PAREN ;
public void field_constriant(ColumnDescr column) throws RecognitionException {
Token f=null;
@@ -985,41 +1016,41 @@
String op = "==";
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:367:4: ( LEFT_PAREN f= ID restriction[fc, column] ( connective[fc] restriction[fc, column] )* RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:367:4: LEFT_PAREN f= ID restriction[fc, column] ( connective[fc] restriction[fc, column] )* RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:371:4: ( LEFT_PAREN f= ID restriction[fc, column] ( connective[fc] restriction[fc, column] )* RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:371:4: LEFT_PAREN f= ID restriction[fc, column] ( connective[fc] restriction[fc, column] )* RIGHT_PAREN
{
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_field_constriant658);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_field_constriant661);
f=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_field_constriant665);
+ match(input,ID,FOLLOW_ID_in_field_constriant668);
fc = new FieldConstraintDescr(f.getText());
fc.setLocation( offset(f.getLine()), f.getCharPositionInLine() );
fc.setStartCharacter( ((CommonToken)f).getStartIndex() );
column.addDescr( fc );
- pushFollow(FOLLOW_restriction_in_field_constriant677);
+ pushFollow(FOLLOW_restriction_in_field_constriant680);
restriction(fc, column);
_fsp--;
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:376:3: ( connective[fc] restriction[fc, column] )*
- loop11:
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:380:3: ( connective[fc] restriction[fc, column] )*
+ loop12:
do {
- int alt11=2;
- int LA11_0 = input.LA(1);
- if ( ((LA11_0>=35 && LA11_0<=36)) ) {
- alt11=1;
+ int alt12=2;
+ int LA12_0 = input.LA(1);
+ if ( ((LA12_0>=35 && LA12_0<=36)) ) {
+ alt12=1;
}
- switch (alt11) {
+ switch (alt12) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:377:5: connective[fc] restriction[fc, column]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:381:5: connective[fc] restriction[fc, column]
{
- pushFollow(FOLLOW_connective_in_field_constriant689);
+ pushFollow(FOLLOW_connective_in_field_constriant692);
connective(fc);
_fsp--;
- pushFollow(FOLLOW_restriction_in_field_constriant706);
+ pushFollow(FOLLOW_restriction_in_field_constriant709);
restriction(fc, column);
_fsp--;
@@ -1028,11 +1059,11 @@
break;
default :
- break loop11;
+ break loop12;
}
} while (true);
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_field_constriant729);
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_field_constriant732);
}
@@ -1049,40 +1080,40 @@
// $ANTLR start connective
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:383:1: connective[FieldConstraintDescr fc] : ( '&' | '|' ) ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:387:1: connective[FieldConstraintDescr fc] : ( '&' | '|' ) ;
public void connective(FieldConstraintDescr fc) throws RecognitionException {
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:384:4: ( ( '&' | '|' ) )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:384:4: ( '&' | '|' )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:388:4: ( ( '&' | '|' ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:388:4: ( '&' | '|' )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:384:4: ( '&' | '|' )
- int alt12=2;
- int LA12_0 = input.LA(1);
- if ( (LA12_0==35) ) {
- alt12=1;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:388:4: ( '&' | '|' )
+ int alt13=2;
+ int LA13_0 = input.LA(1);
+ if ( (LA13_0==35) ) {
+ alt13=1;
}
- else if ( (LA12_0==36) ) {
- alt12=2;
+ else if ( (LA13_0==36) ) {
+ alt13=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("384:4: ( '&' | '|' )", 12, 0, input);
+ new NoViableAltException("388:4: ( '&' | '|' )", 13, 0, input);
throw nvae;
}
- switch (alt12) {
+ switch (alt13) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:384:6: '&'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:388:6: '&'
{
- match(input,35,FOLLOW_35_in_connective747);
+ match(input,35,FOLLOW_35_in_connective750);
fc.addRestriction(new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND));
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:385:9: '|'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:389:9: '|'
{
- match(input,36,FOLLOW_36_in_connective759);
+ match(input,36,FOLLOW_36_in_connective762);
fc.addRestriction(new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR));
}
@@ -1106,7 +1137,7 @@
// $ANTLR start restriction
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:389:1: restriction[FieldConstraintDescr fc, ColumnDescr column] : ( '~' )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction ) ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:393:1: restriction[FieldConstraintDescr fc, ColumnDescr column] : ( '~' )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction ) ;
public void restriction(FieldConstraintDescr fc, ColumnDescr column) throws RecognitionException {
String lc = null;
@@ -1115,20 +1146,20 @@
String op = "==";
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:393:4: ( ( '~' )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction ) )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:393:4: ( '~' )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:397:4: ( ( '~' )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:397:4: ( '~' )? ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:393:4: ( '~' )?
- int alt13=2;
- int LA13_0 = input.LA(1);
- if ( (LA13_0==37) ) {
- alt13=1;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:397:4: ( '~' )?
+ int alt14=2;
+ int LA14_0 = input.LA(1);
+ if ( (LA14_0==37) ) {
+ alt14=1;
}
- switch (alt13) {
+ switch (alt14) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:393:5: '~'
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:397:5: '~'
{
- match(input,37,FOLLOW_37_in_restriction794);
+ match(input,37,FOLLOW_37_in_restriction797);
op = "!=";
}
@@ -1136,38 +1167,38 @@
}
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:394:3: ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )
- int alt14=4;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:398:3: ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )
+ int alt15=4;
switch ( input.LA(1) ) {
case 38:
- alt14=1;
+ alt15=1;
break;
case 39:
- alt14=2;
+ alt15=2;
break;
case VAR:
- alt14=3;
+ alt15=3;
break;
case ID:
case STRING:
+ case FLOAT:
case INT:
- case FLOAT:
case BOOL:
case NULL:
- alt14=4;
+ alt15=4;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("394:3: ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )", 14, 0, input);
+ new NoViableAltException("398:3: ( predicate_constraint[op, column] | return_value_restriction[op, fc] | variable_restriction[op, fc] | lc= literal_restriction )", 15, 0, input);
throw nvae;
}
- switch (alt14) {
+ switch (alt15) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:394:7: predicate_constraint[op, column]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:398:6: predicate_constraint[op, column]
{
- pushFollow(FOLLOW_predicate_constraint_in_restriction812);
+ pushFollow(FOLLOW_predicate_constraint_in_restriction814);
predicate_constraint(op, column);
_fsp--;
@@ -1175,9 +1206,9 @@
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:395:11: return_value_restriction[op, fc]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:399:11: return_value_restriction[op, fc]
{
- pushFollow(FOLLOW_return_value_restriction_in_restriction832);
+ pushFollow(FOLLOW_return_value_restriction_in_restriction834);
return_value_restriction(op, fc);
_fsp--;
@@ -1185,9 +1216,9 @@
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:396:10: variable_restriction[op, fc]
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:400:10: variable_restriction[op, fc]
{
- pushFollow(FOLLOW_variable_restriction_in_restriction844);
+ pushFollow(FOLLOW_variable_restriction_in_restriction846);
variable_restriction(op, fc);
_fsp--;
@@ -1195,14 +1226,14 @@
}
break;
case 4 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:397:12: lc= literal_restriction
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:401:12: lc= literal_restriction
{
- pushFollow(FOLLOW_literal_restriction_in_restriction860);
+ pushFollow(FOLLOW_literal_restriction_in_restriction862);
lc=literal_restriction();
_fsp--;
- fc.addRestriction( new LiteralRestrictionDescr(op, lc, true) );
+ fc.addRestriction( new LiteralRestrictionDescr(op, lc, true) );
op = "==";
@@ -1227,21 +1258,25 @@
// $ANTLR start predicate_constraint
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:404:1: predicate_constraint[String op, ColumnDescr column] : ':' LEFT_PAREN id= ID RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:408:1: predicate_constraint[String op, ColumnDescr column] : ':' function[context] ;
public void predicate_constraint(String op, ColumnDescr column) throws RecognitionException {
- Token id=null;
-
+
+ ExecutionEngine engine = new CLPPredicate();
+ ExecutionBuildContext context = new ExecutionBuildContext( engine );
+
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:405:4: ( ':' LEFT_PAREN id= ID RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:405:4: ':' LEFT_PAREN id= ID RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:413:4: ( ':' function[context] )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:413:4: ':' function[context]
{
- match(input,38,FOLLOW_38_in_predicate_constraint893);
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_predicate_constraint894);
- id=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_predicate_constraint901);
- column.addDescr( new PredicateDescr( id.getText() ) );
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_predicate_constraint908);
+ match(input,38,FOLLOW_38_in_predicate_constraint904);
+ pushFollow(FOLLOW_function_in_predicate_constraint908);
+ function(context);
+ _fsp--;
+
+ column.addDescr( new PredicateDescr( engine ) );
+
+
}
}
@@ -1257,24 +1292,25 @@
// $ANTLR start return_value_restriction
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:411:1: return_value_restriction[String op, FieldConstraintDescr fc] : '=' LEFT_PAREN id= ID RIGHT_PAREN ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:420:1: return_value_restriction[String op, FieldConstraintDescr fc] : '=' function[context] ;
public void return_value_restriction(String op, FieldConstraintDescr fc) throws RecognitionException {
- Token id=null;
-
- PredicateDescr d = null;
+ ExecutionEngine engine = new CLPReturnValue();
+ ExecutionBuildContext context = new ExecutionBuildContext( engine );
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:415:4: ( '=' LEFT_PAREN id= ID RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:415:4: '=' LEFT_PAREN id= ID RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:425:4: ( '=' function[context] )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:425:4: '=' function[context]
{
- match(input,39,FOLLOW_39_in_return_value_restriction927);
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_return_value_restriction928);
- id=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_return_value_restriction935);
- fc.addRestriction( new ReturnValueRestrictionDescr(op, id.getText() ) );
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_return_value_restriction942);
+ match(input,39,FOLLOW_39_in_return_value_restriction931);
+ pushFollow(FOLLOW_function_in_return_value_restriction936);
+ function(context);
+ _fsp--;
+
+ fc.addRestriction( new ReturnValueRestrictionDescr (op, engine ) );
+
+
}
}
@@ -1290,16 +1326,16 @@
// $ANTLR start variable_restriction
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:420:1: variable_restriction[String op, FieldConstraintDescr fc] : var= VAR ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:431:1: variable_restriction[String op, FieldConstraintDescr fc] : var= VAR ;
public void variable_restriction(String op, FieldConstraintDescr fc) throws RecognitionException {
Token var=null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:421:4: (var= VAR )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:421:4: var= VAR
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:432:4: (var= VAR )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:432:4: var= VAR
{
var=(Token)input.LT(1);
- match(input,VAR,FOLLOW_VAR_in_variable_restriction958);
+ match(input,VAR,FOLLOW_VAR_in_variable_restriction957);
fc.addRestriction( new VariableRestrictionDescr(op, var.getText()) );
@@ -1319,7 +1355,7 @@
// $ANTLR start literal_restriction
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:427:1: literal_restriction returns [String text] : t= literal ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:438:1: literal_restriction returns [String text] : t= literal ;
public String literal_restriction() throws RecognitionException {
String text = null;
@@ -1330,10 +1366,10 @@
text = null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:432:6: (t= literal )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:432:6: t= literal
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:443:6: (t= literal )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:443:6: t= literal
{
- pushFollow(FOLLOW_literal_in_literal_restriction991);
+ pushFollow(FOLLOW_literal_in_literal_restriction990);
t=literal();
_fsp--;
@@ -1356,70 +1392,417 @@
// $ANTLR start function
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:437:1: function : LEFT_PAREN ID ( VAR | literal | function ) RIGHT_PAREN ;
- public void function() throws RecognitionException {
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:448:1: function[ExecutionBuildContext context] returns [Function f] : LEFT_PAREN name= ID ( function_params[context, f] )+ RIGHT_PAREN ;
+ public Function function(ExecutionBuildContext context) throws RecognitionException {
+ Function f = null;
+
+ Token name=null;
+
+
+ FunctionFactory factory = FunctionFactory.getInstance();
+
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:438:4: ( LEFT_PAREN ID ( VAR | literal | function ) RIGHT_PAREN )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:438:4: LEFT_PAREN ID ( VAR | literal | function ) RIGHT_PAREN
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:452:4: ( LEFT_PAREN name= ID ( function_params[context, f] )+ RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:452:4: LEFT_PAREN name= ID ( function_params[context, f] )+ RIGHT_PAREN
{
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_function1011);
- match(input,ID,FOLLOW_ID_in_function1015);
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:440:6: ( VAR | literal | function )
- int alt15=3;
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_function1015);
+ name=(Token)input.LT(1);
+ match(input,ID,FOLLOW_ID_in_function1021);
+
+ if ( name.getText().equals("bind") ) {
+ context.createLocalVariable( name.getText() );
+ }
+ f = factory.createFunction( name.getText() );
+
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:460:3: ( function_params[context, f] )+
+ int cnt16=0;
+ loop16:
+ do {
+ int alt16=2;
+ int LA16_0 = input.LA(1);
+ if ( ((LA16_0>=LEFT_PAREN && LA16_0<=ID)||(LA16_0>=VAR && LA16_0<=NULL)) ) {
+ alt16=1;
+ }
+
+
+ switch (alt16) {
+ case 1 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:460:3: function_params[context, f]
+ {
+ pushFollow(FOLLOW_function_params_in_function1034);
+ function_params(context, f);
+ _fsp--;
+
+
+ }
+ break;
+
+ default :
+ if ( cnt16 >= 1 ) break loop16;
+ EarlyExitException eee =
+ new EarlyExitException(16, input);
+ throw eee;
+ }
+ cnt16++;
+ } while (true);
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_function1044);
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return f;
+ }
+ // $ANTLR end function
+
+
+ // $ANTLR start modify_function
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:465:1: modify_function[ExecutionBuildContext context] returns [Function f] : LEFT_PAREN 'modify' ( slot_name_value_pair[context, f] )+ RIGHT_PAREN ;
+ public Function modify_function(ExecutionBuildContext context) throws RecognitionException {
+ Function f = null;
+
+
+ FunctionFactory factory = FunctionFactory.getInstance();
+ f = factory.createFunction( "modify" );
+
+ try {
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:471:3: ( LEFT_PAREN 'modify' ( slot_name_value_pair[context, f] )+ RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:471:3: LEFT_PAREN 'modify' ( slot_name_value_pair[context, f] )+ RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_modify_function1068);
+ match(input,40,FOLLOW_40_in_modify_function1073);
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:473:4: ( slot_name_value_pair[context, f] )+
+ int cnt17=0;
+ loop17:
+ do {
+ int alt17=2;
+ int LA17_0 = input.LA(1);
+ if ( (LA17_0==LEFT_PAREN) ) {
+ alt17=1;
+ }
+
+
+ switch (alt17) {
+ case 1 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:473:4: slot_name_value_pair[context, f]
+ {
+ pushFollow(FOLLOW_slot_name_value_pair_in_modify_function1078);
+ slot_name_value_pair(context, f);
+ _fsp--;
+
+
+ }
+ break;
+
+ default :
+ if ( cnt17 >= 1 ) break loop17;
+ EarlyExitException eee =
+ new EarlyExitException(17, input);
+ throw eee;
+ }
+ cnt17++;
+ } while (true);
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_modify_function1084);
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return f;
+ }
+ // $ANTLR end modify_function
+
+
+ // $ANTLR start function_params
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:477:1: function_params[ExecutionBuildContext context, Function f] : (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) ;
+ public void function_params(ExecutionBuildContext context, Function f) throws RecognitionException {
+ Token t=null;
+ Function nf = null;
+
+
+
+ ValueHandler value = null;
+
+ try {
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:482:3: ( (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:482:3: (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
+ {
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:482:3: (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
+ int alt18=8;
switch ( input.LA(1) ) {
case VAR:
- alt15=1;
+ alt18=1;
break;
+ case STRING:
+ alt18=2;
+ break;
case ID:
- case STRING:
+ alt18=3;
+ break;
+ case FLOAT:
+ alt18=4;
+ break;
case INT:
- case FLOAT:
+ alt18=5;
+ break;
case BOOL:
+ alt18=6;
+ break;
case NULL:
- alt15=2;
+ alt18=7;
break;
case LEFT_PAREN:
- alt15=3;
+ alt18=8;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("440:6: ( VAR | literal | function )", 15, 0, input);
+ new NoViableAltException("482:3: (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )", 18, 0, input);
throw nvae;
}
- switch (alt15) {
+ switch (alt18) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:440:10: VAR
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:482:6: t= VAR
{
- match(input,VAR,FOLLOW_VAR_in_function1026);
+ t=(Token)input.LT(1);
+ match(input,VAR,FOLLOW_VAR_in_function_params1113);
+ value = context.getVariableValueHandler(t.getText() );
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:441:10: literal
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:483:6: t= STRING
{
- pushFollow(FOLLOW_literal_in_function1037);
- literal();
+ t=(Token)input.LT(1);
+ match(input,STRING,FOLLOW_STRING_in_function_params1125);
+ value = new ObjectLiteralValue( getString( t ) );
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:484:7: t= ID
+ {
+ t=(Token)input.LT(1);
+ match(input,ID,FOLLOW_ID_in_function_params1140);
+ value = new ObjectLiteralValue( t.getText() );
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:485:6: t= FLOAT
+ {
+ t=(Token)input.LT(1);
+ match(input,FLOAT,FOLLOW_FLOAT_in_function_params1161);
+ value = new DoubleLiteralValue( t.getText() );
+
+ }
+ break;
+ case 5 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:486:6: t= INT
+ {
+ t=(Token)input.LT(1);
+ match(input,INT,FOLLOW_INT_in_function_params1176);
+ value = new LongLiteralValue( t.getText() );
+
+ }
+ break;
+ case 6 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:487:6: t= BOOL
+ {
+ t=(Token)input.LT(1);
+ match(input,BOOL,FOLLOW_BOOL_in_function_params1196);
+ value = new BooleanLiteralValue( t.getText() );
+
+ }
+ break;
+ case 7 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:488:6: t= NULL
+ {
+ t=(Token)input.LT(1);
+ match(input,NULL,FOLLOW_NULL_in_function_params1218);
+ value = ObjectLiteralValue.NULL;
+
+ }
+ break;
+ case 8 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:489:6: nf= function[context]
+ {
+ pushFollow(FOLLOW_function_in_function_params1234);
+ nf=function(context);
_fsp--;
+ value = nf;
}
break;
+
+ }
+
+ f.addParameter( value );
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end function_params
+
+
+ // $ANTLR start slot_name_value_pair
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:495:1: slot_name_value_pair[ExecutionBuildContext context, Function f] : LEFT_PAREN id= ID (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN ;
+ public void slot_name_value_pair(ExecutionBuildContext context, Function f) throws RecognitionException {
+ Token id=null;
+ Token t=null;
+ Function nf = null;
+
+
+
+ SlotNameValuePair nameValuePair = null;
+ String name = null;
+
+ try {
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:501:3: ( LEFT_PAREN id= ID (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:501:3: LEFT_PAREN id= ID (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] ) RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_slot_name_value_pair1276);
+ id=(Token)input.LT(1);
+ match(input,ID,FOLLOW_ID_in_slot_name_value_pair1282);
+
+ name = id.getText();
+
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:505:3: (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )
+ int alt19=8;
+ switch ( input.LA(1) ) {
+ case VAR:
+ alt19=1;
+ break;
+ case STRING:
+ alt19=2;
+ break;
+ case ID:
+ alt19=3;
+ break;
+ case FLOAT:
+ alt19=4;
+ break;
+ case INT:
+ alt19=5;
+ break;
+ case BOOL:
+ alt19=6;
+ break;
+ case NULL:
+ alt19=7;
+ break;
+ case LEFT_PAREN:
+ alt19=8;
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("505:3: (t= VAR | t= STRING | t= ID | t= FLOAT | t= INT | t= BOOL | t= NULL | nf= function[context] )", 19, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt19) {
+ case 1 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:505:6: t= VAR
+ {
+ t=(Token)input.LT(1);
+ match(input,VAR,FOLLOW_VAR_in_slot_name_value_pair1293);
+ nameValuePair = new SlotNameValuePair(name, context.getVariableValueHandler( t.getText() ) );
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:506:7: t= STRING
+ {
+ t=(Token)input.LT(1);
+ match(input,STRING,FOLLOW_STRING_in_slot_name_value_pair1311);
+ nameValuePair = new SlotNameValuePair(name, new ObjectLiteralValue( getString( t ) ) );
+
+ }
+ break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:442:10: function
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:507:7: t= ID
{
- pushFollow(FOLLOW_function_in_function1048);
- function();
+ t=(Token)input.LT(1);
+ match(input,ID,FOLLOW_ID_in_slot_name_value_pair1326);
+ nameValuePair = new SlotNameValuePair(name, new ObjectLiteralValue( t.getText() ) );
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:508:6: t= FLOAT
+ {
+ t=(Token)input.LT(1);
+ match(input,FLOAT,FOLLOW_FLOAT_in_slot_name_value_pair1347);
+ nameValuePair = new SlotNameValuePair(name, new DoubleLiteralValue( t.getText() ) );
+
+ }
+ break;
+ case 5 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:509:6: t= INT
+ {
+ t=(Token)input.LT(1);
+ match(input,INT,FOLLOW_INT_in_slot_name_value_pair1362);
+ nameValuePair = new SlotNameValuePair(name, new LongLiteralValue( t.getText() ) );
+
+ }
+ break;
+ case 6 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:510:6: t= BOOL
+ {
+ t=(Token)input.LT(1);
+ match(input,BOOL,FOLLOW_BOOL_in_slot_name_value_pair1382);
+ nameValuePair = new SlotNameValuePair(name, new BooleanLiteralValue( t.getText() ) ) ;
+
+ }
+ break;
+ case 7 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:511:6: t= NULL
+ {
+ t=(Token)input.LT(1);
+ match(input,NULL,FOLLOW_NULL_in_slot_name_value_pair1404);
+ nameValuePair = new SlotNameValuePair(name, ObjectLiteralValue.NULL );
+
+ }
+ break;
+ case 8 :
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:512:6: nf= function[context]
+ {
+ pushFollow(FOLLOW_function_in_slot_name_value_pair1420);
+ nf=function(context);
_fsp--;
+ nameValuePair = new SlotNameValuePair(name, nf );
}
break;
}
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_function1062);
+ f.addParameter( nameValuePair );
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_slot_name_value_pair1457);
}
@@ -1432,11 +1815,11 @@
}
return ;
}
- // $ANTLR end function
+ // $ANTLR end slot_name_value_pair
// $ANTLR start literal
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:448:1: literal returns [String text] : (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:519:1: literal returns [String text] : (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
public String literal() throws RecognitionException {
String text = null;
@@ -1446,88 +1829,88 @@
text = null;
try {
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:452:4: ( (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:452:4: (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:523:4: ( (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:523:4: (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL )
{
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:452:4: (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL )
- int alt16=6;
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:523:4: (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL )
+ int alt20=6;
switch ( input.LA(1) ) {
case STRING:
- alt16=1;
+ alt20=1;
break;
case ID:
- alt16=2;
+ alt20=2;
break;
case INT:
- alt16=3;
+ alt20=3;
break;
case FLOAT:
- alt16=4;
+ alt20=4;
break;
case BOOL:
- alt16=5;
+ alt20=5;
break;
case NULL:
- alt16=6;
+ alt20=6;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("452:4: (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL )", 16, 0, input);
+ new NoViableAltException("523:4: (t= STRING | t= ID | t= INT | t= FLOAT | t= BOOL | t= NULL )", 20, 0, input);
throw nvae;
}
- switch (alt16) {
+ switch (alt20) {
case 1 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:452:8: t= STRING
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:523:8: t= STRING
{
t=(Token)input.LT(1);
- match(input,STRING,FOLLOW_STRING_in_literal1091);
+ match(input,STRING,FOLLOW_STRING_in_literal1486);
text = getString( t );
}
break;
case 2 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:453:7: t= ID
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:524:7: t= ID
{
t=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_literal1104);
+ match(input,ID,FOLLOW_ID_in_literal1499);
text = t.getText();
}
break;
case 3 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:454:7: t= INT
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:525:7: t= INT
{
t=(Token)input.LT(1);
- match(input,INT,FOLLOW_INT_in_literal1120);
+ match(input,INT,FOLLOW_INT_in_literal1515);
text = t.getText();
}
break;
case 4 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:455:7: t= FLOAT
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:526:7: t= FLOAT
{
t=(Token)input.LT(1);
- match(input,FLOAT,FOLLOW_FLOAT_in_literal1135);
+ match(input,FLOAT,FOLLOW_FLOAT_in_literal1530);
text = t.getText();
}
break;
case 5 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:456:7: t= BOOL
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:527:7: t= BOOL
{
t=(Token)input.LT(1);
- match(input,BOOL,FOLLOW_BOOL_in_literal1148);
+ match(input,BOOL,FOLLOW_BOOL_in_literal1543);
text = t.getText();
}
break;
case 6 :
- // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:457:7: t= NULL
+ // C:\\dev\\jbossrules\\trunk\\drools-compiler\\src\\main\\resources\\org\\drools\\clp\\CLP.g:528:7: t= NULL
{
t=(Token)input.LT(1);
- match(input,NULL,FOLLOW_NULL_in_literal1162);
+ match(input,NULL,FOLLOW_NULL_in_literal1557);
text = null;
}
@@ -1550,93 +1933,161 @@
// $ANTLR end literal
+ protected DFA2 dfa2 = new DFA2(this);
+ public static final String DFA2_eotS =
+ "\20\uffff";
+ public static final String DFA2_eofS =
+ "\20\uffff";
+ public static final String DFA2_minS =
+ "\1\4\1\5\2\uffff\1\4\1\5\11\4\1\uffff";
+ public static final String DFA2_maxS =
+ "\1\14\1\13\2\uffff\1\21\1\5\1\47\7\44\1\21\1\uffff";
+ public static final String DFA2_acceptS =
+ "\2\uffff\1\2\1\1\13\uffff\1\1";
+ public static final String DFA2_specialS =
+ "\20\uffff}>";
+ public static final String[] DFA2_transition = {
+ "\1\1\1\uffff\1\2\5\uffff\1\3",
+ "\1\4\1\uffff\5\3",
+ "",
+ "",
+ "\1\5\1\2\1\3\5\uffff\6\2",
+ "\1\6",
+ "\1\2\1\11\6\uffff\1\7\1\10\1\12\1\13\1\14\1\15\23\uffff\3\3",
+ "\2\2\1\16\5\uffff\6\2\21\uffff\2\3",
+ "\2\2\1\16\5\uffff\6\2\21\uffff\2\3",
+ "\2\2\1\16\5\uffff\6\2\21\uffff\2\3",
+ "\2\2\1\16\5\uffff\6\2\21\uffff\2\3",
+ "\2\2\1\16\5\uffff\6\2\21\uffff\2\3",
+ "\2\2\1\16\5\uffff\6\2\21\uffff\2\3",
+ "\2\2\1\16\5\uffff\6\2\21\uffff\2\3",
+ "\1\5\1\2\1\17\5\uffff\6\2",
+ ""
+ };
+
+ class DFA2 extends DFA {
+ public DFA2(BaseRecognizer recognizer) {
+ this.recognizer = recognizer;
+ this.decisionNumber = 2;
+ this.eot = DFA.unpackEncodedString(DFA2_eotS);
+ this.eof = DFA.unpackEncodedString(DFA2_eofS);
+ this.min = DFA.unpackEncodedStringToUnsignedChars(DFA2_minS);
+ this.max = DFA.unpackEncodedStringToUnsignedChars(DFA2_maxS);
+ this.accept = DFA.unpackEncodedString(DFA2_acceptS);
+ this.special = DFA.unpackEncodedString(DFA2_specialS);
+ int numStates = DFA2_transition.length;
+ this.transition = new short[numStates][];
+ for (int i=0; i<numStates; i++) {
+ transition[i] = DFA.unpackEncodedString(DFA2_transition[i]);
+ }
+ }
+ public String getDescription() {
+ return "()* loopback of 232:4: ( lhs[lhs] )*";
+ }
+ }
- public static final BitSet FOLLOW_27_in_opt_semicolon38 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_rule64 = new BitSet(new long[]{0x0000000010000000L});
- public static final BitSet FOLLOW_28_in_rule66 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_rule74 = new BitSet(new long[]{0x00000000000000D0L});
- public static final BitSet FOLLOW_lhs_in_rule85 = new BitSet(new long[]{0x00000000000000D0L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_rule92 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_and_ce_in_lhs109 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_or_ce_in_lhs119 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_not_ce_in_lhs128 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_exists_ce_in_lhs137 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_eval_ce_in_lhs151 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_normal_pattern_in_lhs165 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_bound_pattern_in_lhs174 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_and_ce_in_ce196 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_or_ce_in_ce209 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_not_ce_in_ce218 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_exists_ce_in_ce227 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_eval_ce_in_ce241 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_normal_pattern_in_ce265 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_and_ce297 = new BitSet(new long[]{0x0000000020000000L});
- public static final BitSet FOLLOW_29_in_and_ce302 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_ce_in_and_ce308 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_and_ce317 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_or_ce345 = new BitSet(new long[]{0x0000000040000000L});
- public static final BitSet FOLLOW_30_in_or_ce350 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_ce_in_or_ce356 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_or_ce365 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_not_ce393 = new BitSet(new long[]{0x0000000080000000L});
- public static final BitSet FOLLOW_31_in_not_ce398 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_ce_in_not_ce404 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_not_ce413 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_exists_ce442 = new BitSet(new long[]{0x0000000100000000L});
- public static final BitSet FOLLOW_32_in_exists_ce447 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_ce_in_exists_ce453 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_exists_ce462 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce490 = new BitSet(new long[]{0x0000000200000000L});
- public static final BitSet FOLLOW_33_in_eval_ce495 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce501 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_eval_ce510 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce516 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce520 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_normal_pattern548 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_normal_pattern555 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_field_constriant_in_normal_pattern561 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_normal_pattern571 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_VAR_in_bound_pattern599 = new BitSet(new long[]{0x0000000400000000L});
- public static final BitSet FOLLOW_34_in_bound_pattern605 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_bound_pattern610 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_bound_pattern617 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_field_constriant_in_bound_pattern623 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_bound_pattern630 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_field_constriant658 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_field_constriant665 = new BitSet(new long[]{0x000000E000001FA0L});
- public static final BitSet FOLLOW_restriction_in_field_constriant677 = new BitSet(new long[]{0x0000001800000040L});
- public static final BitSet FOLLOW_connective_in_field_constriant689 = new BitSet(new long[]{0x000000E000001FA0L});
- public static final BitSet FOLLOW_restriction_in_field_constriant706 = new BitSet(new long[]{0x0000001800000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_field_constriant729 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_35_in_connective747 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_36_in_connective759 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_37_in_restriction794 = new BitSet(new long[]{0x000000C000001FA0L});
- public static final BitSet FOLLOW_predicate_constraint_in_restriction812 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_return_value_restriction_in_restriction832 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_variable_restriction_in_restriction844 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_literal_restriction_in_restriction860 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_38_in_predicate_constraint893 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_predicate_constraint894 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_predicate_constraint901 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_predicate_constraint908 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_39_in_return_value_restriction927 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_return_value_restriction928 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_return_value_restriction935 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_return_value_restriction942 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_VAR_in_variable_restriction958 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_literal_in_literal_restriction991 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_function1011 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_function1015 = new BitSet(new long[]{0x0000000000001FB0L});
- public static final BitSet FOLLOW_VAR_in_function1026 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_literal_in_function1037 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_function_in_function1048 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_function1062 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRING_in_literal1091 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ID_in_literal1104 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_INT_in_literal1120 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_FLOAT_in_literal1135 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_BOOL_in_literal1148 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_NULL_in_literal1162 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_33_in_opt_semicolon38 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_rule64 = new BitSet(new long[]{0x0000000000040000L});
+ public static final BitSet FOLLOW_DEFRULE_in_rule66 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_rule74 = new BitSet(new long[]{0x0000000000001050L});
+ public static final BitSet FOLLOW_lhs_in_rule85 = new BitSet(new long[]{0x0000000000001050L});
+ public static final BitSet FOLLOW_function_in_rule92 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_rule101 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_and_ce_in_lhs120 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_or_ce_in_lhs130 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_not_ce_in_lhs139 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_exists_ce_in_lhs148 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_eval_ce_in_lhs162 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_normal_pattern_in_lhs176 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_bound_pattern_in_lhs185 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_and_ce_in_ce207 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_or_ce_in_ce220 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_not_ce_in_ce229 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_exists_ce_in_ce238 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_eval_ce_in_ce252 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_normal_pattern_in_ce276 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_and_ce308 = new BitSet(new long[]{0x0000000000000080L});
+ public static final BitSet FOLLOW_AND_in_and_ce313 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_ce_in_and_ce319 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_and_ce328 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_or_ce356 = new BitSet(new long[]{0x0000000000000100L});
+ public static final BitSet FOLLOW_OR_in_or_ce361 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_ce_in_or_ce367 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_or_ce376 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_not_ce404 = new BitSet(new long[]{0x0000000000000200L});
+ public static final BitSet FOLLOW_NOT_in_not_ce409 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_ce_in_not_ce415 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_not_ce424 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_exists_ce453 = new BitSet(new long[]{0x0000000000000400L});
+ public static final BitSet FOLLOW_EXISTS_in_exists_ce458 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_ce_in_exists_ce464 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_exists_ce473 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce501 = new BitSet(new long[]{0x0000000000000800L});
+ public static final BitSet FOLLOW_TEST_in_eval_ce506 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_function_in_eval_ce512 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce523 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_normal_pattern551 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_normal_pattern558 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_field_constriant_in_normal_pattern564 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_normal_pattern574 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VAR_in_bound_pattern602 = new BitSet(new long[]{0x0000000400000000L});
+ public static final BitSet FOLLOW_34_in_bound_pattern608 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_bound_pattern613 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_bound_pattern620 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_field_constriant_in_bound_pattern626 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_bound_pattern633 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_field_constriant661 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_field_constriant668 = new BitSet(new long[]{0x000000E00003F020L});
+ public static final BitSet FOLLOW_restriction_in_field_constriant680 = new BitSet(new long[]{0x0000001800000040L});
+ public static final BitSet FOLLOW_connective_in_field_constriant692 = new BitSet(new long[]{0x000000E00003F020L});
+ public static final BitSet FOLLOW_restriction_in_field_constriant709 = new BitSet(new long[]{0x0000001800000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_field_constriant732 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_35_in_connective750 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_36_in_connective762 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_37_in_restriction797 = new BitSet(new long[]{0x000000C00003F020L});
+ public static final BitSet FOLLOW_predicate_constraint_in_restriction814 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_return_value_restriction_in_restriction834 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_variable_restriction_in_restriction846 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_restriction_in_restriction862 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_38_in_predicate_constraint904 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_function_in_predicate_constraint908 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_39_in_return_value_restriction931 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_function_in_return_value_restriction936 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VAR_in_variable_restriction957 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_in_literal_restriction990 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_function1015 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_function1021 = new BitSet(new long[]{0x000000000003F030L});
+ public static final BitSet FOLLOW_function_params_in_function1034 = new BitSet(new long[]{0x000000000003F070L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_function1044 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_modify_function1068 = new BitSet(new long[]{0x0000010000000000L});
+ public static final BitSet FOLLOW_40_in_modify_function1073 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_slot_name_value_pair_in_modify_function1078 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_modify_function1084 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VAR_in_function_params1113 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_in_function_params1125 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_function_params1140 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_FLOAT_in_function_params1161 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_INT_in_function_params1176 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_BOOL_in_function_params1196 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_NULL_in_function_params1218 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_function_in_function_params1234 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_slot_name_value_pair1276 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_slot_name_value_pair1282 = new BitSet(new long[]{0x000000000003F030L});
+ public static final BitSet FOLLOW_VAR_in_slot_name_value_pair1293 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_STRING_in_slot_name_value_pair1311 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_ID_in_slot_name_value_pair1326 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_FLOAT_in_slot_name_value_pair1347 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_INT_in_slot_name_value_pair1362 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_BOOL_in_slot_name_value_pair1382 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_NULL_in_slot_name_value_pair1404 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_function_in_slot_name_value_pair1420 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_slot_name_value_pair1457 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_in_literal1486 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_literal1499 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_INT_in_literal1515 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_FLOAT_in_literal1530 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_BOOL_in_literal1543 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_NULL_in_literal1557 = new BitSet(new long[]{0x0000000000000002L});
}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPredicate.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPredicate.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPredicate.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.drools.clp;
+
+import org.drools.WorkingMemory;
+import org.drools.base.FieldFactory;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.spi.PredicateExpression;
+import org.drools.spi.Tuple;
+
+public class CLPPredicate
+ implements
+ PredicateExpression,
+ ExecutionEngine {
+ private Function function;
+ private int index;
+
+ public CLPPredicate() {
+ }
+
+ public CLPPredicate(Function function) {
+ this.function = function;
+ }
+
+ public void addFunction(Function function) {
+ setFunction( function );
+ }
+
+ public void setFunction(Function function) {
+ this.function = function;
+ }
+
+ public int getNextIndex() {
+ return this.index++;
+ }
+
+ public boolean evaluate(Object object,
+ Tuple tuple,
+ Declaration[] previousDeclarations,
+ Declaration[] localDeclarations,
+ WorkingMemory workingMemory) throws Exception {
+ ExecutionContext context = new ExecutionContext( (InternalWorkingMemory) workingMemory,
+ (ReteTuple) tuple,
+ object,
+ this.index-1 );
+ return this.function.getBooleanValue( context );
+ }
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPreviousDeclarationVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPreviousDeclarationVariable.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPPreviousDeclarationVariable.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,86 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.drools.base.ValueType;
+import org.drools.common.InternalFactHandle;
+import org.drools.rule.Declaration;
+import org.mvel.integration.VariableResolver;
+
+public class CLPPreviousDeclarationVariable implements VariableValueHandler {
+
+ private Declaration declaration;
+
+ public CLPPreviousDeclarationVariable(Declaration declaration) {
+ this.declaration = declaration;
+ }
+
+ public String getIdentifier() {
+ return this.declaration.getIdentifier();
+ }
+
+ public Class getKnownType() {
+ return declaration.getExtractor().getExtractToClass();
+ }
+
+ public ValueType getValueType() {
+ return this.declaration.getValueType();
+ }
+
+ public void setValue(ExecutionContext context,
+ Object object) {
+ throw new UnsupportedOperationException( "External Variable identifer='" + getIdentifier() + "' type='" + getKnownType() + "' is final, it cannot be set" );
+ }
+
+ public Object getValue(ExecutionContext context) {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return declaration.getValue( handle.getObject() );
+ }
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return (BigDecimal) declaration.getValue( handle.getObject() );
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return (BigInteger) declaration.getValue( handle.getObject() );
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return declaration.getBooleanValue( handle.getObject() );
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return declaration.getDoubleValue( handle.getObject() );
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return declaration.getFloatValue( handle.getObject() );
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return declaration.getIntValue( handle.getObject() );
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return declaration.getLongValue( handle.getObject() );
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return declaration.getShortValue( handle.getObject() );
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ InternalFactHandle handle = context.getTuple().get( this.declaration );
+ return (String) declaration.getValue( handle.getObject() );
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPReturnValue.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPReturnValue.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/CLPReturnValue.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.drools.clp;
+
+import org.drools.WorkingMemory;
+import org.drools.base.FieldFactory;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.spi.FieldValue;
+import org.drools.spi.ReturnValueExpression;
+import org.drools.spi.Tuple;
+
+public class CLPReturnValue
+ implements
+ ReturnValueExpression,
+ ExecutionEngine {
+ private Function function;
+ private int index;
+
+ public CLPReturnValue() {
+
+ }
+
+ public CLPReturnValue(Function function) {
+ this.function = function;
+ }
+
+ public void setFunction(Function function) {
+ this.function = function;
+ }
+
+ public void addFunction(Function function) {
+ setFunction( function );
+ }
+
+ public int getNextIndex() {
+ return this.index++;
+ }
+
+ public FieldValue evaluate(Object object,
+ Tuple tuple,
+ Declaration[] previousDeclarations,
+ Declaration[] localDeclarations,
+ WorkingMemory workingMemory) throws Exception {
+ ExecutionContext context = new ExecutionContext( (InternalWorkingMemory) workingMemory,
+ (ReteTuple) tuple,
+ object,
+ this.index-1 );
+ return FieldFactory.getFieldValue( this.function.getBooleanValue( context ) );
+ }
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/DoubleLiteralValue.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/DoubleLiteralValue.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/DoubleLiteralValue.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,60 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public class DoubleLiteralValue extends BaseValueHandler {
+ private double doubleValue;
+
+ public DoubleLiteralValue(String doubleValue) {
+ this.doubleValue = Double.valueOf( doubleValue ).doubleValue();
+ }
+
+ public DoubleLiteralValue(double doubleValue) {
+ this.doubleValue = doubleValue;
+ }
+
+ public void setValue(ExecutionContext context, Object value) {
+ throw new RuntimeException( "LiteralValues cannot be set");
+ }
+
+ public Object getValue(ExecutionContext context) {
+ return new Double( this.doubleValue );
+ }
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ return new BigDecimal( this.doubleValue );
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ return BigInteger.valueOf( (long) this.doubleValue );
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ return ( this.doubleValue == 0 ) ? false : true;
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ return this.doubleValue;
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ return (float) this.doubleValue;
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ return (int) this.doubleValue;
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ return (long) this.doubleValue;
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ return (short) this.doubleValue;
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ return Double.toString( this.doubleValue );
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionBuildContext.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionBuildContext.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionBuildContext.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,34 @@
+package org.drools.clp;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ExecutionBuildContext {
+ private Map vars = new HashMap();
+ private ExecutionEngine engine;
+
+ public ExecutionBuildContext(ExecutionEngine engine) {
+ this.engine = engine;
+ }
+
+ public void addFunction(Function function) {
+ this.engine.addFunction( function );
+ }
+
+ public ValueHandler createLocalVariable(String identifier) {
+ ValueHandler var = ( ValueHandler ) this.vars.get( identifier ) ;
+ if ( var == null ) {
+ var = new LocalVariableValue(identifier, this.engine.getNextIndex() );
+ }
+ return var;
+ }
+
+ public ValueHandler getVariableValueHandler(String identifier) {
+ ValueHandler var = ( ValueHandler ) this.vars.get( identifier ) ;
+ if ( var == null ) {
+ var = new TempTokenVariable(identifier);
+ }
+ return var;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionContext.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionContext.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionContext.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,52 @@
+package org.drools.clp;
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.reteoo.ReteTuple;
+
+public class ExecutionContext {
+ private InternalWorkingMemory workingMemory;
+ private ReteTuple tuple;
+ private Object object;
+ private Object[] localVariables;
+
+ public ExecutionContext(InternalWorkingMemory workingMemory,
+ ReteTuple tuple,
+ int localVariableSize) {
+ this( workingMemory, tuple, null, localVariableSize );
+ }
+
+ public ExecutionContext(InternalWorkingMemory workingMemory,
+ ReteTuple tuple,
+ Object object,
+ int localVariableSize) {
+ this.workingMemory = workingMemory;
+ this.tuple = tuple;
+ this.object = object;
+ this.localVariables = new Object[ localVariableSize ];
+ }
+
+ public ReteTuple getTuple() {
+ return tuple;
+ }
+
+ public InternalWorkingMemory getWorkingMemory() {
+ return workingMemory;
+ }
+
+ public Object getObject() {
+ return this.object;
+ }
+
+ public Object getLocalVariable(int index) {
+ return localVariables[index];
+ }
+
+ public void setLocalVariable(int index, Object object) {
+ this.localVariables[index] = object;
+ }
+
+
+
+
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionEngine.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionEngine.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExecutionEngine.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,7 @@
+package org.drools.clp;
+
+public interface ExecutionEngine {
+ public void addFunction(Function function);
+
+ public int getNextIndex();
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExpressionExecutionEngine.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExpressionExecutionEngine.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ExpressionExecutionEngine.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,24 @@
+package org.drools.clp;
+
+import org.drools.spi.Consequence;
+import org.drools.spi.KnowledgeHelper;
+
+public class ExpressionExecutionEngine { //implements Consequence, ReturnValueExpression, PredicateExpression {
+ //private Map variableMap = new HashMap();
+
+ private Function function;
+ private int localVariableSize;
+
+ public ExpressionExecutionEngine() {
+
+ }
+
+ public ExpressionExecutionEngine(Function function) {
+ this.function = function;
+ }
+
+ public void setFunction(Function function) {
+ this.function = function;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Function.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Function.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/Function.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,14 @@
+package org.drools.clp;
+
+import java.util.Map;
+
+public interface Function extends ValueHandler {
+ public String getName();
+
+ public void addParameter(ValueHandler valueHandler);
+
+ public ValueHandler[] getParameters();
+
+ public void replaceTempTokens(Map variables);
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/FunctionFactory.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,96 @@
+package org.drools.clp;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+public class FunctionFactory {
+ public static final FunctionFactory instance = new FunctionFactory();
+
+ public static FunctionFactory getInstance() {
+ return instance;
+ }
+
+ public Map functions;
+
+ public Map variables;
+
+ private FunctionFactory() {
+ this.functions = new HashMap();
+ this.variables = new HashMap();
+
+ try {
+ loadFunctions();
+ } catch ( IOException e ) {
+ throw new RuntimeException( e );
+ } catch ( ClassNotFoundException e ) {
+ throw new RuntimeException( e );
+ }
+ }
+
+ public void loadFunctions() throws IOException, ClassNotFoundException {
+ BufferedReader reader = new BufferedReader( new InputStreamReader( getClass().getResourceAsStream( "functions.conf" ) ) );
+ loadFunctions( reader );
+ }
+
+ public void loadFunctions(BufferedReader reader) throws IOException, ClassNotFoundException {
+ String line = null;
+
+ try {
+ while( (line = reader.readLine() ) != null ) {
+ Class clazz = getClass().getClassLoader().loadClass( line );
+ Function function = ( Function) clazz.newInstance();
+ this.functions.put( function.getName(), clazz );
+ }
+ } catch(IllegalAccessException e) {
+ throw new RuntimeException( e );
+ } catch(InstantiationException e) {
+ throw new RuntimeException( e );
+ }
+ }
+
+ public Function createFunction(String name) {
+ try {
+ Class clazz = ( Class ) this.functions.get( name );
+ if ( clazz == null ) {
+ throw new RuntimeException( "Function '" + name + "' does not exist" );
+ }
+ return (Function) clazz.newInstance();
+ } catch ( InstantiationException e ) {
+ throw new RuntimeException( e );
+ } catch ( IllegalAccessException e ) {
+ throw new RuntimeException( e );
+ }
+ }
+
+ public void addFunction(String name, Function function) {
+ this.functions.put( name, function );
+ }
+
+ public void init() {
+ this.variables.clear();
+ }
+
+ public void setVariable(LocalVariableValue variable) {
+ this.variables.put( variable.getIdentifier(), variable );
+ }
+
+ public VariableValueHandler getVariable(String identifier) {
+ VariableValueHandler variable = ( VariableValueHandler ) this.variables.get( identifier );
+ if ( identifier == null ) {
+ variable = new TempTokenVariable( identifier );
+ this.variables.put( identifier, variable );
+ }
+ return variable;
+ }
+
+ public int getFunctionSize() {
+ return this.functions.size();
+ }
+
+ public int getVariablesSize() {
+ return this.variables.size();
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LessThanFunction.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,34 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+
+import org.drools.FactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.Extractor;
+
+public class LessThanFunction extends BaseFunction implements Function {
+ private static final String name = "<";
+
+ public LessThanFunction() {
+
+ }
+
+ public LessThanFunction(ValueHandler[] parameters) {
+ super( parameters );
+ }
+
+ public Object getValue(ExecutionContext context) {
+ ValueHandler[] args = getParameters();
+ return new Boolean( args[1].getBigDecimalValue( context ).compareTo( args[2].getBigDecimalValue( context ) ) < 0 );
+ }
+
+ public boolean getBoolean(ExecutionContext context) {
+ ValueHandler[] args = getParameters();
+ return args[1].getBigDecimalValue( context ).compareTo( args[2].getBigDecimalValue( context ) ) < 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LocalVariableValue.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LocalVariableValue.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LocalVariableValue.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,86 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.drools.base.ValueType;
+
+public class LocalVariableValue implements VariableValueHandler {
+ private static final long serialVersionUID = 320L;
+
+ /** The identifier for the variable. */
+ private final String identifier;
+ private final int index;
+
+ /**
+ * Construct.
+ *
+ * @param identifier
+ * The name of the variable.
+ */
+ public LocalVariableValue(final String identifier, final int index) {
+ this.identifier = identifier;
+ this.index = index;
+ }
+
+ /**
+ * Retrieve the variable's identifier.
+ *
+ * @return The variable's identifier.
+ */
+ public String getIdentifier() {
+ return this.identifier;
+ }
+
+ public ValueType getValueType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object getValue(ExecutionContext context) {
+ return context.getLocalVariable( this.index );
+ }
+
+ public void setValue(ExecutionContext context,
+ Object object) {
+ context.setLocalVariable( this.index, object );
+ }
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ return (BigDecimal) getValue(context);
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ return (BigInteger) getValue(context);
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ return ((Boolean) getValue(context)).booleanValue();
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ return ((Double) getValue(context)).doubleValue();
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ return ((Float) getValue(context)).floatValue();
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ return ((Integer) getValue(context)).intValue();
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ return ((Long) getValue(context)).longValue();
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ return ((Short) getValue(context)).shortValue();
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ return (String) getValue(context);
+ }
+
+}
+
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LongLiteralValue.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LongLiteralValue.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/LongLiteralValue.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,60 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public class LongLiteralValue extends BaseValueHandler {
+ private long longValue;
+
+ public LongLiteralValue(String longValue) {
+ this.longValue = Long.valueOf( longValue ).longValue();
+ }
+
+ public LongLiteralValue(long longValue) {
+ this.longValue = longValue;
+ }
+
+ public void setValue(ExecutionContext context, Object value) {
+ throw new RuntimeException( "LiteralValues cannot be set");
+ }
+
+ public Object getValue(ExecutionContext context) {
+ return new Long( this.longValue );
+ }
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ return new BigDecimal( this.longValue );
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ return BigInteger.valueOf( this.longValue );
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ return ( this.longValue == 0 ) ? false : true;
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ return this.longValue;
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ return this.longValue;
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ return (int) this.longValue;
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ return this.longValue;
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ return (short) this.longValue;
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ return Long.toString( this.longValue );
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ModifyFunction.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,44 @@
+package org.drools.clp;
+
+public class ModifyFunction extends BaseFunction implements Function {
+ private static final String name = "+";
+
+ private VariableValueHandler variable;
+
+ private SlotNameValuePair[] pairs;
+
+ public ModifyFunction(VariableValueHandler variable) {
+ this.variable = variable;
+ }
+
+ public void setVariableValueHandler(VariableValueHandler variable) {
+ this.variable = variable;
+ }
+
+ public ModifyFunction() {
+ }
+
+ public void addParameter(ValueHandler valueHandler) {
+ // we implement here rather than inheriting to save a runtime cast
+ SlotNameValuePair[] temp = new SlotNameValuePair[ pairs.length ];
+ System.arraycopy( this.pairs, 0, temp, 0, this.pairs.length -1 );
+ temp[ temp.length - 1] = ( SlotNameValuePair) valueHandler;
+ this.pairs = temp;
+ }
+
+ public Object getValue(ExecutionContext context) {
+// ValueHandler[] args = BaseFunction.resolveParameters( getParameters(), context );
+// BigDecimal bdval = new BigDecimal(0);
+
+ for ( int i = 0, length = this.pairs.length; i < length; i++ ) {
+
+ }
+
+ return null; //bdval;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ObjectLiteralValue.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ObjectLiteralValue.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ObjectLiteralValue.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,59 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public class ObjectLiteralValue extends BaseValueHandler {
+ public static final ObjectLiteralValue NULL = new ObjectLiteralValue( "null" );
+
+ private Object objectValue;
+
+ public ObjectLiteralValue(Object objectValue) {
+ this.objectValue = objectValue;
+ }
+
+ public void setValue(ExecutionContext context, Object value) {
+ throw new RuntimeException( "LiteralValues cannot be set");
+ }
+
+ public Object getValue(ExecutionContext context) {
+ return this.objectValue;
+ }
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ return (BigDecimal) getValue(context);
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ return (BigInteger) getValue(context);
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ return ((Boolean) getValue(context)).booleanValue();
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ return ((Double) getValue(context)).doubleValue();
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ return ((Float) getValue(context)).floatValue();
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ return ((Integer) getValue(context)).intValue();
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ return ((Long) getValue(context)).longValue();
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ return ((Short) getValue(context)).shortValue();
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ return (String) getValue(context);
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/SlotNameValuePair.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/SlotNameValuePair.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/SlotNameValuePair.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,72 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public class SlotNameValuePair implements ValueHandler {
+ private String name;
+ private ValueHandler value;
+
+ public SlotNameValuePair(String name, ValueHandler value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public ValueHandler getValueHandler() {
+ return this.value;
+ }
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "cannot getBigDecimalValue from SlotNameValuePair" );
+ }
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "cannot getBigIntegerValue from SlotNameValuePair" );
+ }
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException {
+ throw new RuntimeException( "cannot getBooleanValue from SlotNameValuePair" );
+ }
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "cannot getDoubleValue from SlotNameValuePair" );
+ }
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "cannot getFloatValue from SlotNameValuePair" );
+ }
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "cannot getIntValue from SlotNameValuePair" );
+ }
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "cannot getLongValue from SlotNameValuePair" );
+ }
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException {
+ throw new RuntimeException( "cannot getShortValue from SlotNameValuePair" );
+ }
+
+ public String getStringValue(ExecutionContext context) {
+ throw new RuntimeException( "cannot getStringValue from SlotNameValuePair" );
+ }
+
+ public Object getValue(ExecutionContext context) {
+ throw new RuntimeException( "cannot getValue from SlotNameValuePair" );
+ }
+
+ public void setValue(ExecutionContext context,
+ Object object) {
+ throw new RuntimeException( "cannot setValue on SlotNameValuePair" );
+
+ }
+
+
+
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/TempTokenVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/TempTokenVariable.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/TempTokenVariable.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,31 @@
+package org.drools.clp;
+
+import org.drools.common.InternalFactHandle;
+import org.drools.rule.Declaration;
+import org.mvel.integration.VariableResolver;
+
+public class TempTokenVariable extends BaseValueHandler implements VariableValueHandler {
+
+ private String identifier;
+
+ public TempTokenVariable(String identifier) {
+ this.identifier = identifier;
+ }
+
+ public String getIdentifier() {
+ return this.identifier;
+ }
+
+ public Object getValue(ExecutionContext context) {
+ throw new UnsupportedOperationException( "TempTokenVariable Variable identifer='" + getIdentifier() + " cannot be read" );
+ }
+
+ public void setValue(ExecutionContext context, Object value) {
+ throw new UnsupportedOperationException( "TempTokenVariable Variable identifer='" + getIdentifier() + " cannot be set" );
+ }
+
+ public void setContext(ExecutionContext context) {
+
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ValueHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ValueHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/ValueHandler.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,35 @@
+package org.drools.clp;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.drools.base.ValueType;
+
+public interface ValueHandler {
+
+ //public ValueType getValueType();
+
+ public void setValue(ExecutionContext context,
+ Object object);
+
+ public Object getValue(ExecutionContext context);
+
+ public String getStringValue(ExecutionContext context);
+
+ public boolean getBooleanValue(ExecutionContext context) throws ClassCastException;
+
+ public int getIntValue(ExecutionContext context) throws NumberFormatException;
+
+ public short getShortValue(ExecutionContext context) throws NumberFormatException;
+
+ public long getLongValue(ExecutionContext context) throws NumberFormatException;
+
+ public float getFloatValue(ExecutionContext context) throws NumberFormatException;
+
+ public double getDoubleValue(ExecutionContext context) throws NumberFormatException;
+
+ public BigInteger getBigIntegerValue(ExecutionContext context) throws NumberFormatException;
+
+ public BigDecimal getBigDecimalValue(ExecutionContext context) throws NumberFormatException;
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/VariableValueHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/VariableValueHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/VariableValueHandler.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,6 @@
+package org.drools.clp;
+
+public interface VariableValueHandler extends ValueHandler {
+ public String getIdentifier();
+}
+
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/clp.tokens
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/clp.tokens 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/clp.tokens 2007-03-12 23:22:22 UTC (rev 10137)
@@ -1,36 +1,38 @@
+EXISTS=10
LEFT_PAREN=4
-RIGHT_CURLY=24
-BOOL=11
-HexDigit=16
-WS=14
-MISC=26
-STRING=8
-FLOAT=10
-VAR=7
-UnicodeEscape=17
-EscapeSequence=15
-INT=9
-NULL=12
-EOL=13
-LEFT_SQUARE=21
-OctalEscape=18
-SH_STYLE_SINGLE_LINE_COMMENT=19
-MULTI_LINE_COMMENT=25
+RIGHT_CURLY=30
+BOOL=16
+DEFRULE=18
+HexDigit=22
+WS=20
+MISC=32
+STRING=13
+FLOAT=14
+OR=8
+VAR=12
+UnicodeEscape=23
+AND=7
+EscapeSequence=21
+INT=15
+NULL=17
+EOL=19
+LEFT_SQUARE=27
+SH_STYLE_SINGLE_LINE_COMMENT=25
+OctalEscape=24
+MULTI_LINE_COMMENT=31
+TEST=11
RIGHT_PAREN=6
-LEFT_CURLY=23
-RIGHT_SQUARE=22
-C_STYLE_SINGLE_LINE_COMMENT=20
+NOT=9
+LEFT_CURLY=29
+RIGHT_SQUARE=28
+C_STYLE_SINGLE_LINE_COMMENT=26
ID=5
-'and'=29
-'exists'=32
-'|'=36
-'test'=33
-'<-'=34
-';'=27
'&'=35
':'=38
-'not'=31
+'|'=36
+'modify'=40
'='=39
-'defrule'=28
-'or'=30
+'<-'=34
+'defrule'=18
+';'=33
'~'=37
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/clp__.g
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/clp__.g 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/clp__.g 2007-03-12 23:22:22 UTC (rev 10137)
@@ -3,33 +3,41 @@
package org.drools.clp;
}
-T27 : ';' ;
-T28 : 'defrule' ;
-T29 : 'and' ;
-T30 : 'or' ;
-T31 : 'not' ;
-T32 : 'exists' ;
-T33 : 'test' ;
+T33 : ';' ;
T34 : '<-' ;
T35 : '&' ;
T36 : '|' ;
T37 : '~' ;
T38 : ':' ;
T39 : '=' ;
+T40 : 'modify' ;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 461
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 533
+DEFRULE : 'defrule';
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 534
+OR : 'or';
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 535
+AND : 'and';
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 536
+NOT : 'not';
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 537
+EXISTS : 'exists';
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 538
+TEST : 'test';
+
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 540
VAR : '?'ID
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 464
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 543
ID
: ('a'..'z'|'A'..'Z'|'_'|'$'|'\u00c0'..'\u00ff')('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\u00c0'..'\u00ff')*
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 468
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 547
NULL : 'null';
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 470
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 549
WS : ( ' '
| '\t'
| '\f'
@@ -38,7 +46,7 @@
{ $channel=HIDDEN; }
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 478
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 557
fragment
EOL :
( ( '\r\n' )=> '\r\n' // Evil DOS
@@ -47,27 +55,27 @@
)
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 486
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 565
INT
: ('-')?('0'..'9')+
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 490
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 569
FLOAT
: ('-')?('0'..'9')+ '.' ('0'..'9')+
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 494
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 573
STRING
: ('"' ( EscapeSequence | ~('\\'|'"') )* '"')
| ('\'' ( EscapeSequence | ~('\\'|'\'') )* '\'')
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 499
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 578
fragment
HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 502
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 581
fragment
EscapeSequence
: '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
@@ -75,7 +83,7 @@
| OctalEscape
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 509
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 588
fragment
OctalEscape
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
@@ -83,68 +91,68 @@
| '\\' ('0'..'7')
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 516
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 595
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 521
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 600
BOOL
: ('true'|'false')
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 525
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 604
SH_STYLE_SINGLE_LINE_COMMENT
: '#' ( options{greedy=false;} : .)* EOL /* ('\r')? '\n' */
{ $channel=HIDDEN; }
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 531
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 610
C_STYLE_SINGLE_LINE_COMMENT
: '//' ( options{greedy=false;} : .)* EOL // ('\r')? '\n'
{ $channel=HIDDEN; }
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 537
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 616
LEFT_PAREN
: '('
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 541
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 620
RIGHT_PAREN
: ')'
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 545
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 624
LEFT_SQUARE
: '['
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 549
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 628
RIGHT_SQUARE
: ']'
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 553
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 632
LEFT_CURLY
: '{'
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 557
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 636
RIGHT_CURLY
: '}'
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 561
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 640
MULTI_LINE_COMMENT
: '/*' (options{greedy=false;} : .)* '*/'
{ $channel=HIDDEN; }
;
-// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 566
+// $ANTLR src "C:\dev\jbossrules\trunk\drools-compiler\src\main\resources\org\drools\clp\CLP.g" 645
MISC :
'!' | '@' | '$' | '%' | '^' | '&' | '*' | '_' | '-' | '+' | '?' | '|' | ',' | '=' | '/' | '\'' | '\\'
;
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions.conf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions.conf (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/clp/functions.conf 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,3 @@
+org.drools.clp.AddFunction
+org.drools.clp.LessThanFunction
+org.drools.clp.BindFunction
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/DRLParser.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/DRLParser.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/DRLParser.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -3672,7 +3672,7 @@
if( text != null ) {
String body = text.substring(1, text.length()-1);
- d.setText( body );
+ d.setContent( body );
column.addDescr( d );
}
@@ -4799,7 +4799,7 @@
if( c != null ) {
String body = c.substring(1, c.length()-1);
checkTrailingSemicolon( body, offset(loc.getLine()) );
- ((EvalDescr) d).setText( body );
+ ((EvalDescr) d).setContent( body );
}
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/DrlDumper.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/DrlDumper.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/DrlDumper.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -113,7 +113,7 @@
public void visitEvalDescr(final EvalDescr descr) {
this.template = new String();
- this.template = "\t\teval ( " + descr.getText() + " )" + DrlDumper.eol;
+ this.template = "\t\teval ( " + descr.getContent() + " )" + DrlDumper.eol;
}
public void visitExistsDescr(final ExistsDescr descr) {
@@ -202,13 +202,13 @@
public void visitPredicateDescr(final PredicateDescr descr) {
this.template = new String();
- this.template = "( " + descr.getText() + " )";
+ this.template = "( " + descr.getContent() + " )";
}
public void visitReturnValueRestrictionDescr(final ReturnValueRestrictionDescr descr) {
this.template = new String();
- this.template = descr.getEvaluator() + " ( " + descr.getText() + ")";
+ this.template = descr.getEvaluator() + " ( " + descr.getContent() + ")";
}
public void visitQueryDescr(final QueryDescr descr) {
@@ -232,7 +232,7 @@
lhs = "\t when";
}
- String rhs = ruleDescr.getConsequence();
+ String rhs = (String) ruleDescr.getConsequence();
if ( rhs == null ) {
rhs = "\t then" + DrlDumper.eol + "\t";
} else {
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/EvalDescr.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/EvalDescr.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/EvalDescr.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -27,7 +27,7 @@
*/
private static final long serialVersionUID = 325264120108029570L;
- private String text;
+ private Object content;
private String[] declarations;
@@ -36,16 +36,16 @@
public EvalDescr() {
}
- public EvalDescr(final String text) {
- this.text = text;
+ public EvalDescr(final Object content) {
+ this.content = content;
}
- public String getText() {
- return this.text;
+ public Object getContent() {
+ return this.content;
}
- public void setText(final String text) {
- this.text = text;
+ public void setContent(final Object content) {
+ this.content = content;
}
public String getClassMethodName() {
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/PredicateDescr.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/PredicateDescr.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/PredicateDescr.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -22,7 +22,7 @@
*/
private static final long serialVersionUID = 320;
//private final String fieldName;
- private String text;
+ private Object content;
//private final String declaration;
private String[] declarations;
@@ -42,8 +42,8 @@
// this.declaration = declaration;
// this.text = text;
// }
- public PredicateDescr( final String text ) {
- this.text = text;
+ public PredicateDescr( final Object text ) {
+ this.content = text;
}
public PredicateDescr( ) {
@@ -61,12 +61,12 @@
this.classMethodName = classMethodName;
}
- public String getText() {
- return this.text;
+ public Object getContent() {
+ return this.content;
}
- public void setText(final String text) {
- this.text = text;
+ public void setContent(final Object text) {
+ this.content = text;
}
// public String getDeclaration() {
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/ReturnValueRestrictionDescr.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/ReturnValueRestrictionDescr.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/ReturnValueRestrictionDescr.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -22,7 +22,7 @@
*/
private static final long serialVersionUID = 320L;
private String evaluator;
- private String text;
+ private Object content;
private String[] declarations;
private String classMethodName;
@@ -32,9 +32,9 @@
}
public ReturnValueRestrictionDescr(final String evaluator,
- final String text) {
+ final Object content) {
this.evaluator = evaluator;
- this.text = text;
+ this.content = content;
}
public String getClassMethodName() {
@@ -49,12 +49,12 @@
return this.evaluator;
}
- public String getText() {
- return this.text;
+ public Object getContent() {
+ return this.content;
}
- public void setText(final String text) {
- this.text = text;
+ public void setContent(final String text) {
+ this.content = text;
}
public void setDeclarations(final String[] declarations) {
@@ -66,6 +66,6 @@
}
public String toString() {
- return "[ReturnValue: evaluator=" + this.evaluator + "; text=" + this.text + "]";
+ return "[ReturnValue: evaluator=" + this.evaluator + "; text=" + this.content + "]";
}
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/RuleDescr.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/RuleDescr.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/RuleDescr.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -29,7 +29,7 @@
private String documentation;
private AndDescr lhs;
- private String consequence;
+ private Object consequence;
private int consequenceLine;
private int consequenceColumn;
private int offset;
@@ -87,11 +87,11 @@
this.lhs = lhs;
}
- public String getConsequence() {
+ public Object getConsequence() {
return this.consequence;
}
- public void setConsequence(final String consequence) {
+ public void setConsequence(final Object consequence) {
this.consequence = consequence;
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ColumnBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ColumnBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ColumnBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -367,7 +367,7 @@
final PredicateDescr predicateDescr) {
final List[] usedIdentifiers = utils.getUsedIdentifiers( context,
predicateDescr,
- predicateDescr.getText() );
+ predicateDescr.getContent() );
final List tupleDeclarations = new ArrayList();
final List factDeclarations = new ArrayList();
@@ -524,7 +524,7 @@
final ReturnValueRestrictionDescr returnValueRestrictionDescr) {
final List[] usedIdentifiers = utils.getUsedIdentifiers( context,
returnValueRestrictionDescr,
- returnValueRestrictionDescr.getText() );
+ returnValueRestrictionDescr.getContent() );
final List tupleDeclarations = new ArrayList();
final List factDeclarations = new ArrayList();
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/BuildUtils.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/BuildUtils.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/BuildUtils.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -76,10 +76,10 @@
public List[] getUsedIdentifiers(final BuildContext context,
final BaseDescr descr,
- final String text) {
+ final Object content) {
List[] usedIdentifiers = null;
try {
- usedIdentifiers = this.analyzer.analyzeExpression( text,
+ usedIdentifiers = this.analyzer.analyzeExpression( (String) content,
new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
} catch ( final Exception e ) {
context.getErrors().add( new RuleError( context.getRule(),
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -55,7 +55,7 @@
final List[] usedIdentifiers = utils.getUsedCIdentifiers( context,
ruleDescr,
- ruleDescr.getConsequence() );
+ (String) ruleDescr.getConsequence() );
final Declaration[] declarations = new Declaration[usedIdentifiers[0].size()];
for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
@@ -67,7 +67,7 @@
declarations,
(String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] ) );
st.setAttribute( "text",
- utils.getKnowledgeHelperFixer().fix( ruleDescr.getConsequence() ) );
+ utils.getKnowledgeHelperFixer().fix( (String) ruleDescr.getConsequence() ) );
context.getMethods().add( st.toString() );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaEvalBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaEvalBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaEvalBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -59,7 +59,7 @@
final List[] usedIdentifiers = utils.getUsedIdentifiers( context,
evalDescr,
- evalDescr.getText() );
+ evalDescr.getContent() );
final Declaration[] declarations = new Declaration[usedIdentifiers[0].size()];
for ( int i = 0, size = usedIdentifiers[0].size(); i < size; i++ ) {
@@ -78,7 +78,7 @@
st.setAttribute( "methodName",
className );
- final String evalText = evalDescr.getText();
+ final String evalText = (String) evalDescr.getContent();
st.setAttribute( "text",
evalText );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaPredicateBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaPredicateBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaPredicateBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -45,7 +45,7 @@
st.setAttribute( "methodName",
className );
- final String predicateText = predicateDescr.getText();
+ final String predicateText = (String) predicateDescr.getContent();
st.setAttribute( "text",
predicateText );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -40,7 +40,7 @@
st.setAttribute( "methodName",
className );
- final String returnValueText = returnValueRestrictionDescr.getText();
+ final String returnValueText = (String) returnValueRestrictionDescr.getContent();
st.setAttribute( "text",
returnValueText );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -27,7 +27,7 @@
factory.setPreviousDeclarationMap( context.getDeclarationResolver().getDeclarations() );
factory.setGlobalsMap( context.getPkg().getGlobals() );
- Serializable expr = MVEL.compileExpression( ruleDescr.getConsequence() );
+ Serializable expr = MVEL.compileExpression( (String) ruleDescr.getConsequence() );
context.getRule().setConsequence( new MVELConsequence( expr,
factory ) );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -73,7 +73,7 @@
factory.setPreviousDeclarationMap( context.getDeclarationResolver().getDeclarations() );
factory.setGlobalsMap( context.getPkg().getGlobals() );
- Serializable expr = MVEL.compileExpression( evalDescr.getText() );
+ Serializable expr = MVEL.compileExpression( (String) evalDescr.getContent() );
final EvalCondition eval = new EvalCondition( declarations );
eval.setEvalExpression( new MVELEvalExpression(expr,factory) );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -83,7 +83,7 @@
factory.setGlobalsMap( context.getPkg().getGlobals() );
- Serializable expr = MVEL.compileExpression( predicateDescr.getText() );
+ Serializable expr = MVEL.compileExpression( (String) predicateDescr.getContent() );
predicate.setPredicateExpression( new MVELPredicateExpression(expr,factory) );
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -76,7 +76,7 @@
factory.setGlobalsMap( context.getPkg().getGlobals() );
- Serializable expr = MVEL.compileExpression( returnValueRestrictionDescr.getText() );
+ Serializable expr = MVEL.compileExpression( (String) returnValueRestrictionDescr.getContent() );
returnValueRestriction.setReturnValueExpression( new MVELReturnValueExpression(expr,factory) );
}
@@ -114,7 +114,7 @@
factory.setGlobalsMap( context.getPkg().getGlobals() );
- Serializable expr = MVEL.compileExpression( predicateDescr.getText() );
+ Serializable expr = MVEL.compileExpression( (String) predicateDescr.getContent() );
predicate.setPredicateExpression( new MVELPredicateExpression(expr,factory) );
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/EvalHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/EvalHandler.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/EvalHandler.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -85,7 +85,7 @@
this.xmlPackageReader.getLocator() );
}
- evalDescr.setText( expression );
+ evalDescr.setContent( expression );
final LinkedList parents = this.xmlPackageReader.getParents();
final ListIterator it = parents.listIterator( parents.size() );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/PredicateHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/PredicateHandler.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/PredicateHandler.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -77,7 +77,7 @@
this.xmlPackageReader.getLocator() );
}
- predicateDescr.setText( expression );
+ predicateDescr.setContent( expression );
final LinkedList parents = this.xmlPackageReader.getParents();
final ListIterator it = parents.listIterator( parents.size() );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ReturnValueRestrictionHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ReturnValueRestrictionHandler.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ReturnValueRestrictionHandler.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -82,7 +82,7 @@
this.xmlPackageReader.getLocator() );
}
- returnValueDescr.setText( expression );
+ returnValueDescr.setContent( expression );
final LinkedList parents = this.xmlPackageReader.getParents();
final ListIterator it = parents.listIterator( parents.size() );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlDumper.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlDumper.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlDumper.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -105,7 +105,7 @@
public void visitEvalDescr(final EvalDescr descr) {
this.template = new String();
- this.template = "<eval>" + replaceIllegalChars( descr.getText() ) + "</eval>" + XmlDumper.eol;
+ this.template = "<eval>" + replaceIllegalChars( (String) descr.getContent() ) + "</eval>" + XmlDumper.eol;
}
public void visitExistsDescr(final ExistsDescr descr) {
@@ -169,12 +169,12 @@
public void visitPredicateDescr(final PredicateDescr descr) {
this.template = new String();
- this.template = "<predicate>" + replaceIllegalChars( descr.getText() ) + "</predicate>" + XmlDumper.eol;
+ this.template = "<predicate>" + replaceIllegalChars( (String) descr.getContent() ) + "</predicate>" + XmlDumper.eol;
}
public void visitReturnValueRestrictionDescr(final ReturnValueRestrictionDescr descr) {
this.template = new String();
- this.template = "<return-value-restriction evaluator=\"" + replaceIllegalChars( descr.getEvaluator() ) + "\" >" + replaceIllegalChars( descr.getText() ) + "</return-value-restriction>" + XmlDumper.eol;
+ this.template = "<return-value-restriction evaluator=\"" + replaceIllegalChars( descr.getEvaluator() ) + "\" >" + replaceIllegalChars( (String) descr.getContent() ) + "</return-value-restriction>" + XmlDumper.eol;
}
public void visitQueryDescr(final QueryDescr descr) {
@@ -198,7 +198,7 @@
lhs = "<lhs> </lhs>";
}
- final String rhs = "<rhs>" + replaceIllegalChars( ruleDescr.getConsequence() ) + "</rhs>" + XmlDumper.eol;
+ final String rhs = "<rhs>" + replaceIllegalChars( (String) ruleDescr.getConsequence() ) + "</rhs>" + XmlDumper.eol;
rule += attribute;
rule += lhs;
rule += rhs;
Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/CLP.g
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/CLP.g 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/clp/CLP.g 2007-03-12 23:22:22 UTC (rev 10137)
@@ -212,6 +212,8 @@
rule = null;
AndDescr lhs = null;
ColumnDescr colum = null;
+ ExecutionEngine engine = new BlockExecutionEngine();
+ ExecutionBuildContext context = new ExecutionBuildContext( engine );
}
: loc=LEFT_PAREN 'defrule'
ruleName=ID
@@ -228,10 +230,12 @@
lhs.setStartCharacter( ((CommonToken)loc).getStartIndex() );
}
lhs[lhs]*
+ function[context]* { rule.setConsequence( engine ); }
RIGHT_PAREN
;
+/* lhs is slightly different to ce as lhs allows pattern bindings, ce doesn't */
lhs[ConditionalElementDescr in_ce]
: ( and_ce[in_ce]
| or_ce[in_ce]
@@ -259,7 +263,7 @@
AndDescr andDescr= null;
}
: LEFT_PAREN
- 'and' {
+ AND {
andDescr = new AndDescr();
in_ce.addDescr( andDescr );
}
@@ -272,7 +276,7 @@
OrDescr orDescr= null;
}
: LEFT_PAREN
- 'or' {
+ OR {
orDescr = new OrDescr();
in_ce.addDescr( orDescr );
}
@@ -285,7 +289,7 @@
NotDescr notDescr= null;
}
: LEFT_PAREN
- 'not' {
+ NOT {
notDescr = new NotDescr();
in_ce.addDescr( notDescr );
}
@@ -295,10 +299,10 @@
exists_ce[ConditionalElementDescr in_ce]
@init {
- ExistsDescr existsDescr= null;
+ ExistsDescr existsDescr= null;
}
: LEFT_PAREN
- 'exists' {
+ EXISTS {
existsDescr = new ExistsDescr();
in_ce.addDescr( existsDescr );
}
@@ -308,18 +312,18 @@
eval_ce[ConditionalElementDescr in_ce]
@init {
- EvalDescr evalDescr= null;
+ EvalDescr evalDescr= null;
+ ExecutionEngine engine = new CLPEval();
+ ExecutionBuildContext context = new ExecutionBuildContext( engine );
}
: LEFT_PAREN
- 'test' {
+ TEST {
evalDescr = new EvalDescr();
in_ce.addDescr( evalDescr );
}
- LEFT_PAREN
- t=ID {
- evalDescr.setText( t.getText() );
- }
- RIGHT_PAREN
+ function[context] {
+ evalDescr.setContent( engine );
+ }
RIGHT_PAREN
;
@@ -391,30 +395,37 @@
String op = "==";
}
: ('~'{op = "!=";})?
- ( predicate_constraint[op, column]
- | return_value_restriction[op, fc]
- | variable_restriction[op, fc]
+ ( predicate_constraint[op, column]
+ | return_value_restriction[op, fc]
+ | variable_restriction[op, fc]
| lc=literal_restriction {
- fc.addRestriction( new LiteralRestrictionDescr(op, lc, true) );
+ fc.addRestriction( new LiteralRestrictionDescr(op, lc, true) );
op = "==";
}
)
;
predicate_constraint[String op, ColumnDescr column]
- : ':'LEFT_PAREN
- id=ID { column.addDescr( new PredicateDescr( id.getText() ) ); }
- RIGHT_PAREN
+ @init {
+ ExecutionEngine engine = new CLPPredicate();
+ ExecutionBuildContext context = new ExecutionBuildContext( engine );
+ }
+ : ':'
+ function[context] {
+ column.addDescr( new PredicateDescr( engine ) );
+ }
;
return_value_restriction[String op, FieldConstraintDescr fc]
@init {
- PredicateDescr d = null;
+ ExecutionEngine engine = new CLPReturnValue();
+ ExecutionBuildContext context = new ExecutionBuildContext( engine );
}
- : '='LEFT_PAREN
- id=ID{ fc.addRestriction( new ReturnValueRestrictionDescr(op, id.getText() ) ); }
- RIGHT_PAREN
+ : '='
+ function[context] {
+ fc.addRestriction( new ReturnValueRestrictionDescr (op, engine ) );
+ }
;
variable_restriction[String op, FieldConstraintDescr fc]
@@ -434,17 +445,77 @@
}
;
-function
+function[ExecutionBuildContext context] returns[Function f]
+ @init {
+ FunctionFactory factory = FunctionFactory.getInstance();
+ }
: LEFT_PAREN
- ID
- ( VAR
- | literal
- | function
- )
+ name=ID {
+ if ( name.getText().equals("bind") ) {
+ context.createLocalVariable( name.getText() );
+ }
+ f = factory.createFunction( name.getText() );
+ }
+
+ function_params[context, f]+
RIGHT_PAREN
;
+
+modify_function[ExecutionBuildContext context] returns[Function f]
+ @init {
+ FunctionFactory factory = FunctionFactory.getInstance();
+ f = factory.createFunction( "modify" );
+ }
+ :
+ LEFT_PAREN
+ 'modify'
+ slot_name_value_pair[context, f]+
+ RIGHT_PAREN
+ ;
+function_params[ExecutionBuildContext context, Function f]
+ @init {
+ ValueHandler value = null;
+ }
+ :
+ ( t=VAR { value = context.getVariableValueHandler(t.getText() ); }
+ | t=STRING { value = new ObjectLiteralValue( getString( t ) ); }
+ | t=ID { value = new ObjectLiteralValue( t.getText() ); }
+ | t=FLOAT { value = new DoubleLiteralValue( t.getText() ); }
+ | t=INT { value = new LongLiteralValue( t.getText() ); }
+ | t=BOOL { value = new BooleanLiteralValue( t.getText() ); }
+ | t=NULL { value = ObjectLiteralValue.NULL; }
+ | nf=function[context] { value = nf; }
+ )
+ { f.addParameter( value ); }
+
+ ;
+
+slot_name_value_pair[ExecutionBuildContext context, Function f]
+ @init {
+ SlotNameValuePair nameValuePair = null;
+ String name = null;
+ }
+ :
+ LEFT_PAREN
+ id=ID {
+ name = id.getText();
+ }
+ ( t=VAR { nameValuePair = new SlotNameValuePair(name, context.getVariableValueHandler( t.getText() ) ); }
+ | t=STRING { nameValuePair = new SlotNameValuePair(name, new ObjectLiteralValue( getString( t ) ) ); }
+ | t=ID { nameValuePair = new SlotNameValuePair(name, new ObjectLiteralValue( t.getText() ) ); }
+ | t=FLOAT { nameValuePair = new SlotNameValuePair(name, new DoubleLiteralValue( t.getText() ) ); }
+ | t=INT { nameValuePair = new SlotNameValuePair(name, new LongLiteralValue( t.getText() ) ); }
+ | t=BOOL { nameValuePair = new SlotNameValuePair(name, new BooleanLiteralValue( t.getText() ) ) ; }
+ | t=NULL { nameValuePair = new SlotNameValuePair(name, ObjectLiteralValue.NULL ); }
+ | nf=function[context]
+ { nameValuePair = new SlotNameValuePair(name, nf ); }
+ )
+ { f.addParameter( nameValuePair ); }
+ RIGHT_PAREN
+ ;
+
literal returns [String text]
@init {
text = null;
@@ -457,6 +528,14 @@
| t=NULL { text = null; }
)
;
+
+
+DEFRULE : 'defrule';
+OR : 'or';
+AND : 'and';
+NOT : 'not';
+EXISTS : 'exists';
+TEST : 'test';
VAR : '?'ID
;
Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/DRL.g
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/DRL.g 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/DRL.g 2007-03-12 23:22:22 UTC (rev 10137)
@@ -1138,9 +1138,15 @@
retval_constraint returns [String text]
@init {
text = null;
+ CLPReturnValue engine = new CLPReturnValue();
+ Function function;
}
:
- c=paren_chunk[null] { text = c.substring(1, c.length()-1); }
+ f=function {
+ engine.setFunction( f );
+ }
+ //c=paren_chunk[null] { text = c.substring(1, c.length()-1); }
+ //{
;
lhs_or returns [BaseDescr d]
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/AddFunctionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/AddFunctionTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/AddFunctionTest.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,71 @@
+package org.drools.clp;
+
+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.common.InternalFactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Column;
+import org.drools.rule.Declaration;
+import org.drools.spi.ColumnExtractor;
+import org.drools.spi.ObjectType;
+
+import junit.framework.TestCase;
+
+public class AddFunctionTest extends TestCase {
+ public void testAdd() {
+ ValueHandler val1 = new ObjectLiteralValue(new BigDecimal( 10 ));
+ ValueHandler val2 = new ObjectLiteralValue(new BigDecimal( 10 ));
+ AddFunction add = new AddFunction( new ValueHandler[] { val1, val2 } );
+
+ assertEquals( new BigDecimal( 20 ), add.getBigDecimalValue( null ) );
+ }
+
+ public void testNestedAdd() {
+
+ ValueHandler val1 = new ObjectLiteralValue(new BigDecimal( 10 ));
+ ValueHandler val2 = new ObjectLiteralValue(new BigDecimal( 10 ));
+ ValueHandler val3 = new ObjectLiteralValue(new BigDecimal( 10 ));
+
+ AddFunction add1 = new AddFunction( new ValueHandler[] { val1, val2 } );
+ AddFunction add2 = new AddFunction( new ValueHandler[] { val3, add1 } );
+
+ assertEquals( new BigDecimal( 30 ), add2.getBigDecimalValue( null ) );
+ }
+
+ public void testNestedAddWithVars() {
+ RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ InternalWorkingMemory workingMemory = ( InternalWorkingMemory ) ruleBase.newWorkingMemory();
+
+ InternalFactHandle factHandle = ( InternalFactHandle ) workingMemory.assertObject( new BigDecimal( 10 ) );
+ ReteTuple tuple = new ReteTuple( factHandle );
+
+ ObjectType objectType = new ClassObjectType( BigDecimal.class );
+ Column column0 = new Column(0, objectType);
+ Column column1 = new Column(1, objectType);
+ ColumnExtractor extractor = new ColumnExtractor( objectType );
+
+ Map variables = new HashMap();
+ variables.put( "pd", new CLPPreviousDeclarationVariable( new Declaration("pd", extractor, column0) ) );
+ variables.put( "ld", new CLPLocalDeclarationVariable( new Declaration("ld", extractor, column1) ) );
+
+ ValueHandler val1 = new TempTokenVariable("pd");
+ ValueHandler val2 = new LocalVariableValue("lv", 0);
+ ValueHandler val3 = new TempTokenVariable("ld");
+
+ ExecutionContext context = new ExecutionContext(workingMemory, tuple, new BigDecimal( 10 ), 1 );
+ context.setLocalVariable( 0, new BigDecimal( 10 ) );
+
+ AddFunction add1 = new AddFunction( new ValueHandler[] { val1, val2 } );
+ AddFunction add2 = new AddFunction( new ValueHandler[] { val3, add1 } );
+
+ add2.replaceTempTokens( variables );
+
+ assertEquals( new BigDecimal( 30 ), add2.getBigDecimalValue( context ) );
+ }
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ClpParserTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ClpParserTest.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/ClpParserTest.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -32,8 +32,13 @@
private CLPParser parser;
- public void testRule() throws Exception {
- RuleDescr rule = parse( "(defrule xxx ?b <- (person (name \"yyy\"&?bf|~\"zzz\"|~=(ppp)&:(ooo)) ) ?c <- (hobby (type ?bf2&~iii) (rating fivestar) )" ).rule();
+ public void testParseFunction() throws Exception {
+ ExecutionBuildContext context = new ExecutionBuildContext( new CLPPredicate() );
+ parse( "(< 1 2)" ).function( context );
+ }
+
+ public void testPatternsRule() throws Exception {
+ RuleDescr rule = parse( "(defrule xxx ?b <- (person (name \"yyy\"&?bf|~\"zzz\"|~=(+ 2 2)&:(< 1 2)) ) ?c <- (hobby (type ?bf2&~iii) (rating fivestar) )" ).rule();
assertEquals( "xxx",
rule.getName() );
@@ -96,11 +101,11 @@
assertEquals( "!=",
retDescr.getEvaluator() );
assertEquals( "ppp",
- retDescr.getText() );
+ retDescr.getContent() );
PredicateDescr predicateDescr = (PredicateDescr) colList.get( 1 );
assertEquals( "ooo",
- predicateDescr.getText() );
+ predicateDescr.getContent() );
// Parse the second column
col = (ColumnDescr) lhsList.get( 1 );
@@ -286,7 +291,7 @@
lhsList.size() );
EvalDescr evalDescr = (EvalDescr) lhsList.get( 0 );
- assertEquals( "yyy", evalDescr.getText() );
+ assertEquals( "yyy", evalDescr.getContent() );
}
private CLPParser parse(final String text) throws Exception {
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/FunctionFactoryTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/FunctionFactoryTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/clp/FunctionFactoryTest.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -0,0 +1,13 @@
+package org.drools.clp;
+
+import junit.framework.TestCase;
+
+public class FunctionFactoryTest extends TestCase {
+ public void testInit() {
+ FunctionFactory factory = FunctionFactory.getInstance();
+ assertEquals( 2, factory.getFunctionSize() );
+
+ assertSame( AddFunction.class , factory.createFunction( "+" ).getClass() );
+ assertSame( BindFunction.class , factory.createFunction( "bind" ).getClass() );
+ }
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -237,7 +237,7 @@
assertFalse( parser.hasErrors() );
assertEqualsIgnoreWhitespace( "if (speed > speedLimit ? true : false;) pullEmOver();",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
}
public void FIX_ME_testLatinChars() throws Exception {
@@ -278,7 +278,7 @@
final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
assertEqualsIgnoreWhitespace( "yourFunction(new String[3] {\"a\",\"b\",\"c\"});",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
final FunctionDescr func = (FunctionDescr) pkg.getFunctions().get( 0 );
assertEquals( "String[]",
@@ -298,7 +298,7 @@
rule.getName() );
assertNotNull( rule.getLhs() );
assertEquals( "",
- rule.getConsequence().trim() );
+ (( String ) rule.getConsequence()).trim() );
assertFalse( this.parser.hasErrors() );
}
@@ -311,7 +311,7 @@
rule.getName() );
assertNotNull( rule.getLhs() );
assertEquals( "",
- rule.getConsequence().trim() );
+ (( String ) rule.getConsequence()).trim() );
assertFalse( this.parser.hasErrors() );
}
@@ -376,13 +376,13 @@
+ "Object o = new String(\"Hello\");" + "String s = (String) o;";
assertEqualsIgnoreWhitespace( expected,
- rule.getConsequence() );
- assertTrue( rule.getConsequence().indexOf( "++" ) > 0 );
- assertTrue( rule.getConsequence().indexOf( "--" ) > 0 );
- assertTrue( rule.getConsequence().indexOf( "+=" ) > 0 );
- assertTrue( rule.getConsequence().indexOf( "==" ) > 0 );
+ ( String ) rule.getConsequence() );
+ assertTrue( (( String ) rule.getConsequence()).indexOf( "++" ) > 0 );
+ assertTrue( (( String ) rule.getConsequence()).indexOf( "--" ) > 0 );
+ assertTrue( (( String ) rule.getConsequence()).indexOf( "+=" ) > 0 );
+ assertTrue( (( String ) rule.getConsequence()).indexOf( "==" ) > 0 );
- //System.out.println(rule.getConsequence());
+ //System.out.println(( String ) rule.getConsequence());
//note, need to assert that "i++" is preserved as is, no extra spaces.
assertFalse( this.parser.hasErrors() );
@@ -415,7 +415,7 @@
rule.getName() );
assertNotNull( rule.getLhs() );
assertEqualsIgnoreWhitespace( "cons();",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
final AndDescr lhs = rule.getLhs();
assertEquals( 3,
@@ -663,7 +663,7 @@
// assertEquals("x", arg.getValue());
// assertEquals(ArgumentValueDescr.VARIABLE, arg.getType());
//
- // assertEqualsIgnoreWhitespace("whee();", rule.getConsequence());
+ // assertEqualsIgnoreWhitespace("whee();", ( String ) rule.getConsequence());
//
// from = (FromDescr) rule.getLhs().getDescrs().get(6);
// assertEquals("wa", ((FunctionCallDescr)from.getDataSource()).getName());
@@ -775,7 +775,7 @@
third.getObjectType() );
assertEqualsIgnoreWhitespace( "if ( a == b ) { " + " assert( foo3 );" + "} else {" + " retract( foo4 );" + "}" + " System.out.println( a4 );",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertFalse( this.parser.hasErrors() );
}
@@ -788,7 +788,7 @@
assertNotNull( rule );
assertEqualsIgnoreWhitespace( "consequence();",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertEquals( "simple_rule",
rule.getName() );
assertEquals( 2,
@@ -917,7 +917,7 @@
parseResource( "test_CommentLineNumbersInConsequence.drl" ).compilation_unit();
assertFalse( parser.hasErrors() );
- String rhs = ((RuleDescr) parser.getPackageDescr().getRules().get( 0 )).getConsequence();
+ String rhs = (String) ((RuleDescr) parser.getPackageDescr().getRules().get( 0 )).getConsequence();
//System.out.println(rhs);
assertEquals( "\n first\n\n\n\n\n\n\n second",
rhs );
@@ -1002,7 +1002,7 @@
third.getObjectType() );
assertEqualsIgnoreWhitespace( "if ( a == b ) { " + " assert( foo3 );" + "} else {" + " retract( foo4 );" + "}" + " System.out.println( a4 );",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertFalse( this.parser.hasErrors() );
}
@@ -1219,7 +1219,7 @@
assertEquals( 1,
lhs.getDescrs().size() );
assertEqualsIgnoreWhitespace( "System.out.println(\"I like \" + t);",
- rule0.getConsequence() );
+ (String) rule0.getConsequence() );
// Check first column
ColumnDescr first = (ColumnDescr) lhs.getDescrs().get( 0 );
@@ -1232,7 +1232,7 @@
assertEquals( 1,
lhs.getDescrs().size() );
assertEqualsIgnoreWhitespace( "System.out.println(\"I like \" + t);",
- rule1.getConsequence() );
+ (String) rule1.getConsequence() );
// Check first column
first = (ColumnDescr) lhs.getDescrs().get( 0 );
@@ -1276,7 +1276,7 @@
final OrDescr or = (OrDescr) rule.getLhs().getDescrs().get( 0 );
assertEquals( 2,
or.getDescrs().size() );
- assertNotNull( rule.getConsequence() );
+ assertNotNull( ( String ) rule.getConsequence() );
}
@@ -1306,7 +1306,7 @@
assertEquals( "Bar",
col.getObjectType() );
- assertNotNull( rule.getConsequence() );
+ assertNotNull( ( String ) rule.getConsequence() );
}
@@ -1333,7 +1333,7 @@
assertEquals( "location",
((FieldConstraintDescr) col.getDescrs().get( 1 )).getFieldName() );
- assertNotNull( rule.getConsequence() );
+ assertNotNull( ( String ) rule.getConsequence() );
}
@@ -1597,7 +1597,7 @@
literal.getText() );
assertEqualsIgnoreWhitespace( "System.out.println( \"Mark and Michael\" );",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertFalse( parser.hasErrors() );
}
@@ -1637,7 +1637,7 @@
cheeseDescr.getIdentifier() );
assertEqualsIgnoreWhitespace( "System.out.println( \"Mark and Michael\" + bar );",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertFalse( parser.hasErrors() );
}
@@ -1678,7 +1678,7 @@
secondFact.getIdentifier() );
assertEqualsIgnoreWhitespace( "System.out.println( \"Mark and Michael\" + bar );",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertFalse( parser.hasErrors() );
}
@@ -1716,7 +1716,7 @@
secondFact.getIdentifier() );
assertEqualsIgnoreWhitespace( "System.out.println( \"Mark and Michael\" + bar );",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertFalse( parser.hasErrors() );
}
@@ -1781,7 +1781,7 @@
final EvalDescr eval = (EvalDescr) rule.getLhs().getDescrs().get( 0 );
assertEqualsIgnoreWhitespace( "abc(\"foo\") + 5",
- eval.getText() );
+ (String) eval.getContent() );
final ColumnDescr col = (ColumnDescr) rule.getLhs().getDescrs().get( 1 );
assertEquals( "Foo",
@@ -1808,9 +1808,9 @@
final EvalDescr eval = (EvalDescr) rule.getLhs().getDescrs().get( 2 );
assertEqualsIgnoreWhitespace( "abc(\"foo\")",
- eval.getText() );
+ (String) eval.getContent() );
assertEqualsIgnoreWhitespace( "Kapow",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertFalse( parser.hasErrors() );
}
@@ -1835,7 +1835,7 @@
ReturnValueRestrictionDescr retval = (ReturnValueRestrictionDescr) fld.getRestrictions().get( 0 );
assertEquals( "a + b",
- retval.getText() );
+ retval.getContent() );
assertEquals( "name",
fld.getFieldName() );
assertEquals( "==",
@@ -1866,7 +1866,7 @@
assertEquals( "$age2",
field.getIdentifier() );
assertEqualsIgnoreWhitespace( "$age2 == $age1+2",
- pred.getText() );
+ (String) pred.getContent() );
assertFalse( parser.getErrorMessages().toString(),
parser.hasErrors() );
@@ -2003,7 +2003,7 @@
assertEquals( "simple_rule",
rule.getName() );
assertEqualsIgnoreWhitespace( "bar();",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
final List attrs = rule.getAttributes();
assertEquals( 5,
@@ -2047,7 +2047,7 @@
assertEquals( "simple_rule",
rule.getName() );
assertEqualsIgnoreWhitespace( "bar();",
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
final List attrs = rule.getAttributes();
assertEquals( 5,
@@ -2339,7 +2339,7 @@
assertEquals( "attr",
field.getFieldName() );
assertEquals( " $var.equals(\"xyz\") ",
- predicate.getText() );
+ predicate.getContent() );
}
public void testPredicate2() throws Exception {
@@ -2355,7 +2355,7 @@
PredicateDescr predicate = (PredicateDescr) constraints.get( 0 );
assertEquals( " $var.equals(\"xyz\") ",
- predicate.getText() );
+ predicate.getContent() );
}
public void testEscapedStrings() throws Exception {
@@ -2369,7 +2369,7 @@
final String expected = "String s = \"\\\"\\n\\t\\\\\";";
assertEqualsIgnoreWhitespace( expected,
- rule.getConsequence() );
+ ( String ) rule.getConsequence() );
assertFalse( this.parser.getErrorMessages().toString(),
this.parser.hasErrors() );
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -50,7 +50,7 @@
context.setDeclarationResolver( declarationResolver );
EvalDescr evalDescr = new EvalDescr();
- evalDescr.setText( "a == 10" );
+ evalDescr.setContent( "a == 10" );
MVELEvalBuilder builder = new MVELEvalBuilder();
EvalCondition eval = ( EvalCondition ) builder.build( context,
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -71,7 +71,7 @@
context.setDeclarationResolver( declarationResolver );
PredicateDescr predicateDescr = new PredicateDescr();
- predicateDescr.setText( "a == b" );
+ predicateDescr.setContent( "a == b" );
MVELPredicateBuilder builder = new MVELPredicateBuilder();
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -75,7 +75,7 @@
context.setDeclarationResolver( declarationResolver );
ReturnValueRestrictionDescr returnValueDescr = new ReturnValueRestrictionDescr("=");
- returnValueDescr.setText( "a + b" );
+ returnValueDescr.setContent( "a + b" );
MVELReturnValueBuilder builder = new MVELReturnValueBuilder();
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/XmlPackageReaderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/XmlPackageReaderTest.java 2007-03-12 21:54:25 UTC (rev 10136)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/XmlPackageReaderTest.java 2007-03-12 23:22:22 UTC (rev 10137)
@@ -195,7 +195,7 @@
assertEquals( "Foo",
columnDescr.getObjectType() );
- final String consequence = ruleDescr.getConsequence();
+ final String consequence = (String) ruleDescr.getConsequence();
assertNotNull( consequence );
assertEquals( "System.out.println( \"hello\" );",
consequence.trim() );
@@ -281,7 +281,7 @@
assertEquals( "==",
returnValueDescr.getEvaluator() );
assertEquals( "1==1",
- returnValueDescr.getText() );
+ returnValueDescr.getContent() );
final VariableRestrictionDescr variableDescr = (VariableRestrictionDescr) fieldConstraintDescr.getRestrictions().get( 2 );
assertEquals( "==",
@@ -291,7 +291,7 @@
final PredicateDescr predicateDescr = (PredicateDescr) column3.getDescrs().get( 1 );
assertEquals( "1==1",
- predicateDescr.getText() );
+ predicateDescr.getContent() );
final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) column3.getDescrs().get( 2 );
@@ -338,7 +338,7 @@
final EvalDescr evalDescr = (EvalDescr) lhsDescr.getDescrs().get( 9 );
assertEquals( "1==1",
- evalDescr.getText() );
+ evalDescr.getContent() );
}
public void testParseRhs() throws Exception {
@@ -391,7 +391,7 @@
assertEquals( "my rule",
ruleDescr.getName() );
- final String consequence = ruleDescr.getConsequence();
+ final String consequence = (String) ruleDescr.getConsequence();
assertNotNull( consequence );
assertEquals( "System.out.println( \"hello\" );",
consequence.trim() );
More information about the jboss-svn-commits
mailing list