-
Notifications
You must be signed in to change notification settings - Fork 0
/
query-string.ohm
60 lines (45 loc) · 1.26 KB
/
query-string.ohm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
QueryString {
Query = orQuery*
and = caseInsensitive<"and">
or = caseInsensitive<"or">
not = caseInsensitive<"not">
orQuery =
| orQuery space+ or space+ andQuery -- or
| andQuery
andQuery =
| andQuery space+ and space+ notQuery -- and
| notQuery
notQuery =
| not space+ notQuery -- not
| queryComp
queryComp =
| "(" spaces (orQuery spaces)* ")"? -- parentheses
| queryTerm
queryTerm =
| columnQuery
| term
columnIdent = (letter | "_") (letter | digit | "_")*
operator = "gt" | "lt" | "ge" | "le" | "eq" | "ne"
columnQuery = columnIdent ":" (operator ":")? term
term =
| stringLiteral
| rawTerm
rawTerm =
| ("!".."'" | "*".."~")+
stringLiteral =
"\"" doubleStringCharacter* "\""
doubleStringCharacter (character) =
~("\"" | "\\") any -- nonEscaped
| "\\" escapeSequence -- escaped
escapeSequence =
"\"" -- doubleQuote
| "\\" -- reverseSolidus
| "/" -- solidus
| "b" -- backspace
| "f" -- formfeed
| "n" -- newline
| "r" -- carriageReturn
| "t" -- horizontalTab
| "u" fourHexDigits -- codePoint
fourHexDigits = hexDigit hexDigit hexDigit hexDigit
}