MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / unget

Function unget

Source/external/json.hpp:8675–8699  ·  view source on GitHub ↗

! @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. */

Source from the content-addressed store, hash-verified

8673 behave as if the unget character is read again.
8674 */
8675 void unget()
8676 {
8677 next_unget = true;
8678
8679 --position.chars_read_total;
8680
8681 // in case we "unget" a newline, we have to also decrement the lines_read
8682 if (position.chars_read_current_line == 0)
8683 {
8684 if (position.lines_read > 0)
8685 {
8686 --position.lines_read;
8687 }
8688 }
8689 else
8690 {
8691 --position.chars_read_current_line;
8692 }
8693
8694 if (JSON_HEDLEY_LIKELY(current != std::char_traits<char_type>::eof()))
8695 {
8696 JSON_ASSERT(!token_string.empty());
8697 token_string.pop_back();
8698 }
8699 }
8700
8701 /// add a character to token_buffer
8702 void add(char_int_type c)

Callers 3

scan_commentMethod · 0.85
scan_numberMethod · 0.85
skip_bomFunction · 0.85

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected