MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / unget

Function unget

3rd/nlohmann_json/single_include/nlohmann/json.hpp:7994–8018  ·  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

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)

Callers 3

scan_commentMethod · 0.70
scan_numberMethod · 0.70
skip_bomFunction · 0.70

Calls 2

emptyMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected