Skip to content

Commit

Permalink
Manually defined signed_int class in filtertranformer and grammar for…
Browse files Browse the repository at this point in the history
… length queries
  • Loading branch information
ml-evs committed Mar 9, 2020
1 parent ae7ccf1 commit b83c45c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions optimade/filtertransformers/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ def string(self, string):
# string: ESCAPED_STRING
return string.strip('"')

def signed_int(self, arg):
# signed_int : SIGNED_INT
return int(arg[0])

def number(self, arg):
# number: SIGNED_INT | SIGNED_FLOAT
token = arg[0]
Expand Down
5 changes: 4 additions & 1 deletion optimade/grammar/v0.10.1.lark
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ set_op_rhs: HAS ( [ OPERATOR ] value
| ONLY value_list )

// Note: support for [ OPERATOR ] is OPTIONAL
length_op_rhs: LENGTH [ OPERATOR ] SIGNED_INT
length_op_rhs: LENGTH [ OPERATOR ] signed_int

set_zip_op_rhs: property_zip_addon HAS ( value_zip | ONLY value_zip_list | ALL value_zip_list | ANY value_zip_list )
property_zip_addon: ":" property (":" property)*
Expand All @@ -63,6 +63,9 @@ string: ESCAPED_STRING
// Number token syntax
number: SIGNED_INT | SIGNED_FLOAT

// Custom signed int
signed_int: SIGNED_INT

// Tokens

// Boolean relations
Expand Down

0 comments on commit b83c45c

Please sign in to comment.