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.
()
| 178 | // any of: nil (-1), empty space, comma, single/double quote, backtick, |
| 179 | // or opening/closing parenthesis/bracket. |
| 180 | func (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. |