Skip to content

fix(cql2_text): allow single-letter property names - #173

Open
C1-BA-B1-F3 wants to merge 1 commit into
geopython:mainfrom
C1-BA-B1-F3:fix/cql2-text-single-letter-attribute
Open

C1-BA-B1-F3 wants to merge 1 commit into
geopython:mainfrom
C1-BA-B1-F3:fix/cql2-text-single-letter-attribute

Conversation

@C1-BA-B1-F3

Copy link
Copy Markdown

Summary

The unquoted attribute regex in the cql2_text Lark grammar required at least two characters:

attribute: /[a-zA-Z][a-zA-Z_:0-9.]+/

So expressions with a single-letter property name like a = 1 or S_INTERSECTS(g, BBOX(...)) failed to parse with UnexpectedCharacters.

Changing the trailing .+ to .* accepts single-letter identifiers while keeping all existing behaviour.

Test plan

  • New regression tests test_single_letter_attribute and test_single_letter_attribute_in_function cover the fix.
  • pytest tests/parsers/cql2_text/ — 50/50 pass.
  • pytest tests/parsers tests/native tests/test_utils.py — 247/247 pass (backend suites requiring optional deps django/osgeo/elasticsearch/sqlalchemy were not run locally; the change is confined to the cql2_text grammar and does not touch backend code).

Fixes #165

The unquoted attribute regex /[a-zA-Z][a-zA-Z_:0-9.]+/ required at
least two characters, so expressions like 'a = 1' or 'S_INTERSECTS(g,
BBOX(...))' failed to parse.

Change the trailing .+ to .* so a single-letter identifier is accepted.

Fixes geopython#165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cql2-text: single-letter property names fail to parse (attribute token requires 2+ chars)

1 participant