opPROX: PROX_REMAIN defined as a complementary class.
Change-Id: I520a6aa678d74764dbe4ed4a1ddf0708a8b75dba
diff --git a/src/main/antlr/cosmas/c2ps_opPROX.g b/src/main/antlr/cosmas/c2ps_opPROX.g
index 73ee879..0d8ba77 100644
--- a/src/main/antlr/cosmas/c2ps_opPROX.g
+++ b/src/main/antlr/cosmas/c2ps_opPROX.g
@@ -37,15 +37,8 @@
// trying to catch everything (at the end of the option sequence) that should not appear inside the prox. options:
// e.g. /w5umin -> remain = 'umin'.
-//PROX_REMAIN
-// : (',')? ('b'..'h'|'j'..'l'|'n'|'o'|'q'|'r'|'u'|'v'|'y'|'z'|'B'..'H'|'J'..'L'|'N'|'O'|'Q'|'R'|'U'|'V'|'Y'|'Z') (~ ' ')* ;
-
-//PROX_REMAIN
-// : (',')? ~('a'|'i'|'m'|'p'|'s'|'t'|'w'|'x'|'A'|'I'|'M'|'P'|'S'|'T'|'W'|'X'|' ') (~ (' '))*;
-
PROX_REMAIN
- : ',' ~('a'|'i'|'m'|'p'|'s'|'t'|'w'|'x'|'A'|'I'|'M'|'P'|'S'|'T'|'W'|'X'|'0'..'9') (~ ' ')*
- | ~('a'|'i'|'m'|'p'|'s'|'t'|'w'|'x'|'A'|'I'|'M'|'P'|'S'|'T'|'W'|'X'|'0'..'9') (~ ' ')*;
+ : ~(','|'a'|'i'|'m'|'n'|'p'|'s'|'t'|'w'|'x'|'A'|'I'|'M'|'N'|'P'|'S'|'T'|'W'|'X'|'0'..'9'|'+'|'-'|':'|'/'|'%') (~ ' ')* ;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
diff --git a/src/test/java/de/ids_mannheim/korap/test/cosmas2/Cosmas2QueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/test/cosmas2/Cosmas2QueryProcessorTest.java
index bb4319c..3fcfba3 100644
--- a/src/test/java/de/ids_mannheim/korap/test/cosmas2/Cosmas2QueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/test/cosmas2/Cosmas2QueryProcessorTest.java
@@ -513,6 +513,24 @@
@Test
public void testOPPROX () throws JsonProcessingException, IOException {
+
+ // test unknown proximity options:
+
+ query = "ab /+w1:2u,p cd";
+ qs.setQuery(query, "cosmas2");
+ res = mapper.readTree(qs.toJSON());
+ //System.out.printf("Query '%s': returns: '%s'.\n", query, res.toPrettyString()) ;
+ //System.out.printf("Query '%s': context: '%s'.\n", query, res.get("@context").toPrettyString()) ;
+ //System.out.printf("Query '%s': errors : '%s'.\n", query, res.get("errors").toPrettyString()) ;
+ System.out.printf("Query '%s': errorCode: '%s'.\n", query, res.get("errors").get(0).get(0).toPrettyString()) ;
+ System.out.printf("Query '%s': errorText : '%s'.\n", query, res.get("errors").get(0).get(1).toPrettyString()) ;
+ System.out.printf("Query '%s': errorPos : '%s'.\n", query, res.get("errors").get(0).get(2).toPrettyString()) ;
+
+ assertTrue("Error code expected!",!res.get("errors").isNull());
+ assertTrue("Error code expected!", res.get("errors").get(0).get(0).isInt());
+ assertEquals(StatusCodes.ERR_PROX_WRONG_CHARS, res.get("errors").get(0).get(0).asInt());
+
+
query = "Sonne /+w1:4 Mond";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());