From 2f3eb3ce7887c3f92134beefc58e560473ba6948 Mon Sep 17 00:00:00 2001 From: twanvl Date: Mon, 29 Dec 2008 19:12:28 +0000 Subject: [PATCH] warn about incorrect string escape sequences git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1266 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/script/parser.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/script/parser.cpp b/src/script/parser.cpp index 2626dac1..89367192 100644 --- a/src/script/parser.cpp +++ b/src/script/parser.cpp @@ -289,7 +289,12 @@ void TokenIterator::readStringToken() { c = input.GetChar(pos++); if (c == _('n')) str += _('\n'); else if (c == _('<')) str += _('\1'); // escape for < - else str += c; // \ or { or " + else if (c == _('\\') || c == _('"') || c == _('{') || c == _('}')) { + str += c; // \ or { or " + } else { + add_error(String::Format(_("Invalid string escape sequence: \"\\%c\""),c)); + str += _('\\') + c; // ignore + } } else if (c == _('{')) { // smart string // "a{e}b" --> "a" "{ e }" "b"