[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src map.hpp serialization/parser.cpp se...
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src map.hpp serialization/parser.cpp se... |
Date: |
Mon, 28 Mar 2005 07:29:10 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/03/28 12:29:10
Modified files:
src : map.hpp
src/serialization: parser.cpp tokenizer.cpp
Log message:
Allowing back WML variables to contain spaces. Not that I like it, but
it did
break too much stuff.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/map.hpp.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/parser.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/tokenizer.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: wesnoth/src/map.hpp
diff -u wesnoth/src/map.hpp:1.36 wesnoth/src/map.hpp:1.37
--- wesnoth/src/map.hpp:1.36 Sun Mar 27 23:06:17 2005
+++ wesnoth/src/map.hpp Mon Mar 28 12:29:10 2005
@@ -1,4 +1,4 @@
-/* $Id: map.hpp,v 1.36 2005/03/27 23:06:17 gruikya Exp $ */
+/* $Id: map.hpp,v 1.37 2005/03/28 12:29:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -15,7 +15,6 @@
#define MAP_H_INCLUDED
class config;
-class vconfig;
#include "terrain.hpp"
Index: wesnoth/src/serialization/parser.cpp
diff -u wesnoth/src/serialization/parser.cpp:1.9
wesnoth/src/serialization/parser.cpp:1.10
--- wesnoth/src/serialization/parser.cpp:1.9 Sun Mar 27 23:06:17 2005
+++ wesnoth/src/serialization/parser.cpp Mon Mar 28 12:29:10 2005
@@ -1,4 +1,4 @@
-/* $Id: parser.cpp,v 1.9 2005/03/27 23:06:17 gruikya Exp $ */
+/* $Id: parser.cpp,v 1.10 2005/03/28 12:29:10 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -203,16 +203,28 @@
{
config& cfg = *elements.top().cfg;
std::vector<std::string> variables;
- variables.push_back(tok_.current_token().value);
- tok_.next_token();
+ variables.push_back("");
while (tok_.current_token().type != '=') {
- if (tok_.current_token().type != ',')
+ switch(tok_.current_token().type) {
+ case token::STRING:
+ if(!variables.back().empty())
+ variables.back() += ' ';
+ variables.back() += tok_.current_token().value;
+ break;
+ case ',':
+ if(variables.back().empty()) {
+ // FIXME: this error message is not really
+ // appropriate, although a proper one should
+ // wait after string freeze.
+ error(_("Unexpected characters after variable
name (expected , or =)"));
+ variables.push_back("");
+ }
+ break;
+ default:
error(_("Unexpected characters after variable name
(expected , or =)"));
- tok_.next_token();
- if (tok_.current_token().type != token::STRING)
- error(_("Invalid variable name"));
- variables.push_back(tok_.current_token().value);
+ break;
+ }
tok_.next_token();
}
Index: wesnoth/src/serialization/tokenizer.cpp
diff -u wesnoth/src/serialization/tokenizer.cpp:1.1
wesnoth/src/serialization/tokenizer.cpp:1.2
--- wesnoth/src/serialization/tokenizer.cpp:1.1 Sun Mar 27 23:06:17 2005
+++ wesnoth/src/serialization/tokenizer.cpp Mon Mar 28 12:29:10 2005
@@ -1,4 +1,4 @@
-/* $Id: tokenizer.cpp,v 1.1 2005/03/27 23:06:17 gruikya Exp $ */
+/* $Id: tokenizer.cpp,v 1.2 2005/03/28 12:29:10 gruikya Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -84,7 +84,7 @@
token_.value += current_;
};
break;
- case '[': case ']': case '/': case '\n': case '=': case ',': case '+':
case '_':
+ case '[': case ']': case '/': case '\n': case '=': case ',': case '+':
token_.type = token::token_type(current_);
token_.value = current_;
break;
@@ -100,6 +100,8 @@
token_.type = token::MISC;
token_.value += current_;
}
+ if(token_.value == "_")
+ token_.type = token::token_type('_');
}
if(current_ != EOF)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src map.hpp serialization/parser.cpp se...,
Philippe Plantier <=