Skip to content

Commit

Permalink
Disallow empty regex in PQ+
Browse files Browse the repository at this point in the history
Change-Id: Ifcda331007866616e6bd079e8d331dec9d1f880a
Reviewed-on: https://korap.ids-mannheim.de/gerrit/c/KorAP/Koral/+/7512
Reviewed-by: Nils Diewald <nils@diewald-online.de>
  • Loading branch information
Akron committed Sep 13, 2023
1 parent d964323 commit 56dcb86
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/main/antlr/poliqarpplus/Regex.g4
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ fragment RE_chgroup : '[' '^'? RE_char+ ']';
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 | '\'' | ':' )* ('"'|''|'');
fragment RE_dquote : ('"'|''|'') (RE_expr | '\'' | ':' )+ ('"'|''|'');
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void dquoutes () {

// 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
Expand All @@ -68,7 +68,7 @@ public void dquoutes () {
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(
Expand Down

0 comments on commit 56dcb86

Please sign in to comment.