added 'string mode' to script parser; added Keyword and related classes

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@85 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-11-21 14:35:14 +00:00
parent b6f1a9aac7
commit 7148d90bcb
14 changed files with 221 additions and 36 deletions
+3 -1
View File
@@ -77,7 +77,7 @@ class OptionalScript {
ScriptP script; ///< The script, may be null if there is no script
String unparsed; ///< Unparsed script, for writing back to a file
// parse the unparsed string, while reading
void parse(Reader&);
void parse(Reader&, bool string_mode = false);
DECLARE_REFLECTION();
template <typename T> friend class Scriptable;
};
@@ -126,6 +126,8 @@ void Reader::handle(Scriptable<T>& s) {
if (starts_with(s.script.unparsed, _("script:"))) {
s.script.unparsed = s.script.unparsed.substr(7);
s.script.parse(*this);
} else if (s.script.unparsed.find_first_of('{') != String.npos) {
s.script.parse(*this, true);
} else {
handle(s.value);
}