geopython / geopython/pygeofilter
cql2 does not accept single character attribute names
- Dominant language
- Python
- Stars
- 90
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
Right now, single character attributes cannot be used in CQL2 filters:
```python
❯ pygeofilter parse cql2_text "a = 1"
Error: No terminal matches 'a' in the current parser context, at line 1 col 1
a = 1
^
Expected one of:
* INT
* S_CROSSES
* NOT
* MINUS
* S_OVERLAPS
* SINGLE_QUOTED
* S_TOUCHES
* S_INTERSECTS
* INCLUDE
* DOUBLE_QUOTED
* S_CONTAINS
* BOOLEAN
* EXCLUDE
* LPAR
* FLOAT
* S_EQUALS
* S_DISJOINT
* S_WITHIN
* ENVELOPE
* /[a-zA-Z][a-zA-Z_:0-9.]+/
```
The challenge is that final regex which doesn't match single character names:
https://github.com/geopython/pygeofilter/blob/main/pygeofilter/parsers/cql2_text/grammar.lark#L143
Contributor guide
Research direction
Start with the attribute-name terminal regex at line 143 of pygeofilter/parsers/cql2_text/grammar.lark and reproduce the issue using the provided pygeofilter parse cql2_text command. Adjust the grammar so a single-character attribute parses, then verify that both the reported case and existing multi-character attribute names continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100