MCPcopy Create free account
hub / github.com/bytebase/bytebase / skipQuoted

Function skipQuoted

backend/plugin/parser/tidb/backup.go:826–841  ·  view source on GitHub ↗

skipQuoted returns the index of the closing quote of the string/identifier literal opened at i (s[i] is the opening quote), or len(s)-1 if unterminated.

(s string, i int)

Source from the content-addressed store, hash-verified

824// skipQuoted returns the index of the closing quote of the string/identifier
825// literal opened at i (s[i] is the opening quote), or len(s)-1 if unterminated.
826func skipQuoted(s string, i int) int {
827 quote := s[i]
828 for j := i + 1; j < len(s); {
829 switch {
830 case s[j] == '\\' && quote != '`':
831 j += 2 // backslash escape ('...'/"..." only)
832 case s[j] == quote && j+1 < len(s) && s[j+1] == quote:
833 j += 2 // doubled-quote escape ('' "" ``)
834 case s[j] == quote:
835 return j
836 default:
837 j++
838 }
839 }
840 return len(s) - 1
841}
842
843// skipBlockComment returns the index of the closing "/" of the /* */ comment
844// opened at i, or len(s)-1 if unterminated.

Callers 1

parenDeficitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected