2022-04-11 18:34:09 +00:00
|
|
|
@precedence { logic @left }
|
|
|
|
@top Program { Query }
|
2022-12-14 19:04:20 +00:00
|
|
|
@skip { space }
|
2022-04-11 18:34:09 +00:00
|
|
|
|
|
|
|
Query {
|
2022-12-14 19:04:20 +00:00
|
|
|
Name ( WhereClause | LimitClause | OrderClause | SelectClause | RenderClause )*
|
2022-04-11 18:34:09 +00:00
|
|
|
}
|
|
|
|
|
2022-04-21 09:46:33 +00:00
|
|
|
commaSep<content> { content ("," content)* }
|
|
|
|
|
2022-12-14 19:04:20 +00:00
|
|
|
WhereClause { Where LogicalExpr }
|
|
|
|
LimitClause { Limit Number }
|
|
|
|
OrderClause { Order Name OrderDirection? }
|
|
|
|
SelectClause { Select commaSep<Name> }
|
|
|
|
RenderClause { Render (PageRef | String) }
|
2022-04-11 18:34:09 +00:00
|
|
|
|
2022-12-14 19:04:20 +00:00
|
|
|
OrderDirection {
|
2022-04-11 18:34:09 +00:00
|
|
|
"desc" | "asc"
|
|
|
|
}
|
|
|
|
|
2022-04-28 09:55:38 +00:00
|
|
|
Value { Number | String | Bool | Regex | Null | List }
|
2022-04-11 18:34:09 +00:00
|
|
|
|
2022-12-14 19:04:20 +00:00
|
|
|
LogicalExpr { FilterExpr (And FilterExpr)* }
|
2022-04-11 18:34:09 +00:00
|
|
|
|
|
|
|
FilterExpr {
|
|
|
|
Name "<" Value
|
|
|
|
| Name "<=" Value
|
|
|
|
| Name "=" Value
|
|
|
|
| Name "!=" Value
|
|
|
|
| Name ">=" Value
|
|
|
|
| Name ">" Value
|
2022-04-12 11:33:07 +00:00
|
|
|
| Name "=~" Value
|
2022-04-13 12:46:52 +00:00
|
|
|
| Name "!=~" Value
|
2022-04-28 09:55:38 +00:00
|
|
|
| Name "in" Value
|
2022-04-11 18:34:09 +00:00
|
|
|
}
|
|
|
|
|
2022-04-28 09:55:38 +00:00
|
|
|
List { "[" commaSep<Value> "]" }
|
|
|
|
|
2022-04-21 09:46:33 +00:00
|
|
|
|
2022-04-11 18:34:09 +00:00
|
|
|
Bool {
|
|
|
|
"true" | "false"
|
|
|
|
}
|
|
|
|
|
2022-04-13 12:46:52 +00:00
|
|
|
|
2022-04-11 18:34:09 +00:00
|
|
|
@tokens {
|
|
|
|
space { std.whitespace+ }
|
2022-04-19 14:54:47 +00:00
|
|
|
Name { (std.asciiLetter | "-" | "_")+ }
|
2022-12-14 19:04:20 +00:00
|
|
|
|
|
|
|
Where { "where" }
|
|
|
|
Order { "order by" }
|
|
|
|
Select { "select" }
|
|
|
|
Render { "render" }
|
|
|
|
Limit { "limit" }
|
|
|
|
And { "and" }
|
|
|
|
Null { "null" }
|
|
|
|
|
2022-04-12 11:33:07 +00:00
|
|
|
String {
|
|
|
|
("\"" | "“" | "”") ![\"”“]* ("\"" | "“" | "”")
|
|
|
|
}
|
2022-08-09 13:37:47 +00:00
|
|
|
PageRef {
|
|
|
|
"[" "[" ![\]]* "]" "]"
|
|
|
|
}
|
2022-04-12 11:33:07 +00:00
|
|
|
Regex { "/" ( ![/\\\n\r] | "\\" _ )* "/"? }
|
|
|
|
|
2022-04-11 18:34:09 +00:00
|
|
|
Number { std.digit+ }
|
2022-12-14 19:04:20 +00:00
|
|
|
|
|
|
|
// @precedence { Where, Sort, Select, Render, Limit, And, Null, Name }
|
2022-04-11 18:34:09 +00:00
|
|
|
}
|