readTarget reads a comma-separated list of target variables from the given start position to the given end position. It returns the target list and its end position.
( pos, endPos int, )
| 649 | // start position to the given end position. It returns the target list and its |
| 650 | // end position. |
| 651 | func (l *lexer) readTarget( |
| 652 | pos, endPos int, |
| 653 | ) (target []plpgsqltree.Variable, targetEnd int, err error) { |
| 654 | for ; pos < endPos; pos += 2 { |
| 655 | tok := l.tokens[pos] |
| 656 | if tok.id != IDENT { |
| 657 | return nil, 0, errors.Newf("\"%s\" is not a scalar variable", tok.str) |
| 658 | } |
| 659 | variable := plpgsqltree.Variable(strings.TrimSpace(l.getStr(pos, pos+1))) |
| 660 | target = append(target, variable) |
| 661 | if pos+1 == endPos || l.tokens[pos+1].id != ',' { |
| 662 | // This is the end of the target list. |
| 663 | break |
| 664 | } |
| 665 | } |
| 666 | return target, pos + 1, nil |
| 667 | } |
| 668 | |
| 669 | func checkLoopLabels(start, end string) error { |
| 670 | if start == "" && end != "" { |
no test coverage detected