mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Working on installer packages;
Nicer warnings about using spaces for indentation git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@321 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -28,11 +28,6 @@ String IncludePackage::typeName() const { return _("include"); }
|
||||
|
||||
IMPLEMENT_REFLECTION(IncludePackage) {
|
||||
REFLECT_BASE(Packaged);
|
||||
REFLECT_IF_READING {
|
||||
// ingore
|
||||
String version;
|
||||
REFLECT(version);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : PackageManager
|
||||
|
||||
+12
-3
@@ -100,7 +100,7 @@ void Reader::moveNext() {
|
||||
}
|
||||
}
|
||||
|
||||
void Reader::readLine() {
|
||||
void Reader::readLine(bool in_string) {
|
||||
// fix UTF8 in ascii builds; skip BOM
|
||||
line = decodeUTF8BOM(stream.ReadLine());
|
||||
line_number += 1;
|
||||
@@ -121,7 +121,16 @@ void Reader::readLine() {
|
||||
indent = -1;
|
||||
return;
|
||||
}
|
||||
key = cannocial_name_form(trim(line.substr(indent, pos - indent)));
|
||||
key = line.substr(indent, pos - indent);
|
||||
if (!in_string && starts_with(key, _(" "))) {
|
||||
warning(_("key: '") + key + _("' starts with a space; only use TABs for indentation!"));
|
||||
// try to fix up: 8 spaces is a tab
|
||||
while (starts_with(key, _(" "))) {
|
||||
key = key.substr(8);
|
||||
indent += 1;
|
||||
}
|
||||
}
|
||||
key = cannocial_name_form(trim(key));
|
||||
value = pos == String::npos ? _("") : trim_left(line.substr(pos+1));
|
||||
}
|
||||
|
||||
@@ -177,7 +186,7 @@ const String& Reader::getValue() {
|
||||
if (!first) multi_line_str += _('\n');
|
||||
first = false;
|
||||
multi_line_str += line.substr(expected_indent); // strip expected indent
|
||||
readLine();
|
||||
readLine(true);
|
||||
}
|
||||
// moveNext(), but without emptying multi_line_str
|
||||
just_opened = false;
|
||||
|
||||
@@ -151,7 +151,7 @@ class Reader {
|
||||
/// Move to the next non empty line
|
||||
void moveNext();
|
||||
/// Reads the next line from the input, and stores it in line/key/value/indent
|
||||
void readLine();
|
||||
void readLine(bool in_string = false);
|
||||
|
||||
/// Return the value on the current line
|
||||
const String& getValue();
|
||||
|
||||
Reference in New Issue
Block a user