Skip to content

Commit

Permalink
Update grammar.lark and test_parser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jokiefer committed Oct 24, 2023
1 parent 9a2d0ea commit 468cdf2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pygeofilter/parsers/ecql/grammar.lark
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@

attribute: NAME
| DOUBLE_QUOTED
| QUALIFIED_NAME

?literal: number
| BOOLEAN
Expand All @@ -113,6 +114,8 @@ BOOLEAN: ( "TRUE" | "FALSE" )
DOUBLE_QUOTED: "\"" /.*?/ "\""
SINGLE_QUOTED: "'" /.*?/ "'"

QUALIFIED_NAME: NAME ":" NAME

%import .wkt.ewkt_geometry
%import .iso8601.DATETIME
%import .iso8601.DURATION
Expand Down
8 changes: 8 additions & 0 deletions tests/parsers/ecql/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
from pygeofilter.parsers.ecql import parse


def test_namespace_attribute_eq_literal():
result = parse("ns:attr = 'A'")
assert result == ast.Equal(
ast.Attribute("ns:attr"),
"A",
)


def test_attribute_eq_literal():
result = parse("attr = 'A'")
assert result == ast.Equal(
Expand Down

0 comments on commit 468cdf2

Please sign in to comment.