forked from kent/consciousness
parser: add negated key glob filter (!key:pattern)
Fixes split agent query: all | type:semantic | !key:_* | sort:content-len | limit:1 Also adds glob_pattern rule that allows * and ? wildcards in key filters. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
c8280ae871
commit
c8922c9408
1 changed files with 8 additions and 1 deletions
|
|
@ -97,7 +97,8 @@ peg::parser! {
|
|||
/ "select:" f:field_list_colon() { Stage::Transform(Transform::Select(f)) }
|
||||
/ "type:" t:ident() { make_type_filter(&t) }
|
||||
/ "age:" c:cmp_duration() { Stage::Filter(Filter::Age(c)) }
|
||||
/ "key:" g:ident() { Stage::Filter(Filter::KeyGlob(g)) }
|
||||
/ "key:" g:glob_pattern() { Stage::Filter(Filter::KeyGlob(g)) }
|
||||
/ "!key:" g:glob_pattern() { Stage::Filter(Filter::Negated(Box::new(Filter::KeyGlob(g)))) }
|
||||
/ "provenance:" p:ident() { Stage::Filter(Filter::Provenance(p)) }
|
||||
/ "not-visited:" a:ident() "," d:integer() { Stage::Filter(Filter::NotVisited { agent: a, duration: d as i64 }) }
|
||||
/ "visited:" a:ident() { Stage::Filter(Filter::Visited { agent: a }) }
|
||||
|
|
@ -220,6 +221,12 @@ peg::parser! {
|
|||
= s:$(['a'..='z' | 'A'..='Z' | '_']['a'..='z' | 'A'..='Z' | '0'..='9' | '_' | '-' | '.']*) {
|
||||
s.to_string()
|
||||
}
|
||||
|
||||
// Glob pattern for key matching (allows * and ?)
|
||||
rule glob_pattern() -> String
|
||||
= s:$(['a'..='z' | 'A'..='Z' | '0'..='9' | '_' | '-' | '.' | '*' | '?']+) {
|
||||
s.to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue