gws.lib.cql.parser

CQL2-Text parser.

Source code: gws.lib.cql.parser

Module Contents

class gws.lib.cql.parser.C

Operator, keyword and function sets of the parser.

ADDITIVE_OPERATORS

Additive operators, also used as unary signs.

ARRAY_FUNCTIONS

Functions whose parenthesized arguments are array literals.

COMPARISON_OPERATORS

Comparison operators.

FUNCTIONS

Standard functions and their number of arguments.

KEYWORDS

Reserved keywords.

LITERALS

Literal node types.

MULTIPLICATIVE_OPERATORS

Multiplicative operators.

NOT_EQUAL_OPERATORS

Not-equal operators, emitted as <>.

OPERATORS

All operators.

PATTERN_FUNCTIONS

Functions allowed as a LIKE pattern.

POWER_OPERATORS

Power operators.

PREDICATE_KEYWORDS

Keywords that can follow an operand in a predicate.

WKT_KEYWORDS

Geometry types that start a WKT literal.

class gws.lib.cql.parser.Node

Node types of the parse tree.

AND = 'AND'
ARRAY = 'ARRAY'
BETWEEN = 'BETWEEN'
BOOL = 'BOOL'
DATE = 'DATE'
FLOAT = 'FLOAT'
FUNCTION = 'FUNCTION'
IN = 'IN'
INT = 'INT'
IS_NULL = 'IS_NULL'
LIKE = 'LIKE'
NAME = 'NAME'
NOT = 'NOT'
NOT_BETWEEN = 'NOT_BETWEEN'
NOT_IN = 'NOT_IN'
NOT_LIKE = 'NOT_LIKE'
NOT_NULL = 'NOT_NULL'
OR = 'OR'
STRING = 'STRING'
TIMESTAMP = 'TIMESTAMP'
USER_FUNCTION = 'USER_FUNCTION'
WKT = 'WKT'
gws.lib.cql.parser.parse(s: str)

Parse a CQL2-Text expression.

Parameters:

s – CQL2-Text expression.

Returns:

A parse tree of nested lists, see the package documentation.

Raises:

ParseError – If the expression is invalid.

exception gws.lib.cql.parser.ParseError

Bases: Exception

A CQL2-Text expression is invalid. The message contains the error position.