Consume a ':' from the input stream (if the next token is a colon), returning an error if a colon is needed but not present.
(fd protoreflect.FieldDescriptor)
| 473 | // Consume a ':' from the input stream (if the next token is a colon), |
| 474 | // returning an error if a colon is needed but not present. |
| 475 | func (p *textParser) checkForColon(fd protoreflect.FieldDescriptor) *ParseError { |
| 476 | tok := p.next() |
| 477 | if tok.err != nil { |
| 478 | return tok.err |
| 479 | } |
| 480 | if tok.value != ":" { |
| 481 | if fd.Message() == nil { |
| 482 | return p.errorf("expected ':', found %q", tok.value) |
| 483 | } |
| 484 | p.back() |
| 485 | } |
| 486 | return nil |
| 487 | } |
| 488 | |
| 489 | // consumeExtensionOrAnyName consumes an extension name or an Any type URL and |
| 490 | // the following ']'. It returns the name or URL consumed. |
no test coverage detected