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
+7 -1
View File
@@ -28,6 +28,8 @@ const (
itemEq // =
itemPatMatch // %
itemRegexp // ~
itemLeftCurly // {
itemRightCurly // }
itemString
)
@@ -152,6 +154,10 @@ func lexMain(l *lexer) stateFn {
l.emit(itemLeftParen)
case r == ')':
l.emit(itemRightParen)
case r == '{':
l.emit(itemLeftCurly)
case r == '}':
l.emit(itemRightCurly)
case r == '|':
l.emit(itemOr)
case r == ',':
@@ -195,7 +201,7 @@ func lexMain(l *lexer) stateFn {
func lexString(l *lexer) stateFn {
for {
r := l.next()
if unicode.IsSpace(r) || strings.IndexRune("()|,!<>=%~", r) > 0 {
if unicode.IsSpace(r) || strings.IndexRune("()|,!{}", r) > 0 {
l.backup()
l.emit(itemString)
return lexMain(l)