MCPcopy Index your code
hub / github.com/perkeep/perkeep / parseOperand

Method parseOperand

pkg/search/expr.go:225–250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223}
224
225func (p *parser) parseOperand() (c *Constraint, err error) {
226 negated := p.stripNot()
227 i := p.peek()
228 switch i.typ {
229 case tokenError:
230 err = newParseExpError(i.val, *i)
231 return
232 case tokenEOF:
233 err = newParseExpError(expectedAtom, *i)
234 return
235 case tokenClose:
236 err = newParseExpError(noMatchingOpening, *i)
237 return
238 case tokenLiteral, tokenQuotedLiteral, tokenPredicate, tokenColon, tokenArg:
239 c, err = p.parseAtom()
240 case tokenOpen:
241 c, err = p.parseGroup()
242 }
243 if err != nil {
244 return
245 }
246 if negated {
247 c = notConst(c)
248 }
249 return
250}
251
252// AtomWords returns the parsed atom, the starting position of this
253// atom and an error.

Callers 4

parseExpMethod · 0.95
parseAndMethod · 0.95
parseAndRHSMethod · 0.95
TestParseOperandFunction · 0.80

Calls 6

stripNotMethod · 0.95
peekMethod · 0.95
parseAtomMethod · 0.95
parseGroupMethod · 0.95
newParseExpErrorFunction · 0.85
notConstFunction · 0.85

Tested by 1

TestParseOperandFunction · 0.64