MCPcopy
hub / github.com/golang/protobuf / next

Method next

proto/text_decode.go:620–648  ·  view source on GitHub ↗

Advances the parser and returns the new current token.

()

Source from the content-addressed store, hash-verified

618
619// Advances the parser and returns the new current token.
620func (p *textParser) next() *token {
621 if p.backed || p.done {
622 p.backed = false
623 return &p.cur
624 }
625 p.advance()
626 if p.done {
627 p.cur.value = ""
628 } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {
629 // Look for multiple quoted strings separated by whitespace,
630 // and concatenate them.
631 cat := p.cur
632 for {
633 p.skipWhitespace()
634 if p.done || !isQuote(p.s[0]) {
635 break
636 }
637 p.advance()
638 if p.cur.err != nil {
639 return &p.cur
640 }
641 cat.value += " " + p.cur.value
642 cat.unquoted += p.cur.unquoted
643 }
644 p.done = false // parser may have seen EOF, but we want to return cat
645 p.cur = cat
646 }
647 return &p.cur
648}
649
650func (p *textParser) consumeToken(s string) error {
651 tok := p.next()

Callers 8

unmarshalMessageMethod · 0.95
unmarshalValueMethod · 0.95
checkForColonMethod · 0.95
consumeTokenMethod · 0.95

Calls 3

advanceMethod · 0.95
skipWhitespaceMethod · 0.95
isQuoteFunction · 0.85

Tested by

no test coverage detected