skipWhitespace skips over whitespace characters (space, tab, newline, etc) and comments. Multiple consecutive block comments and whitespace will be concatenated together into the final return value.
(lval *sqlSymType, allowComments bool)
| 450 | // skipWhitespace skips over whitespace characters (space, tab, newline, etc) and comments. Multiple consecutive |
| 451 | // block comments and whitespace will be concatenated together into the final return value. |
| 452 | func (s *scanner) skipWhitespace(lval *sqlSymType, allowComments bool) (blockComment string, newline, ok bool) { |
| 453 | newline = false |
| 454 | for { |
| 455 | ch := s.peek() |
| 456 | if ch == '\n' { |
| 457 | s.pos++ |
| 458 | newline = true |
| 459 | continue |
| 460 | } |
| 461 | if ch == ' ' || ch == '\t' || ch == '\r' || ch == '\f' { |
| 462 | s.pos++ |
| 463 | continue |
| 464 | } |
| 465 | if allowComments { |
| 466 | if cmt, present, cok := s.scanComment(lval); !cok { |
| 467 | return "", false, false |
| 468 | } else if present { |
| 469 | if len(blockComment) > 0 { |
| 470 | blockComment += " " |
| 471 | } |
| 472 | blockComment += cmt |
| 473 | continue |
| 474 | } |
| 475 | } |
| 476 | break |
| 477 | } |
| 478 | return blockComment, newline, true |
| 479 | } |
| 480 | |
| 481 | // scanComment scans for a comment starting at the current position. |
| 482 | // For block-style comments, returns the comment string scanned. |
no test coverage detected