Skip to main content

Module parser

Module parser 

Source
Expand description

WQL parser — recursive descent parser for the Web Query Language.

Grammar:

query := SELECT fields FROM model [JOIN ...] [WHERE ...] [ACROSS ...] [ORDER BY ...] [LIMIT n]
fields := field (',' field)*
field := name [AS alias] | temporal_func
temporal_func := name '_' duration '_ago' | name '_trend' | 'predicted_' name '_' duration
model := IDENTIFIER
where := WHERE expr
expr := comparison ((AND | OR) comparison)*
comparison := field op value
op := '=' | '<' | '>' | '<=' | '>=' | '!='
across := ACROSS domain (',' domain)*
order := ORDER BY field (ASC | DESC)
limit := LIMIT number

Structs§

JoinClause
JOIN clause.
ModelRef
Model reference in FROM clause.
OrderByField
ORDER BY field with direction.
SelectField
A selected field with optional alias and temporal function.
WqlQuery
A parsed WQL query.

Enums§

ComparisonOp
Comparison operator.
TemporalFunc
Temporal function applied to a field.
WhereExpr
WHERE expression (AND/OR tree of comparisons).
WqlValue
A literal value in a WQL expression.

Functions§

parse
Parse a WQL query string into an AST.