MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / skipWhitespace

Method skipWhitespace

pkg/sql/tokenizer/tokenizer.go:675–702  ·  view source on GitHub ↗

skipWhitespace advances past any whitespace Optimized with ASCII fast-path since >99% of SQL whitespace is ASCII

()

Source from the content-addressed store, hash-verified

673// skipWhitespace advances past any whitespace
674// Optimized with ASCII fast-path since >99% of SQL whitespace is ASCII
675func (t *Tokenizer) skipWhitespace() {
676 for t.pos.Index < len(t.input) {
677 b := t.input[t.pos.Index]
678 // Fast path: ASCII whitespace (covers >99% of cases)
679 if b < 128 {
680 switch b {
681 case ' ', '\t', '\r':
682 t.pos.Index++
683 t.pos.Column++
684 continue
685 case '\n':
686 t.pos.Index++
687 t.pos.Line++
688 t.pos.Column = 0
689 continue
690 }
691 // Not whitespace, exit
692 break
693 }
694 // Slow path: UTF-8 encoded character (rare in SQL)
695 r, size := utf8.DecodeRune(t.input[t.pos.Index:])
696 if r == ' ' || r == '\t' || r == '\n' || r == '\r' {
697 t.pos.AdvanceRune(r, size)
698 continue
699 }
700 break
701 }
702}
703
704// nextToken picks out the next token from the input
705func (t *Tokenizer) nextToken() (models.Token, error) {

Callers 4

TokenizeMethod · 0.95
TokenizeContextMethod · 0.95
readIdentifierMethod · 0.95
readPunctuationMethod · 0.95

Calls 1

AdvanceRuneMethod · 0.80

Tested by

no test coverage detected