()
| 50 | } |
| 51 | |
| 52 | func (p *Parser) scanFnBlock() (sql string, tokens []plpgsqlSymType, done bool) { |
| 53 | var lval plpgsqlSymType |
| 54 | tokens = p.tokBuf[:0] |
| 55 | |
| 56 | // Scan the first token. |
| 57 | p.scanner.Scan(&lval) |
| 58 | if lval.id == 0 { |
| 59 | return "", nil, true |
| 60 | } |
| 61 | |
| 62 | startPos := lval.pos |
| 63 | // We make the resulting token positions match the returned string. |
| 64 | lval.pos = 0 |
| 65 | tokens = append(tokens, lval) |
| 66 | for { |
| 67 | if lval.id == ERROR { |
| 68 | return p.scanner.In()[startPos:], tokens, true |
| 69 | } |
| 70 | // Reset the plpgsqlSymType struct before scanning. |
| 71 | lval = plpgsqlSymType{} |
| 72 | posBeforeScan := p.scanner.Pos() |
| 73 | p.scanner.Scan(&lval) |
| 74 | if lval.id == 0 { |
| 75 | return p.scanner.In()[startPos:posBeforeScan], tokens, (lval.id == 0) |
| 76 | } |
| 77 | lval.pos -= startPos |
| 78 | tokens = append(tokens, lval) |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | func (p *Parser) parseWithDepth( |
| 83 | depth int, plpgsql string, nakedIntType *types.T, |
no test coverage detected