Advances the parser and returns the new current token.
()
| 618 | |
| 619 | // Advances the parser and returns the new current token. |
| 620 | func (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 | |
| 650 | func (p *textParser) consumeToken(s string) error { |
| 651 | tok := p.next() |
no test coverage detected