MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / unget

Function unget

extern/json/json.hpp:8679–8703  ·  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

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

Callers 3

scan_commentMethod · 0.85
scan_numberMethod · 0.85
skip_bomFunction · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected