Disallow empty regex in PQ+
Change-Id: Ifcda331007866616e6bd079e8d331dec9d1f880a
Reviewed-on: https://korap.ids-mannheim.de/gerrit/c/KorAP/Koral/+/7512
Reviewed-by: Nils Diewald <nils@diewald-online.de>
diff --git a/Changes b/Changes
index ecd5b3d..3e98baa 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+0.41 2023-09-13
+ - [bugfix] Disallow empty regex in PQ+ (diewald)
+
0.40 2023-07-26
- [feature] Initial support for CQP
(irimia, margaretha, diewald)
diff --git a/pom.xml b/pom.xml
index 8e38774..6bdd557 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<groupId>de.ids_mannheim.korap</groupId>
<artifactId>Koral</artifactId>
- <version>0.40.0</version>
+ <version>0.41.0</version>
<packaging>jar</packaging>
<name>Koral</name>
<url>https://korap.ids-mannheim.de</url>
diff --git a/src/main/antlr/poliqarpplus/Regex.g4 b/src/main/antlr/poliqarpplus/Regex.g4
index f83b395..48c9808 100644
--- a/src/main/antlr/poliqarpplus/Regex.g4
+++ b/src/main/antlr/poliqarpplus/Regex.g4
@@ -15,4 +15,4 @@
fragment RE_quant : ('.' | RE_char | RE_chgroup | ( '(' RE_expr ')')) ('?' | '*' | '+' | RE_focc) '?'?;
fragment RE_group : '(' RE_expr ')';
fragment RE_expr : ('.' | RE_char | RE_alter | RE_chgroup | RE_quant | RE_group | '^' )+;
-fragment RE_dquote : ('"'|'„'|'“') (RE_expr | '\'' | ':' )* ('"'|'“'|'”');
\ No newline at end of file
+fragment RE_dquote : ('"'|'„'|'“') (RE_expr | '\'' | ':' )+ ('"'|'“'|'”');
\ No newline at end of file
diff --git a/src/test/java/de/ids_mannheim/korap/query/test/poliqarpplus/PQGrammarTest.java b/src/test/java/de/ids_mannheim/korap/query/test/poliqarpplus/PQGrammarTest.java
index 536ae0c..2b45c6a 100644
--- a/src/test/java/de/ids_mannheim/korap/query/test/poliqarpplus/PQGrammarTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/test/poliqarpplus/PQGrammarTest.java
@@ -59,7 +59,7 @@
// how it behaves
assertEquals(
- "(request (query (segment (token (key (regex \"\"))))) <EOF>)",
+ "(request query <EOF>)", // see different behaviour of " and '; for ", the query is parsed and an empty regex is generated
treeString("\"\"\"")
);
// how it should behave
@@ -68,7 +68,7 @@
treeString("\"\"\"")
);
assertEquals(
- "(request (query (sequence (segment (token (key (regex \"\")))) (segment (token (key -key))))) <EOF>)", // see different behaviour of " and '; for ", the query is parsed and an empty regex is generated
+ "(request (query (segment (token (key -key)))) <EOF>)", // see different behaviour of " and '; for ", the query is parsed and an empty regex is generated
treeString("\"\"-key\"")
);
assertEquals(