[jboss-svn-commits] JBL Code SVN: r34823 - in labs/jbossrules/branches/DRLv6/src: test/java/org/drools/lang and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 20 18:35:12 EDT 2010


Author: dsotty
Date: 2010-08-20 18:35:12 -0400 (Fri, 20 Aug 2010)
New Revision: 34823

Modified:
   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:


Modified: labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g	2010-08-20 18:30:43 UTC (rev 34822)
+++ labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g	2010-08-20 22:35:12 UTC (rev 34823)
@@ -184,17 +184,15 @@
   : 'default'
   ;
 
+OA_OTHERWISE
+  : 'otherwise'
+  ;
 
 
-
 ACCUMULATE
-  : 'acc'
+  : ( 'acc' | 'accumulate' | 'accL')
   ;
   
-ACCUMULATE_LEFT
-  : 'accL'
-  ; 
-
 ACCUMULATE_RIGHT
   : 'accR'
   ;   
@@ -219,13 +217,29 @@
   : 'attributes'
   ;
 
+AVERAGE
+  : 'avg'
+  ;
+  
 BOOL
   : ('true'|'false') 
   ;
+
+BRANCH
+  : 'branch'
+  ; 
   
+CLOSURE
+  : 'closure'
+  ;  
+  
 COLLECT
   : 'collect'
   ;
+  
+COLLECT_LIST
+  : 'collectList'
+  ;  
 
 CONTAINS
   : 'contains'
@@ -248,6 +262,11 @@
   :  'disjoint'
   ;
 
+DISTINCT
+  : 'distinct'
+  ;
+
+
 DO
   : 'do'
   ;
@@ -280,6 +299,10 @@
 EXTEND  
   : 'extends'
   ;
+ 
+FALLING
+  : 'falling'
+  ; 
   
 FILTER
   : 'filter'
@@ -341,6 +364,10 @@
   : 'length'
   ;
 
+LIMIT
+  : 'limit'
+  ;
+
 MAX 
   : 'max'
   ;
@@ -353,6 +380,10 @@
   : 'modify'
   ; 
   
+MODIFY_LOG  
+  : 'modifyLogical'
+  ;
+  
 MVEL
   : 'mvel'
   ;  
@@ -387,6 +418,14 @@
 OR
   : 'or'
   ;
+  
+ORDERBY
+  : 'orderby'
+  ;  
+  
+OTHERWISE
+  : 'OTHERWISE'
+  ;  
  
 OVER
   : 'over'
@@ -400,6 +439,10 @@
   : 'property'
   ;  
 
+ONCHANGE
+  : 'onChange'
+  ;
+
 QUERY
   : 'query'
   ;
@@ -420,6 +463,10 @@
   : 'reverse'
   ;
   
+RISING
+  : 'rising'
+  ;
+  
 ROLE
   : 'role'
   ;  
@@ -427,13 +474,23 @@
 RULE  
   : 'rule'
   ;
+  
+SEQ
+  : 'seq'
+  ;  
 
 SOME
   : 'some'
   ; 
-  
 
+START
+  : 'start'
+  ; 
   
+SUM
+  : 'sum'
+  ;
+  
 SYMMETRIC
   : 'symmetric'
   ;  
@@ -446,6 +503,10 @@
   : 'then'
   ;
   
+THROTTLE
+  : 'throttle'
+  ;  
+  
 TIME
   : 'time'
   ;   
@@ -458,6 +519,10 @@
   : 'type'
   ;  
 
+UNIQUE
+  : 'unique'
+  ;
+
 UPDATE
   : 'update'
   ;
@@ -516,6 +581,7 @@
   : '&&'
   ;
 
+   
 DOUBLE_ANG
   : '<>'  
   ;
@@ -524,6 +590,14 @@
   : '^^'
   ; 
 
+DOUBLE_HYPEN 
+  : '--'
+  ;
+
+DOUBLE_DOT 
+  : '..'
+  ;
+
 DOUBLE_GREATER
   : '>>'
   ;
@@ -536,7 +610,14 @@
   : '||'
   ;
     
+DOUBLE_SQUARE_LEFT
+  : '[['
+  ;
 
+DOUBLE_SQUARE_RIGHT
+  : ']]'
+  ;
+
 EQUAL
   : '=='
   ;
@@ -555,12 +636,16 @@
 
 GREATER_EQUAL
   : '>='
-  ; 
+  ;   
 
 LESS
   : '<'
   ;
 
+LESS_PERCENT
+  : '<%'
+  ;  
+
 LESS_EQUAL
   : '<='
   ;
@@ -569,9 +654,21 @@
   : '-'
   ;
 
+NEG_MARK
+  : '!'
+  ;
+
 NOT_EQUAL
   : '!='
   ;
+  
+PERCENT
+  : '%'
+  ;  
+  
+PERCENT_GREATER
+  : '%>'
+  ;  
 
 PIPE
   : '|'
@@ -658,7 +755,7 @@
   
 MISC  :
     //'!' | '%' | '^' | '*' | '-' | '+'  | '?' | '/' | '\'' | '\\' | '|' | '&' 
-    '!' | '%' | '^' | '\'' | '\\' | '&' 
+    '^' | '\'' | '\\' | '&' 
   ;
  
 

Modified: labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g	2010-08-20 18:30:43 UTC (rev 34822)
+++ labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g	2010-08-20 22:35:12 UTC (rev 34823)
@@ -43,9 +43,19 @@
   
   VT_LHS;
   VT_ARROW;
+  
   VT_RHS;
+  VT_THEN;
+  VT_CLOSURE;
   
-
+  VT_BRANCH;
+  VT_BRANCH_DEFAULT;
+  VT_BRANCH_LABEL;
+  VT_NEG_BRANCH_LABEL;
+  
+  VT_RISING_EDGE;
+  VT_FALLING_EDGE;
+  
   VT_RHS_CHUNK;
   VT_CURLY_CHUNK;
   VT_SQUARE_CHUNK;
@@ -79,17 +89,26 @@
   VT_POSITIONAL_VAR;
   VT_POSITIONAL_CONST;
   VT_POSITIONAL_INDEX;
+  VT_POSITIONAL_SKIP;
   
   VT_BINDING;
   VT_ACCESSOR;
+  VT_VERSION;
   VT_INDEXER;
   VT_INDEX_ALL;
   VT_METHOD;
   VT_EXPR;
+  VT_OTHERWISE;
   
   VT_FILTER;
+  VT_SET;
   
+  VT_SEQUENCE;
+  VT_TRAIL;
+  VT_TRAIL_NODE;
+  
   VT_LIST;
+  VT_RANGE;
   
   VT_BEHAVIOR;
   VT_ENTRYPOINT;
@@ -97,8 +116,16 @@
   VT_FROM_SOURCE;
   VT_EXPRESSION_CHAIN;
   
-  VT_ACCUMULATE_INIT_CLAUSE;
-  VT_ACCUMULATE_ID_CLAUSE;
+  VT_ACCUMULATE_LEFT;
+  VT_ACCUMULATE_RIGHT;
+  VT_ACCUMULATE_ITERATION;
+  VT_ACCUMULATE_FUNCTION;
+  VT_ACC_ITER_INIT;
+  VT_ACC_ITER_ACT;
+  VT_ACC_ITER_REV;
+  VT_ACC_ITER_RES;
+  
+  VT_COLLECT_LIST;
 }
   
 @parser::header {
@@ -224,37 +251,8 @@
 
 /**************************** TYPE DECLARATION *******************************************/
 
-//TODO : What for?? proto-declare??
-/*
-template
-  : 
-    TEMPLATE template_id 
-    semi1=SEMICOLON?
-    template_slot+
-    end=END semi2=SEMICOLON?
-    -> ^(TEMPLATE template_id template_slot+ END)
-  ;
 
-template_id
-  :   id=ID
-     -> VT_TEMPLATE_ID[$id]
-  |   id=STRING
-     -> VT_TEMPLATE_ID[$id]
-  ;
 
-template_slot
-  : data_type slot_id SEMICOLON?
-    -> ^(VT_SLOT data_type slot_id)
-  ;
-
-slot_id
-  : id=ID
-    -> VT_SLOT_ID[$id]
-  ;
-*/
-
-
-
 type_declaration
   : DECLARE  type_declare_id extend?
     type_declare_attributes?  
@@ -404,15 +402,16 @@
 
 
 
-rule
-  : RULE rule_id (EXTEND rule_id)?    
+rule 
+  : RULE rule_id parameters? (EXTEND rule_id)?    
     rule_metadata* 
     rule_attributes?
     rule_arrow?     
     when_part? 
     then_part
     -> ^(RULE rule_id 
-              ^(VT_EXTENDS rule_id)? 
+              ^(VT_EXTENDS rule_id)?
+              parameters? 
               rule_metadata* 
               rule_attributes? 
               rule_arrow?
@@ -522,7 +521,7 @@
   ; 
   
 ra_calendars
-  : A_CALENDAR^ LEFT_PAREN! string_list RIGHT_PAREN!
+  : A_CALENDAR^ LEFT_PAREN! literal_list RIGHT_PAREN!
   ;
 
 
@@ -564,6 +563,7 @@
   | oa_defeat
   | oa_default
   | oa_crisp
+  | oa_otherwise
   ;
 
 oa_kind
@@ -608,9 +608,70 @@
   : OA_DEFAULT^
   ;
 
+oa_otherwise
+  : OA_OTHERWISE^ LEFT_PAREN! STRING RIGHT_PAREN!
+  ;
 
 
 
+
+
+pattern_attributes
+  : (AT single_pattern_attribute)+
+    -> ^(VT_ATTRIBUTES single_pattern_attribute+)
+    | AT LEFT_SQUARE single_pattern_attribute (COMMA single_pattern_attribute)* RIGHT_SQUARE
+    -> ^(VT_ATTRIBUTES single_pattern_attribute+)
+  ;
+    
+single_pattern_attribute
+  : single_operator_attribute
+  | pa_onChange
+  ;
+  
+pa_onChange
+  : ONCHANGE^ LEFT_PAREN!
+    (
+      TIMES (COMMA! NEG_MARK! ID)*
+      | ID (COMMA! ID)*
+    )
+    RIGHT_PAREN!
+  ;     
+
+
+
+query_attributes
+    : (AT single_query_attribute)+
+      -> ^(VT_ATTRIBUTES single_query_attribute+)
+      | AT LEFT_SQUARE single_query_attribute (COMMA single_query_attribute)* RIGHT_SQUARE
+      -> ^(VT_ATTRIBUTES single_query_attribute+)
+    ;
+
+single_query_attribute
+  :
+  ;
+  
+  
+  
+trail_attributes
+  :  (AT single_trail_attribute)+
+      -> ^(VT_ATTRIBUTES single_trail_attribute+)
+      | AT LEFT_SQUARE single_trail_attribute (COMMA single_trail_attribute)* RIGHT_SQUARE
+      -> ^(VT_ATTRIBUTES single_trail_attribute+)
+    ;
+
+single_trail_attribute
+  : ta_trail_start
+  | ta_trail_end
+  ;
+
+ta_trail_start
+  : START
+  ;
+
+ta_trail_end
+  : END
+  ;  
+
 /**************************** LHS *******************************************/
 
 
@@ -626,6 +687,10 @@
   ->  ^(VT_AND_IMPLICIT lhs_implies+)
   ;
 
+lhs_base
+  :   LEFT_PAREN! lhs_root RIGHT_PAREN!
+  | lhs_atom_pattern  
+  ;
 
 
 lhs_implies
@@ -707,10 +772,15 @@
     unary_operator^  operator_attributes? lhs_modified_unary
   | LEFT_PAREN! lhs_root RIGHT_PAREN!    
   | lhs_quantifiexpr
+  | lhs_edge
+  | lhs_branch
+  | lhs_sequence
   | lhs_label_atom_pattern
   ;
 
 
+
+
 lhs_quantifiexpr
   : lhs_exists
   | lhs_not
@@ -720,14 +790,13 @@
 
 lhs_exists  
   : lab=label? EXISTS operator_attributes?
-  (
-    LEFT_PAREN lhs_root RIGHT_PAREN
-  | lhs_atom_pattern  
-  )
-  -> {lab==null}? ^(VT_EXISTS operator_attributes? lhs_root? lhs_atom_pattern?)
-  -> ^(VT_BINDING label ^(VT_EXISTS operator_attributes? lhs_root? lhs_atom_pattern?)) 
+    lhs_base
+  -> {lab==null}? ^(VT_EXISTS operator_attributes? lhs_base)
+  -> ^(VT_BINDING label ^(VT_EXISTS operator_attributes? lhs_base)) 
   ;
+  
 
+
 lhs_forall  
   : FORALL operator_attributes?
   (
@@ -739,50 +808,101 @@
   ; 
   
 lhs_not   
-  : NOT operator_attributes?
-  (
-    LEFT_PAREN lhs_root RIGHT_PAREN
-  | lhs_atom_pattern  
-  )
-  -> ^(VT_NEXISTS operator_attributes? lhs_root? lhs_atom_pattern?)
+  : NOT operator_attributes? lhs_base
+  -> ^(VT_NEXISTS operator_attributes? lhs_base)
   ; 
 
-/*
-lhs_atom_pattern
-  : lab=label? ID LEFT_PAREN constraints? RIGHT_PAREN operator_attributes? over_clause? from?
-    -> {lab==null}? ^(VT_AND operator_attributes? VT_ENABLED ^(VT_PATTERN ID) constraints? over_clause? from?)
-    -> ^(label ^(VT_AND operator_attributes? VT_ENABLED ^(VT_PATTERN ID) constraints? over_clause? from?))
-  ; 
-*/
 
 lhs_label_atom_pattern
-  : lab=label? lhs_atom_pattern
-    -> {lab==null}? lhs_atom_pattern 
-    -> ^(VT_BINDING label lhs_atom_pattern)
+  : lab=label? ( lhs_atom_pattern | ordered_obj_pattern )
+    -> {lab==null}? lhs_atom_pattern? ordered_obj_pattern? 
+    -> ^(VT_BINDING label lhs_atom_pattern ordered_obj_pattern?)  
   ;  
 
 
 /* over_clause obsolete, replaced by filters (see far below in lhs_unary)*/
 lhs_atom_pattern
-  : ID LEFT_PAREN constraints? RIGHT_PAREN operator_attributes?  from?  
+  : ID LEFT_PAREN constraints? RIGHT_PAREN pattern_attributes?  from?  
   -> ^(VT_PATTERN
-          ^(VT_AND operator_attributes? VT_ENABLED ^(VT_TYPE ID) constraints? )
+          ^(VT_AND pattern_attributes? VT_ENABLED ^(VT_TYPE ID) constraints? )
           from?
-      )    
+      )       
   ;
 
 
 
+/************************************************ LHS CONSTRUCTS *************************/
+
+
+lhs_edge
+  : RISING lhs_base
+    -> ^(VT_RISING_EDGE lhs_base)
+   | FALLING lhs_base     
+    -> ^(VT_FALLING_EDGE lhs_base)
+  ;
+
+
+lhs_branch
+  : BRANCH  
+      LEFT_PAREN  
+        lhs_base?
+        branch_alternative+
+      RIGHT_PAREN  
+      -> ^(VT_BRANCH ^(VT_BRANCH_DEFAULT lhs_base)? branch_alternative+ )
+  ;
+  
+branch_alternative
+  :  branch_label^ lhs_base    
+  ;  
+  
+branch_label
+  : LEFT_SQUARE neg=NEG_MARK? ID RIGHT_SQUARE
+  -> {neg!=null}? ^(VT_NEG_BRANCH_LABEL ID)
+  -> ^(VT_BRANCH_LABEL ID)
+  ;  
+
+
+
 filter_chain
-  :   PIPE filter filter_chain?
-  -> ^(VT_FILTER filter filter_chain?)
+  :   PIPE filter (PIPE filter)*
+  -> ^(VT_FILTER filter+ )
   ;
   
 filter
-  :   over_elements
+  :   over_filter
+  |   unique_filter
+  |   throttle_filter
   |   FILTER ID  
   ;
   
+  
+   
+  
+lhs_sequence
+  : 
+   SEQ LEFT_PAREN
+      trail+
+  RIGHT_PAREN   
+  -> ^(VT_SEQUENCE trail+)
+  ;
+
+trail
+  : trail_path 
+  -> ^(VT_TRAIL trail_path)          
+  ;  
+  
+trail_path
+  : trail_node
+    (lhs_root DOUBLE_GREATER! trail_node)+       
+    SEMICOLON!    
+  ;  
+
+trail_node
+  : ID trail_attributes?
+  -> ^(VT_TRAIL_NODE ID trail_attributes?)
+  ;
+  
+  
 /*********************************************** INSIDE PATTERN *****************************************/
 
 
@@ -811,17 +931,36 @@
   String idx = ""+j;
 }
   : literal  
-    -> ^(VT_POSITIONAL_CONST VT_POSITIONAL_INDEX[$start,idx] literal)   
+    -> ^(VT_POSITIONAL_CONST VT_POSITIONAL_INDEX[$start,idx] ^(EQUAL ^(VT_EXPR literal)))   
   | var_literal 
-    -> ^(VT_POSITIONAL_VAR VT_POSITIONAL_INDEX[$start,idx] var_literal) 
+    -> ^(VT_POSITIONAL_VAR VT_POSITIONAL_INDEX[$start,idx] ^(EQUAL ^(VT_EXPR var_literal)))
+  | QUESTION_MARK rest=restriction_root?
+    ->{rest==null}? ^(VT_POSITIONAL_SKIP VT_POSITIONAL_INDEX[$start,idx])
+    -> ^(VT_POSITIONAL_CONST VT_POSITIONAL_INDEX[$start,idx] restriction_root)   
   ;
                 
 slotted_constraint
-  :   constr_implies
+  :   constr_implies  
   ; 
+  
+/*  
+ordered_constraints
+  : ordered_constraint[j++] (COMMA! ordered_constraint[j++])*
+  ;  
+  
+ordered_constraint[int j]
+ at init{
+  String idx = ""+j;
+}
+: literal  
+    -> ^(VT_POSITIONAL_CONST VT_POSITIONAL_INDEX[$start,idx] literal)   
+  | var_literal 
+    -> ^(VT_POSITIONAL_VAR VT_POSITIONAL_INDEX[$start,idx] var_literal)
+  | QUESTION_MARK restriction_root?
+    -> ^(VT_POSITIONAL_SKIP VT_POSITIONAL_INDEX[$start,idx])   
+  ;
+*/
 
-
-
 /********************************************* ATOMIC DATA DEFINITIONS ************************************************/
 
 
@@ -830,20 +969,44 @@
     -> ^(VT_NAME ID+)
   ;
 
-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()+" ]"]
+
+gen_accessor_list
+  : first=general_accessor_path (COMMA next=general_accessor_path)* 
+  -> ^(VT_LIST general_accessor_path+)
   ;
+ 
+literal_list
+  : first=literal (COMMA next=literal)* 
+  -> ^(VT_LIST literal+)
+  ;  
 
+var_list
+  : first=VAR (COMMA next=VAR)* 
+  -> ^(VT_LIST VAR+)
+  ;
+  
+members_list
+  : (literal|var_literal) (COMMA! (literal|var_literal))*
+  ;  
+
+integer_range
+  : INT DOUBLE_DOT INT
+  -> ^(VT_RANGE INT INT)
+  ;
+
+list_literal
+  : LEFT_CURLY members_list? RIGHT_CURLY  
+    ->^(VT_LIST members_list?)  
+  ; 
+
+
 literal
 options{
 k=6;
 }
-    :   STRING 
+    :   STRING m=msr_unit?
+        -> {m==null}? STRING
+        -> ^(VT_MSR STRING $m)
     |   INT m=msr_unit?
         -> {m==null}? INT
         -> ^(VT_MSR INT $m)
@@ -853,7 +1016,7 @@
     |   BOOL 
     |   NULL 
     | literal_object
-    | list 
+    | list_literal 
     ;
     
     
@@ -874,29 +1037,34 @@
     
 msr_unit
     :   (GATE! ID)+
-    //-> ^(VT_MSR ID+) 
     ;
        
     
-list
-  : LEFT_CURLY list_members? RIGHT_CURLY  
-    ->^(VT_LIST list_members?)  
-  ; 
 
-list_members
-  : (literal|var_literal) (COMMA! (literal|var_literal))*
-  ;
+
+
     
   
     
 literal_object
+  : new_object
+    | ordered_object_literal
+  ;   
+  
+new_object
   : NEW ID LEFT_PAREN literal_object_args? RIGHT_PAREN
     -> ^(VT_NEW_OBJ ^(VT_TYPE ID) ^(VT_ARGS literal_object_args)?)
-  ;   
+  ;  
   
 literal_object_args
   :  method_args
   ;
+  
+  
+//TODO : time format strings
+time_string
+  : STRING
+  ;  
 
 
 /**************************************************** METHODS AND EXPRESSIONS ***********************************************/
@@ -1154,6 +1322,8 @@
 right_expression
   : expr_root
   -> ^(VT_EXPR expr_root)
+  | OTHERWISE
+  -> ^(VT_OTHERWISE)
   ;
 
 
@@ -1161,6 +1331,10 @@
 /***************************************** ACCESSOR PATHS *******************************/
 
 
+general_accessor_path
+  : var
+  | accessor_path
+  ;
 
 accessor_path
   : accessor (DOT accessor)*
@@ -1183,21 +1357,32 @@
     }
     -> {ix==null}? ^($m)
     -> ^($ix)
-  | id=ID ix=indexer?
+  | id=versioned_accessor ix=indexer?
     { 
         if (ix != null ) {
               Tree t = ((Tree) ix.getTree());     
               Tree temp = t.getChild(0);                                        
-              t.setChild(0,new CommonTree(new CommonToken(STRING,$id.text)));
+              t.setChild(0,(Tree) id.getTree());
               t.addChild(temp);
         }  
     }  
-    -> {ix==null}? ^(ID)
+    -> {ix==null}? ^($id)
     -> ^($ix)
   | nested_obj_pattern
   ;
 
 
+versioned_accessor
+  : ID v=version?
+  -> {v!=null}? ^(VT_VERSION ID version)
+  -> ID
+  ;
+
+version
+  : DOUBLE_LESS! INT DOUBLE_GREATER!
+  | DOUBLE_LESS! integer_range DOUBLE_GREATER!
+  ;
+
 nested_obj_pattern
   : GATE fqn=fully_qualified_name?  LEFT_PAREN constraints RIGHT_PAREN
     -> {fqn==null}? ^(VT_NESTED_PATTERN constraints) 
@@ -1230,13 +1415,10 @@
 
 
 
-/***************************************************   PATTERN SOURCES ******************************************/
 
-over_clause
-  : OVER^ over_elements (COMMA! over_elements)*
-  ;
+/************************************************** FILTERS ******************************/
 
-over_elements
+over_filter
   : id1=WINDOW COLON 
     (  id2=TIME paren_chunk
       -> ^(VT_BEHAVIOR $id1 $id2 paren_chunk)
@@ -1244,7 +1426,20 @@
       -> ^(VT_BEHAVIOR $id1 $id2 INT) 
     ) 
   ;
+  
+unique_filter
+  : UNIQUE
+    -> ^(VT_BEHAVIOR UNIQUE) 
+  ;  
+  
+throttle_filter
+  : THROTTLE LEFT_PAREN INT RIGHT_PAREN
+    -> ^(VT_BEHAVIOR THROTTLE INT)
+  ;  
 
+
+/***************************************************   PATTERN SOURCES ******************************************/
+
 from
   : FROM^
             (  accumulate_statement
@@ -1281,81 +1476,175 @@
 from_source
   : var
     | accessor_path 
-    //args=paren_chunk?
-    //expression_chain?
-    //-> ^(VT_FROM_SOURCE ID paren_chunk? expression_chain?)
+    | LEFT_SQUARE! literal_list RIGHT_SQUARE!
+    | LEFT_SQUARE! var_list RIGHT_SQUARE!
+    | LEFT_SQUARE! integer_range RIGHT_SQUARE!    
   ;
 
 
 
-/**
-  TODO :
-*/ 
+
 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? )
+  : acc_left
+  | acc_right
   ;
+  
+  
+acc_left
+  : ACCUMULATE accumulate_body
+  -> ^(VT_ACCUMULATE_LEFT accumulate_body)
+  ;
 
-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))
+acc_right
+  : ACCUMULATE_RIGHT accumulate_body
+  -> ^(VT_ACCUMULATE_RIGHT accumulate_body)
+  ;    
+
+accumulate_body
+  : LEFT_PAREN 
+      lhs_root 
+    ( COMMA?
+      ( accumulate_iteration
+      | l=label? accumulate_functions )
+    )?     
+    RIGHT_PAREN
+    -> {l==null}? lhs_root accumulate_iteration? accumulate_functions?
+    -> lhs_root ^(VT_BINDING label accumulate_functions?)
   ;
 
 
+accumulate_functions
+  : acc_collect_list
+  | acc_avg
+  | acc_min
+  | acc_max
+  | acc_sum
+  | acc_count
+  | acc_distinct
+  | acc_orderby
+  | acc_limit
+  ;
+
+ 
+acc_collect_list
+  : COLLECT_LIST 
+      LEFT_PAREN
+        (constr_implies
+        | var)
+      RIGHT_PAREN
+    -> ^(VT_COLLECT_LIST constr_implies? var?)
+  ;
+
+acc_avg
+  : AVERAGE LEFT_PAREN expr_root RIGHT_PAREN
+  -> ^(VT_ACCUMULATE_FUNCTION AVERAGE ^(VT_EXPR expr_root))
+  ;
+  
+acc_min
+  : MIN LEFT_PAREN expr_root RIGHT_PAREN
+  -> ^(VT_ACCUMULATE_FUNCTION MIN ^(VT_EXPR expr_root))
+  ;
+
+acc_max
+  : MAX LEFT_PAREN expr_root RIGHT_PAREN
+  -> ^(VT_ACCUMULATE_FUNCTION MAX ^(VT_EXPR expr_root))
+  ;
+
+acc_sum
+  : SUM LEFT_PAREN expr_root RIGHT_PAREN
+  -> ^(VT_ACCUMULATE_FUNCTION SUM ^(VT_EXPR expr_root))
+  ;
+  
+acc_count
+  : COUNT LEFT_PAREN RIGHT_PAREN
+  -> ^(VT_ACCUMULATE_FUNCTION COUNT)
+  ;
+  
+acc_distinct
+  : DISTINCT LEFT_PAREN gen_accessor_list RIGHT_PAREN
+  -> ^(VT_ACCUMULATE_FUNCTION DISTINCT gen_accessor_list)
+  ;
+
+acc_orderby
+  : ORDERBY LEFT_PAREN gen_accessor_list RIGHT_PAREN
+  -> ^(VT_ACCUMULATE_FUNCTION ORDERBY gen_accessor_list)
+  ;
+  
+acc_limit
+  : LIMIT LEFT_PAREN INT RIGHT_PAREN
+  -> ^(VT_ACCUMULATE_FUNCTION LIMIT INT)
+  ;
+
+
+
+accumulate_iteration
+  : INIT pc1=accumulate_paren_chunk COMMA?  
+    ACTION pc2=accumulate_paren_chunk COMMA?
+    REVERSE pc3=accumulate_paren_chunk COMMA?
+    RESULT pc4=accumulate_paren_chunk COMMA?   
+    -> ^(VT_ACCUMULATE_ITERATION ^(VT_ACC_ITER_INIT $pc1) ^(VT_ACC_ITER_ACT $pc2) ^(VT_ACC_ITER_REV $pc3)? ^(VT_ACC_ITER_RES $pc4))
+  ;
+  
+  
 accumulate_paren_chunk
 @init{
   String text = "";
-} : pc=accumulate_paren_chunk_data[false] {text = $pc.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
+  : LEFT_PAREN
+    (any=~ ( LEFT_PAREN | RIGHT_PAREN )   
+    | accumulate_paren_chunk_data[true] )* 
+    RIGHT_PAREN    
   ;
 
-accumulate_id_clause
-  : ID paren_chunk
-  -> ^(VT_ACCUMULATE_ID_CLAUSE ID paren_chunk)
-  ;
 
+/******************************************* QUICK OBJS **********************/
 
 
+ordered_object_literal
+  : DOUBLE_SQUARE_LEFT
+      method_args
+    DOUBLE_SQUARE_RIGHT
+    -> ^(VT_NEW_OBJ ^(VT_ARGS method_args))
+  ;
 
+ordered_obj_pattern
+  : DOUBLE_SQUARE_LEFT
+      positional_constraints
+    DOUBLE_SQUARE_RIGHT
+    -> ^(VT_AND positional_constraints)
+  ;
 
 /***************************************************   QUERIES ******************************************/
 
 
 query   //TODO
-  : QUERY ID 
-    //parameters? 
-    lhs_root
+  : QUERY ID parameters? 
+      query_body+
     END
-    -> ^(QUERY ID /*parameters?*/ lhs_root)   
+    -> ^(QUERY ID parameters? ^(VT_AND_IMPLICIT query_body+) )   
   ;
 
+query_body
+  : lhs_label_atom_pattern 
+  | lhs_query 
+  ;
 
+
 lhs_query
-  : QUESTION_MARK ID LEFT_PAREN positional_constraints? RIGHT_PAREN
-    -> ^(VT_QUERY_PATTERN ID positional_constraints?)
+  : QUESTION_MARK ID LEFT_PAREN positional_constraints? RIGHT_PAREN query_attributes? from?
+    -> ^(VT_QUERY_PATTERN ID query_attributes? positional_constraints? from?)
   ;
 
 
 
 
 
+
 /*************************************** QUANTIFIERS AND EVALUATORS ***********************************/
 
 inner_quantifier
@@ -1496,20 +1785,30 @@
  
 then_part  
   :     
-      rhs_structured
-      -> ^(VT_RHS rhs_structured)
-    | rhs_chunk
-      -> ^(VT_RHS rhs_chunk)   
-    
+      rhs_structured      
+ //   | rhs_chunk
+ //     -> ^(VT_RHS rhs_chunk)      
   ; 
 
 
 rhs_structured
-  : DO LEFT_CURLY!
-    rhs_atom*
-    RIGHT_CURLY!
+  : THEN then? (CLOSURE closure)? END    
+    -> ^(VT_RHS then? closure?)
+    
+  | DO! LEFT_CURLY! rhs_atom* RIGHT_CURLY!    
   ;
+  
+then
+  : rhs_atom+
+  -> ^(VT_THEN rhs_atom+)
+  ;  
 
+closure
+  : rhs_atom+
+  -> ^(VT_CLOSURE rhs_atom+)
+  ;   
+  
+
 rhs_atom
   :   rhs_insert
     | rhs_insert_logical
@@ -1517,6 +1816,7 @@
     | rhs_retract_logical
     | rhs_update
     | rhs_modify
+    | rhs_modify_logical
     | rhs_side_effect
   ; 
   
@@ -1555,25 +1855,45 @@
 rhs_modify
   : MODIFY^ LEFT_PAREN! var RIGHT_PAREN! 
     LEFT_CURLY!
-      accessor_path
-      (COMMA! accessor_path)*
+      set_action+
     RIGHT_CURLY!
     SEMICOLON?
   ;
   
+rhs_modify_logical
+  : MODIFY_LOG^ LEFT_PAREN! var RIGHT_PAREN! 
+    LEFT_CURLY!
+      set_action+
+    RIGHT_CURLY!
+    SEMICOLON?
+  ;  
+  
+set_action
+  : accessor_path EQUALS right_expression SEMICOLON   
+  -> ^(VT_SET accessor_path right_expression)
+  ;  
+  
+  
 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])
+  :     
+    LESS_PERCENT rc=side_effect_chunk {text = $rc.text;} PERCENT_GREATER
+    -> VT_RHS_CHUNK[$rc.start,text]
+    | LESS dialect PERCENT
+        rc=side_effect_chunk {text = $rc.text;}
+      PERCENT_GREATER 
+    -> ^(VT_DIALECT dialect VT_RHS_CHUNK[$rc.start,text])         
   ;
   
+dialect
+  : JAVA 
+  | MVEL
+  ;
+  
 side_effect_chunk
-  : ~ ( END | DOUBLE_GREATER )*   
+  : ~ ( END | (PERCENT_GREATER) )*   
   ;
 
 

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-20 18:30:43 UTC (rev 34822)
+++ labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java	2010-08-20 22:35:12 UTC (rev 34823)
@@ -1,5 +1,48 @@
 package org.drools.lang;
 
+
+
+/**
+ * Test for future Drools Language Enhancements as of
+ * 
+ * 
+ * Nested Objects	-- done
+ * 		will require .# syntax even if no cast is required
+ * Casting Nested Objects -- done
+ * Positional  Constraints -- done
+ * POSL - Positional-Slotted Language -- done
+ * Method Calls -- done
+ * Maps and Arrays (Collections) -- done
+ * Collections and XPath like filtering -- done
+ * Free form Expressions -- done (simple)
+ * Queries and Unification -- done
+ * Ontologies and Relations via Triples with Hybrid POJO Graph Notation -- IN PROGRESS
+ * Escapes for Dialects -- done
+ * Accumulate -- done
+ * SQL Group Operators -- done
+ * Pipes - Pass through Filters -- done
+ * Unit support -- done
+ * Otherwise -- done
+ * Branch (Labelled Else) -- done
+ * Rule Dependency Meta-Rule Language -- not a language problem
+ * Parallel Meta-Rule Language -- future
+ * MVCC -- future (not a language problem? - depends on Parallel Meta-Rule)
+ * Slot-specific -- done
+ * Field Versioning -- done
+ * Logical Modify -- done
+ * Lambda Support with Analysis -- not a language problem?
+ * Rising / Falling edges -- done
+ * Single Pass Insertion / Single Match -- not a language problem?
+ * Query Based Backward Chaining with POSL -- done
+ * Federated Data Sources for Queries -- done (using from)
+ * Event Sequencing -- done
+ * Uncertainty / Vagueness -- done
+ * Ordered facts -- done
+ * 
+ * 
+ */
+
+
 import static org.junit.Assert.assertTrue;
 
 import java.awt.event.MouseEvent;
@@ -19,8 +62,6 @@
 import javax.swing.JList;
 import javax.swing.JScrollPane;
 import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
 
 import org.antlr.runtime.ANTLRInputStream;
 import org.antlr.runtime.CommonTokenStream;
@@ -542,7 +583,7 @@
 		String rule = "rule";
 		String[] testDRL = new String[] {
 				"rule \"r\" when " +
-				"Person( \"john\" , 18, 2.0, true, null, new Dog(), {12, $x, \"test\" }, $var) " +
+				"Person( \"john\" , 18, 2.0, ?, ?, true, null, new Dog(), {12, $x, \"test\" }, $var, ? == 3) " +
 				"then end",
 		};
 		check(rule,testDRL);	
@@ -590,6 +631,7 @@
 		String[] testDRL = new String[] {
 				"method(2.0, 3.0#km, \"xx\")",
 				"method()#km",
+				"method( new Obj(), [[ 3, 4 ]] )",
 		};
 		check(rule,testDRL);										
 	}
@@ -758,6 +800,29 @@
 		check(rule,testDRL);										
 	}	
 	
+	@Test
+	public void test_lhs_query() {
+		String rule = "lhs_query";
+		String[] testDRL = {							
+				" ?queryName( \"literal\", $p, $unificationVar ) from federatedDataTable"  
+				
+		};
+		check(rule,testDRL);										
+	}
+	
+	
+	@Test
+	public void test_query() {
+		String rule = "query";
+		String[] testDRL = {							
+				" query queryName(int arg1, String arg2, Obj arg3)" + "\n" +
+				"  $o1 : Object1( field1 == arg1 ) " + "\n" +
+				"  Object2( field1 == $o1, field2 == $arg3) " + "\n" +
+				" end "				
+		};
+		check(rule,testDRL);										
+	}
+	
 	@Test	
 	public void test_msr_unit() {
 		String rule = "msr_unit";
@@ -777,11 +842,59 @@
 		check(rule,testDRL);										
 	}	
 	
+	/*
+	lhs_branch
+	  : BRANCH 
+	      LEFT_PAREN  
+	        lhs_base?
+	        branch_alternative+
+	      RIGHT_PAREN  
+	      -> ^(VT_BRANCH ^(VT_BRANCH_DEFAULT lhs_base)? branch_alternative+ )
+	  ;	  
 	
+	*/
 	
+	@Test	
+	public void test_branch() {
+		String rule = "rule";
+		String[] testDRL = new String[] {
+				" rule test when " + "\n" +
+				"  branch (" + "\n" +
+				"	Person( ) " + "\n" +
+				"	[b1] Person( ) " + "\n" +
+				"	[b2] ( neg @crisp exists Person( ) ) " + "\n" +
+				" ) " + "\n" +
+				" then end ",
+		};
+		check(rule,testDRL);										
+	}
 	
+	@Test	
+	public void test_branch_alternative() {
+		String rule = "branch_alternative";
+		String[] testDRL = new String[] {				
+				" [label] Person() ",				
+				" [! label] Person() ",
+				" [label] ( rising Person() ) ",	
+				" [label] ( ( Person() or Person() ) | unique )",
+		};
+		check(rule,testDRL);										
+	}
 	
+	@Test	
+	public void test_branch_label() {
+		String rule = "branch_label";
+		String[] testDRL = new String[] {				
+				" [label] ",				
+				" [! label] ",
+		};
+		check(rule,testDRL);										
+	}
 	
+	
+	
+	
+	
 	@Test	
 	public void test_expression() {
 		String rule = "right_expression";
@@ -882,7 +995,11 @@
 								
 				" #nested( age == 18 ) ",
 				
-				" pets[3] "
+				" pets[3] ",
+				
+				" age<<1>> ",
+				
+				" age<<0 .. -5>> ",
 		};
 		check(rule,testDRL);										
 	}		
@@ -933,12 +1050,26 @@
 				" from collect ( $p : Person() from $source )",
 				
 				" from collect ( Person() )",														
+				
+				" from [\"str1\", \"str2\"]",
+				
+				" from [ 1,2,3,4,5 ]",
+				" from [ $v1, $v2, $v3 ]",
+				
+				" from accumulate ( Person() ) ",
+				" from acc ( Person() ) ",
+				" from accL ( Person() ) ",
+				" from accR ( Person() ) ",
 		};
 		check(rule,testDRL);									
 	}
 	
 	
 	
+	
+	
+	
+	
 	@Test	
 	public void test_from_rule() {
 		String rule = "rule";
@@ -952,6 +1083,30 @@
 	
 	
 	@Test	
+	public void test_accumulate() {
+		String rule = "rule";
+		String[] testDRL = {
+				"rule other1 when " + "\n" +	
+				" List( ) from acc ( Person() ) " + "\n" +
+				"then end ",
+				
+				"rule other1 when " + "\n" +	
+				" List( ) from acc ( " + "\n" +
+				"	Person(), " + "\n" +
+				"	init( int j = 0; ) " + "\n" +
+				"	action( j++; ) " + "\n" +
+				"	reverse( j--; ) " + "\n" +
+				"	result( j; ) " + "\n" +
+				") " + "\n" +
+				"then end ",
+		};
+				
+		check(rule,testDRL);										
+	}
+	
+	
+	
+	@Test	
 	public void test_label() {
 		String rule = "label";
 		String[] testDRL = new String[] {
@@ -1046,12 +1201,79 @@
 				"		Person( ) " + "\n" +
 				"	) | window:length( 10 ) | window:time(2h)" + "\n" +
 				" then end ",							
+				
+				" rule test when " + "\n" +
+				" 	( " + "\n" +
+				"		Person( )" + "\n" +
+				"		Person( ) " + "\n" +
+				"	) | unique | throttle(30)" + "\n" +
+				" then end ",
 		};
 		check(rule,testDRL);
 	}
 		
 	
 	@Test	
+	public void test_rhs_side_effect() {
+		String rule = "then_part";
+		String[] testDRL = new String[] {
+				" then <% ... %> end ",
+				 
+				" then " + "\n" +
+				"   < java % " + "\n" +
+				"		System.out.println(); " + "\n" +
+				"		Math.abs(12); " + "\n" +
+				"	%> " + "\n" +
+				"  <% System.out.println(); %> " + "\n" +
+				" end ",
+				
+				" then < mvel % ... %> end",
+		};
+		check(rule,testDRL);
+	}
+	
+	
+	@Test	
+	public void test_rhs() {
+		String rule = "then_part";
+		String[] testDRL = new String[] {				
+				 
+				" then " + "\n" +
+				"  insert new Object(); " + "\n" +
+				"  insert [[ \"st\", 22, getit(), new Obj() ]]; " + "\n" +
+				"  insertLogical new String(\"test\");" + "\n" +				
+				"  retract new Object(); " + "\n" +
+				"  retract $x; " + "\n" +				
+				"  retractLogical new Object(); " + "\n" +
+				"  retractLogical $x; " + "\n" +
+				"  update $x; " + "\n" +
+				" end ",
+				
+				" then " + "\n" +
+				"  modify ($x) { " + "\n" +
+				"    age = 18; " + "\n" +
+				"    name = \"john\"; " + "\n" +
+				"    address.city = ask(); " + "\n" +
+				"  } " + "\n" +
+				" end ",
+				
+		};
+		check(rule,testDRL);
+	}
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	@Test	
 	public void test_dle_nested_objects() {
 		String rule = "lhs_atom_pattern";
 		String[] testDRL = {
@@ -1065,7 +1287,7 @@
 	public void test_dle_nested_objects_cast() {
 		String rule = "lhs_atom_pattern";
 		String[] testDRL = {
-				"Person( name==  \"mark\", address.#org.domain.LongAddress( city == \"london\", country ==  \"uk\") )"
+				"Person( name==  \"mark\", address.#org.domain.LongAddress( city == \"london\", country ==  \"uk\").subfield )"
 		};
 				
 		check(rule,testDRL);										
@@ -1148,24 +1370,215 @@
 	}
 	
 	
+	@Test
+	public void test_dle_slot_specific() {
+		String rule = "rule";
+		String[] testDRL = {			
+				"rule test when " + "\n" +
+				" $p : Person() @onChange(*,!name)" + "\n" +
+				" $p2 : Person() @onChange(name, age)" + "\n" +
+				" then end"
+		};
+		check(rule,testDRL);										
+	}
+	
+	
+	@Test
+	public void test_dle_edges() {
+		String rule = "rule";
+		String[] testDRL = {			
+				"rule test when " + "\n" +
+				" rising Person() " + "\n" +
+				" falling ($p : Person() ) " + "\n" +
+				" then end"
+		};
+		check(rule,testDRL);										
+	}
+	
+	
+	@Test
+	public void test_dle_version() {
+		String rule = "rule";
+		String[] testDRL = {			
+				"rule test when " + "\n" +
+				" Person( age<<-1>> == field.val<<-2>>.someother ) " + "\n" +
+				" then end"
+		};
+		check(rule,testDRL);										
+	}
+	
+	@Test
+	public void test_dle_closure() {
+		String rule = "rule";
+		String[] testDRL = {			
+				"rule test when " + "\n" +	
+				" then " + "\n" +
+				"   <% System.out.println(\"true\"); %>" + "\n" +
+				" closure" + "\n" +
+				"   <% System.out.println(\"no more\"); %> " + "\n" +
+				" end" 
+		};
+		check(rule,testDRL);										
+	}
+	
+	
+	@Test	
+	public void test_dle_otherwise() {
+		String rule = "rule";
+		String[] testDRL = {
+				"rule other1 when " + "\n" +	
+				" Person( name == @otherwise(\"og1\") \"john\" )" + "\n" +
+				"then end ",			
+				
+				"rule other2 when " + "\n" +	
+				" Person( name == @otherwise(\"og1\") \"mark\" )" + "\n" +
+				"then end",
+				
+				"rule otherDef when " + "\n" +	
+				" Person( name == @otherwise(\"og1\") OTHERWISE )" + "\n" +
+				"then end",
+		};
+				
+		check(rule,testDRL);										
+	}
+	
 
-    
 
-       
 	
+	@Test	
+	public void test_dle_accumulate() {
+		String rule = "accumulate_statement";
+		String[] testDRL = {
+				"acc ( " + "\n" +
+				"  $n : Number() from [-9 .. -5] " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $n : Number() from [1 .. 5], " + "\n" +
+				"  collectList( | $n + 1 | ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $user : User() from users, " + "\n" +
+				"  $parentNames : collectList( $user.parent.name ) " + "\n" +
+				") ",	
+				
+				"acc ( " + "\n" +
+				"  ( $user : User() from users" + "\n" +
+				"    $parent : Parent( age > 30 ) from $user.parent ), " + "\n" +
+				"  $parentNames : collectList( $parent.name ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $s : String() from [\"foo\" , \"bar\"], " + "\n" +
+				"  collectList( $s.toUpperCase() ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $n : Number() from [2,4,8,16,32], " + "\n" +
+				"  collectList( | $n | < 10  ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $n : Number( | intValue / 2 | == 0 ) " + "\n" +
+				"     from acc( $n2 : Number() from [0 .. 10], " + "\n" +
+				"               collectList( |$n2*$n2| )" + "\n" +
+				"             ), " + "\n" +
+				"  collectList( $n ) " + "\n" +
+				") ",
+																
+				
+		};				
+		check(rule,testDRL);										
+	}
 	
-	/*
+	
 	@Test	
-	public void test_ {
-		String rule = "";
+	public void test_dle_accumulate_functions() {
+		String rule = "accumulate_statement";
 		String[] testDRL = {
-				""
+				"acc ( " + "\n" +
+				"  $p : Person(), " + "\n" +
+				"  $num : count( ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $p : Person( $h : height, $w : weight ), " + "\n" +
+				"  avg( $h * $w / 100 ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $p : Person( $h : height, $w : weight ), " + "\n" +
+				"  sum( $w ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $p : Person( $h : height, $w : weight ), " + "\n" +
+				"  min( $w ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $p : Person( $h : height, $w : weight ), " + "\n" +
+				"  max( $w ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $p : Person( $h : height, $w : weight ), " + "\n" +
+				"  limit( 100 ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $p : Person( $h : height, $w : weight ), " + "\n" +
+				"  orderby( $h.val[3].fld , $w ) " + "\n" +
+				") ",
+				
+				"acc ( " + "\n" +
+				"  $p : Person( $h : height, $w : weight ), " + "\n" +
+				"  distinct( $p ) " + "\n" +
+				") ",
+				
+																				
+		};				
+		check(rule,testDRL);										
+	}
+	
+	
+	
+	@Test	
+	public void test_dle_ordered_patterns() {
+		String rule = "rule";
+		String[] testDRL = {
+				"rule test when " + "\n" +
+				" Person( age != 18)" +
+				" [[ 23, ?, \"mark\", ? , ? != 18 ]]" + "\n" +
+				"then end",
 		};
 				
 		check(rule,testDRL);										
 	}
-	*/
 	
+	
+	
+	@Test	
+	public void test_dle_sequence() {
+		String rule = "lhs_sequence";
+		String[] testDRL = {
+				"seq (" + "\n" +
+				" begin @start C() >> finish @end; "  + "\n" +
+				"  "  + "\n" +
+				" mynode @start $d : D() >> finish @end; "  + "\n" +
+				"  "  + "\n" +
+				" begin @start $e : E() >> midstate $f : F( this after $e) >> name; "  + "\n" +
+				"  "  + "\n" +
+				" name (C() or B()) >> finish @end;  "  + "\n" +
+				"  "  + "\n" +
+				")",						
+		};
+				
+		check(rule,testDRL);										
+	}
+	
+	
 
 	
 	



More information about the jboss-svn-commits mailing list