anchor.diff:  	;	
   
   compareExpr returns [PredicateExpr retval]
  +options {backtrack=true;}	
   	: d1=dateExpr o=compOp d2=dateExpr 		{retval = new DateCompare($d1.retval, $o.retval, $d2.retval);}	
   	| s1=stringExpr o=compOp s2=stringExpr	  	{retval = new StringCompare($s1.retval, $o.retval, $s2.retval);}
   	| n1=numericExpr o=compOp n2=numericExpr	{retval = new NumberCompare($n1.retval, $o.retval, $n2.retval);}
  
positive.code: 	: n=not? p=condPrimary				{$condFactor.retval = ($n.text != null) ?  new CondFactor(true, $p.retval) :  $p.retval;};
  	
  condPrimary returns [PredicateExpr retval]
  	: s=simpleCondExpr  				{retval = $s.retval;}
  	| LPAREN o=orExpr RPAREN			{retval = $o.retval;}
  	;
  
  simpleCondExpr returns [PredicateExpr retval]
  	: n=nullCompExpr				{retval = $n.retval;}
  	| c=compareExpr 				{retval = $c.retval;}
  	| b1=betweenStmt				{retval = $b1.retval;}
  
negative.code: 	;
  
  betweenStmt returns [PredicateExpr retval]
  options {backtrack=true;}	
  	: d1=dateExpr n=not? keyBETWEEN d2=dateExpr and d3=dateExpr
  							{retval = new DateBetweenStmt($d1.retval, ($n.text != null), $d2.retval, $d3.retval);}
  	| n1=numericExpr n=not? keyBETWEEN n2=numericExpr and n3=numericExpr		
  