MCPcopy
hub / github.com/helm/helm / valList

Method valList

pkg/strvals/parser.go:466–502  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

464}
465
466func (t *parser) valList() ([]any, error) {
467 r, _, e := t.sc.ReadRune()
468 if e != nil {
469 return []any{}, e
470 }
471
472 if r != '{' {
473 t.sc.UnreadRune()
474 return []any{}, ErrNotList
475 }
476
477 list := []any{}
478 stop := runeSet([]rune{',', '}'})
479 for {
480 switch rs, last, err := runesUntil(t.sc, stop); {
481 case err != nil:
482 if err == io.EOF {
483 err = errors.New("list must terminate with '}'")
484 }
485 return list, err
486 case last == '}':
487 // If this is followed by ',', consume it.
488 if r, _, e := t.sc.ReadRune(); e == nil && r != ',' {
489 t.sc.UnreadRune()
490 }
491 v, e := t.reader(rs)
492 list = append(list, v)
493 return list, e
494 case last == ',':
495 v, e := t.reader(rs)
496 if e != nil {
497 return list, e
498 }
499 list = append(list, v)
500 }
501 }
502}
503
504func runesUntil(in io.RuneReader, stop map[rune]bool) ([]rune, rune, error) {
505 v := []rune{}

Callers 2

keyMethod · 0.95
listItemMethod · 0.95

Calls 2

runeSetFunction · 0.85
runesUntilFunction · 0.85

Tested by

no test coverage detected