Skip to content

cql2 does not accept single character attribute names #144

Description

@mikemahoney218-usgs

Right now, single character attributes cannot be used in CQL2 filters:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions