mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-11 21:17:28 +00:00
Fix schema validator ignoring toplevel keys
This commit is contained in:
parent
6936c59e17
commit
90d1aec2f2
@ -125,6 +125,10 @@ void parser::operator()()
|
||||
cfg_.clear();
|
||||
elements.emplace(&cfg_, "");
|
||||
|
||||
if(validator_) {
|
||||
validator_->open_tag("", cfg_, tok_.get_start_line(), tok_.get_file());
|
||||
}
|
||||
|
||||
do {
|
||||
tok_.next_token();
|
||||
|
||||
@ -163,6 +167,12 @@ void parser::operator()()
|
||||
// The main element should be there. If it is not, this is a parser error.
|
||||
assert(!elements.empty());
|
||||
|
||||
if(validator_) {
|
||||
element& el = elements.top();
|
||||
validator_->validate(*el.cfg, el.name, el.start_line, el.file);
|
||||
validator_->close_tag();
|
||||
}
|
||||
|
||||
if(elements.size() != 1) {
|
||||
utils::string_map i18n_symbols;
|
||||
i18n_symbols["tag"] = elements.top().name;
|
||||
|
@ -205,7 +205,9 @@ bool schema_validator::read_config_file(const std::string& filename)
|
||||
*/
|
||||
void schema_validator::open_tag(const std::string& name, const config& parent, int start_line, const std::string& file, bool addittion)
|
||||
{
|
||||
if(!stack_.empty()) {
|
||||
if(name.empty()) {
|
||||
// Opened the root tag; nothing special to do here
|
||||
} else if(!stack_.empty()) {
|
||||
const wml_tag* tag = nullptr;
|
||||
|
||||
if(stack_.top()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user