From 0dfa147bb19b45bdef5942317821d99360074ddd Mon Sep 17 00:00:00 2001 From: Andrius Merkys Date: Thu, 2 Jun 2022 16:45:01 +0200 Subject: [PATCH 1/5] Including `FuzzyStringOpRhs` in `ValueListEntry`. --- optimade.rst | 2 +- tests/outputs/Filter_037.out | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/optimade.rst b/optimade.rst index 874ed765b..84c4de8f8 100644 --- a/optimade.rst +++ b/optimade.rst @@ -2537,7 +2537,7 @@ The Filter Language EBNF Grammar OrderedValue = ( OrderedConstant | Property ) ; (* Note: support for Property in OrderedValue is OPTIONAL *) - ValueListEntry = ( Value | ValueEqRhs | ValueRelCompRhs ) ; + ValueListEntry = ( Value | ValueEqRhs | ValueRelCompRhs | FuzzyStringOpRhs ) ; (* Note: support for ValueEqRhs and ValueRelCompRhs in ValueListEntry are OPTIONAL *) ValueList = ValueListEntry, { Comma, ValueListEntry } ; diff --git a/tests/outputs/Filter_037.out b/tests/outputs/Filter_037.out index 816de0f1f..84264bb5a 100644 --- a/tests/outputs/Filter_037.out +++ b/tests/outputs/Filter_037.out @@ -70,7 +70,8 @@ Error: in tests/cases/Filter_037.inp: line 1: "-", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "_", - "!", "=", "<", ">", "ONLY", "ALL", or "ANY" + "!", "=", "<", ">", "CONTAINS", "STARTS", "ENDS", "ONLY", "ALL", + or "ANY" elements:element_counts HAS IS 'H':6,'He':7 ^ From 4fb4dac54c808629a223586d13535d42d7c94a5b Mon Sep 17 00:00:00 2001 From: Andrius Merkys Date: Thu, 2 Jun 2022 16:55:12 +0200 Subject: [PATCH 2/5] Adding `FuzzyStringOpRhs` to `SetOpRhs`. --- optimade.rst | 2 +- tests/outputs/Filter_032.out | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/optimade.rst b/optimade.rst index 84c4de8f8..0e009c8d3 100644 --- a/optimade.rst +++ b/optimade.rst @@ -2580,7 +2580,7 @@ The Filter Language EBNF Grammar | STARTS, [ WITH ], Value | ENDS, [ WITH ], Value ; - SetOpRhs = HAS, ( ( Value | EqualityOperator, Value | RelativeComparisonOperator, OrderedValue ) | ALL, ValueList | ANY, ValueList | ONLY, ValueList ) ; + SetOpRhs = HAS, ( ( Value | EqualityOperator, Value | RelativeComparisonOperator, OrderedValue | FuzzyStringOpRhs ) | ALL, ValueList | ANY, ValueList | ONLY, ValueList ) ; (* Note: support for the alternatives with EqualityOperator, RelativeComparisonOperator, and ONLY in SetOpRhs are OPTIONAL *) SetZipOpRhs = PropertyZipAddon, HAS, ( ValueZip | ONLY, ValueZipList | ALL, ValueZipList | ANY, ValueZipList ) ; diff --git a/tests/outputs/Filter_032.out b/tests/outputs/Filter_032.out index dfa5d9ace..2b6a497d9 100644 --- a/tests/outputs/Filter_032.out +++ b/tests/outputs/Filter_032.out @@ -37,7 +37,8 @@ Error: in tests/cases/Filter_032.inp: line 1: "-", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "_", - "!", "=", "<", ">", "ALL", "ANY", or "ONLY" + "!", "=", "<", ">", "CONTAINS", "STARTS", "ENDS", "ALL", "ANY", or + "ONLY" elements HAS IS "H" ^ From 198dac1f87e7ff79a72fa064c0ba8b6341a7026b Mon Sep 17 00:00:00 2001 From: Andrius Merkys Date: Thu, 2 Jun 2022 16:55:28 +0200 Subject: [PATCH 3/5] Adding some tests. --- tests/cases/Filter_080.inp | 1 + tests/cases/Filter_080.opt | 1 + tests/cases/Filter_081.inp | 1 + tests/cases/Filter_081.opt | 1 + tests/outputs/Filter_080.out | 103 +++++++++++++++++++++++++++++++++++ tests/outputs/Filter_081.out | 64 ++++++++++++++++++++++ 6 files changed, 171 insertions(+) create mode 100644 tests/cases/Filter_080.inp create mode 120000 tests/cases/Filter_080.opt create mode 100644 tests/cases/Filter_081.inp create mode 100644 tests/cases/Filter_081.opt create mode 100644 tests/outputs/Filter_080.out create mode 100644 tests/outputs/Filter_081.out diff --git a/tests/cases/Filter_080.inp b/tests/cases/Filter_080.inp new file mode 100644 index 000000000..1672e7e49 --- /dev/null +++ b/tests/cases/Filter_080.inp @@ -0,0 +1 @@ +name:surname HAS STARTS WITH "J":CONTAINS "Doe" diff --git a/tests/cases/Filter_080.opt b/tests/cases/Filter_080.opt new file mode 120000 index 000000000..e285e85c8 --- /dev/null +++ b/tests/cases/Filter_080.opt @@ -0,0 +1 @@ +Filter_001.opt \ No newline at end of file diff --git a/tests/cases/Filter_081.inp b/tests/cases/Filter_081.inp new file mode 100644 index 000000000..c1519e9db --- /dev/null +++ b/tests/cases/Filter_081.inp @@ -0,0 +1 @@ +title HAS ENDS WITH "MOF" diff --git a/tests/cases/Filter_081.opt b/tests/cases/Filter_081.opt new file mode 100644 index 000000000..9e317c21e --- /dev/null +++ b/tests/cases/Filter_081.opt @@ -0,0 +1 @@ +tests/generated/Filter.g diff --git a/tests/outputs/Filter_080.out b/tests/outputs/Filter_080.out new file mode 100644 index 000000000..662240b62 --- /dev/null +++ b/tests/outputs/Filter_080.out @@ -0,0 +1,103 @@ +Parse tree from tests/cases/Filter_080.inp: +Filter(9999) + Expression(9999) + ExpressionClause(9999) + ExpressionPhrase(9999) + Comparison(9999) + PropertyFirstComparison(9999) + Property(9999) + Identifier(9999) + LowercaseLetter(9999) + TOKEN_95(9999): "n", line: 1, col: 1 + LowercaseLetter(9999) + TOKEN_82(9999): "a", line: 1, col: 2 + LowercaseLetter(9999) + TOKEN_94(9999): "m", line: 1, col: 3 + LowercaseLetter(9999) + TOKEN_86(9999): "e", line: 1, col: 4 + SetZipOpRhs(9999) + PropertyZipAddon(9999) + Colon(9999) + TOKEN_26(9999): ":", line: 1, col: 5 + Property(9999) + Identifier(9999) + LowercaseLetter(9999) + TOKEN_100(9999): "s", line: 1, col: 6 + LowercaseLetter(9999) + TOKEN_102(9999): "u", line: 1, col: 7 + LowercaseLetter(9999) + TOKEN_99(9999): "r", line: 1, col: 8 + LowercaseLetter(9999) + TOKEN_95(9999): "n", line: 1, col: 9 + LowercaseLetter(9999) + TOKEN_82(9999): "a", line: 1, col: 10 + LowercaseLetter(9999) + TOKEN_94(9999): "m", line: 1, col: 11 + LowercaseLetter(9999) + TOKEN_86(9999): "e", line: 1, col: 12 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 13 + HAS(9999) + TOKEN_47(9999): "HAS", line: 1, col: 14 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 17 + ValueZip(9999) + ValueListEntry(9999) + FuzzyStringOpRhs(9999) + STARTS(9999) + TOKEN_65(9999): "STARTS", line: 1, col: 18 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 24 + WITH(9999) + TOKEN_72(9999): "WITH", line: 1, col: 25 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 29 + Value(9999) + OrderedValue(9999) + OrderedConstant(9999) + String(9999) + TOKEN_3(9999): """, line: 1, col: 30 + EscapedChar(9999) + UnescapedChar(9999) + Letter(9999) + UppercaseLetter(9999) + TOKEN_50(9999): "J", line: 1, col: 31 + TOKEN_3(9999): """, line: 1, col: 32 + Colon(9999) + TOKEN_26(9999): ":", line: 1, col: 33 + ValueListEntry(9999) + FuzzyStringOpRhs(9999) + CONTAINS(9999) + TOKEN_39(9999): "CONTAINS", line: 1, col: 34 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 42 + Value(9999) + OrderedValue(9999) + OrderedConstant(9999) + String(9999) + TOKEN_3(9999): """, line: 1, col: 43 + EscapedChar(9999) + UnescapedChar(9999) + Letter(9999) + UppercaseLetter(9999) + TOKEN_40(9999): "D", line: 1, col: 44 + EscapedChar(9999) + UnescapedChar(9999) + Letter(9999) + LowercaseLetter(9999) + TOKEN_96(9999): "o", line: 1, col: 45 + EscapedChar(9999) + UnescapedChar(9999) + Letter(9999) + LowercaseLetter(9999) + TOKEN_86(9999): "e", line: 1, col: 46 + TOKEN_3(9999): """, line: 1, col: 47 + Spaces(9999) + Space(9999) + nl(9999) + SPECIAL_1(9999): "(...)", line: 1, col: 48 diff --git a/tests/outputs/Filter_081.out b/tests/outputs/Filter_081.out new file mode 100644 index 000000000..de23142af --- /dev/null +++ b/tests/outputs/Filter_081.out @@ -0,0 +1,64 @@ +Parse tree from tests/cases/Filter_081.inp: +Filter(9999) + Expression(9999) + ExpressionClause(9999) + ExpressionPhrase(9999) + Comparison(9999) + PropertyFirstComparison(9999) + Property(9999) + Identifier(9999) + LowercaseLetter(9999) + TOKEN_101(9999): "t", line: 1, col: 1 + LowercaseLetter(9999) + TOKEN_90(9999): "i", line: 1, col: 2 + LowercaseLetter(9999) + TOKEN_101(9999): "t", line: 1, col: 3 + LowercaseLetter(9999) + TOKEN_93(9999): "l", line: 1, col: 4 + LowercaseLetter(9999) + TOKEN_86(9999): "e", line: 1, col: 5 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 6 + SetOpRhs(9999) + HAS(9999) + TOKEN_47(9999): "HAS", line: 1, col: 7 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 10 + FuzzyStringOpRhs(9999) + ENDS(9999) + TOKEN_42(9999): "ENDS", line: 1, col: 11 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 15 + WITH(9999) + TOKEN_72(9999): "WITH", line: 1, col: 16 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 20 + Value(9999) + OrderedValue(9999) + OrderedConstant(9999) + String(9999) + TOKEN_3(9999): """, line: 1, col: 21 + EscapedChar(9999) + UnescapedChar(9999) + Letter(9999) + UppercaseLetter(9999) + TOKEN_55(9999): "M", line: 1, col: 22 + EscapedChar(9999) + UnescapedChar(9999) + Letter(9999) + UppercaseLetter(9999) + TOKEN_58(9999): "O", line: 1, col: 23 + EscapedChar(9999) + UnescapedChar(9999) + Letter(9999) + UppercaseLetter(9999) + TOKEN_43(9999): "F", line: 1, col: 24 + TOKEN_3(9999): """, line: 1, col: 25 + Spaces(9999) + Space(9999) + nl(9999) + SPECIAL_1(9999): "(...)", line: 1, col: 26 From 74accdc44ef8d3dd21af1a7c7ce3ac83062bc9d4 Mon Sep 17 00:00:00 2001 From: Andrius Merkys Date: Thu, 2 Jun 2022 16:56:20 +0200 Subject: [PATCH 4/5] Adding yet another test. --- tests/cases/Filter_082.inp | 1 + tests/cases/Filter_082.opt | 1 + tests/outputs/Filter_082.out | 67 ++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 tests/cases/Filter_082.inp create mode 100644 tests/cases/Filter_082.opt create mode 100644 tests/outputs/Filter_082.out diff --git a/tests/cases/Filter_082.inp b/tests/cases/Filter_082.inp new file mode 100644 index 000000000..09f442ce4 --- /dev/null +++ b/tests/cases/Filter_082.inp @@ -0,0 +1 @@ +elements HAS ALL STARTS WITH "S" diff --git a/tests/cases/Filter_082.opt b/tests/cases/Filter_082.opt new file mode 100644 index 000000000..9e317c21e --- /dev/null +++ b/tests/cases/Filter_082.opt @@ -0,0 +1 @@ +tests/generated/Filter.g diff --git a/tests/outputs/Filter_082.out b/tests/outputs/Filter_082.out new file mode 100644 index 000000000..f73cf40e4 --- /dev/null +++ b/tests/outputs/Filter_082.out @@ -0,0 +1,67 @@ +Parse tree from tests/cases/Filter_082.inp: +Filter(9999) + Expression(9999) + ExpressionClause(9999) + ExpressionPhrase(9999) + Comparison(9999) + PropertyFirstComparison(9999) + Property(9999) + Identifier(9999) + LowercaseLetter(9999) + TOKEN_86(9999): "e", line: 1, col: 1 + LowercaseLetter(9999) + TOKEN_93(9999): "l", line: 1, col: 2 + LowercaseLetter(9999) + TOKEN_86(9999): "e", line: 1, col: 3 + LowercaseLetter(9999) + TOKEN_94(9999): "m", line: 1, col: 4 + LowercaseLetter(9999) + TOKEN_86(9999): "e", line: 1, col: 5 + LowercaseLetter(9999) + TOKEN_95(9999): "n", line: 1, col: 6 + LowercaseLetter(9999) + TOKEN_101(9999): "t", line: 1, col: 7 + LowercaseLetter(9999) + TOKEN_100(9999): "s", line: 1, col: 8 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 9 + SetOpRhs(9999) + HAS(9999) + TOKEN_47(9999): "HAS", line: 1, col: 10 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 13 + ALL(9999) + TOKEN_34(9999): "ALL", line: 1, col: 14 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 17 + ValueList(9999) + ValueListEntry(9999) + FuzzyStringOpRhs(9999) + STARTS(9999) + TOKEN_65(9999): "STARTS", line: 1, col: 18 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 24 + WITH(9999) + TOKEN_72(9999): "WITH", line: 1, col: 25 + Spaces(9999) + Space(9999) + TOKEN_1(9999): " ", line: 1, col: 29 + Value(9999) + OrderedValue(9999) + OrderedConstant(9999) + String(9999) + TOKEN_3(9999): """, line: 1, col: 30 + EscapedChar(9999) + UnescapedChar(9999) + Letter(9999) + UppercaseLetter(9999) + TOKEN_64(9999): "S", line: 1, col: 31 + TOKEN_3(9999): """, line: 1, col: 32 + Spaces(9999) + Space(9999) + nl(9999) + SPECIAL_1(9999): "(...)", line: 1, col: 33 From 9976882071068e725cf593439da06180f62a2eb5 Mon Sep 17 00:00:00 2001 From: Andrius Merkys Date: Thu, 2 Jun 2022 16:57:06 +0200 Subject: [PATCH 5/5] New features are OPTIONAL. --- optimade.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/optimade.rst b/optimade.rst index 0e009c8d3..44cb8ca7e 100644 --- a/optimade.rst +++ b/optimade.rst @@ -2538,7 +2538,7 @@ The Filter Language EBNF Grammar (* Note: support for Property in OrderedValue is OPTIONAL *) ValueListEntry = ( Value | ValueEqRhs | ValueRelCompRhs | FuzzyStringOpRhs ) ; - (* Note: support for ValueEqRhs and ValueRelCompRhs in ValueListEntry are OPTIONAL *) + (* Note: support for ValueEqRhs, ValueRelCompRhs and FuzzyStringOpRhs in ValueListEntry are OPTIONAL *) ValueList = ValueListEntry, { Comma, ValueListEntry } ; ValueZip = ValueListEntry, Colon, ValueListEntry, { Colon, ValueListEntry } ; @@ -2581,7 +2581,7 @@ The Filter Language EBNF Grammar | ENDS, [ WITH ], Value ; SetOpRhs = HAS, ( ( Value | EqualityOperator, Value | RelativeComparisonOperator, OrderedValue | FuzzyStringOpRhs ) | ALL, ValueList | ANY, ValueList | ONLY, ValueList ) ; - (* Note: support for the alternatives with EqualityOperator, RelativeComparisonOperator, and ONLY in SetOpRhs are OPTIONAL *) + (* Note: support for the alternatives with EqualityOperator, RelativeComparisonOperator, FuzzyStringOpRhs, and ONLY in SetOpRhs are OPTIONAL *) SetZipOpRhs = PropertyZipAddon, HAS, ( ValueZip | ONLY, ValueZipList | ALL, ValueZipList | ANY, ValueZipList ) ;