! @brief unget current character (read it again on next get) We implement unget by setting variable next_unget to true. The input is not changed - we just simulate ungetting by modifying chars_read_total, chars_read_current_line, and token_string. The next call to get() will behave as if the unget character is read again. */
| 7311 | behave as if the unget character is read again. |
| 7312 | */ |
| 7313 | void unget() |
| 7314 | { |
| 7315 | next_unget = true; |
| 7316 | |
| 7317 | --position.chars_read_total; |
| 7318 | |
| 7319 | // in case we "unget" a newline, we have to also decrement the lines_read |
| 7320 | if (position.chars_read_current_line == 0) |
| 7321 | { |
| 7322 | if (position.lines_read > 0) |
| 7323 | { |
| 7324 | --position.lines_read; |
| 7325 | } |
| 7326 | } |
| 7327 | else |
| 7328 | { |
| 7329 | --position.chars_read_current_line; |
| 7330 | } |
| 7331 | |
| 7332 | if (JSON_HEDLEY_LIKELY(current != std::char_traits<char_type>::eof())) |
| 7333 | { |
| 7334 | JSON_ASSERT(!token_string.empty()); |
| 7335 | token_string.pop_back(); |
| 7336 | } |
| 7337 | } |
| 7338 | |
| 7339 | /// add a character to token_buffer |
| 7340 | void add(char_int_type c) |
no test coverage detected