forked from aptly-dev/aptly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery.go
29 lines (24 loc) · 782 Bytes
/
query.go
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
// Package query implements query language for
package query
import (
"github.com/aptly-dev/aptly/deb"
)
/*
Query language resembling Debian dependencies and reprepro
queries: http://mirrorer.alioth.debian.org/reprepro.1.html
Query := A | A '|' Query
A := B | B ',' A
B := C | '!' B
C := '(' Query ')' | D
D := <field> <condition> <arch_condition> | <pkg>_<version>_<arch>
field := <package-name> | <field> | $special_field
condition := '(' <operator> value ')' |
arch_condition := '{' arch '}' |
operator := | << | < | <= | > | >> | >= | = | % | ~
*/
// Parse parses input package query into PackageQuery tree ready for evaluation
func Parse(query string) (result deb.PackageQuery, err error) {
l, _ := lex("", query)
result, err = parse(l)
return
}