diff --git a/CHANGELOG.md b/CHANGELOG.md index 707c0f6b7a8c98586ff72eb19df927ffd30a6d95..7996c53a80d5a7a363baa5bcddbec7e4bf0a6440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +* #131 - CQL Parsing error when white space characters before some units. * #134 - CQL Parsing error when multiple white space characters after `FROM`. * #130 - Error during `FIND ENTITY` when `QUERY_FILTER_ENTITIES_WITHOUT_RETRIEVE_PERMISSIONS=False`. diff --git a/src/main/java/org/caosdb/server/query/CQLParser.g4 b/src/main/java/org/caosdb/server/query/CQLParser.g4 index 6c6aa748c1c5196936b0581031ecaa0aa5605d66..b2e3cb5d74ba492836281291373425dbcc7281b8 100644 --- a/src/main/java/org/caosdb/server/query/CQLParser.g4 +++ b/src/main/java/org/caosdb/server/query/CQLParser.g4 @@ -495,8 +495,8 @@ number_with_unit unit : - TXT - | NUM SLASH TXT + (~(WHITE_SPACE | DOT))+ + | NUM SLASH (~(WHITE_SPACE | DOT))+ ; location returns [String str] diff --git a/src/test/java/org/caosdb/server/query/TestCQL.java b/src/test/java/org/caosdb/server/query/TestCQL.java index 62aeb5ed3f003090b54a1f3f7a384d0bd3e7fec4..154977a909a9d34ac2034c1ef352b81e7b2a3cb7 100644 --- a/src/test/java/org/caosdb/server/query/TestCQL.java +++ b/src/test/java/org/caosdb/server/query/TestCQL.java @@ -240,6 +240,7 @@ public class TestCQL { String queryIssue132a = "FIND ENTITY WHICH HAS BEEN INSERTED AFTER TODAY"; String queryIssue132b = "FIND ENTITY WHICH HAS BEEN CREATED TODAY BY ME"; String queryIssue134 = "SELECT pname FROM ename"; + String queryIssue131 = "FIND ENTITY WITH pname = 13 €"; // File paths /////////////////////////////////////////////////////////////// String filepath_verb01 = "/foo/"; @@ -6720,18 +6721,24 @@ public class TestCQL { assertEquals("TRANS(Insert,(,Today,Transactor(null,=))", sfq.filter.toString()); } - /* - * String queryIssue134 = "SELECT pname FROM ename"; + /** + * Multiple white space chars after `FROM`. + * + * <p>String queryIssue134 = "SELECT pname FROM ename"; */ @Test public void testIssue134() { - CQLLexer lexer; - lexer = new CQLLexer(CharStreams.fromString(this.queryIssue134)); - final CommonTokenStream tokens = new CommonTokenStream(lexer); - - final CQLParser parser = new CQLParser(tokens); - final CqContext sfq = parser.cq(); - Query q = new Query(this.queryIssue134); - q.parse(); + // must not throw ParsingException + new Query(this.queryIssue134).parse(); + } + /** + * Space before special character unit + * + * <p>String queryIssue131= "FIND ENTITY WITH pname = 13 €"; + */ + @Test + public void testIssue131() { + // must not throw ParsingException + new Query(this.queryIssue131).parse(); } }