check for an empty value read and consume optional spaces until comma or EOF (empty val) or any other char (not empty val) comma and spaces are consumed, while any other char is not consumed
()
| 439 | // read and consume optional spaces until comma or EOF (empty val) or any other char (not empty val) |
| 440 | // comma and spaces are consumed, while any other char is not consumed |
| 441 | func (t *parser) emptyVal() (bool, error) { |
| 442 | for { |
| 443 | r, _, e := t.sc.ReadRune() |
| 444 | if e == io.EOF { |
| 445 | return true, nil |
| 446 | } |
| 447 | if e != nil { |
| 448 | return false, e |
| 449 | } |
| 450 | if r == ',' { |
| 451 | return true, nil |
| 452 | } |
| 453 | if !unicode.IsSpace(r) { |
| 454 | t.sc.UnreadRune() |
| 455 | return false, nil |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | func (t *parser) val() ([]rune, error) { |
| 461 | stop := runeSet([]rune{','}) |