Prox...

Change-Id: I4287658e0157593eb934fe1723df8ea1bb4fdc26
diff --git a/src/main/antlr/cosmas/c2ps_opPROX.g b/src/main/antlr/cosmas/c2ps_opPROX.g
index eda044e..4e80d82 100644
--- a/src/main/antlr/cosmas/c2ps_opPROX.g
+++ b/src/main/antlr/cosmas/c2ps_opPROX.g
@@ -90,19 +90,16 @@
 */
 
 // new rule: accepts options in any order:
-// but how to handle multiple values for those options?
+// count each option type and find out if any one  is missing or occures multiple times.
 // 28.11.23/FB
 
 proxDist
-@init{ int countM=0;}
+@init{ int countM=0; int countD=0; int countV=0;}
 	:
-		//((m=proxMeasure {countM++;})|d=proxDirection|v=proxDistValue)+ {countM == 1}? 
-		
-		((m=proxMeasure {countM++;})|d=proxDirection|v=proxDistValue)+ 
-		      
-	->  {c2ps_opPROX.encodeDIST(DIST, DIR, $d.tree, $m.tree, $v.tree, $proxDist.text, countM)};
+		(m=proxMeasure {countM++;}|d=proxDirection {countD++;}|v=proxDistValue {countV++;} )+
+		 
+	->  {c2ps_opPROX.encodeDIST(DIST, DIR, $d.tree, $m.tree, $v.tree, $proxDist.text, $proxDist.index, countD, countM, countV)};
 	
-//	->  {c2ps_opPROX.checkDIST($proxDist.text) == true } ? {c2ps_opPROX.encodeDIST(DIST, DIR, $d.tree, $m.tree, $v.tree, $proxDist.text)};
 
 // new rule accepts only '+' and '-'; default tree for direction is 
 // set in c2ps_opPROX.encodeDIST() now.
@@ -117,12 +114,6 @@
 		-> {$m2.text != null}? ^(RANGE $m1  $m2)
 		->				       ^(RANGE VAL0 $m1);
 
-/* calling c2ps_opPROX.checkMeasure() as a check will not compile by ANTLR,
-   reason unknown! 01.12.23/FB
-proxMeasure
-	:	(meas='w'|meas='s'|meas='p'|meas='t') -> {c2ps_opPROX.checkMeasure($meas)} ? ^(MEAS $meas) ;  
-*/
-
 // mentioning >1 measures will be checked/rejected in c2ps_opPROX.encodeDIST(). 
 
 proxMeasure
@@ -137,4 +128,4 @@
 proxGroup
 	:	'min' -> ^(GRP MIN)
 	|	'max' -> ^(GRP MAX);
-	
+	
\ No newline at end of file
diff --git a/src/main/java/de/ids_mannheim/korap/query/parse/cosmas/c2ps_opPROX.java b/src/main/java/de/ids_mannheim/korap/query/parse/cosmas/c2ps_opPROX.java
index efa5a41..efad8a3 100644
--- a/src/main/java/de/ids_mannheim/korap/query/parse/cosmas/c2ps_opPROX.java
+++ b/src/main/java/de/ids_mannheim/korap/query/parse/cosmas/c2ps_opPROX.java
@@ -35,17 +35,19 @@
 	 * 28.11.23/FB
 	 */
 	
-	public static Object encodeDIST(int typeDIST, int typeDIR, Object ctDir, Object ctMeas, Object ctVal, String text, int countM)  
-			//throws C2RecognitionException 
+	public static Object encodeDIST(int typeDIST, int typeDIR, Object ctDir, Object ctMeas, Object ctVal, String text, int start,
+									int countD, int countM, int countV)  
+			
 	{
 		boolean multiple = false;
 		CommonTree tree1 = (CommonTree)ctDir;
 		CommonTree tree2 = (CommonTree)ctMeas;
 		CommonTree tree3 = (CommonTree)ctVal;
-		
-		System.err.printf("Debug: encodeDIST: scanned input='%s' countM=%d.\n", text, countM);
+		//String text = "for debugging only";
+		int pos = -1;
+		System.err.printf("Debug: encodeDIST: scanned input='%s' start=%d countM=%d countD=%d countV=%d.\n", 
+					text, start, countM, countD, countV);
 
-		
 		if( duplicateOptions(text) == true )
 			{
 			CommonTree errorTree, errorNode, errorPos, errorArg, errorMes;