anchor.diff:      ;
       		 
   groupCondition
  -    : b=builtInCall -> groupCondition(builtInCall={$b.st})
  -    | f=functionCall -> groupCondition(functionCall={$f.st})
  -    | ^(AS e=expression (v+=var)*) -> groupCondition(expression={$e.st}, var={$v})
  -    | var -> groupCondition(var={$var.st})
  +    : ^(GROUP_CONDITION b=builtInCall) -> groupCondition(builtInCall={$b.st})
  +    | ^(GROUP_CONDITION f=functionCall) -> groupCondition(functionCall={$f.st})
  +    | ^(GROUP_CONDITION e=expression ^(AS (v=var)?) ) -> groupCondition(expression={$e.st}, var={$v.st})
  +    | ^(GROUP_CONDITION var) -> groupCondition(var={$var.st})
       ;
   
   havingClause
  
positive.code:     | ^(UCASE e=expression) -> builtInCall(type={$UCASE.text}, expression={$e.st})
      | ^(LCASE e=expression) -> builtInCall(type={$LCASE.text}, expression={$e.st})
      | ^(ENCODE_FOR_URI e=expression) -> builtInCall(type={$ENCODE_FOR_URI.text}, expression={$e.st})
      | ^(CONTAINS e=expression) -> builtInCall(type={$CONTAINS.text}, expression={$e.st})
      | ^(STRSTARTS e=expression) -> builtInCall(type={$STRSTARTS.text}, expression={$e.st})
      | ^(STRENDS e=expression) -> builtInCall(type={$STRENDS.text}, expression={$e.st})
      | ^(YEAR e=expression) -> builtInCall(type={$YEAR.text}, expression={$e.st})
      | ^(MONTH e=expression) -> builtInCall(type={$MONTH.text}, expression={$e.st})
      | ^(DAY e=expression) -> builtInCall(type={$DAY.text}, expression={$e.st})
  
negative.code:     ;
  
  subSelect
      : ^(SUBSELECT (w+=whereClause)* (s=solutionModifier)) -> subSelect(whereClause={$w}, solutionModifier={$s.st})
      ;
      	
  selectClause
  