MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / skipWhitespace

Method skipWhitespace

pkg/sql/parser/scan.go:415–438  ·  view source on GitHub ↗
(lval *sqlSymType, allowComments bool)

Source from the content-addressed store, hash-verified

413}
414
415func (s *scanner) skipWhitespace(lval *sqlSymType, allowComments bool) (newline, ok bool) {
416 newline = false
417 for {
418 ch := s.peek()
419 if ch == '\n' {
420 s.pos++
421 newline = true
422 continue
423 }
424 if ch == ' ' || ch == '\t' || ch == '\r' || ch == '\f' {
425 s.pos++
426 continue
427 }
428 if allowComments {
429 if present, cok := s.scanComment(lval); !cok {
430 return false, false
431 } else if present {
432 continue
433 }
434 }
435 break
436 }
437 return newline, true
438}
439
440func (s *scanner) scanComment(lval *sqlSymType) (present, ok bool) {
441 start := s.pos

Callers 4

scanMethod · 0.95
scanHexStringMethod · 0.95
scanBitStringMethod · 0.95
scanStringMethod · 0.95

Calls 2

peekMethod · 0.95
scanCommentMethod · 0.95

Tested by

no test coverage detected