parseQuote unquotes string inside double or single quote
(cur *ListNode, end rune)
| 398 | |
| 399 | // parseQuote unquotes string inside double or single quote |
| 400 | func (p *Parser) parseQuote(cur *ListNode, end rune) error { |
| 401 | Loop: |
| 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 |
| 423 | func (p *Parser) parseField(cur *ListNode) error { |
no test coverage detected