MCPcopy
hub / github.com/kashav/fsql / readWord

Method readWord

tokenizer/tokenizer.go:180–192  ·  view source on GitHub ↗

readWord reads a single word from the input. Returns when the next rune is any of: nil (-1), empty space, comma, single/double quote, backtick, or opening/closing parenthesis/bracket.

()

Source from the content-addressed store, hash-verified

178// any of: nil (-1), empty space, comma, single/double quote, backtick,
179// or opening/closing parenthesis/bracket.
180func (t *Tokenizer) readWord() string {
181 word := []rune{}
182
183 for {
184 if unicode.IsSpace(t.current()) ||
185 t.currentIs(-1, ',', '\'', '"', '`', '(', ')', '[', ']') {
186 return string(word)
187 }
188
189 word = append(word, t.current())
190 t.input = t.input[1:]
191 }
192}
193
194// readQuery reads a full string until reaching a closing parentheses. Counts
195// opening parens to ensure that balance is maintained.

Callers 4

NextMethod · 0.95
readQueryMethod · 0.95
readUntilMethod · 0.95
TestTokenizer_ReadWordFunction · 0.80

Calls 2

currentMethod · 0.95
currentIsMethod · 0.95

Tested by 1

TestTokenizer_ReadWordFunction · 0.64