MCPcopy Index your code
hub / github.com/tidwall/gjson / parseArray

Function parseArray

gjson.go:1508–1815  ·  view source on GitHub ↗
(c *parseContext, i int, path string)

Source from the content-addressed store, hash-verified

1506 return false
1507}
1508func parseArray(c *parseContext, i int, path string) (int, bool) {
1509 var pmatch, vesc, ok, hit bool
1510 var val string
1511 var h int
1512 var alog []int
1513 var partidx int
1514 var multires []byte
1515 var queryIndexes []int
1516 rp := parseArrayPath(path)
1517 if !rp.arrch {
1518 n, ok := parseUint(rp.part)
1519 if !ok {
1520 partidx = -1
1521 } else {
1522 partidx = int(n)
1523 }
1524 }
1525 if !rp.more && rp.piped {
1526 c.pipe = rp.pipe
1527 c.piped = true
1528 }
1529
1530 procQuery := func(qval Result) bool {
1531 if rp.query.all {
1532 if len(multires) == 0 {
1533 multires = append(multires, '[')
1534 }
1535 }
1536 var tmp parseContext
1537 tmp.value = qval
1538 fillIndex(c.json, &tmp)
1539 parentIndex := tmp.value.Index
1540 var res Result
1541 if qval.Type == JSON {
1542 res = qval.Get(rp.query.path)
1543 } else {
1544 if rp.query.path != "" {
1545 return false
1546 }
1547 res = qval
1548 }
1549 if queryMatches(&rp, res) {
1550 if rp.more {
1551 left, right, ok := splitPossiblePipe(rp.path)
1552 if ok {
1553 rp.path = left
1554 c.pipe = right
1555 c.piped = true
1556 }
1557 res = qval.Get(rp.path)
1558 } else {
1559 res = qval
1560 }
1561 if rp.query.all {
1562 raw := res.Raw
1563 if len(raw) == 0 {
1564 raw = res.String()
1565 }

Callers 2

parseObjectFunction · 0.85
GetFunction · 0.85

Calls 15

GetMethod · 0.95
StringMethod · 0.95
ExistsMethod · 0.95
parseArrayPathFunction · 0.85
parseUintFunction · 0.85
fillIndexFunction · 0.85
queryMatchesFunction · 0.85
splitPossiblePipeFunction · 0.85
parseStringFunction · 0.85
unescapeFunction · 0.85
parseObjectFunction · 0.85
parseSquashFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…