Grammar

The grammar for the query language is as follows. When coding in C++ you would generally use the query building functions rather than the parsed query string (i.e. the below grammar is not used in that case as you use C++).

The grammar is inspired by the C++ query API, however it does support single quote strings (’) in addition to double quote (“).

Query : SelectAll | Select | CountAll | Count | EraseAll | Erase

SelectAll : select < ClassName > ( )

Select : select < ClassName > ( SetExpression )

EraseAll : erase < ClassName > ( )

Erase : erase < ClassName > ( SetExpression )

CountAll : count < ClassName > ( )

Count : count < ClassName > ( SetExpression )

SetExpression : SetOperation | FieldComparison | SelectAll | Select | SequenceExpression

FieldExpression : FieldName

ValueExpression : Constant | CountAll | Count

FieldComparison : ValueComparator ( FieldExpression, ValueExpression )
                 | SetComparator ( FieldExpression, SetExpression )

ValueComparator : eq | neq | gt | lt | gte | lte | match

SetComparator : in | not_in | any_in | all_in | noitemsin

SetOperation : SetOperator ( SetExpression, SetExpression )

SetOperator :  set_union | set_isect | set_diff

SequenceExpression : { Constants }

Constants : Constant [, Constants]

Constant : obj_id | Number | String

String : A single or double quoted string

Number : An integer or float

ClassName : A class name

FieldName : A member field/property name of the selected class