MCPcopy
hub / github.com/kubernetes/client-go / parseQuote

Method parseQuote

util/jsonpath/parser.go:400–420  ·  view source on GitHub ↗

parseQuote unquotes string inside double or single quote

(cur *ListNode, end rune)

Source from the content-addressed store, hash-verified

398
399// parseQuote unquotes string inside double or single quote
400func (p *Parser) parseQuote(cur *ListNode, end rune) error {
401Loop:
402 for {
403 switch p.next() {
404 case eof, '\n':
405 return fmt.Errorf("unterminated quoted string")
406 case end:
407 //if it's not escape break the Loop
408 if p.input[p.pos-2] != '\\' {
409 break Loop
410 }
411 }
412 }
413 value := p.consumeText()
414 s, err := UnquoteExtend(value)
415 if err != nil {
416 return fmt.Errorf("unquote string %s error %v", value, err)
417 }
418 cur.append(newText(s))
419 return p.parseInsideAction(cur)
420}
421
422// parseField scans a field until a terminator
423func (p *Parser) parseField(cur *ListNode) error {

Callers 1

parseInsideActionMethod · 0.95

Calls 7

nextMethod · 0.95
consumeTextMethod · 0.95
parseInsideActionMethod · 0.95
UnquoteExtendFunction · 0.85
newTextFunction · 0.85
appendMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected