MCPcopy Index your code
hub / github.com/bytebase/bytebase / readCommand

Function readCommand

backend/plugin/parser/tsql/batch/parse.go:22–37  ·  view source on GitHub ↗

readCommand reads to the next control character to find a command in the string. Command regexes constrain matches to the beginning of the string, and all commands consume an entire line.

(r []rune, i, end int)

Source from the content-addressed store, hash-verified

20// to the beginning of the string, and all commands consume
21// an entire line.
22func readCommand(r []rune, i, end int) (Command, int) {
23 for ; i < end; i++ {
24 next := grab(r, i, end)
25 if next == 0 || (unicode.IsControl(next) && next != '\t') {
26 break
27 }
28 }
29
30 for _, builder := range commandBuilders {
31 cmd := builder(string(r[:i]))
32 if cmd != nil {
33 return cmd, i
34 }
35 }
36 return nil, i
37}
38
39// readMultilineComment finds the end of a multiline comment (ie, '*/').
40func readMultilineComment(r []rune, i, end int) (int, bool) {

Callers 1

NextMethod · 0.85

Calls 1

grabFunction · 0.85

Tested by

no test coverage detected