[jboss-svn-commits] JBL Code SVN: r34778 - in labs/jbossrules/branches/DRLv6: out and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 18 12:44:57 EDT 2010


Author: dsotty
Date: 2010-08-18 12:44:56 -0400 (Wed, 18 Aug 2010)
New Revision: 34778

Added:
   labs/jbossrules/branches/DRLv6/lib/antlrworks-1.4.jar
   labs/jbossrules/branches/DRLv6/lib/prefuse.jar
   labs/jbossrules/branches/DRLv6/lib/prefuse.src.jar
   labs/jbossrules/branches/DRLv6/src/main/java/org/drools/lang/classes/
   labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/DRLTreeMLFormatter.java
   labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/ProTreeView.java
Removed:
   labs/jbossrules/branches/DRLv6/lib/antlrworks-1.3.1.jar
Modified:
   labs/jbossrules/branches/DRLv6/out/DRLv6Log.txt
   labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/DRLTreeFormatter.java
   labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g
   labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g
   labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java
Log:


Deleted: labs/jbossrules/branches/DRLv6/lib/antlrworks-1.3.1.jar
===================================================================
(Binary files differ)

Added: labs/jbossrules/branches/DRLv6/lib/antlrworks-1.4.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/branches/DRLv6/lib/antlrworks-1.4.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossrules/branches/DRLv6/lib/prefuse.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/branches/DRLv6/lib/prefuse.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossrules/branches/DRLv6/lib/prefuse.src.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/branches/DRLv6/lib/prefuse.src.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossrules/branches/DRLv6/out/DRLv6Log.txt
===================================================================
--- labs/jbossrules/branches/DRLv6/out/DRLv6Log.txt	2010-08-18 14:38:59 UTC (rev 34777)
+++ labs/jbossrules/branches/DRLv6/out/DRLv6Log.txt	2010-08-18 16:44:56 UTC (rev 34778)
@@ -1,1529 +0,0 @@
-**************************************
-compilation_unit
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 7
->> SOURCE : 
-package org.pack.subpack;
-import org.klass;
-
-declare Klass
-end
-
-rule "ruel"
-when
-then
-end
-
->> OUTPUT : 
-
-	(VT_COMPILATION_UNIT 
-		(package 
-			(VT_PACKAGE_ID org pack subpack
-			)
-		) 
-		(import 
-			(VT_IMPORT_ID org klass
-			)
-		) 
-		(VT_TYPE_DECLARE Klass
-		) 
-		(rule "ruel" 
-			(when VT_AND_IMPLICIT
-			) 
-		)
-	)
-**************************************
-package_statement
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-package this.isa.pack ;
->> OUTPUT : 
-
-	(package 
-		(VT_PACKAGE_ID this isa pack
-		)
-	)
-**************************************
-package_statement
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-package semi.colon.is.optional 
->> OUTPUT : 
-
-	(package 
-		(VT_PACKAGE_ID semi colon is optional
-		)
-	)
-**************************************
-package_statement
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-package simplePack
->> OUTPUT : 
-
-	(package 
-		(VT_PACKAGE_ID simplePack
-		)
-	)
-**************************************
-global
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-global int N 
->> OUTPUT : 
-
-	(global 
-		(VT_DATA_TYPE 0 int
-		) N
-	)
-**************************************
-global
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-global org.it.pack.String strix ;
->> OUTPUT : 
-
-	(global 
-		(VT_DATA_TYPE 0 org it pack String
-		) strix
-	)
-**************************************
-data_type
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-String
->> OUTPUT : 
-
-	(VT_DATA_TYPE 0 String
-	)
-**************************************
-data_type
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-int
->> OUTPUT : 
-
-	(VT_DATA_TYPE 0 int
-	)
-**************************************
-data_type
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-float[]
->> OUTPUT : 
-
-	(VT_DATA_TYPE 1 float
-	)
-**************************************
-data_type
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-org.pack.data.Claxx[]
->> OUTPUT : 
-
-	(VT_DATA_TYPE 1 org pack data Claxx
-	)
-**************************************
-data_type
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-int[][][]
->> OUTPUT : 
-
-	(VT_DATA_TYPE 3 int
-	)
-**************************************
-import_statement
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-import jav.lang.String
->> OUTPUT : 
-
-	(import 
-		(VT_IMPORT_ID jav lang String
-		)
-	)
-**************************************
-import_statement
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-import Test ; 
->> OUTPUT : 
-
-	(import 
-		(VT_IMPORT_ID Test
-		)
-	)
-**************************************
-import_statement
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-import jav.pack.*
->> OUTPUT : 
-
-	(import 
-		(VT_IMPORT_ID jav pack .*
-		)
-	)
-**************************************
-function_import_statement
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-import function org.pack.square
->> OUTPUT : 
-
-	(import function 
-		(VT_IMPORT_ID org pack square
-		)
-	)
-**************************************
-function
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-function float square( float x ) { ... x*x ... }
->> OUTPUT : 
-
-	(function 
-		(VT_DATA_TYPE 0 float
-		) square 
-		(VT_PARAM_LIST 
-			(VT_PARAM 
-				(VT_DATA_TYPE 0 float
-				) x
-			)
-		) { ... x*x ... }
-	)
-**************************************
-function
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-function process( int x, org.String zz ) { ... ... }
->> OUTPUT : 
-
-	(function process 
-		(VT_PARAM_LIST 
-			(VT_PARAM 
-				(VT_DATA_TYPE 0 int
-				) x
-			) 
-			(VT_PARAM 
-				(VT_DATA_TYPE 0 org String
-				) zz
-			)
-		) { ... ... }
-	)
-**************************************
-parameters
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-( int a, org.klass.AnType obj, String[][] argz )
->> OUTPUT : 
-
-	(VT_PARAM_LIST 
-		(VT_PARAM 
-			(VT_DATA_TYPE 0 int
-			) a
-		) 
-		(VT_PARAM 
-			(VT_DATA_TYPE 0 org klass AnType
-			) obj
-		) 
-		(VT_PARAM 
-			(VT_DATA_TYPE 2 String
-			) argz
-		)
-	)
-**************************************
-type_declaration
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-declare Student extends Person
- @role(entity) 
- @namespace(myNS="http:\\www.stix.com\domain\subd#") 
- age  : int 
- name : String 
- end 
-
->> OUTPUT : 
-
-	(VT_TYPE_DECLARE Student extends Person 
-		(VT_ATTRIBUTES 
-			(role entity
-			) 
-			(namespace myNS "http:\\www.stix.com\domain\subd#"
-			)
-		) 
-		(VT_FIELD age 
-			(VT_DATA_TYPE 0 int
-			)
-		) 
-		(VT_FIELD name 
-			(VT_DATA_TYPE 0 String
-			)
-		)
-	)
-**************************************
-type_declaration
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-declare HasFriend extends Knows
- at role(property) 
- at namespace(myNS="http:\\www.somens.com\arg\test#") 
- at disjoint(HasEnemy) 
- at symmetric 
-subject	: Person 
-object  : Person 
-end 
-
->> OUTPUT : 
-
-	(VT_TYPE_DECLARE HasFriend extends Knows 
-		(VT_ATTRIBUTES 
-			(role property
-			) 
-			(namespace myNS "http:\\www.somens.com\arg\test#"
-			) 
-			(disjoint HasEnemy
-			) symmetric
-		) 
-		(VT_FIELD subject 
-			(VT_DATA_TYPE 0 Person
-			)
-		) 
-		(VT_FIELD object 
-			(VT_DATA_TYPE 0 Person
-			)
-		)
-	)
-**************************************
-type_declaration
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-declare HasSpouse 
- at role(property) 
- at namespace(myNS="http:\\www.somens.com\arg\test#") 
- at symmetric 
- at transitive 
- at inverse(HasSpouse) 
-subject	= ("john") : Person 	@[key] 
-object  : Person	@[key] 
-end 
-
->> OUTPUT : 
-
-	(VT_TYPE_DECLARE HasSpouse 
-		(VT_ATTRIBUTES 
-			(role property
-			) 
-			(namespace myNS "http:\\www.somens.com\arg\test#"
-			) symmetric transitive 
-			(inverse HasSpouse
-			)
-		) 
-		(VT_FIELD 
-			(VT_ATTRIBUTES key
-			) subject 
-			(VT_DATA_TYPE 0 Person
-			) 
-			(= 
-				("john"
-				)
-			)
-		) 
-		(VT_FIELD 
-			(VT_ATTRIBUTES key
-			) object 
-			(VT_DATA_TYPE 0 Person
-			)
-		)
-	)
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at role(event)
->> OUTPUT : 
-
-	(role event
-	)
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at role(type)
->> OUTPUT : 
-
-	(role type
-	)
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at role(entity)
->> OUTPUT : 
-
-	(role entity
-	)
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at role(property)
->> OUTPUT : 
-
-	(role property
-	)
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at namespace( alias = "http:\\www.org.dom\arg# ")
->> OUTPUT : 
-
-	(namespace alias "http:\\www.org.dom\arg# "
-	)
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at disjoint(AnotherType)
->> OUTPUT : 
-
-	(disjoint AnotherType
-	)
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at symmetric
->> OUTPUT : 
-symmetric
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at transitive
->> OUTPUT : 
-transitive
-**************************************
-type_declare_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
- at inverse(ReverseProperty)
->> OUTPUT : 
-
-	(inverse ReverseProperty
-	)
-**************************************
-decl_field
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-field = (...) : datatype[][] @[key]
->> OUTPUT : 
-
-	(VT_FIELD 
-		(VT_ATTRIBUTES key
-		) field 
-		(VT_DATA_TYPE 2 datatype
-		) 
-		(= 
-			(...
-			)
-		)
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule "ruleName" extends "anotherRule" 
- salience 100 
- no-loop 
- calendar "s1" , "s2" 
-when
-then
-end
-
->> OUTPUT : 
-
-	(rule "ruleName" 
-		(extends "anotherRule"
-		) 
-		(VT_ATTRIBUTES 
-			(salience 100
-			) no-loop 
-			(calendar [ "s1", "s2" ]
-			)
-		) 
-		(when VT_AND_IMPLICIT
-		) 
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-salience 100
->> OUTPUT : 
-
-	(salience 100
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-no-loop true
->> OUTPUT : 
-
-	(no-loop true
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-agenda-group "test-group"
->> OUTPUT : 
-
-	(agenda-group "test-group"
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-activation-group "act-group"
->> OUTPUT : 
-
-	(activation-group "act-group"
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-auto-focus false
->> OUTPUT : 
-
-	(auto-focus false
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-effective "2010-04-12"
->> OUTPUT : 
-
-	(effective "2010-04-12"
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-expires "2010-04-12"
->> OUTPUT : 
-
-	(expires "2010-04-12"
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-enabled true
->> OUTPUT : 
-
-	(enabled true
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-ruleflow-group "act-group"
->> OUTPUT : 
-
-	(ruleflow-group "act-group"
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-agenda-group "act-group"
->> OUTPUT : 
-
-	(agenda-group "act-group"
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-duration 100
->> OUTPUT : 
-
-	(duration 100
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-timer 100
->> OUTPUT : 
-
-	(timer 100
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-dialect "java" 
->> OUTPUT : 
-
-	(dialect "java"
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-lock-on-active true
->> OUTPUT : 
-
-	(lock-on-active true
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-defeats "anotherRule" 
->> OUTPUT : 
-
-	(defeats "anotherRule"
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-deductive
->> OUTPUT : 
-deductive
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-abductive
->> OUTPUT : 
-abductive
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-equivalence
->> OUTPUT : 
-equivalence
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-deduction @[crisp]
->> OUTPUT : 
-
-	(deduction 
-		(VT_ATTRIBUTES crisp
-		)
-	)
-**************************************
-rule_attribute
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-implication @[crisp]
->> OUTPUT : 
-
-	(implication 
-		(VT_ATTRIBUTES crisp
-		)
-	)
-**************************************
-operator_attributes
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-@[
-kind="lukasiewicz", 
-id="myID", 
-params="addit,args,2,more", 
-degree="[0.3,0.2]", 
-crisp,
-default,
-defeat,
-merge="mStrat", 
-missing="sStrat" 
-]
->> OUTPUT : 
-
-	(VT_ATTRIBUTES 
-		(kind = "lukasiewicz"
-		) 
-		(id = "myID"
-		) 
-		(params = "addit,args,2,more"
-		) 
-		(degree = "[0.3,0.2]"
-		) crisp default defeat 
-		(merge = "mStrat"
-		) 
-		(missing = "sStrat"
-		)
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule test when Bus() Car() Taxi()then end
->> OUTPUT : 
-
-	(rule test 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_AND VT_ENABLED 
-					(VT_PATTERN Bus
-					)
-				) 
-				(VT_AND VT_ENABLED 
-					(VT_PATTERN Car
-					)
-				) 
-				(VT_AND VT_ENABLED 
-					(VT_PATTERN Taxi
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule test when $p : Person() implies @[kind="anImpl"] Dog()then end
->> OUTPUT : 
-
-	(rule test 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_IMPLIES 
-					(VT_ATTRIBUTES 
-						(kind = "anImpl"
-						)
-					) 
-					(VT_BINDING $p : 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						)
-					) 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Dog
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule test when Car() or @[kind="anOr"] Taxi() or @[kind="anotherOr"] Bus()then end
->> OUTPUT : 
-
-	(rule test 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_OR 
-					(VT_ATTRIBUTES 
-						(kind = "anotherOr"
-						)
-					) 
-					(VT_OR 
-						(VT_ATTRIBUTES 
-							(kind = "anOr"
-							)
-						) 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Car
-							)
-						) 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Taxi
-							)
-						)
-					) 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Bus
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-rule test when $p : Person() xor Dog()then end
->> OUTPUT : 
-
-	(rule test 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_XOR 
-					(VT_BINDING $p : 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						)
-					) 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Dog
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule test when (Person() xor Dog()) equiv Cat()then end
->> OUTPUT : 
-
-	(rule test 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_EQUIV 
-					(VT_AND_IMPLICIT 
-						(VT_XOR 
-							(VT_AND VT_ENABLED 
-								(VT_PATTERN Person
-								)
-							) 
-							(VT_AND VT_ENABLED 
-								(VT_PATTERN Dog
-								)
-							)
-						)
-					) 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Cat
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule test when Car() and Taxi() and Bus()then end
->> OUTPUT : 
-
-	(rule test 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_AND 
-					(VT_AND 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Car
-							)
-						) 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Taxi
-							)
-						)
-					) 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Bus
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule test when (P() implies Q()) implies ( (K() equiv K()) or Z() and X() )then end
->> OUTPUT : 
-
-	(rule test 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_IMPLIES 
-					(VT_AND_IMPLICIT 
-						(VT_IMPLIES 
-							(VT_AND VT_ENABLED 
-								(VT_PATTERN P
-								)
-							) 
-							(VT_AND VT_ENABLED 
-								(VT_PATTERN Q
-								)
-							)
-						)
-					) 
-					(VT_AND_IMPLICIT 
-						(VT_OR 
-							(VT_AND_IMPLICIT 
-								(VT_EQUIV 
-									(VT_AND VT_ENABLED 
-										(VT_PATTERN K
-										)
-									) 
-									(VT_AND VT_ENABLED 
-										(VT_PATTERN K
-										)
-									)
-								)
-							) 
-							(VT_AND 
-								(VT_AND VT_ENABLED 
-									(VT_PATTERN Z
-									)
-								) 
-								(VT_AND VT_ENABLED 
-									(VT_PATTERN X
-									)
-								)
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-rule "r" when neg @[crisp] very @[crisp] Person() then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_NEG 
-					(VT_ATTRIBUTES crisp
-					) 
-					(VT_HEDGE_VERY 
-						(VT_ATTRIBUTES crisp
-						) 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-rule "r" when $lab : Person()then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_BINDING $lab : 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Person
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-rule "r" when (Person() implies Dog())then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_AND_IMPLICIT 
-					(VT_IMPLIES 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						) 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Dog
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-rule "r" when exists @[crisp] ( $p : Person() and $d : Dog() ) then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_EXISTS 
-					(VT_ATTRIBUTES crisp
-					) 
-					(VT_AND_IMPLICIT 
-						(VT_AND 
-							(VT_BINDING $p : 
-								(VT_AND VT_ENABLED 
-									(VT_PATTERN Person
-									)
-								)
-							) 
-							(VT_BINDING $d : 
-								(VT_AND VT_ENABLED 
-									(VT_PATTERN Dog
-									)
-								)
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule "r" when  $p : exists Person() then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_BINDING $p : 
-					(VT_EXISTS 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule "r" when not @[crisp] ( $p : Person() and $d : Dog() ) then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_NEXISTS 
-					(VT_ATTRIBUTES crisp
-					) 
-					(VT_AND_IMPLICIT 
-						(VT_AND 
-							(VT_BINDING $p : 
-								(VT_AND VT_ENABLED 
-									(VT_PATTERN Person
-									)
-								)
-							) 
-							(VT_BINDING $d : 
-								(VT_AND VT_ENABLED 
-									(VT_PATTERN Dog
-									)
-								)
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-rule "r" when  not Person() then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_NEXISTS 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Person
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule "r" when forall @[crisp] Person() then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_FORALL 
-					(VT_ATTRIBUTES crisp
-					) 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Person
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-rule "r" when forall  ( $p : Person()                Person() ) then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_FORALL 
-					(VT_BINDING $p : 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						)
-					) 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Person
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule "r" when forall  ( $p : Person()                (Person() Dog()) ) then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_FORALL 
-					(VT_BINDING $p : 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						)
-					) 
-					(VT_AND_IMPLICIT 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						) 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Dog
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule "r" when forall  ( ($p : Person() $d : Dog() )          (     Person()      Dog() )         ) then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_FORALL 
-					(VT_AND_IMPLICIT 
-						(VT_BINDING $p : 
-							(VT_AND VT_ENABLED 
-								(VT_PATTERN Person
-								)
-							)
-						) 
-						(VT_BINDING $d : 
-							(VT_AND VT_ENABLED 
-								(VT_PATTERN Dog
-								)
-							)
-						)
-					) 
-					(VT_AND_IMPLICIT 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Person
-							)
-						) 
-						(VT_AND VT_ENABLED 
-							(VT_PATTERN Dog
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-rule "r" when $p : Person() then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_BINDING $p : 
-					(VT_AND VT_ENABLED 
-						(VT_PATTERN Person
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule "r" when Person() @[crisp]then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_AND 
-					(VT_ATTRIBUTES crisp
-					) VT_ENABLED 
-					(VT_PATTERN Person
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 3
->> SOURCE : 
-rule "r" when Person( "john" , 18, height > 150) then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_AND VT_ENABLED 
-					(VT_PATTERN Person
-					) 
-					(VT_AND 
-						(VT_POSITIONAL_CONST 0 "john"
-						) 
-						(VT_POSITIONAL_CONST 1 18
-						) 
-						(> 150 
-							(VT_EXPR height
-							)
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-rule
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-rule "r" when Person( "john" , 18, 2.0, true, null, new Dog(), {12, $x, "test" }, $var) then end
->> OUTPUT : 
-
-	(rule "r" 
-		(when 
-			(VT_AND_IMPLICIT 
-				(VT_AND VT_ENABLED 
-					(VT_PATTERN Person
-					) 
-					(VT_AND 
-						(VT_POSITIONAL_CONST 0 "john"
-						) 
-						(VT_POSITIONAL_CONST 1 18
-						) 
-						(VT_POSITIONAL_CONST 2 2.0
-						) 
-						(VT_POSITIONAL_CONST 3 true
-						) 
-						(VT_POSITIONAL_CONST 4 null
-						) 
-						(VT_POSITIONAL_CONST 5 
-							(VT_NEW_OBJ 
-								(VT_TYPE Dog
-								)
-							)
-						) 
-						(VT_POSITIONAL_CONST 6 
-							(VT_LIST 12 $x "test"
-							)
-						) 
-						(VT_POSITIONAL_VAR 7 $var
-						)
-					)
-				)
-			)
-		) 
-	)
-**************************************
-literal_object
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-new Thing(13, $var, true)
->> OUTPUT : 
-
-	(VT_NEW_OBJ 
-		(VT_TYPE Thing
-		) 
-		(VT_ARGS 13 $var true
-		)
-	)
-**************************************
-literal_object
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 0
->> SOURCE : 
-new Obj(12 - 13*($var*2 + sqrt(4)))
->> OUTPUT : 
-
-	(VT_NEW_OBJ 
-		(VT_TYPE Obj
-		) 
-		(VT_ARGS 
-			(- 12 
-				(* 13 
-					(+ 
-						(* $var 2
-						) 
-						(sqrt 
-							(VT_ARGS 4
-							)
-						)
-					)
-				)
-			)
-		)
-	)
-**************************************
-type_declaration
-**************************************
->>>> RESULT :  SUCCESS 
->> TIME to parse 1
->> SOURCE : 
-declare Student 
- defined Male() and Human() and (Slave() or worksAt some (School() or Prison()))
- age  : int 
- name : String 
- end 
-
->> OUTPUT : 
-
-	(VT_TYPE_DECLARE Student 
-		(VT_DL_DEFINITION 
-			(VT_AND 
-				(VT_DL_TYPE Male
-				) 
-				(VT_DL_TYPE Human
-				) 
-				(VT_OR 
-					(VT_DL_TYPE Slave
-					) 
-					(some worksAt 
-						(VT_OR 
-							(VT_DL_TYPE School
-							) 
-							(VT_DL_TYPE Prison
-							)
-						)
-					)
-				)
-			)
-		) 
-		(VT_FIELD age 
-			(VT_DATA_TYPE 0 int
-			)
-		) 
-		(VT_FIELD name 
-			(VT_DATA_TYPE 0 String
-			)
-		)
-	)

Modified: labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/DRLTreeFormatter.java
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/DRLTreeFormatter.java	2010-08-18 14:38:59 UTC (rev 34777)
+++ labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/DRLTreeFormatter.java	2010-08-18 16:44:56 UTC (rev 34778)
@@ -5,6 +5,10 @@
 public class DRLTreeFormatter {
 
 	public static String toIndentedStringTree(CommonTree tree) {
+		return toIndentedStringTree(tree, "\t");
+	}
+	
+	public static String toIndentedStringTree(CommonTree tree, String sep) {
 		String ts = new String(tree.toStringTree());		
 		
 		//ts = ts.substring(0, ts.indexOf("then"));
@@ -16,14 +20,14 @@
 				
 				sb.append("\n");
 				for (int k = 0; k < dep; k++)
-					sb.append("\t");
+					sb.append(sep);
 				sb.append(ts.charAt(j));
 				
 			} else
 			if (ts.charAt(j) == ')') {				
 				sb.append("\n");
 				for (int k = 0; k < dep; k++)
-					sb.append("\t");
+					sb.append(sep);
 				sb.append(ts.charAt(j));
 				dep--;				
 			} else {

Added: labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/DRLTreeMLFormatter.java
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/DRLTreeMLFormatter.java	                        (rev 0)
+++ labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/DRLTreeMLFormatter.java	2010-08-18 16:44:56 UTC (rev 34778)
@@ -0,0 +1,57 @@
+package org.drools.util;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.antlr.runtime.tree.CommonTree;
+import org.antlr.runtime.tree.Tree;
+
+import com.sun.xml.internal.ws.util.ByteArrayBuffer;
+
+import prefuse.data.Graph;
+import prefuse.data.Node;
+import prefuse.data.io.DataIOException;
+import prefuse.data.io.TreeMLWriter;
+
+public class DRLTreeMLFormatter {
+		
+
+	public static final String FIELD = "text";
+
+	public static InputStream getAsStream(CommonTree resultTree) {
+		ByteArrayBuffer buffer = new ByteArrayBuffer();
+		Graph graph = buildGraph(resultTree);
+		
+		TreeMLWriter writer = new TreeMLWriter();				
+		try {
+			writer.writeGraph(graph, buffer);
+		} catch (DataIOException e) {
+			e.printStackTrace();
+		}
+		
+		return buffer.newInputStream(); 
+	}
+
+	private static Graph buildGraph(CommonTree resultTree) {
+		Graph tree = new Graph(true);
+			tree.addColumn(FIELD, String.class);
+			Node root = tree.addNode();
+			root.set(FIELD, resultTree.toString());
+			visit(resultTree, root, tree);
+		return tree;
+	}
+
+	private static void visit(Tree sourceTree, Node father, Graph tgtTree) {
+		int N = sourceTree.getChildCount();
+		
+		for (int j = 0; j < N; j++) {
+			Node n = tgtTree.addNode();			
+			Tree child = sourceTree.getChild(j);
+			n.setString(FIELD, child.toString());
+			tgtTree.addEdge(father,n);
+			visit(child,n,tgtTree);
+		}
+		
+	}
+
+}

Added: labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/ProTreeView.java
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/ProTreeView.java	                        (rev 0)
+++ labs/jbossrules/branches/DRLv6/src/main/java/org/drools/util/ProTreeView.java	2010-08-18 16:44:56 UTC (rev 34778)
@@ -0,0 +1,477 @@
+package org.drools.util;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.awt.geom.Point2D;
+import java.io.InputStream;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextPane;
+import javax.swing.KeyStroke;
+import javax.swing.SwingConstants;
+
+import prefuse.Constants;
+import prefuse.Display;
+import prefuse.Visualization;
+import prefuse.action.Action;
+import prefuse.action.ActionList;
+import prefuse.action.ItemAction;
+import prefuse.action.RepaintAction;
+import prefuse.action.animate.ColorAnimator;
+import prefuse.action.animate.LocationAnimator;
+import prefuse.action.animate.QualityControlAnimator;
+import prefuse.action.animate.VisibilityAnimator;
+import prefuse.action.assignment.ColorAction;
+import prefuse.action.assignment.FontAction;
+import prefuse.action.filter.FisheyeTreeFilter;
+import prefuse.action.layout.CollapsedSubtreeLayout;
+import prefuse.action.layout.graph.NodeLinkTreeLayout;
+import prefuse.activity.SlowInSlowOutPacer;
+import prefuse.controls.ControlAdapter;
+import prefuse.controls.FocusControl;
+import prefuse.controls.PanControl;
+import prefuse.controls.ZoomControl;
+import prefuse.controls.ZoomToFitControl;
+import prefuse.data.Tree;
+import prefuse.data.Tuple;
+import prefuse.data.event.TupleSetListener;
+import prefuse.data.io.DataIOException;
+import prefuse.data.io.TreeMLReader;
+import prefuse.data.search.PrefixSearchTupleSet;
+import prefuse.data.tuple.TupleSet;
+import prefuse.render.DefaultRendererFactory;
+import prefuse.render.EdgeRenderer;
+import prefuse.render.LabelRenderer;
+import prefuse.render.ShapeRenderer;
+import prefuse.util.ColorLib;
+import prefuse.util.FontLib;
+import prefuse.util.ui.JFastLabel;
+import prefuse.util.ui.JSearchPanel;
+import prefuse.visual.VisualItem;
+import prefuse.visual.expression.InGroupPredicate;
+import prefuse.visual.sort.TreeDepthItemSorter;
+
+
+/**
+ * Demonstration of a node-link tree viewer
+ *
+ * @version 1.0
+ * @author <a href="http://jheer.org">jeffrey heer</a>
+ */
+public class ProTreeView extends Display {
+
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = -2460952911303437417L;
+
+    
+    private static final String tree = "tree";
+    private static final String treeNodes = "tree.nodes";
+    private static final String treeEdges = "tree.edges";
+    
+    private LabelRenderer m_nodeRenderer;
+    private EdgeRenderer m_edgeRenderer;
+    
+    private String m_label = "label";
+    private int m_orientation = Constants.ORIENT_LEFT_RIGHT;
+    
+    public ProTreeView(Tree t, String label) {
+        super(new Visualization());
+        m_label = label;
+
+        m_vis.add(tree, t);
+        
+        m_nodeRenderer = new LabelRenderer(m_label);
+        m_nodeRenderer.setRenderType(ShapeRenderer.RENDER_TYPE_FILL);
+        m_nodeRenderer.setHorizontalAlignment(Constants.LEFT);
+        m_nodeRenderer.setRoundedCorner(8,8);
+        m_edgeRenderer = new EdgeRenderer(Constants.EDGE_TYPE_CURVE);
+        
+        DefaultRendererFactory rf = new DefaultRendererFactory(m_nodeRenderer);
+        rf.add(new InGroupPredicate(treeEdges), m_edgeRenderer);
+        m_vis.setRendererFactory(rf);
+               
+        // colors
+        ItemAction nodeColor = new NodeColorAction(treeNodes);
+        ItemAction textColor = new ColorAction(treeNodes,
+                VisualItem.TEXTCOLOR, ColorLib.rgb(0,0,0));
+        m_vis.putAction("textColor", textColor);
+        
+        ItemAction edgeColor = new ColorAction(treeEdges,
+                VisualItem.STROKECOLOR, ColorLib.rgb(200,200,200));
+        
+        // quick repaint
+        ActionList repaint = new ActionList();
+        repaint.add(nodeColor);
+        repaint.add(new RepaintAction());
+        m_vis.putAction("repaint", repaint);
+        
+        // full paint
+        ActionList fullPaint = new ActionList();
+        fullPaint.add(nodeColor);
+        m_vis.putAction("fullPaint", fullPaint);
+        
+        // animate paint change
+        ActionList animatePaint = new ActionList(400);
+        animatePaint.add(new ColorAnimator(treeNodes));
+        animatePaint.add(new RepaintAction());
+        m_vis.putAction("animatePaint", animatePaint);
+        
+        // create the tree layout action
+        NodeLinkTreeLayout treeLayout = new NodeLinkTreeLayout(tree,
+                m_orientation, 50, 0, 8);
+        treeLayout.setLayoutAnchor(new Point2D.Double(50,200));
+        m_vis.putAction("treeLayout", treeLayout);
+        
+        CollapsedSubtreeLayout subLayout = 
+            new CollapsedSubtreeLayout(tree, m_orientation);
+        m_vis.putAction("subLayout", subLayout);
+        
+        AutoPanAction autoPan = new AutoPanAction();
+        
+        // create the filtering and layout
+        ActionList filter = new ActionList();
+        filter.add(new FisheyeTreeFilter(tree, 2));
+        filter.add(new FontAction(treeNodes, FontLib.getFont("Tahoma", 12)));
+        filter.add(treeLayout);
+        filter.add(subLayout);
+        filter.add(textColor);
+        filter.add(nodeColor);
+        filter.add(edgeColor);
+        m_vis.putAction("filter", filter);
+        
+        // animated transition
+        ActionList animate = new ActionList(1000);
+        animate.setPacingFunction(new SlowInSlowOutPacer());
+        animate.add(autoPan);
+        animate.add(new QualityControlAnimator());
+        animate.add(new VisibilityAnimator(tree));
+        animate.add(new LocationAnimator(treeNodes));
+        animate.add(new ColorAnimator(treeNodes));
+        animate.add(new RepaintAction());
+        m_vis.putAction("animate", animate);
+        m_vis.alwaysRunAfter("filter", "animate");
+        
+        // create animator for orientation changes
+        ActionList orient = new ActionList(2000);
+        orient.setPacingFunction(new SlowInSlowOutPacer());
+        orient.add(autoPan);
+        orient.add(new QualityControlAnimator());
+        orient.add(new LocationAnimator(treeNodes));
+        orient.add(new RepaintAction());
+        m_vis.putAction("orient", orient);
+        
+        // ------------------------------------------------
+        
+        // initialize the display
+        setSize(800	,450);
+        setItemSorter(new TreeDepthItemSorter());
+        addControlListener(new ZoomToFitControl());
+        addControlListener(new ZoomControl());
+        addControlListener(new PanControl());
+        addControlListener(new FocusControl(1, "filter"));
+        
+        registerKeyboardAction(
+            new OrientAction(Constants.ORIENT_LEFT_RIGHT),
+            "left-to-right", KeyStroke.getKeyStroke("ctrl 1"), WHEN_FOCUSED);
+        registerKeyboardAction(
+            new OrientAction(Constants.ORIENT_TOP_BOTTOM),
+            "top-to-bottom", KeyStroke.getKeyStroke("ctrl 2"), WHEN_FOCUSED);
+        registerKeyboardAction(
+            new OrientAction(Constants.ORIENT_RIGHT_LEFT),
+            "right-to-left", KeyStroke.getKeyStroke("ctrl 3"), WHEN_FOCUSED);
+        registerKeyboardAction(
+            new OrientAction(Constants.ORIENT_BOTTOM_TOP),
+            "bottom-to-top", KeyStroke.getKeyStroke("ctrl 4"), WHEN_FOCUSED);
+        
+        // ------------------------------------------------
+        
+        // filter graph and perform layout
+        setOrientation(m_orientation);
+        m_vis.run("filter");
+        
+        TupleSet search = new PrefixSearchTupleSet(); 
+        m_vis.addFocusGroup(Visualization.SEARCH_ITEMS, search);
+        search.addTupleSetListener(new TupleSetListener() {
+            public void tupleSetChanged(TupleSet t, Tuple[] add, Tuple[] rem) {
+                m_vis.cancel("animatePaint");
+                m_vis.run("fullPaint");
+                m_vis.run("animatePaint");
+            }
+        });
+    }
+    
+    // ------------------------------------------------------------------------
+    
+    public void setOrientation(int orientation) {
+        NodeLinkTreeLayout rtl 
+            = (NodeLinkTreeLayout)m_vis.getAction("treeLayout");
+        CollapsedSubtreeLayout stl
+            = (CollapsedSubtreeLayout)m_vis.getAction("subLayout");
+        switch ( orientation ) {
+        case Constants.ORIENT_LEFT_RIGHT:
+            m_nodeRenderer.setHorizontalAlignment(Constants.LEFT);
+            m_edgeRenderer.setHorizontalAlignment1(Constants.RIGHT);
+            m_edgeRenderer.setHorizontalAlignment2(Constants.LEFT);
+            m_edgeRenderer.setVerticalAlignment1(Constants.CENTER);
+            m_edgeRenderer.setVerticalAlignment2(Constants.CENTER);
+            break;
+        case Constants.ORIENT_RIGHT_LEFT:
+            m_nodeRenderer.setHorizontalAlignment(Constants.RIGHT);
+            m_edgeRenderer.setHorizontalAlignment1(Constants.LEFT);
+            m_edgeRenderer.setHorizontalAlignment2(Constants.RIGHT);
+            m_edgeRenderer.setVerticalAlignment1(Constants.CENTER);
+            m_edgeRenderer.setVerticalAlignment2(Constants.CENTER);
+            break;
+        case Constants.ORIENT_TOP_BOTTOM:
+            m_nodeRenderer.setHorizontalAlignment(Constants.CENTER);
+            m_edgeRenderer.setHorizontalAlignment1(Constants.CENTER);
+            m_edgeRenderer.setHorizontalAlignment2(Constants.CENTER);
+            m_edgeRenderer.setVerticalAlignment1(Constants.BOTTOM);
+            m_edgeRenderer.setVerticalAlignment2(Constants.TOP);
+            break;
+        case Constants.ORIENT_BOTTOM_TOP:
+            m_nodeRenderer.setHorizontalAlignment(Constants.CENTER);
+            m_edgeRenderer.setHorizontalAlignment1(Constants.CENTER);
+            m_edgeRenderer.setHorizontalAlignment2(Constants.CENTER);
+            m_edgeRenderer.setVerticalAlignment1(Constants.TOP);
+            m_edgeRenderer.setVerticalAlignment2(Constants.BOTTOM);
+            break;
+        default:
+            throw new IllegalArgumentException(
+                "Unrecognized orientation value: "+orientation);
+        }
+        m_orientation = orientation;
+        rtl.setOrientation(orientation);
+        stl.setOrientation(orientation);
+    }
+    
+    public int getOrientation() {
+        return m_orientation;
+    }
+    
+    
+    
+    
+    
+    
+    
+  
+    
+    
+    
+    
+    
+    
+    
+    
+    public static JFrame visualize_tree(InputStream source, final String field, final String sourceDRL, final String drlTree, final String titleStr) {
+        Color BACKGROUND = Color.WHITE;
+        Color FOREGROUND = Color.BLACK;
+        
+        Tree t = null;
+		try {
+			t = (Tree) new TreeMLReader().readGraph(source);
+		} catch (DataIOException e1) {
+			e1.printStackTrace();
+		}
+		
+        // create a new treemap
+        final ProTreeView tview = new ProTreeView(t, field);
+        tview.setBackground(BACKGROUND);
+        tview.setForeground(FOREGROUND);
+        
+     
+        
+        JTextArea original = new JTextArea();
+        	original.setText(sourceDRL);
+        JScrollPane scroller1 = new JScrollPane(original);
+            scroller1.setPreferredSize(new Dimension(400,100));
+            scroller1.setBackground(BACKGROUND);
+            scroller1.setForeground(FOREGROUND);
+            scroller1.setFont(FontLib.getFont("Tahoma", Font.PLAIN, 14));	
+        	
+        JTextArea parsed = new JTextArea();
+        	parsed.setText(drlTree);
+        JScrollPane scroller2 = new JScrollPane(parsed);
+             scroller2.setPreferredSize(new Dimension(400,100));
+             scroller2.setBackground(BACKGROUND);
+             scroller2.setForeground(FOREGROUND);
+             scroller2.setFont(FontLib.getFont("Tahoma", Font.PLAIN, 14));	
+         	
+        JSplitPane splitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, 
+        		scroller1, scroller2);	
+        	
+        
+        
+        
+        final JFastLabel title = new JFastLabel("                 ");
+        title.setPreferredSize(new Dimension(350, 20));
+        title.setVerticalAlignment(SwingConstants.BOTTOM);
+        title.setHorizontalAlignment(SwingConstants.CENTER);
+//        title.setBorder(BorderFactory.createEmptyBorder(3,0,0,0));
+        title.setText(titleStr);
+        title.setFont(FontLib.getFont("Tahoma", Font.PLAIN, 14));
+        title.setBackground(BACKGROUND);
+        title.setForeground(FOREGROUND);
+        
+        tview.addControlListener(new ControlAdapter() {
+            public void itemEntered(VisualItem item, MouseEvent e) {
+                if ( item.canGetString(field) )
+                    title.setText(titleStr + " : " + item.getString(field));
+            }
+            public void itemExited(VisualItem item, MouseEvent e) {
+                title.setText(titleStr);
+            }
+        });
+        
+     
+        
+        JPanel panel = new JPanel(new BorderLayout());
+        panel.setBackground(BACKGROUND);
+        panel.setForeground(FOREGROUND);
+        panel.add(title, BorderLayout.NORTH);
+        panel.add(tview, BorderLayout.CENTER);
+        panel.add(splitter, BorderLayout.SOUTH);
+        
+        
+        JFrame frame = new JFrame(titleStr);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setContentPane(panel);
+        frame.pack();
+        
+        return frame;
+    }
+    
+    // ------------------------------------------------------------------------
+   
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    public class OrientAction extends AbstractAction {
+      
+		private static final long serialVersionUID = 1L;
+		private int orientation;
+        
+        public OrientAction(int orientation) {
+            this.orientation = orientation;
+        }
+        public void actionPerformed(ActionEvent evt) {
+            setOrientation(orientation);
+            getVisualization().cancel("orient");
+            getVisualization().run("treeLayout");
+            getVisualization().run("orient");
+        }
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    public class AutoPanAction extends Action {
+        private Point2D m_start = new Point2D.Double();
+        private Point2D m_end   = new Point2D.Double();
+        private Point2D m_cur   = new Point2D.Double();
+        private int     m_bias  = 150;
+        
+        public void run(double frac) {
+            TupleSet ts = m_vis.getFocusGroup(Visualization.FOCUS_ITEMS);
+            if ( ts.getTupleCount() == 0 )
+                return;
+            
+            if ( frac == 0.0 ) {
+                int xbias=0, ybias=0;
+                switch ( m_orientation ) {
+                case Constants.ORIENT_LEFT_RIGHT:
+                    xbias = m_bias;
+                    break;
+                case Constants.ORIENT_RIGHT_LEFT:
+                    xbias = -m_bias;
+                    break;
+                case Constants.ORIENT_TOP_BOTTOM:
+                    ybias = m_bias;
+                    break;
+                case Constants.ORIENT_BOTTOM_TOP:
+                    ybias = -m_bias;
+                    break;
+                }
+
+                VisualItem vi = (VisualItem)ts.tuples().next();
+                m_cur.setLocation(getWidth()/2, getHeight()/2);
+                getAbsoluteCoordinate(m_cur, m_start);
+                m_end.setLocation(vi.getX()+xbias, vi.getY()+ybias);
+            } else {
+                m_cur.setLocation(m_start.getX() + frac*(m_end.getX()-m_start.getX()),
+                                  m_start.getY() + frac*(m_end.getY()-m_start.getY()));
+                panToAbs(m_cur);
+            }
+        }
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    public static class NodeColorAction extends ColorAction {
+        
+        public NodeColorAction(String group) {
+            super(group, VisualItem.FILLCOLOR);
+        }
+        
+        public int getColor(VisualItem item) {
+            if ( m_vis.isInGroup(item, Visualization.SEARCH_ITEMS) )
+                return ColorLib.rgb(255,190,190);
+            else if ( m_vis.isInGroup(item, Visualization.FOCUS_ITEMS) )
+                return ColorLib.rgb(198,229,229);
+            else if ( item.getDOI() > -1 )
+                return ColorLib.rgb(164,193,193);
+            else
+                return ColorLib.rgba(255,255,255,0);
+        }
+        
+    } // end of inner class TreeMapColorAction
+    
+    
+} // end of class TreeMap

Modified: labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g	2010-08-18 14:38:59 UTC (rev 34777)
+++ labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g	2010-08-18 16:44:56 UTC (rev 34778)
@@ -3,7 +3,7 @@
 options {
   language = Java; 
 }  
-
+  
 @lexer::header {
   package org.drools.lang;
 
@@ -357,9 +357,11 @@
   : 'mvel'
   ;  
 
+
 NEG
   : 'neg'
   ;
+  
 
 NEW
   : 'new'

Modified: labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g	2010-08-18 14:38:59 UTC (rev 34777)
+++ labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g	2010-08-18 16:44:56 UTC (rev 34778)
@@ -1,10 +1,9 @@
-parser grammar DRLv6Parser;
+parser grammar DRLv6Parser; 
  
 options {
   language = Java;
   output = AST;
   tokenVocab = DRLv6Lexer;
-  k=5; 
 }
       
      
@@ -207,7 +206,7 @@
 
 
 
-/**************************** TEMPLATE *******************************************/
+/**************************** TYPE DECLARATION *******************************************/
 
 //TODO : What for?? proto-declare??
 /*
@@ -256,7 +255,9 @@
 
 type_declare_attributes
   :      
-          type_declare_attribute+
+        (AT type_declare_attribute)+
+          -> ^(VT_ATTRIBUTES type_declare_attribute+)
+        | AT LEFT_SQUARE type_declare_attribute (COMMA type_declare_attribute)* RIGHT_SQUARE
           -> ^(VT_ATTRIBUTES type_declare_attribute+)                    
   ;
 
@@ -275,27 +276,27 @@
   ;  
   
 tda_role
-  :     AT! ROLE^ LEFT_PAREN! ( EVENT | ENTITY | PROPERTY | TYPE ) RIGHT_PAREN!
+  :     ROLE^ LEFT_PAREN! ( EVENT | ENTITY | PROPERTY | TYPE ) RIGHT_PAREN!
   ;
   
 tda_namespace
-  :     AT! NAMESPACE^ LEFT_PAREN! ID EQUALS! STRING RIGHT_PAREN! 
+  :     NAMESPACE^ LEFT_PAREN! ID EQUALS! STRING RIGHT_PAREN! 
   ;  
   
 tda_disjoint
-  :    AT! DISJOINT^ LEFT_PAREN! ID RIGHT_PAREN!
+  :     DISJOINT^ LEFT_PAREN! ID RIGHT_PAREN!
   ;
 
 tda_inverse
-  :    AT! INVERSE^ LEFT_PAREN! ID RIGHT_PAREN!
+  :     INVERSE^ LEFT_PAREN! ID RIGHT_PAREN!
   ;  
   
 tda_symmetric
-  :   AT! SYMMETRIC^
+  :     SYMMETRIC^
   ;
   
  tda_transitive
-  :   AT! TRANSITIVE^
+  :     TRANSITIVE^
   ;  
   
   
@@ -355,11 +356,11 @@
   -> {and==null}? dl_atom
   ->  ^(VT_AND dl_atom+)
   ;  
-
+ 
 dl_atom
   :   NEG dl_atom
       -> ^(VT_NEG dl_atom)
-  |   dl_type
+  |   dl_type 
   |   dl_prop
   ;
   
@@ -377,8 +378,10 @@
 dl_prop
   :   ID (ALL | SOME)^ dl_type      
   ;  
+  
+  
 
-/**************************** RULES *******************************************/
+/******************************************************* RULES *******************************************/
 
 
 
@@ -387,7 +390,9 @@
 rule
   : RULE rule_id (EXTEND rule_id)?    
     rule_metadata* 
-    rule_attributes? 
+    rule_attributes?
+    deduction?  
+    implication?     
     when_part? 
     then_part
     -> ^(RULE rule_id ^(EXTEND rule_id)? rule_metadata* rule_attributes? when_part? then_part)
@@ -408,11 +413,22 @@
 
 
 
+deduction  
+    :   A_DEDUCTION^ operator_attributes
+    ; 
+  
+  
+implication
+    :   A_IMPLICATION^ operator_attributes
+    ;
+
+
+
 /**************************** RULE ATTRIBS *******************************************/
 
 
 rule_attributes
-  : rule_attribute ( COMMA? rule_attribute)*
+  : AT rule_attribute ( COMMA? AT rule_attribute)*
     -> ^(VT_ATTRIBUTES rule_attribute+)
   ;
 
@@ -432,102 +448,80 @@
   | ra_calendars
   | ra_defeats
   | ra_direction  
-  | ra_deduction  
-  | ra_implication
   ;
 
 ra_date_effective
-  : A_DATE_EFFECTIVE^ STRING
+  : A_DATE_EFFECTIVE^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
 
 ra_date_expires
-  : A_DATE_EXPIRES^ STRING
+  : A_DATE_EXPIRES^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
   
 ra_enabled
   : A_ENABLED^ 
-        ( BOOL 
-          | paren_chunk 
-          )
+    LEFT_PAREN! BOOL RIGHT_PAREN!
   ; 
 
 ra_salience
   : A_SALIENCE^
-    ( INT
-    | paren_chunk
-    )
+    LEFT_PAREN! INT RIGHT_PAREN!
   ;
 
 ra_no_loop
-  : A_NOLOOP^ BOOL?
+  : A_NOLOOP^ (LEFT_PAREN! BOOL RIGHT_PAREN!)?
   ;
 
 ra_auto_focus
-  : A_AUTOFOCUS^ BOOL?
+  : A_AUTOFOCUS^ (LEFT_PAREN! BOOL RIGHT_PAREN!)?
   ; 
   
 ra_activation_group
-  : A_ACTGROUP^ STRING
+  : A_ACTGROUP^ (LEFT_PAREN! STRING RIGHT_PAREN!)
   ;
 
 ra_ruleflow_group
-  : A_RULEFLOWGROUP^ STRING
+  : A_RULEFLOWGROUP^ (LEFT_PAREN! STRING RIGHT_PAREN!)
   ;
 
 ra_agenda_group
-  : A_AGENDAGROUP^ STRING
+  : A_AGENDAGROUP^ (LEFT_PAREN! STRING RIGHT_PAREN!)
   ;
 
 ra_timer
   : (A_DURATION^| A_TIMER^) 
-    (INT | paren_chunk )
+    LEFT_PAREN! INT RIGHT_PAREN!
   ; 
   
 ra_calendars
-  : A_CALENDAR^ string_list
+  : A_CALENDAR^ LEFT_PAREN! string_list RIGHT_PAREN!
   ;
 
-string_list
- at init {
-    StringBuilder buf = new StringBuilder();
-}
-  : first=STRING { buf.append( "[ "+ $first.text ); }
-     (COMMA next=STRING { buf.append( ", " + $next.text ); } )* 
-  -> STRING[$first,buf.toString()+" ]"]
-  ;
 
-
 ra_dialect
-  : A_DIALECT^ STRING
+  : A_DIALECT^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;     
   
 ra_lock_on_active
-  : A_LOCKONACTIVE^ BOOL?
+  : A_LOCKONACTIVE^ (LEFT_PAREN! BOOL RIGHT_PAREN)!
   ;
-
-ra_deduction  
-    :   A_DEDUCTION^ operator_attributes
-    ; 
   
-  
-ra_implication
-    :   A_IMPLICATION^ operator_attributes
-    ;
-  
 ra_direction
   : A_DIRECTION^
   ;  
 
 ra_defeats
-  : DEFEATS^ STRING
+  : DEFEATS^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
 
 
 
 
 operator_attributes
-    : AT LEFT_SQUARE single_operator_attribute (COMMA single_operator_attribute)* RIGHT_SQUARE
+    : (AT single_operator_attribute)+
       -> ^(VT_ATTRIBUTES single_operator_attribute+)
+      | AT LEFT_SQUARE single_operator_attribute (COMMA single_operator_attribute)* RIGHT_SQUARE
+      -> ^(VT_ATTRIBUTES single_operator_attribute+)
     ;
   
 
@@ -537,7 +531,7 @@
   | oa_params
   | oa_degree
   | oa_merge
-  | oa_filter
+  //| oa_filter
   | oa_missing
   | oa_defeat
   | oa_default
@@ -545,19 +539,19 @@
   ;
 
 oa_kind
-  :   OA_KIND^ EQUALS STRING
+  :   OA_KIND^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
   
 oa_id
-  : OA_ID^ EQUALS STRING
+  : OA_ID^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
 
 oa_params
-  : OA_PARAMS^ EQUALS STRING
+  : OA_PARAMS^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
 
 oa_degree
-  : OA_DEGREE^ EQUALS STRING
+  : OA_DEGREE^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
   
 oa_crisp
@@ -565,15 +559,17 @@
   ;   
 
 oa_merge
-  : OA_MERGE^ EQUALS STRING
+  : OA_MERGE^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;   
-    
+
+/*    
 oa_filter
-  : OA_FILTER^ EQUALS STRING
+  : OA_FILTER^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
+*/
 
 oa_missing
-  : OA_MISSING^ EQUALS STRING
+  : OA_MISSING^ LEFT_PAREN! STRING RIGHT_PAREN!
   ;
         
 oa_defeat
@@ -672,7 +668,7 @@
   ;
   
 lhs_unary
-  : lhs_modified_unary filter_chain?
+  : lhs_modified_unary filter_chain^?
   |   lhs_query
   ;
 
@@ -735,23 +731,25 @@
     -> ^(VT_BINDING label lhs_atom_pattern)
   ;  
 
+
+/* over_clause obsolete, replaced by filters (see far below in lhs_unary)*/
 lhs_atom_pattern
-  : ID LEFT_PAREN constraints? RIGHT_PAREN operator_attributes? /*over_clause?*/ from?
-  -> ^(VT_AND operator_attributes? VT_ENABLED ^(VT_PATTERN ID) constraints? /*over_clause?*/ from?)
+  : ID LEFT_PAREN constraints? RIGHT_PAREN operator_attributes?  from?  
+  -> ^(VT_AND operator_attributes? VT_ENABLED ^(VT_PATTERN ID) constraints? from? )
   ;
 
 
 
-
 filter_chain
   :   PIPE filter filter_chain?
-  -> ^(VT_FILTER ID filter_chain?)
+  -> ^(VT_FILTER filter filter_chain?)
   ;
   
 filter
-  :   over_clause
+  :   over_elements
   |   FILTER ID  
   ;
+  
 /*********************************************** INSIDE PATTERN *****************************************/
 
 
@@ -775,7 +773,6 @@
   ;   
   
   
-
 positional_constraint[int j]
 @init{
   String idx = ""+j;
@@ -792,6 +789,18 @@
 
 
 
+/********************************************* ATOMIC DATA DEFINITIONS ************************************************/
+
+
+string_list
+ at init {
+    StringBuilder buf = new StringBuilder();
+}
+  : first=STRING { buf.append( "[ "+ $first.text ); }
+     (COMMA next=STRING { buf.append( ", " + $next.text ); } )* 
+  -> STRING[$first,buf.toString()+" ]"]
+  ;
+
 literal
 options{
 k=6;
@@ -815,12 +824,14 @@
     :   VAR msr_unit?
     ;    
     
+label
+    :   var COLON!
+    ;
+    
 msr_unit
     :   GATE ID msr_unit?
     ;
-   
-  
-        
+       
     
 list
   : LEFT_CURLY list_members? RIGHT_CURLY  
@@ -841,6 +852,9 @@
 literal_object_args
   :  method_args
   ;
+
+
+/**************************************************** METHODS AND EXPRESSIONS ***********************************************/
   
 method_args
   : method_arg (COMMA! method_arg)* 
@@ -848,45 +862,40 @@
 
 
 method_arg
-  : method_expr_root
+  : expr_root
   ;
-
-
-// method expr roots can't start with () and have a slightly simpler structure than outer expressions
-method_expr_root
-  : method_expr_atom  ( (PLUS | MINUS)^ method_factor )*
+  
+method
+  : ID LEFT_PAREN args=method_args? RIGHT_PAREN msr_unit?
+  -> {args==null}? ^(ID msr_unit? )
+  -> ^(ID msr_unit? ^(VT_ARGS method_args?))
   ;
 
-method_expr_recur
-  : method_factor  ( (PLUS | MINUS)^ method_factor )*
-  ;
-   
-method_factor
-  : method_term ( (TIMES | SLASH)^ method_term )*  
+expr_root
+  : factor  ( (PLUS | MINUS) factor )*
   ; 
-      
-method_term
-  : MINUS^? method_expr_unary  
-  ; 
   
-method_expr_unary
-  : method_expr_atom  
-  | LEFT_PAREN! method_expr_recur RIGHT_PAREN!
+factor
+  : term ( (TIMES | SLASH) term )*  
   ; 
-  
-method_expr_atom
-  : var_literal
-  | literal   
-  | method 
+      
+term
+  : MINUS? expr_unary 
   ; 
-  
-method
-  : ID LEFT_PAREN args=method_args? RIGHT_PAREN msr_unit?
-  -> {args==null}? ^(ID msr_unit? )
-  -> ^(ID msr_unit? ^(VT_ARGS method_args?))
+       
+expr_unary
+  : expr_atom  
+  | LEFT_PAREN! expr_root RIGHT_PAREN! 
   ;
+  
+expr_atom
+  : accessor_path
+  | var_literal
+  | literal 
+  ; 
 
 
+
 /************************************* SLOTTED CONSTRAINTS LOGIC HIERARCHY **********************************/
 
 constr_implies
@@ -961,7 +970,7 @@
   
 
 constr_unary
-  : unary_operator operator_attributes? constr_unary
+  : unary_operator^ operator_attributes? constr_unary
   | constr_atom
   | LEFT_PAREN! constr_implies RIGHT_PAREN! 
   ;
@@ -1061,84 +1070,47 @@
     -> ^(inner_quantifier ^(evaluator operator_attributes? right_expression))
   ;
 
-
-
-
-
   
 left_expression
   : label
     ( 
-      left_expr_atom 
-      -> ^(VT_BINDING label ^(VT_FIELD left_expr_atom))
-      | LEFT_PAREN left_expr_root RIGHT_PAREN 
-      -> ^(VT_BINDING label ^(VT_EXPR left_expr_root))
+      accessor_path 
+      -> ^(VT_BINDING label ^(VT_FIELD accessor_path))
+      | PIPE expr_root PIPE
+      -> ^(VT_BINDING label ^(VT_EXPR expr_root))
     )
-  | left_expr_root
-    -> ^(VT_EXPR left_expr_root)
+  | PIPE expr_root PIPE
+    -> ^(VT_EXPR expr_root)
+  | accessor_path    
+    -> ^(VT_FIELD accessor_path)
   ;
 
-left_expr_atom
-  : expr_atom
+right_expression
+  : expr_root
   ;
 
 
-expr_atom
-  : accessor_path 
-  |   var_literal
-  | literal
-  ; 
-   
-
-left_expr_root
-  : accessor_path  ( (PLUS | MINUS) factor )*
-  ;
-
-factor
-  : term ( (TIMES | SLASH) term )*  
-  ; 
-      
-term
-  : MINUS? expr_unary 
-  ; 
   
-expr_unary
-  : expr_atom  
-  | LEFT_PAREN! expr_root RIGHT_PAREN!
-  ; 
-  
-expr_root
-  : factor  ( (PLUS | MINUS) factor )*
-  ; 
+/***************************************** ACCESSOR PATHS *******************************/
 
 
 
-
 accessor_path
-  :   accessor (DOT! accessor)*
+  : accessor (DOT! accessor)*
   | var (DOT! accessor)+
   ;
 
-/* 
-accessor 
-  : ID (LEFT_PAREN! method_args? RIGHT_PAREN!)? indexer?
-  | nested_obj_pattern
-  ;
-*/
 
-
-accessor 
-options{
-  backtrack = true;
-}
-  : ID indexer?
-  | method
+accessor
+  :
+  (ID LEFT_PAREN) => method indexer?
+  | ID indexer?  
   | nested_obj_pattern
   ;
 
 
 nested_obj_pattern
-  : GATE!  (ID (DOT! ID)*)?  LEFT_PAREN! constraints RIGHT_PAREN!
+  : GATE! (ID (DOT! ID)*)?  LEFT_PAREN! constraints RIGHT_PAREN!
   ;
 
 
@@ -1147,7 +1119,7 @@
     (
         INT
       | STRING
-      | ID LEFT_PAREN! method_args RIGHT_PAREN!
+      | method
       | GATE! lhs_label_atom_pattern      
     )?
     RIGHT_SQUARE!
@@ -1155,9 +1127,6 @@
 
 
 
-right_expression
-  : expr_root
-  ;
 
 
 /***************************************************   PATTERN SOURCES ******************************************/
@@ -1209,22 +1178,18 @@
   ;
 
 from_source
-  : ID 
+  : var
+    | accessor_path 
     //args=paren_chunk?
     //expression_chain?
     //-> ^(VT_FROM_SOURCE ID paren_chunk? expression_chain?)
   ;
 
-//TODO
-/*  
-expression_chain
-  : DOT ID ( paren_chunk | square_chunk )? expression_chain?
-    -> ^(VT_EXPRESSION_CHAIN[$DOT] ID square_chunk? paren_chunk? expression_chain?)
-  ;
-*/
 
 
-
+/**
+  TODO :
+*/ 
 accumulate_statement
   : ACCUMULATE  
     LEFT_PAREN 
@@ -1290,11 +1255,8 @@
 
 
 
-label
-  : var COLON
-  ;
+/*************************************** QUANTIFIERS AND EVALUATORS ***********************************/
 
-
 inner_quantifier
   : ALL^
   | SOME^
@@ -1302,13 +1264,30 @@
   | COUNT^ (AT! LEFT_SQUARE! 
         (
           INT
-          | (MAX^ EQUALS! INT)? (MIN^ EQUALS! INT)?
+          | inner_attrs
         )
        RIGHT_SQUARE!)?
   ;
   
+attr_min
+  : (MIN^ EQUALS! INT)
+  ;
 
+attr_max
+  : (MAX^ EQUALS! INT)
+  ;
+  
+inner_attrs
+  : inner_attr (COMMA! inner_attr)?
+  ;  
 
+inner_attr
+  :
+    attr_min
+    | attr_max 
+  ;
+
+
 evaluator
   : (TILDE!)?
     (
@@ -1341,9 +1320,9 @@
 
 
 
+/******************************** VARIOUS OPERATORS *************************************/
 
 
-
 imply_connective
   : IMPLIES
     -> ^(VT_IMPLIES)
@@ -1411,8 +1390,8 @@
   ;
       
 
+/********************************************************* RHS STRUCTURE ****************************************************************/
 
-
  
 then_part  
   :     
@@ -1498,6 +1477,13 @@
 
 
 
+
+
+
+
+/***************************************************************** CHUNKS *********************************************************************/
+
+
 rhs_chunk
 @init{
   String text = "";

Modified: labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java
===================================================================
--- labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java	2010-08-18 14:38:59 UTC (rev 34777)
+++ labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java	2010-08-18 16:44:56 UTC (rev 34778)
@@ -7,12 +7,21 @@
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
+import javax.swing.JFrame;
+
 import org.antlr.runtime.ANTLRInputStream;
 import org.antlr.runtime.CommonTokenStream;
 import org.antlr.runtime.ParserRuleReturnScope;
 import org.antlr.runtime.tree.CommonTree;
+import org.drools.util.DRLTreeFormatter;
+import org.drools.util.DRLTreeMLFormatter;
 import org.drools.util.ParsingResult;
+import org.drools.util.ProTreeView;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -22,35 +31,34 @@
 
 public class Rule_Test {
 
-	
+	private static Logger log;
 	private static FileWriter writer;
+	
+	private static Map<String,String> rules;
+	private static Map<String,String[]> data;
 		
 	@BeforeClass
 	public static void setUpBeforeClass() throws Exception {
+		log = Logger.getAnonymousLogger();
+		log.setLevel(Level.INFO);
 		writer = new FileWriter("out/DRLv6Log.txt"); 
-	}
-
-	@AfterClass
-	public static void tearDownAfterClass() throws Exception {
-		writer.flush();
-		writer.close();
-	}
-
-	@Before
-	public void setUp() throws Exception {
 		
-	}
-
-	@After
-	public void tearDown() throws Exception {
+		rules = new HashMap<String, String>();
+		data = new HashMap<String, String[]>();
 		
+		loadCaseData();
 	}
 	
 	
-	@Test	
-	public void test_compilation_unit() {
-		String rule = "compilation_unit";
-		String testDRL = "" +
+	
+	private static void loadCaseData() {
+		String rule;
+		String[] testDRL;
+		String key;
+				
+		key =  "test_compilation_unit";
+		rule = "compilation_unit";
+		testDRL = new String[] {
 				"package org.pack.subpack;\n" +
 				"import org.klass;\n" +
 				"\n" +
@@ -60,107 +68,92 @@
 				"rule \"ruel\"\n" +
 				"when\n" +
 				"then\n" +
-				"end\n";				
-		;
+				"end\n"
+				};	
+		rules.put(key,rule);
+		data.put(key,testDRL);
 		
-		check(rule,testDRL);										
-	}
-	
-	
-
-	@Test	
-	public void test_package_statement() {
-		String rule = "package_statement";
-		String testDRL[] = {
+		
+		
+		
+		
+		key = "test_package_statement";
+		rule = "package_statement";
+		testDRL = new String[] {
 				"package this.isa.pack ;",
 				"package semi.colon.is.optional ",
 				"package simplePack",
 		};
-					
-		check(rule,testDRL);										
-	}
-	
-	@Test	
-	public void test_global() {
-		String rule = "global";
-		String testDRL[] = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		
+		
+		
+		key = "test_global";
+		rule = "global";
+		testDRL = new String[]  {
 				"global int N ",
 				"global org.it.pack.String strix ;"
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	
-	@Test	
-	public void test_data_type() {
-		String rule = "data_type"; 
-		String[] testDRL = new String[] {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_data_type";
+		rule = "data_type"; 
+		testDRL = new String[] {
 				"String",
 				"int",
 				"float[]",
 				"org.pack.data.Claxx[]",
 				"int[][][]"
 			};
-				
-		check(rule,testDRL);										
-	}
+		rules.put(key,rule);
+		data.put(key,testDRL);
 	
-	
-	
-	
-	
-	@Test	
-	public void test_import_statement() {
-		String rule = "import_statement";
-		String testDRL[] = {
+		key =  "test_import_statement";
+		rule = "import_statement";
+		testDRL = new String[] {
 				"import jav.lang.String",
 				"import Test ; ",
 				"import jav.pack.*"
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	
-	@Test	
-	public void test_function_import_statement() {
-		String rule = "function_import_statement";
-		String testDRL = "import function org.pack.square";
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_function() {
-		String rule = "function";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_function_import_statement";
+		rule = "function_import_statement";
+		testDRL = new String[] {
+				"import function org.pack.square"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_function";
+		rule = "function";
+		testDRL = new String[] {
 				"function float square( float x ) { ... x*x ... }",
 				"function process( int x, org.String zz ) { ... ... }"
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_parameters() {
-		String rule = "parameters";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		key = "test_parameters";
+		rule = "parameters";
+		testDRL = new String[] {
 				"( int a, org.klass.AnType obj, String[][] argz )"
 		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
 				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_type_declaration() {
-		String rule = "type_declaration";
-		String[] testDRL = {
+		
+		key = "test_type_declaration";
+		rule = "type_declaration";
+		testDRL = new String[] {
 				"declare Student extends Person" + "\n" +
 				" @role(entity) " + "\n" +
 				" @namespace(myNS=\"http:\\\\www.stix.com\\domain\\subd#\") " + "\n" +				
@@ -185,17 +178,20 @@
 				"@inverse(HasSpouse) " + "\n" +
 				"subject	= (\"john\") : Person 	@[key] " + "\n" +
 				"object  : Person	@[key] " + "\n" +
-				"end \n"
+				"end \n",
+				
+				"declare AnotherWayForAttributes" + "\n" +
+				" @[ symmetric, inverse(SomeOther), transitive ] " + "\n" +
+				" name : String " + "\n" +
+				" end \n",
 		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
 				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_type_declare_attribute() {
-		String rule = "type_declare_attribute";
-		String[] testDRL = {
+		
+		key = "test_type_declare_attribute"; 
+		rule = "type_declare_attributes";
+		testDRL = new String[] {
 				"@role(event)",
 				"@role(type)",
 				"@role(entity)",
@@ -206,140 +202,119 @@
 				"@transitive",
 				"@inverse(ReverseProperty)"
 				
-		};		
-			
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_decl_field() {
-		String rule = "decl_field";
-		String[] testDRL = {
+		};	
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_decl_field";
+		rule = "decl_field";
+		testDRL = new String[] {
 				"field = (...) : datatype[][] @[key]"
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test		
-	public void test_rule() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_rule";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule \"ruleName\" extends \"anotherRule\" " + "\n" +
-				" salience 100 " + "\n" +
-				" no-loop " + "\n" +
-				" calendar \"s1\" , \"s2\" " + "\n" +
+				" @salience(100) " + "\n" +
+				" @no-loop " + "\n" +
+				" @calendar( \"s1\" , \"s2\" )" + "\n" +
+				"deduction @crisp" + "\n" +
+				"implication @[crisp]" + "\n" +
 				"when" + "\n" +
 				"then" + "\n" +
 				"end" + "\n" 	
 		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
 		
-		
-		String test2;
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	
-	@Test	
-	public void test_rule_attributes() {
-		String rule = "rule_attribute";
-		String[] testDRL = {
-				"salience 100",
-				"no-loop true",
-				"agenda-group \"test-group\"",
-				"activation-group \"act-group\"",
-				"auto-focus false",
-				"effective \"2010-04-12\"",
-				"expires \"2010-04-12\"",
-				"enabled true",
-				"ruleflow-group \"act-group\"",
-				"agenda-group \"act-group\"",
-				"duration 100",
-				"timer 100",
+		key = "test_rule_attributes";
+		rule = "rule_attributes";
+		testDRL = new String[] {
+				"@salience(100)",
+				"@no-loop(true)",
+				"@agenda-group(\"test-group\")",
+				"@activation-group(\"act-group\")",
+				"@auto-focus(false)",
+				"@effective(\"2010-04-12\")",
+				"@expires(\"2010-04-12\")",
+				"@enabled(true)",
+				"@ruleflow-group(\"act-group\")",
+				"@agenda-group(\"act-group\")",
+				"@duration(100)",
+				"@timer(100)",
 //TODO: fails as stand-alone, but works in context..				
 //				"calendar \"s1\" , \"s2\" ",
-				"dialect \"java\" ",
-				"lock-on-active true",
-				"defeats \"anotherRule\" ",
-				"deductive",
-				"abductive",
-				"equivalence",
-				"deduction @[crisp]",
-				"implication @[crisp]"
+				"@dialect( \"java\" )",
+				"@lock-on-active(true)",
+				"@defeats(\"anotherRule\")",
+				"@deductive",
+				"@abductive",
+				"@equivalence",				
 		};
-				
-		check(rule,testDRL);										
-	}
-	  
-	@Test	
-	public void test_operator_attributes() {
-		String rule = "operator_attributes";
-		String[] testDRL = {				
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_operator_attributes";
+		rule = "operator_attributes";
+		testDRL = new String[] {				
 				"@[" + "\n" +
-				"kind=\"lukasiewicz\", " + "\n" +
-				"id=\"myID\", " + "\n" +
-				"params=\"addit,args,2,more\", " + "\n" +
-				"degree=\"[0.3,0.2]\", " + "\n" +
+				"kind(\"lukasiewicz\"), " + "\n" +
+				"id(\"myID\"), " + "\n" +
+				"params(\"addit,args,2,more\"), " + "\n" +
+				"degree(\"[0.3,0.2]\"), " + "\n" +
 				"crisp," + "\n" +
 				"default," + "\n" +
 				"defeat," + "\n" +
-				"merge=\"mStrat\", " + "\n" +
+				"merge(\"mStrat\"), " + "\n" +
 				//"filter=\"fStrat\", " + "\n" +		//TODO: removed "filter" from here
-				"missing=\"sStrat\" " + "\n" +
-				"]",				
+				"missing(\"sStrat\") " + "\n" +
+				"]",									
 		};
-				
-		check(rule,testDRL);
-				
-	}
-
-	
-	@Test
-	public void test_lhs_root() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		key = "test_lhs_root";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule test when " +
 				"Bus() Car() Taxi()" +
 				"then end"
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	@Test
-	public void test_lhs_implies() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		key = "test_lhs_implies";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule test when " +
-				"$p : Person() implies @[kind=\"anImpl\"] Dog()" +
+				"$p : Person() implies @kind(\"anImpl\") @crisp Dog()" +
 				"then end"
 		};
-				
-		check(rule,testDRL);										
-	}	
-	
-	
-	@Test
-	public void test_lhs_or() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+			
+		key = "test_lhs_or";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule test when " +
-				"Car() or @[kind=\"anOr\"] Taxi() or @[kind=\"anotherOr\"] Bus()" +
+				"Car() or @kind(\"anOr\") Taxi() or @[kind(\"anotherOr\")] Bus()" +
 				"then end"
 		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
 				
-		check(rule,testDRL);										
-	}	
-	
-	
-	@Test
-	public void test_lhs_diff() {
-		String rule = "rule";
-		String[] testDRL = {
+		
+		key = "test_lhs_diff";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule test when " +
 				"$p : Person() xor Dog()" +
 				"then end",
@@ -348,42 +323,36 @@
 				"(Person() xor Dog()) equiv Cat()" +
 				"then end"
 		};
-				
-		check(rule,testDRL);										
-	}	
-	
+		rules.put(key,rule);
+		data.put(key,testDRL);
 		
-	
-	
-	@Test
-	public void test_lhs_and() {
-		String rule = "rule";
-		String[] testDRL = {
+		key = "test_lhs_and";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule test when " +
 				"Car() and Taxi() and Bus()" +
 				"then end"
 		};
-				
-		check(rule,testDRL);										
-	}	
-	
-	@Test
-	public void test_lhs_root_complex() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		
+		key = "test_lhs_root_complex";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule test when " +
 				"(P() implies Q()) implies ( (K() equiv K()) or Z() and X() )" +
 				"then end"
 		};
-				
-		check(rule,testDRL);										
-	}	
-	
-	
-	@Test	
-	public void test_lhs_modified_unary() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		
+		key = "test_lhs_modified_unary";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule \"r\" when " +
 				"neg @[crisp] very @[crisp] Person() " +
 				"then end",
@@ -394,52 +363,50 @@
 				
 				"rule \"r\" when " +
 				"(Person() implies Dog())" +
-				"then end"
-				
+				"then end"			
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_lhs_exists() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		
+		key = "test_lhs_exists";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule \"r\" when " +
 				"exists @[crisp] ( $p : Person() and $d : Dog() ) " +
 				"then end",
 				
-				"rule \"r\" when " +
+				"rule \"r2\" when " +
 				" $p : exists Person() " +
-				"then end",							
+				"then end",
 				
+				"rule \"r3\" when " +
+				" $tup : exists ( Person() Car() )" +
+				"then end",			
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	@Test	
-	public void test_lhs_not() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+			
+		key = "test_lhs_not";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule \"r\" when " +
 				"not @[crisp] ( $p : Person() and $d : Dog() ) " +
 				"then end",
 				
 				"rule \"r\" when " +
 				" not Person() " +
-				"then end",							
-				
+				"then end",										
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	@Test	
-	public void test_lhs_forall() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_lhs_forall";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule \"r\" when " +
 				"forall @[crisp] Person() " +
 				"then end",
@@ -458,19 +425,15 @@
 				"forall  ( ($p : Person() $d : Dog() )" +
 				"          (     Person()      Dog() ) " +
 				"        ) " +
-				"then end",							
-				
+				"then end",											
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	
-	@Test	
-	public void test_lhs_label_atom_pattern() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_lhs_label_atom_pattern";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule \"r\" when " +
 				"$p : Person() " +
 				"then end",
@@ -479,91 +442,706 @@
 				"Person() @[crisp]" +
 				"then end",
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_constraints() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_constraints";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule \"r\" when " +
 				"Person( \"john\" , 18, height > 150) " +
 				"then end",
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_positional_constraint() {
-		String rule = "rule";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_positional_constraint";
+		rule = "rule";
+		testDRL = new String[] {
 				"rule \"r\" when " +
 				"Person( \"john\" , 18, 2.0, true, null, new Dog(), {12, $x, \"test\" }, $var) " +
 				"then end",
 		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_nested";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule \"inNest\" when " + "\n" +
+				"Person( name.firstPart == \"john\" ) " + "\n" +
+				"then end",
 				
-		check(rule,testDRL);										
-	}
+				"rule \"inNest2\" when " + "\n" +
+				"Person( name== \"mark\", address.#Address( city == \"london\", country == \"uk\") ) " + "\n" +
+				"then end",
+					
+				"rule \"inNest2\" when " + "\n" +
+				" $p : Person( $a : getAddresses()[ #LongAddress( location == \"london\") ] ) " + "\n" +
+				"then end",
+				
+				"rule \"inNest2\" when " + "\n" +
+				" Person( $p : | pets[ #Dog(color == \"red\") ].age * $v1 | == $v2 - 3 ) " +
+				"then end",
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
 	
-	
-	
-	@Test	
-	public void test_literal_object() {
-		String rule = "literal_object";
-		String[] testDRL = {
+		key = "test_literal_object";
+		rule = "literal_object";
+		testDRL = new String[] {
 				"new Thing(13, $var, true)"
 		};
-				
-		check(rule,testDRL);										
-	}
-	
-	
-	@Test	
-	public void test_method_args() {
-		String rule = "literal_object";
-		String[] testDRL = {
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_method_args";
+		rule = "literal_object";
+		testDRL = new String[] {
 				"new Obj(12 - 13*($var*2 + sqrt(4)))"
 		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_decl_dl";
+		rule = "type_declaration";
+		testDRL = new String[] {
+				"declare Student " + "\n" +
+				" as Male() and Human() and (Slave() or worksAt some (School() or Prison()))" + "\n" +				
+				" age  : int " + "\n" +
+				" name : String " + "\n" +
+				" end \n"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_constr_implies";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( name == \"john\" implies age < 18)" + "\n" +
+				"then end"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_constr_or";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( name == \"john\" implies age < 18 or age > 25)" + "\n" +
+				"then end"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
 				
-		check(rule,testDRL);										
-	}
+		
+		key = "test_constr_diff";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( age < 18 xor age > 25)" + "\n" +
+				"then end",
+				
+				"rule test when " + "\n" +
+				" Person( age < 18 equiv age > 25)" + "\n" +
+				"then end",			
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		
+		key = "test_constr_and";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( name == \"john\" and @crisp age < 18 and @kind(\"xx\") age > @id(\"..\") 25)" + "\n" +
+				"then end"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_constr_unary";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( neg very (name == \"john\" implies age < 18) )" + "\n" +
+				"then end"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_restr_implies";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( name == \"john\" -> == \"mark\")" + "\n" +
+				"then end"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_restr_or";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( age < 18 || > 25)" + "\n" +
+				"then end"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_restr_diff";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( age < 18 ^^ > 25)" + "\n" +
+				"then end",
+				
+				"rule test when " + "\n" +
+				" Person( age < 18 <> > 25)" + "\n" +
+				"then end",
+				
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_restr_and";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( age < 18 && @kind(\"xx\") > @id(\"..\") 25)" + "\n" +
+				"then end"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_restriction_root";
+		rule = "restriction_root";
+		testDRL = new String[] {				
+				" all == @crisp 18 + 2*$x#km " ,
+				// TODO
+				//" all == @crisp 18 + 2*$var "
+				// again, works only within a rule and not parsed standalone
+				// problem is var_literal, without measure unit
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_expression";
+		rule = "right_expression";
+		testDRL = new String[] {				
+				" 2*($x#km+1000) + 500*size.len ",
+				//" 2 * $p "
+				// as above
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		
+		key = "test_expression_in_rule";
+		rule = "rule";
+		testDRL = new String[] {				
+				" rule test when " + "\n" +
+				"  Person( age all == @crisp 18 + 2*$var ) " + "\n" +
+				" then end ",
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_var_literal";
+		rule = "var_literal";
+		testDRL = new String[] {				
+				" $x ",
+				" $x#km ",
+				" $x#km#m ",
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_restriction_root_in_rule";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( age all == @crisp 18+2*$x )" + "\n" +
+				"then end"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
 	
-	
-	public void test_meta_annotation() {
-		String rule = "rule";
-		String[] testDRL = {
-				"xx"	
+		key = "test_left_expression";
+		rule = "left_expression";
+		testDRL = new String[] {				
+				" $a : age " + "\n",
+				
+				"| (age + 2) * $x + 4 * weight.subField |", 
+				
+				"$x : | $z + 4 * weight |",
+				
+				"$a : | (age * 2 + 4 * weight + height) |",								
 		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_left_expression_in_rule";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when " + "\n" +
+				" Person( $a : age )" + "\n" +
+				"then end",
+							
+				"rule test when " + "\n" +
+				" Person( ($a : | age * 2 + 4 * weight |  == 18) implies (age < 25 and age > 4)  )" + "\n" +
+				"then end",								
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_accessor_path";
+		rule = "accessor_path";
+		testDRL = new String[] {				
+				" age ",
 				
-		check(rule,testDRL);										
+				" $var.field ",
+				
+				"address.city.street(2).number", 
+				
+				"$addr.city.#pack.Street( number == 2).subfield[4].subsubfield",												
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_accessor";
+		rule = "accessor";
+		testDRL = new String[] {				
+				" age ",
+				
+				" someMethod(\"p1\",2) ", 
+								
+				" #nested( age == 18 ) ",
+				
+				" pets[3] "
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_indexer";
+		rule = "indexer";
+		testDRL = new String[] {												
+				" [3] ",
+				" [\"rover\"] ",
+				" [ getId(2734) ]",
+				" [ #Pattern( age == 18) ]"
+				
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_from";
+		rule = "from";
+		testDRL = new String[] {												
+				" from entrypoint byId ",
+				" from entrypoint \"byStr\" ",
+				
+				" from $var.access ",
+				
+				" from collect ( Person() )",
+				" from collect ( $p : Person() from $source )",
+				
+				" from collect ( Person() )",														
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_from_rule";
+		rule = "rule";
+		testDRL = new String[] {																				
+				" rule test when " + " \n" +
+				" Person() from collect ( $p: Person() from list )" + "\n" +
+				" then end",				
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_label";
+		rule = "label";
+		testDRL = new String[] {
+				" $var : "
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+			
+		
+		key = "test_inner_quantifier";
+		rule = "inner_quantifier";
+		testDRL = new String[] {
+				"all",
+				"some",
+				"value",
+				"count @[5]",
+				"count @[min=1, max=10]",						
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_inner_quantifier_in_rule";
+		rule = "rule";
+		testDRL = new String[] {
+				"rule test when" + "\n" +
+				" Person( age count @[5] == @crisp 18 ) " + "\n" +
+				"then end",						
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		key = "test_evaluator";
+		rule = "evaluator";
+		testDRL = new String[] {
+				"==",
+				"!=",
+				">",
+				">=",
+				"<",
+				"<=",
+				"~==",
+				"~!=",
+				"~>",
+				"~>=",
+				"~<",
+				"~<=",
+				"in",
+				"contains",
+				"custom"
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		
+		key = "test_filter_chains";
+		rule = "rule";
+		testDRL = new String[] {
+				" rule test when " + "\n" +
+				" Person( age > 18) | window:length( 10 ) | window:time(2h)" + "\n" +
+				" then end ",
+				
+				" rule test when " + "\n" +
+				" 	( " + "\n" +
+				"		Person( age > 18)" + "\n" +
+				"		Person( ) " + "\n" +
+				"	) | window:length( 10 ) | window:time(2h)" + "\n" +
+				" then end ",							
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
+		
+		
+		
+		key = "test_right_expression";
+		rule = "rule";
+		testDRL = new String[] {												
+				" rule test when " + "\n" +
+				" Person( age > 2*$height + $z * weight * comput($k) )" + "\n" +
+				" then end ",
+				
+				" rule test when " + "\n" +
+				" Person( |2*age()| == 3*height*method(weight + 2 *$k*sqrt(x)) )" + "\n" +
+				" then end ",								
+		};
+		rules.put(key,rule);
+		data.put(key,testDRL);
+		
 	}
 	
 	
 	
+
+	@AfterClass
+	public static void tearDownAfterClass() throws Exception {
+		writer.flush();
+		writer.close();		
+	}
+
+	@Before
+	public void setUp() throws Exception {
+		
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		
+	}
 	
 	
 	@Test	
+	public void test_compilation_unit() {		
+		check("test_compilation_unit");	 									
+	}	
+	@Test	
+	public void test_package_statement() {							
+		check("test_package_statement");										
+	}	
+	@Test	
+	public void test_global() {					
+		check("test_global");										
+	}
+	@Test	
+	public void test_data_type() {		
+		check("test_data_type");										
+	}	
+	@Test	
+	public void test_import_statement() {						
+		check("test_import_statement");										
+	}
+	@Test	
+	public void test_function_import_statement() {						
+		check("test_function_import_statement");										
+	}		
+	@Test	
+	public void test_function() {						
+		check("test_function");										
+	}
+	@Test	
+	public void test_parameters() {
+		check("test_parameters");		
+	}	
+	@Test	
+	public void test_type_declaration() {
+		check("test_type_declaration");										
+	}		
+	@Test	
+	public void test_type_declare_attribute() {		
+		check("test_type_declare_attribute");										
+	}		
+	@Test	
+	public void test_decl_field() {					
+		check("test_decl_field");										
+	}
+	@Test		
+	public void test_rule() {
+		check("test_rule");										
+	}	
+	@Test	
+	public void test_rule_attributes() {			
+		check("test_rule_attributes");										
+	}	  
+	@Test	
+	public void test_operator_attributes() {
+		check("test_operator_attributes");
+	}
+	@Test
+	public void test_lhs_root() {
+		check("test_lhs_root");									
+	}	
+	@Test
+	public void test_lhs_implies() {		
+		check("test_lhs_implies");								
+	}	
+	@Test
+	public void test_lhs_or() {
+		check("test_lhs_or");										
+	}	
+	@Test
+	public void test_lhs_diff() {
+		check("test_lhs_diff");
+	}	
+	@Test
+	public void test_lhs_and() {
+		check("test_lhs_and");										
+	}		
+	@Test
+	public void test_lhs_root_complex() {
+		check("test_lhs_root_complex");	
+	}	
+	@Test	
+	public void test_lhs_modified_unary() {
+		check("test_lhs_modified_unary");
+	}
+	@Test	
+	public void test_lhs_exists() {			
+		check("test_lhs_exists");								
+	}	
+	@Test	
+	public void test_lhs_not() {
+		check("test_lhs_not");										
+	}	
+	@Test	
+	public void test_lhs_forall() {
+		check("test_lhs_forall");										
+	}			
+	@Test	
+	public void test_lhs_label_atom_pattern() {
+		check("test_lhs_label_atom_pattern");										
+	}
+	@Test
+	public void test_constraints() {
+		check("test_constraints");										
+	}
+	@Test	
+	public void test_positional_constraint() {
+		check("test_positional_constraint");										
+	}
+	@Test	
+	public void test_nested() {
+		check("test_nested");										
+	}
+	@Test	
+	public void test_literal_object() {
+		check("test_literal_object");
+	}		
+	@Test	
+	public void test_method_args() {
+		check("test_method_args");										
+	}
+	@Test	
 	public void test_decl_dl() {
-		String rule = "type_declaration";
-		String[] testDRL = {
-				"declare Student " + "\n" +
-				" defined Male() and Human() and (Slave() or worksAt some (School() or Prison()))" + "\n" +				
-				" age  : int " + "\n" +
-				" name : String " + "\n" +
-				" end \n"
-		};
-				
-		check(rule,testDRL);										
+		check("test_decl_dl");										
 	}
+	@Test	
+	public void test_constr_implies() {
+		check("test_constr_implies");								
+	}
+	@Test	
+	public void test_constr_or() {
+		check("test_constr_or");										
+	}
+	@Test	
+	public void test_constr_diff() {
+		check("test_constr_diff");										
+	}	
+	@Test	
+	public void test_constr_and() {
+		check("test_constr_and");										
+	}
+	@Test	
+	public void test_constr_unary() {
+		check("test_constr_unary");										
+	}
+	@Test	
+	public void test_restr_implies() {
+		check("test_restr_implies");										
+	}
+	@Test	
+	public void test_restr_or() {		
+		check("test_restr_or");									
+	}
+	@Test	
+	public void test_restr_diff() {
+		check("test_restr_diff");										
+	}	
+	@Test	
+	public void test_restr_and() {
+		check("test_restr_and");										
+	}
+	@Test	
+	public void test_restriction_root() {
+		check("test_restriction_root");										
+	}	
+	@Test	
+	public void test_expression() {
+		check("test_expression");										
+	}	
+	@Test	
+	public void test_expression_in_rule() {
+		check("test_expression_in_rule");										
+	}
+	@Test	
+	public void test_var_literal() {
+		check("test_var_literal");										
+	}
+	@Test	
+	public void test_restriction_root_in_rule() {
+		check("test_restriction_root_in_rule");										
+	}
+	@Test	
+	public void test_left_expression() {
+		check("test_left_expression");										
+	}
+	@Test	
+	public void test_left_expression_in_rule() {
+		check("test_left_expression_in_rule");										
+	}
+	@Test	
+	public void test_accessor_path() {
+		check("test_accessor_path");										
+	}
+	@Test	
+	public void test_accessor() {
+		check("test_accessor");										
+	}		
+	@Test	
+	public void test_indexer() {
+		check("test_indexer");									
+	}
+	@Test	
+	public void test_right_expression() {
+		check("test_right_expression");										
+	}
+	@Test	
+	public void test_from() {
+		check("test_from");										
+	}
+	@Test	
+	public void test_from_rule() {
+		check("test_from_rule");
+	}	
+	@Test	
+	public void test_label() {
+		check("test_label");	
+	}
+	@Test	
+	public void test_inner_quantifier() {
+		check("test_inner_quantifier");
+	}		
+	@Test	
+	public void test_inner_quantifier_in_rule() {	
+		check("test_inner_quantifier_in_rule");
+	}
+	@Test	
+	public void test_evaluator() {
+		check("test_evaluator");
+	}
+	@Test	
+	public void test_filter_chains() {
+		check("test_filter_chains");
+	}
+		
 	
 	
 	
-	//TODO : test filter & tree struct
 	
+	
+	
 	/*
 	@Test	
 	public void test_ {
@@ -577,627 +1155,9 @@
 	*/
 	
 
-/*	  		  
 	
-		  
-	    
 	
-
-
-	// method expr roots can't start with () and have a slightly simpler structure than outer expressions
 	
-
-
-	constr_implies
-	  : left=constr_or (imp=imply_connective operator_attributes? right=constr_or)? 
-	    -> {imp != null}? ^($imp operator_attributes? $left $right)    
-	    -> ^($left)
-	  ;
-	  
-	constr_or
-	@init{
-	  Token orToken = null;
-	  ParserRuleReturnScope seq = null;
-	}
-	  : ld=constr_diff 
-	            {seq=ld;}
-	        ( lios=constr_or_sequitur[seq.getTree()]
-	      {seq=lios;}
-	  )*
-	          -> {lios==null}? ^($ld)
-	          -> ^($lios)
-	  ;
-	  
-	constr_or_sequitur[Object leftChild]
-	  : or=or_connective^ (atts=operator_attributes!)? rightChild=constr_diff!
-	             {
-	               Tree t = ((Tree) or.getTree());               
-	               if (atts != null)
-	                 t.addChild((Tree) atts.getTree());
-	              
-	             t.addChild((Tree) leftChild);
-	       t.addChild((Tree) rightChild.getTree());           
-	           } 
-	  ;
-	  
-	  
-
-
-	constr_diff
-	  : constr_and (( xor_connective^ | eq_connective^ ) operator_attributes? constr_and)?
-	  ;
-	    
-	  
-	  
-	  
-	      
-	constr_and
-	@init{
-	  Token orToken = null;
-	  ParserRuleReturnScope seq = null;
-	}
-	  : ld=constr_unary
-	            {seq=ld;}
-	        ( lias=constr_and_sequitur[seq.getTree()]
-	      {seq=lias;}
-	  )*
-	          -> {lias==null}? ^($ld)
-	          -> ^($lias)
-	  ;
-	  
-	constr_and_sequitur[Object leftChild]
-	  : and=and_connective^ (atts=operator_attributes!)? rightChild=constr_unary!
-	             {
-	               Tree t = ((Tree) and.getTree());                
-	               if (atts != null)
-	                 t.addChild((Tree) atts.getTree());
-	              
-	             t.addChild((Tree) leftChild);
-	       t.addChild((Tree) rightChild.getTree());           
-	           } 
-	  ;
-	  
-	  
-
-	constr_unary
-	  : unary_operator operator_attributes? constr_unary
-	  | constr_atom
-	  | LEFT_PAREN! constr_implies RIGHT_PAREN! 
-	  ;
-	  
-	constr_atom
-	  : left_expression restriction_root^? 
-	  ;
-	  
-
-	  
-	restriction_root
-	  : restr_implies
-	  ; 
-
-
-	restr_implies
-	  : left=restr_or (imp=imply_symbol operator_attributes? right=restr_or)? 
-	    -> {imp != null}? ^($imp operator_attributes? $left $right)    
-	    -> ^($left)
-	  ;
-	  
-	restr_or
-	@init{
-	  Token orToken = null;
-	  ParserRuleReturnScope seq = null;
-	}
-	  : ld=restr_diff 
-	            {seq=ld;}
-	        ( lios=restr_or_sequitur[seq.getTree()]
-	      {seq=lios;}
-	  )*
-	          -> {lios==null}? ^($ld)
-	          -> ^($lios)
-	  ;
-	  
-	restr_or_sequitur[Object leftChild]
-	  : or=or_symbol^ (atts=operator_attributes!)? rightChild=restr_diff!
-	             {
-	               Tree t = ((Tree) or.getTree());               
-	               if (atts != null)
-	                 t.addChild((Tree) atts.getTree());
-	              
-	             t.addChild((Tree) leftChild);
-	       t.addChild((Tree) rightChild.getTree());           
-	           } 
-	  ;
-	  
-	  
-
-
-	restr_diff
-	  : restr_and (( xor_symbol^ | eq_symbol^ ) operator_attributes? restr_and)?
-	  ;
-	    
-	  
-	  
-	  
-	      
-	restr_and
-	@init{
-	  Token orToken = null;
-	  ParserRuleReturnScope seq = null;
-	}
-	  : ld=restr_unary
-	            {seq=ld;}
-	        ( lias=restr_and_sequitur[seq.getTree()]
-	      {seq=lias;}
-	  )*
-	          -> {lias==null}? ^($ld)
-	          -> ^($lias)
-	  ; 
-	  
-	restr_and_sequitur[Object leftChild]
-	  : and=and_symbol^ (atts=operator_attributes!)? rightChild=restr_unary!
-	             {
-	               Tree t = ((Tree) and.getTree());                
-	               if (atts != null)
-	                 t.addChild((Tree) atts.getTree());
-	              
-	             t.addChild((Tree) leftChild);
-	       t.addChild((Tree) rightChild.getTree());           
-	           } 
-	  ;
-
-
-
-	restr_unary
-	  : unary_operator operator_attributes? restr_unary
-	  | LEFT_PAREN! restr_implies RIGHT_PAREN!
-	  | restr_atom
-	  ;
-
-
-	restr_atom
-	  : qnt=inner_quantifier? eval=evaluator operator_attributes? right_expression
-	    -> {qnt==null}? ^(evaluator operator_attributes? right_expression)
-	    -> ^(inner_quantifier ^(evaluator operator_attributes? right_expression))
-	  ;
-
-
-
-
-
-	  
-	left_expression
-	  : label
-	    ( 
-	      left_expr_atom 
-	      -> ^(VT_BINDING VAR ^(VT_FIELD left_expr_atom))
-	      | LEFT_PAREN left_expr_root RIGHT_PAREN 
-	      -> ^(VT_BINDING VAR ^(VT_EXPR left_expr_root))
-	    )
-	  | left_expr_root
-	    -> ^(VT_EXPR left_expr_root)
-	  ;
-
-	left_expr_atom
-	  : expr_atom
-	  ;
-
-
-	expr_atom
-	  : accessor_path 
-	  |   VAR
-	  | literal
-	  ; 
-	   
-
-	left_expr_root
-	  : accessor_path  ( (PLUS | MINUS) factor )*
-	  ;
-
-	factor
-	  : term ( (TIMES | SLASH) term )*  
-	  ; 
-	      
-	term
-	  : MINUS? expr_unary 
-	  ; 
-	  
-	expr_unary
-	  : expr_atom  
-	  | LEFT_PAREN! expr_root RIGHT_PAREN!
-	  ; 
-	  
-	expr_root
-	  : factor  ( (PLUS | MINUS) factor )*
-	  ; 
-
-
-
-
-	accessor_path
-	  :   accessor (DOT! accessor)*
-	  | VAR (DOT! accessor)+
-	  ;
-
-
-	accessor 
-	options{
-	  backtrack = true;
-	}
-	  : ID indexer?
-	  | method
-	  | nested_obj_pattern
-	  ;
-
-
-	nested_obj_pattern
-	  : GATE!  (ID (DOT! ID)*)?  LEFT_PAREN! constraints RIGHT_PAREN!
-	  ;
-
-
-	indexer
-	  : LEFT_SQUARE! 
-	    (
-	        INT
-	      | STRING
-	      | ID LEFT_PAREN! method_args RIGHT_PAREN!
-	      | GATE! lhs_label_atom_pattern      
-	    )?
-	    RIGHT_SQUARE!
-	  ;
-
-
-
-	right_expression
-	  : expr_root
-	  ;
-
-
-	over_clause
-	  : OVER^ over_elements (COMMA! over_elements)*
-	  ;
-
-	over_elements
-	  : id1=WINDOW COLON 
-	    (  id2=TIME paren_chunk
-	      -> ^(VT_BEHAVIOR $id1 $id2 paren_chunk)
-	    |  id2=LENGTH LEFT_PAREN INT RIGHT_PAREN
-	      -> ^(VT_BEHAVIOR $id1 $id2 INT) 
-	    ) 
-	  ;
-
-	from
-	  : FROM^
-	            (  accumulate_statement
-	              | collect_statement 
-	              | entrypoint_statement
-	              | from_source
-	            )
-	  ;
-
-
-
-
-	collect_statement
-	  : COLLECT 
-	    LEFT_PAREN 
-	      lhs_label_atom_pattern 
-	    RIGHT_PAREN 
-	  -> ^(COLLECT lhs_label_atom_pattern)
-	  ;
-
-	entrypoint_statement
-	  : ENTRYPOINT
-	    entrypoint_id
-	  -> ^(VT_ENTRYPOINT entrypoint_id)
-	  ;
-
-	entrypoint_id
-	  :   value=ID 
-	    -> VT_ENTRYPOINT_ID[$value]
-	  |   value=STRING 
-	    -> VT_ENTRYPOINT_ID[$value]
-	  ;
-
-	from_source
-	  : ID 
-	    //args=paren_chunk?
-	    //expression_chain?
-	    //-> ^(VT_FROM_SOURCE ID paren_chunk? expression_chain?)
-	  ;
-
-	//TODO
-	  
-	//expression_chain
-	//  : DOT ID ( paren_chunk | square_chunk )? expression_chain?
-	//    -> ^(VT_EXPRESSION_CHAIN[$DOT] ID square_chunk? paren_chunk? expression_chain?)
-	//  ;
-	//
-
-
-
-	accumulate_statement
-	  : ACCUMULATE  
-	    LEFT_PAREN 
-	      lhs_implies 
-	    COMMA? 
-	    ( accumulate_init_clause
-	    | accumulate_id_clause
-	    )
-	    RIGHT_PAREN 
-	    -> ^( ACCUMULATE lhs_implies accumulate_init_clause? accumulate_id_clause? )
-	  ;
-
-	accumulate_init_clause
-	  : INIT
-	    pc1=accumulate_paren_chunk cm1=COMMA? 
-	    ACTION pc2=accumulate_paren_chunk cm2=COMMA? 
-	  ( REVERSE pc3=accumulate_paren_chunk cm3=COMMA? )?
-	    res1=RESULT pc4=accumulate_paren_chunk
-	    -> ^(VT_ACCUMULATE_INIT_CLAUSE ^(INIT $pc1) ^(ACTION $pc2) ^(REVERSE $pc3)? ^(RESULT $pc4))
-	  ;
-
-
-	accumulate_paren_chunk
-	@init{
-	  String text = "";
-	} : pc=accumulate_paren_chunk_data[false] {text = $pc.text;} 
-	  -> VT_PAREN_CHUNK[$pc.start,text]
-	  ;
-
-	accumulate_paren_chunk_data[boolean isRecursive]
-	  : lp1=LEFT_PAREN    
-	    (any=~ ( LEFT_PAREN | RIGHT_PAREN ) | accumulate_paren_chunk_data[true] )* 
-	    rp1=RIGHT_PAREN
-	  ;
-
-	accumulate_id_clause
-	  : ID paren_chunk
-	  -> ^(VT_ACCUMULATE_ID_CLAUSE ID paren_chunk)
-	  ;
-
-
-	query   //TODO
-	  : QUERY ID 
-	    parameters? 
-	    lhs_root
-	    END
-	    -> ^(QUERY ID parameters? lhs_root)   
-	  ;
-
-
-	lhs_query
-	  : QUESTION_MARK ID LEFT_PAREN positional_constraints? RIGHT_PAREN
-	    -> ^(VT_QUERY_PATTERN ID positional_constraints?)
-	  ;
-
-
-
-
-
-	label
-	  : VAR COLON
-	  ;
-
-
-	inner_quantifier
-	  : ALL^
-	  | SOME^
-	  | VALUE^
-	  | COUNT^ (AT! LEFT_SQUARE! 
-	        (
-	          INT
-	          | (MAX^ EQUALS! INT)? (MIN^ EQUALS! INT)?
-	        )
-	       RIGHT_SQUARE!)?
-	  ;
-	  
-
-
-	evaluator
-	  : (TILDE!)?
-	    (
-	      simple_evaluator
-	    | complex_evaluator
-	    | custom_evaluator
-	    // TODO : | temporal_evaluator
-	    )
-	  
-	  ;
-
-	simple_evaluator
-	  : EQUAL^ 
-	  | GREATER^ 
-	  | GREATER_EQUAL^ 
-	  | LESS^ 
-	  | LESS_EQUAL^ 
-	  | NOT_EQUAL^ 
-	  ;   
-	  
-	complex_evaluator
-	  : IN
-	  | CONTAINS
-	  ; 
-	  
-	custom_evaluator
-	  : ID square_chunk?  //TODO: [] is for backward compat.
-	  ;
-
-
-
-
-
-
-
-	imply_connective
-	  : IMPLIES
-	    -> ^(VT_IMPLIES)
-	  ;
-
-	or_connective
-	  : OR
-	    -> ^(VT_OR)
-	  ;
-	      
-	and_connective
-	  : AND
-	    -> ^(VT_AND)
-	  ;     
-	  
-	xor_connective
-	  : XOR
-	    -> ^(VT_XOR)
-	  ;
-	  
-	eq_connective
-	  : EQUIV
-	    -> ^(VT_EQUIV)
-	  ;
-	  
-	  
-	imply_symbol
-	  : ARROW
-	    -> ^(VT_IMPLIES)
-	  ;
-
-	or_symbol
-	  : DOUBLE_PIPE
-	    -> ^(VT_OR)
-	  ;
-	      
-	and_symbol
-	  : DOUBLE_AMPER
-	    -> ^(VT_AND)
-	  ;     
-	  
-	xor_symbol
-	  : DOUBLE_CAP
-	    -> ^(VT_XOR)
-	  ;
-	  
-	eq_symbol
-	  : DOUBLE_ANG
-	    -> ^(VT_EQUIV)
-	  ; 
-	  
-
-	unary_operator
-	    : NEG
-	      -> ^(VT_NEG)    
-	    |   hedge^
-	    ;
-	  
-	    
-	hedge
-	    :     VERY
-	      -> ^(VT_HEDGE_VERY)
-	      | MOL
-	        -> ^(VT_HEDGE_VERY)
-	  ;
-	      
-
-
-
-	 
-	then_part  
-	  :     
-	      rhs_structured
-	    | rhs_chunk   
-	  ; 
-
-
-	rhs_structured
-	  : DO LEFT_CURLY!
-	    rhs_atom*
-	    RIGHT_CURLY!
-	  ;
-
-	rhs_atom
-	  :   rhs_insert
-	    | rhs_insert_logical
-	    | rhs_retract
-	    | rhs_retract_logical
-	    | rhs_update
-	    | rhs_modify
-	    | rhs_side_effect
-	  ; 
-	  
-	rhs_insert
-	  : INSERT^ literal_object
-	    SEMICOLON!
-	  ;
-
-	rhs_insert_logical
-	  : INSERT_LOG^ literal_object
-	    SEMICOLON!
-	  ;
-	  
-	rhs_retract
-	  : RETRACT^ 
-	    ( literal_object
-	    | VAR
-	    )
-	    SEMICOLON!
-	  ;
-
-	rhs_retract_logical
-	  : RETRACT_LOG^
-	    ( literal_object
-	    | VAR
-	    )
-	    SEMICOLON!
-	  ;
-
-	rhs_update
-	  : UPDATE^
-	      VAR
-	    SEMICOLON!  
-	  ;
-
-	rhs_modify
-	  : MODIFY^ LEFT_PAREN! VAR RIGHT_PAREN! 
-	    LEFT_CURLY!
-	      accessor_path
-	      (COMMA! accessor_path)*
-	    RIGHT_CURLY!
-	    SEMICOLON?
-	  ;
-	  
-	rhs_side_effect
-	@init{
-	  String text = "";
-	}
-	  : (DOUBLE_LESS | LESS dialect=(JAVA | MVEL) LESS)
-	    rc=side_effect_chunk {text = $rc.text;}
-	    DOUBLE_GREATER
-	    -> {dialect==null}? VT_RHS_CHUNK[$rc.start,text]
-	    -> ^(VT_DIALECT[dialect] VT_RHS_CHUNK[$rc.start,text])
-	  ;
-	  
-	side_effect_chunk
-	  : ~ ( END | DOUBLE_GREATER )*   
-	  ;
-
-
-
-
-
-
-	rhs_chunk
-	@init{
-	  String text = "";
-	} : THEN
-	    rc=rhs_chunk_data {text = $rc.text;}
-	    END 
-	    SEMICOLON?        
-	  -> VT_RHS_CHUNK[$rc.start,text]
-	  ;
-
-	rhs_chunk_data
-	  :     
-	      ~END*     
-	  ;
-	  
-	  */
 	
 	
 	
@@ -1207,43 +1167,38 @@
 	
 	
 	
-	
-	
-	
-	
-	
-	
-	
-	
-	private void check(String rule, String testDRL) {
-		check(rule, new String[] {testDRL});		
+	private void check(String key) {
+		check(key,false);
 	}
 	
-	private void check(String rule, String[] testDRL) {
-		ParsingResult[] res = parseAndTest(rule, testDRL);
+	private void check(String key, boolean visual) {
+		ParsingResult[] res = parseAndTest(rules.get(key), data.get(key), visual);
 			
-		for (int j = 0; j < res.length; j++) {
-			log(rule, res[j].toString(true));
+		for (int j = 0; j < res.length; j++) {			
 			assertTrue(res[j].isSuccess());
-			System.out.println("Check " + rule + " >> " + res[j].getParseTime());
 		}	
 	}
 	
 	
 	
-	public ParsingResult[] parseAndTest(String rule, String[] drl) {
+	
+	
+	
+	public ParsingResult[] parseAndTest(String rulekey, String[] drl, boolean visual) {
 		ParsingResult[] ans = new ParsingResult[drl.length];
 		int j = 0;
 		
 		Method ruleM;
 		try {
-			ruleM = DRLv6Parser.class.getMethod(rule);
+			ruleM = DRLv6Parser.class.getMethod(rulekey);
 		} catch (SecurityException e) {
 			return null;
 		} catch (NoSuchMethodException e) {
 			return null;
 		}
 				
+				CommonTree fakeRoot = new CommonTree();
+					
 				
 				for (String drlString : drl) {
 					ParsingResult res = new ParsingResult();
@@ -1260,10 +1215,15 @@
 							root = (ParserRuleReturnScope) ruleM.invoke(parser);
 							long after = new Date().getTime();
 					
-							CommonTree resultTree = (CommonTree) root.getTree();
-									
+							final CommonTree resultTree = (CommonTree) root.getTree();
+							fakeRoot.addChild(resultTree);
+							
 						int errors = parser.getNumberOfSyntaxErrors();
 					
+						final String tree = DRLTreeFormatter.toIndentedStringTree(resultTree);
+						log.log(Level.INFO, tree);
+																																											
+						
 						res.setNumErrors(errors);
 						res.setTree(resultTree);
 						res.setParseTime(after-start);
@@ -1275,6 +1235,22 @@
 						ans[j++] = res;
 					}
 				}
+				
+				
+				
+				if (visual) {							
+					StringBuilder source = new StringBuilder();
+						for (String s : drl) {
+							source.append(s).append("\n");
+						}
+					
+					JFrame view = ProTreeView.visualize_tree(DRLTreeMLFormatter.getAsStream(fakeRoot),
+							DRLTreeMLFormatter.FIELD,
+							source.toString(),	
+							DRLTreeFormatter.toIndentedStringTree(fakeRoot,"  "),
+							rulekey);
+					view.setVisible(true);
+				}
         
         return ans;
 	}
@@ -1296,9 +1272,17 @@
 	
 	
 	
+	public static void main(String[] args) {
+		try {
+			setUpBeforeClass();
+				new Rule_Test().check("test_lhs_diff",true);
+			tearDownAfterClass();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
 	
 	
-	
 }
 
 



More information about the jboss-svn-commits mailing list