Author: sytyi
Date: Sun Jul 31 00:18:22 2011
New Revision: 50503
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50503&view=rev
Log:
Fixed link validation when closing many tags at moment.
Modified:
trunk/src/tools/schema/sourceparser.cpp
Modified: trunk/src/tools/schema/sourceparser.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tools/schema/sourceparser.cpp?rev=50503&r1=50502&r2=50503&view=diff
==============================================================================
--- trunk/src/tools/schema/sourceparser.cpp (original)
+++ trunk/src/tools/schema/sourceparser.cpp Sun Jul 31 00:18:22 2011
@@ -20,6 +20,8 @@
#include "tools/schema/sourceparser.hpp"
#include "boost/regex.hpp"
+
+#include <stack>
namespace schema_validation{
/** Little parts of regex templates used to parse Wml annoations.
@@ -250,26 +252,40 @@
if (current_.empty()){
return;
}
+ std::stack<std::string> error_cache ;
while (current_.size() > 1){
if (i==0){
- return;
+ break;
}
class_tag tag (current_.back());
current_.pop_back();
current_.back().add_tag(tag);
+ error_cache.push(tag.get_name());
i--;
}
- if (i==0){
- return;
- }
- //adding to parent
- if (parent_name_.empty()) {
- orphan_tags_.push_back(current_.back());
-
errors_.add_orphan_error(input_,line_,current_.back().get_name());
- }else{
- root_.add_tag(parent_name_,current_.back(),root_);
- }
- current_.pop_back();
+ if (i!=0){
+ //adding to parent
+ if (parent_name_.empty()) {
+ orphan_tags_.push_back(current_.back());
+
errors_.add_orphan_error(input_,line_,current_.back().get_name());
+ }else{
+ error_cache.push(current_.back().get_name());
+ root_.add_tag(parent_name_,current_.back(),root_);
+ }
+ current_.pop_back();
+ }
+ std::string name_to_remove_from_cache = parent_name_;
+ for (std::vector<class_tag>::const_iterator ii = current_.begin();
+ ii!= current_.end();++ii){
+ name_to_remove_from_cache += ii->get_name() + "/";
+ }
+ while (! error_cache.empty()){
+ name_to_remove_from_cache += error_cache.top();
+ errors_.remove_link_errors(name_to_remove_from_cache);
+ error_cache.pop();
+ name_to_remove_from_cache += "/";
+ }
+
}
@@ -445,7 +461,6 @@
if (ii->get_name() == name){
add_open_tag_error(count_opened);
close_opened_tags(++count_opened);
- errors_.remove_link_errors(parent_name_+name);
return true;
}else{
count_opened ++;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits