mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
don't warn about \' escape sequence.
added numeric escapes git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1643 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+14
-2
@@ -288,9 +288,21 @@ void TokenIterator::readStringToken() {
|
|||||||
}
|
}
|
||||||
c = input.GetChar(pos++);
|
c = input.GetChar(pos++);
|
||||||
if (c == _('n')) str += _('\n');
|
if (c == _('n')) str += _('\n');
|
||||||
|
else if (c == _('r')) str += _('\r');
|
||||||
|
else if (c == _('t')) str += _('\t');
|
||||||
|
else if (c == _('&')); // escape for nothing
|
||||||
else if (c == _('<')) str += _('\1'); // escape for <
|
else if (c == _('<')) str += _('\1'); // escape for <
|
||||||
else if (c == _('\\') || c == _('"') || c == _('{') || c == _('}')) {
|
else if (c == _('\\') || c == _('"') || c == _('\'') || c == _('{') || c == _('}')) {
|
||||||
str += c; // \ or { or "
|
str += c; // \ or { or " or ', don't warn about these, since they look escape-worthy
|
||||||
|
} else if (c >= _('0') && c <= _('9')) {
|
||||||
|
// numeric escape
|
||||||
|
int i = 0;
|
||||||
|
while (c >= _('0') && c <= _('9')) {
|
||||||
|
i = i * 10 + static_cast<int>(c - _('0'));
|
||||||
|
c = input.GetChar(pos++);
|
||||||
|
}
|
||||||
|
pos--;
|
||||||
|
str += static_cast<Char>(i); // ignore
|
||||||
} else {
|
} else {
|
||||||
add_error(String::Format(_("Invalid string escape sequence: \"\\%c\""),c));
|
add_error(String::Format(_("Invalid string escape sequence: \"\\%c\""),c));
|
||||||
str += _('\\') + c; // ignore
|
str += _('\\') + c; // ignore
|
||||||
|
|||||||
Reference in New Issue
Block a user