MCPcopy Create free account
hub / github.com/aptly-dev/aptly / Condition

Method Condition

query/syntax.go:174–205  ·  view source on GitHub ↗

condition := '(' value ')' | operator := | << | < | <= | > | >> | >= | = | % | ~

()

Source from the content-addressed store, hash-verified

172// condition := '(' <operator> value ')' |
173// operator := | << | < | <= | > | >> | >= | = | % | ~
174func (p *parser) Condition() (operator itemType, value string) {
175 if p.input.Current().typ != itemLeftParen {
176 return
177 }
178 p.input.Consume()
179
180 if p.input.Current().typ == itemLt ||
181 p.input.Current().typ == itemGt ||
182 p.input.Current().typ == itemLtEq ||
183 p.input.Current().typ == itemGtEq ||
184 p.input.Current().typ == itemEq ||
185 p.input.Current().typ == itemPatMatch ||
186 p.input.Current().typ == itemRegexp {
187 operator = p.input.Current().typ
188 p.input.Consume()
189 } else {
190 operator = itemEq
191 }
192
193 if p.input.Current().typ != itemString {
194 panic(fmt.Sprintf("unexpected token %s: expecting value", p.input.Current()))
195 }
196 value = p.input.Current().val
197 p.input.Consume()
198
199 if p.input.Current().typ != itemRightParen {
200 panic(fmt.Sprintf("unexpected token %s: expecting ')'", p.input.Current()))
201 }
202 p.input.Consume()
203
204 return
205}
206
207// arch_condition := '{' arch '}' |
208func (p *parser) ArchCondition() (arch string) {

Callers 1

DMethod · 0.95

Calls 2

CurrentMethod · 0.80
ConsumeMethod · 0.80

Tested by

no test coverage detected