Fix bug with special chars handling in strings, detect package key queries,

arch condition for dependency-like queries.
This commit is contained in:
Andrey Smirnov
2014-07-12 00:14:49 +04:00
parent b42fd71acf
commit d54ef1e921
5 changed files with 88 additions and 8 deletions

View File

@@ -1,6 +1,10 @@
// Package query implements query language for
package query
import (
"github.com/smira/aptly/deb"
)
/*
Query language resembling Debian dependencies and reprepro
@@ -10,8 +14,16 @@ package query
A := B | B ',' A
B := C | '!' B
C := '(' Query ')' | D
D := <field> <condition>
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
}