MCPcopy
hub / github.com/dgraph-io/dgraph / collectName

Function collectName

dql/parser.go:3522–3536  ·  view source on GitHub ↗

Name can have dashes or alphanumeric characters. Lexer lexes them as separate items. We put it back together here.

(it *lex.ItemIterator, val string)

Source from the content-addressed store, hash-verified

3520// Name can have dashes or alphanumeric characters. Lexer lexes them as separate items.
3521// We put it back together here.
3522func collectName(it *lex.ItemIterator, val string) string {
3523 var dashOrName bool // false if expecting dash, true if expecting name
3524 for {
3525 items, err := it.Peek(1)
3526 if err == nil && ((items[0].Typ == itemName && dashOrName) ||
3527 (items[0].Val == "-" && !dashOrName)) {
3528 it.Next()
3529 val += it.Item().Val
3530 dashOrName = !dashOrName
3531 } else {
3532 break
3533 }
3534 }
3535 return val
3536}
3537
3538// Steps the parser.
3539func tryParseItemType(it *lex.ItemIterator, typ lex.ItemType) (lex.Item, bool) {

Callers 8

parseListItemNamesFunction · 0.85
parseArgumentsFunction · 0.85
parseFunctionFunction · 0.85
tryParseFacetItemFunction · 0.85
parseCascadeFunction · 0.85
parseGroupbyFunction · 0.85
getRootFunction · 0.85
godeepFunction · 0.85

Calls 3

ItemMethod · 0.80
PeekMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected