! @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. */
| 8744 | behave as if the unget character is read again. |
| 8745 | */ |
| 8746 | void unget() |
| 8747 | { |
| 8748 | next_unget = true; |
| 8749 | |
| 8750 | --position.chars_read_total; |
| 8751 | |
| 8752 | // in case we "unget" a newline, we have to also decrement the lines_read |
| 8753 | if (position.chars_read_current_line == 0) |
| 8754 | { |
| 8755 | if (position.lines_read > 0) |
| 8756 | { |
| 8757 | --position.lines_read; |
| 8758 | } |
| 8759 | } |
| 8760 | else |
| 8761 | { |
| 8762 | --position.chars_read_current_line; |
| 8763 | } |
| 8764 | |
| 8765 | if (JSON_HEDLEY_LIKELY(current != char_traits<char_type>::eof())) |
| 8766 | { |
| 8767 | JSON_ASSERT(!token_string.empty()); |
| 8768 | token_string.pop_back(); |
| 8769 | } |
| 8770 | } |
| 8771 | |
| 8772 | /// add a character to token_buffer |
| 8773 | void add(char_int_type c) |
no test coverage detected