Location lastValueEnd_;
Value* lastValue_;
std::string commentsBefore_;
- OurFeatures features_;
+ int stackDepth_;
+
+ OurFeatures const features_;
bool collectComments_;
}; // OurReader
nodes_.pop();
nodes_.push(&root);
+ stackDepth_ = 0;
bool successful = readValue();
Token token;
skipCommentTokens(token);
}
bool OurReader::readValue() {
+ if (stackDepth_ >= features_.stackLimit_) throw std::runtime_error("Exceeded stackLimit in readValue().");
+ ++stackDepth_;
Token token;
skipCommentTokens(token);
bool successful = true;
lastValue_ = ¤tValue();
}
+ --stackDepth_;
return successful;
}