! @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. */
| 7992 | behave as if the unget character is read again. |
| 7993 | */ |
| 7994 | void unget() |
| 7995 | { |
| 7996 | next_unget = true; |
| 7997 | |
| 7998 | --position.chars_read_total; |
| 7999 | |
| 8000 | // in case we "unget" a newline, we have to also decrement the lines_read |
| 8001 | if (position.chars_read_current_line == 0) |
| 8002 | { |
| 8003 | if (position.lines_read > 0) |
| 8004 | { |
| 8005 | --position.lines_read; |
| 8006 | } |
| 8007 | } |
| 8008 | else |
| 8009 | { |
| 8010 | --position.chars_read_current_line; |
| 8011 | } |
| 8012 | |
| 8013 | if (JSON_HEDLEY_LIKELY(current != std::char_traits<char_type>::eof())) |
| 8014 | { |
| 8015 | JSON_ASSERT(!token_string.empty()); |
| 8016 | token_string.pop_back(); |
| 8017 | } |
| 8018 | } |
| 8019 | |
| 8020 | /// add a character to token_buffer |
| 8021 | void add(char_int_type c) |
no test coverage detected