diff --git a/include/nlohmann/detail/input/parser.hpp b/include/nlohmann/detail/input/parser.hpp index 5fec57a70..54eb443c7 100644 --- a/include/nlohmann/detail/input/parser.hpp +++ b/include/nlohmann/detail/input/parser.hpp @@ -54,7 +54,8 @@ using parser_callback_t = /*! @brief syntax analysis -This class implements a recursive descent parser. +This class implements an iterative parser that keeps the open containers on +an explicit stack and reports what it reads as SAX events. */ template class parser @@ -439,8 +440,9 @@ class parser // We are done with this array. Before we can parse a // new value, we need to evaluate the new state first. - // By setting skip_to_state_evaluation to false, we - // are effectively jumping to the beginning of this if. + // By setting skip_to_state_evaluation to true, the next + // iteration skips parsing a value and evaluates the + // enclosing state directly. JSON_ASSERT(!states.empty()); states.pop_back(); skip_to_state_evaluation = true; @@ -500,8 +502,9 @@ class parser // We are done with this object. Before we can parse a // new value, we need to evaluate the new state first. - // By setting skip_to_state_evaluation to false, we - // are effectively jumping to the beginning of this if. + // By setting skip_to_state_evaluation to true, the next + // iteration skips parsing a value and evaluates the + // enclosing state directly. JSON_ASSERT(!states.empty()); states.pop_back(); skip_to_state_evaluation = true; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 76925282a..04c06617b 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -17132,7 +17132,8 @@ using parser_callback_t = /*! @brief syntax analysis -This class implements a recursive descent parser. +This class implements an iterative parser that keeps the open containers on +an explicit stack and reports what it reads as SAX events. */ template class parser @@ -17517,8 +17518,9 @@ class parser // We are done with this array. Before we can parse a // new value, we need to evaluate the new state first. - // By setting skip_to_state_evaluation to false, we - // are effectively jumping to the beginning of this if. + // By setting skip_to_state_evaluation to true, the next + // iteration skips parsing a value and evaluates the + // enclosing state directly. JSON_ASSERT(!states.empty()); states.pop_back(); skip_to_state_evaluation = true; @@ -17578,8 +17580,9 @@ class parser // We are done with this object. Before we can parse a // new value, we need to evaluate the new state first. - // By setting skip_to_state_evaluation to false, we - // are effectively jumping to the beginning of this if. + // By setting skip_to_state_evaluation to true, the next + // iteration skips parsing a value and evaluates the + // enclosing state directly. JSON_ASSERT(!states.empty()); states.pop_back(); skip_to_state_evaluation = true;