Skip to content

Commit

Permalink
Adjust grammar to correctly handle also ConstantFirst comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
rartino committed Dec 1, 2021
1 parent ca30af5 commit 10fa7ef
Show file tree
Hide file tree
Showing 72 changed files with 4,098 additions and 3,501 deletions.
25 changes: 13 additions & 12 deletions optimade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2492,20 +2492,19 @@ The Filter Language EBNF Grammar
(* Values *)
Constant = String | Number ;
OrderedConstant = String | Number ;
UnorderedConstant = ( TRUE | FALSE ) ;
Value = ( OrderedValue | UnorderedValue ) ;
Value = ( UnorderedConstant | OrderedValue ) ;
OrderedValue = String | Number | Property ;
OrderedValue = ( OrderedConstant | Property ) ;
(* Note: support for Property in OrderedValue is OPTIONAL *)
UnorderedValue = ( TRUE | FALSE ) ;
ValueListEntry = ( Value | ValueEqRhs | ValueIneqRhs ) ;
(* Support for Operator in ValueListEntry is OPTIONAL *)
ValueList = ( Value | EqOperator, Value | IneqOperator, OrderedValue ), { Comma, ( Value | EqOperator, Value | IneqOperator, OrderedValue ) } ;
(* Support for Operator in ValueList is OPTIONAL *)
ValueZip = ( Value | EqOperator, Value | IneqOperator, OrderedValue ), Colon, ( Value | EqOperator, Value | IneqOperator, OrderedValue ), { Colon, ( Value | EqOperator, Value | IneqOperator, OrderedValue ) } ;
(* Support for Operator in ValueZip is OPTIONAL *)
ValueList = ValueListEntry, { Comma, ValueListEntry } ;
ValueZip = ValueListEntry, Colon, ValueListEntry, { Colon, ValueListEntry } ;
ValueZipList = ValueZip, { Comma, ValueZip } ;
Expand All @@ -2521,17 +2520,19 @@ The Filter Language EBNF Grammar
| PropertyFirstComparison ;
(* Note: support for ConstantFirstComparison is OPTIONAL *)
ConstantFirstComparison = Constant, ValueOpRhs ;
ConstantFirstComparison = ( OrderedConstant, ValueOpRhs
| UnorderedConstant, ValueEqRhs ) ;
PropertyFirstComparison = Property, ( ValueEqRhs
| ValueIneqRhs
PropertyFirstComparison = Property, ( ValueOpRhs
| KnownOpRhs
| FuzzyStringOpRhs
| SetOpRhs
| SetZipOpRhs
| LengthOpRhs ) ;
(* Note: support for SetZipOpRhs in Comparison is OPTIONAL *)
ValueOpRhs = ( ValueEqRhs | ValueIneqRhs ) ;
ValueEqRhs = EqOperator, Value ;
ValueIneqRhs = IneqOperator, OrderedValue ;
Expand Down
73 changes: 39 additions & 34 deletions tests/outputs/Filter_001.out
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ Filter(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 2
ValueOpRhs(9999)
Operator(9999)
TOKEN_30(9999): ">", line: 1, col: 3
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 4
Value(9999)
Property(9999)
Identifier(9999)
LowercaseLetter(9999)
TOKEN_83(9999): "b", line: 1, col: 5
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 6
ValueIneqRhs(9999)
IneqOperator(9999)
TOKEN_30(9999): ">", line: 1, col: 3
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 4
OrderedValue(9999)
Property(9999)
Identifier(9999)
LowercaseLetter(9999)
TOKEN_83(9999): "b", line: 1, col: 5
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 6
AND(9999)
TOKEN_35(9999): "AND", line: 1, col: 7
Spaces(9999)
Expand All @@ -48,19 +49,21 @@ Filter(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 13
ValueOpRhs(9999)
Operator(9999)
TOKEN_30(9999): ">", line: 1, col: 14
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 15
Value(9999)
Number(9999)
Digits(9999)
Digit(9999)
TOKEN_16(9999): "0", line: 1, col: 16
ValueIneqRhs(9999)
IneqOperator(9999)
TOKEN_30(9999): ">", line: 1, col: 14
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 17
TOKEN_1(9999): " ", line: 1, col: 15
OrderedValue(9999)
OrderedConstant(9999)
Number(9999)
Digits(9999)
Digit(9999)
TOKEN_16(9999): "0", line: 1, col: 16
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 17
OR(9999)
TOKEN_60(9999): "OR", line: 1, col: 18
Spaces(9999)
Expand All @@ -79,16 +82,18 @@ Filter(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 22
ValueOpRhs(9999)
Operator(9999)
TOKEN_30(9999): ">", line: 1, col: 23
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 24
Value(9999)
Number(9999)
Digits(9999)
Digit(9999)
TOKEN_16(9999): "0", line: 1, col: 25
ValueIneqRhs(9999)
IneqOperator(9999)
TOKEN_30(9999): ">", line: 1, col: 23
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 24
OrderedValue(9999)
OrderedConstant(9999)
Number(9999)
Digits(9999)
Digit(9999)
TOKEN_16(9999): "0", line: 1, col: 25
ClosingBrace(9999)
TOKEN_9(9999): ")", line: 1, col: 26
Spaces(9999)
Expand Down
37 changes: 20 additions & 17 deletions tests/outputs/Filter_002.out
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ Filter(9999)
LowercaseLetter(9999)
TOKEN_82(9999): "a", line: 1, col: 6
ValueOpRhs(9999)
Operator(9999)
TOKEN_30(9999): ">", line: 1, col: 7
Value(9999)
Property(9999)
Identifier(9999)
LowercaseLetter(9999)
TOKEN_83(9999): "b", line: 1, col: 8
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 9
ValueIneqRhs(9999)
IneqOperator(9999)
TOKEN_30(9999): ">", line: 1, col: 7
OrderedValue(9999)
Property(9999)
Identifier(9999)
LowercaseLetter(9999)
TOKEN_83(9999): "b", line: 1, col: 8
Spaces(9999)
Space(9999)
TOKEN_1(9999): " ", line: 1, col: 9
AND(9999)
TOKEN_35(9999): "AND", line: 1, col: 10
Spaces(9999)
Expand All @@ -44,13 +45,15 @@ Filter(9999)
LowercaseLetter(9999)
TOKEN_105(9999): "x", line: 1, col: 14
ValueOpRhs(9999)
Operator(9999)
TOKEN_30(9999): ">", line: 1, col: 15
Value(9999)
Number(9999)
Digits(9999)
Digit(9999)
TOKEN_16(9999): "0", line: 1, col: 16
ValueIneqRhs(9999)
IneqOperator(9999)
TOKEN_30(9999): ">", line: 1, col: 15
OrderedValue(9999)
OrderedConstant(9999)
Number(9999)
Digits(9999)
Digit(9999)
TOKEN_16(9999): "0", line: 1, col: 16
ClosingBrace(9999)
TOKEN_9(9999): ")", line: 1, col: 17
Spaces(9999)
Expand Down
39 changes: 21 additions & 18 deletions tests/outputs/Filter_003.out
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ Filter(9999)
LowercaseLetter(9999)
TOKEN_82(9999): "a", line: 1, col: 6
ValueOpRhs(9999)
Operator(9999)
TOKEN_30(9999): ">", line: 1, col: 7
Value(9999)
Property(9999)
Identifier(9999)
LowercaseLetter(9999)
TOKEN_83(9999): "b", line: 1, col: 8
ValueIneqRhs(9999)
IneqOperator(9999)
TOKEN_30(9999): ">", line: 1, col: 7
OrderedValue(9999)
Property(9999)
Identifier(9999)
LowercaseLetter(9999)
TOKEN_83(9999): "b", line: 1, col: 8
ClosingBrace(9999)
TOKEN_9(9999): ")", line: 1, col: 9
Spaces(9999)
Expand All @@ -46,14 +47,16 @@ Filter(9999)
LowercaseLetter(9999)
TOKEN_105(9999): "x", line: 1, col: 15
ValueOpRhs(9999)
Operator(9999)
TOKEN_30(9999): ">", line: 1, col: 16
Value(9999)
Number(9999)
Digits(9999)
Digit(9999)
TOKEN_16(9999): "0", line: 1, col: 17
Spaces(9999)
Space(9999)
nl(9999)
SPECIAL_1(9999): "(...)", line: 1, col: 18
ValueIneqRhs(9999)
IneqOperator(9999)
TOKEN_30(9999): ">", line: 1, col: 16
OrderedValue(9999)
OrderedConstant(9999)
Number(9999)
Digits(9999)
Digit(9999)
TOKEN_16(9999): "0", line: 1, col: 17
Spaces(9999)
Space(9999)
nl(9999)
SPECIAL_1(9999): "(...)", line: 1, col: 18
Loading

0 comments on commit 10fa7ef

Please sign in to comment.