2022-04-11 18:34:09 +00:00
|
|
|
@precedence { logic @left }
|
|
|
|
|
|
|
|
@top Program { Query }
|
|
|
|
|
|
|
|
Query {
|
|
|
|
Name (WhereClause | OrderClause | LimitClause)*
|
|
|
|
}
|
|
|
|
|
|
|
|
WhereClause { "where" LogicalExpr }
|
|
|
|
OrderClause { "order" "by" Name Order? }
|
|
|
|
LimitClause { "limit" Number }
|
|
|
|
|
|
|
|
Order {
|
|
|
|
"desc" | "asc"
|
|
|
|
}
|
|
|
|
|
2022-04-12 11:33:07 +00:00
|
|
|
Value { Number | String | Bool | Regex }
|
2022-04-11 18:34:09 +00:00
|
|
|
|
|
|
|
LogicalExpr { AndExpr | FilterExpr }
|
|
|
|
|
|
|
|
AndExpr { FilterExpr !logic "and" FilterExpr }
|
|
|
|
|
|
|
|
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-11 18:34:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@skip { space }
|
|
|
|
|
|
|
|
Bool {
|
|
|
|
"true" | "false"
|
|
|
|
}
|
|
|
|
|
|
|
|
@tokens {
|
|
|
|
space { std.whitespace+ }
|
|
|
|
Name { std.asciiLetter+ }
|
2022-04-12 11:33:07 +00:00
|
|
|
String {
|
|
|
|
("\"" | "“" | "”") ![\"”“]* ("\"" | "“" | "”")
|
|
|
|
}
|
|
|
|
Regex { "/" ( ![/\\\n\r] | "\\" _ )* "/"? }
|
|
|
|
|
2022-04-11 18:34:09 +00:00
|
|
|
Number { std.digit+ }
|
|
|
|
}
|