2025-11-15 23:23:32 +00:00
|
|
|
@external tokens negateToken from "./tokens" { negate }
|
|
|
|
|
|
|
|
|
|
@top Program { query }
|
|
|
|
|
|
|
|
|
|
@precedence {
|
|
|
|
|
negate,
|
|
|
|
|
and,
|
|
|
|
|
or @left
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
query {
|
|
|
|
|
OrExpr |
|
|
|
|
|
AndExpr |
|
|
|
|
|
expr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OrExpr { andExpr (or andExpr)+ }
|
|
|
|
|
|
|
|
|
|
AndExpr { expr expr+ }
|
|
|
|
|
|
|
|
|
|
andExpr { AndExpr | expr }
|
|
|
|
|
|
|
|
|
|
expr {
|
|
|
|
|
NegateExpr |
|
|
|
|
|
ParenExpr |
|
|
|
|
|
PrefixExpr |
|
|
|
|
|
Term
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NegateExpr { !negate negate (PrefixExpr | ParenExpr) }
|
|
|
|
|
|
|
|
|
|
ParenExpr { "(" query ")" }
|
|
|
|
|
|
|
|
|
|
PrefixExpr {
|
2025-11-17 00:12:51 +00:00
|
|
|
ArchivedExpr |
|
|
|
|
|
RevisionExpr |
|
|
|
|
|
ContentExpr |
|
|
|
|
|
FileExpr |
|
|
|
|
|
ForkExpr |
|
|
|
|
|
VisibilityExpr |
|
|
|
|
|
RepoExpr |
|
|
|
|
|
LangExpr |
|
|
|
|
|
SymExpr |
|
|
|
|
|
RepoSetExpr
|
2025-11-15 23:23:32 +00:00
|
|
|
}
|
|
|
|
|
|
2025-11-17 00:12:51 +00:00
|
|
|
RevisionExpr { revisionKw value }
|
|
|
|
|
ContentExpr { contentKw value }
|
|
|
|
|
FileExpr { fileKw value }
|
|
|
|
|
RepoExpr { repoKw value }
|
|
|
|
|
LangExpr { langKw value }
|
|
|
|
|
SymExpr { symKw value }
|
|
|
|
|
RepoSetExpr { reposetKw value }
|
|
|
|
|
|
|
|
|
|
// Modifiers
|
|
|
|
|
ArchivedExpr { archivedKw value }
|
|
|
|
|
ForkExpr { forkKw value }
|
|
|
|
|
VisibilityExpr { visibilityKw value }
|
|
|
|
|
|
2025-11-15 23:23:32 +00:00
|
|
|
|
|
|
|
|
Term { quotedString | word }
|
|
|
|
|
|
|
|
|
|
value { quotedString | word }
|
|
|
|
|
|
|
|
|
|
@skip { space }
|
|
|
|
|
|
|
|
|
|
@tokens {
|
|
|
|
|
archivedKw { "archived:" }
|
2025-11-17 00:12:51 +00:00
|
|
|
revisionKw { "rev:" }
|
2025-11-15 23:23:32 +00:00
|
|
|
contentKw { "content:" | "c:" }
|
|
|
|
|
fileKw { "file:" | "f:" }
|
|
|
|
|
forkKw { "fork:" }
|
2025-11-17 00:12:51 +00:00
|
|
|
visibilityKw { "visibility:" }
|
2025-11-15 23:23:32 +00:00
|
|
|
repoKw { "repo:" | "r:" }
|
|
|
|
|
langKw { "lang:" }
|
|
|
|
|
symKw { "sym:" }
|
|
|
|
|
reposetKw { "reposet:" }
|
|
|
|
|
|
|
|
|
|
or { "or" ![a-zA-Z0-9_] }
|
|
|
|
|
|
|
|
|
|
quotedString { '"' (!["\\\n] | "\\" _)* '"' }
|
|
|
|
|
|
|
|
|
|
// Allow almost anything in a word except spaces, parens, quotes
|
|
|
|
|
// Colons and dashes are allowed anywhere in words (including at the start)
|
|
|
|
|
word { (![ \t\n()"]) (![ \t\n()":] | ":" | "-")* }
|
|
|
|
|
|
|
|
|
|
space { $[ \t\n]+ }
|
|
|
|
|
|
|
|
|
|
@precedence {
|
|
|
|
|
quotedString,
|
2025-11-17 00:12:51 +00:00
|
|
|
archivedKw, revisionKw, contentKw, fileKw,
|
|
|
|
|
forkKw, visibilityKw, repoKw, langKw,
|
|
|
|
|
symKw, reposetKw, or,
|
2025-11-15 23:23:32 +00:00
|
|
|
word
|
|
|
|
|
}
|
|
|
|
|
}
|