Consume one value if it is a plain literal. Never consumes a parenthesis, so * on false the caller can still find the tuple's end from the cursor. */
| 260 | /* Consume one value if it is a plain literal. Never consumes a parenthesis, so |
| 261 | * on false the caller can still find the tuple's end from the cursor. */ |
| 262 | static bool sqlv_read_literal(sqlv_scan_t *sc) { |
| 263 | char c = sqlv_at(sc, 0); |
| 264 | char n = sqlv_at(sc, 1); |
| 265 | if (c == '\'') { |
| 266 | return sqlv_read_string(sc); |
| 267 | } |
| 268 | if ((c == '-' || c == '+') && |
| 269 | (isdigit((unsigned char)n) || (n == '.' && isdigit((unsigned char)sqlv_at(sc, 2))))) { |
| 270 | sqlv_step(sc); |
| 271 | return sqlv_read_number(sc); |
| 272 | } |
| 273 | if (isdigit((unsigned char)c) || (c == '.' && isdigit((unsigned char)n))) { |
| 274 | return sqlv_read_number(sc); |
| 275 | } |
| 276 | if (isalpha((unsigned char)c) || c == '_') { |
| 277 | return sqlv_read_word_literal(sc); |
| 278 | } |
| 279 | return false; |
| 280 | } |
| 281 | |
| 282 | /* Consume one tuple starting at its '('. *literal says whether every value in |
| 283 | * it was a plain literal. Returns false if the tuple never closes. */ |
no test coverage detected