-Refactor
This commit is contained in:
@@ -505,7 +505,6 @@ namespace Newtonsoft.Json
|
|||||||
_charPos = charPos;
|
_charPos = charPos;
|
||||||
if (!EnsureChars(0, true))
|
if (!EnsureChars(0, true))
|
||||||
{
|
{
|
||||||
_charPos = charPos;
|
|
||||||
throw JsonReaderException.Create(this, "Unterminated string. Expected delimiter: {0}.".FormatWith(CultureInfo.InvariantCulture, quote));
|
throw JsonReaderException.Create(this, "Unterminated string. Expected delimiter: {0}.".FormatWith(CultureInfo.InvariantCulture, quote));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,43 +512,36 @@ namespace Newtonsoft.Json
|
|||||||
int escapeStartPos = charPos - 1;
|
int escapeStartPos = charPos - 1;
|
||||||
|
|
||||||
char currentChar = _chars[charPos];
|
char currentChar = _chars[charPos];
|
||||||
|
charPos++;
|
||||||
|
|
||||||
char writeChar;
|
char writeChar;
|
||||||
|
|
||||||
switch (currentChar)
|
switch (currentChar)
|
||||||
{
|
{
|
||||||
case 'b':
|
case 'b':
|
||||||
charPos++;
|
|
||||||
writeChar = '\b';
|
writeChar = '\b';
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
charPos++;
|
|
||||||
writeChar = '\t';
|
writeChar = '\t';
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
charPos++;
|
|
||||||
writeChar = '\n';
|
writeChar = '\n';
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
charPos++;
|
|
||||||
writeChar = '\f';
|
writeChar = '\f';
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
charPos++;
|
|
||||||
writeChar = '\r';
|
writeChar = '\r';
|
||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
charPos++;
|
|
||||||
writeChar = '\\';
|
writeChar = '\\';
|
||||||
break;
|
break;
|
||||||
case '"':
|
case '"':
|
||||||
case '\'':
|
case '\'':
|
||||||
case '/':
|
case '/':
|
||||||
writeChar = currentChar;
|
writeChar = currentChar;
|
||||||
charPos++;
|
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
charPos++;
|
|
||||||
_charPos = charPos;
|
_charPos = charPos;
|
||||||
writeChar = ParseUnicode();
|
writeChar = ParseUnicode();
|
||||||
|
|
||||||
@@ -608,7 +600,6 @@ namespace Newtonsoft.Json
|
|||||||
charPos = _charPos;
|
charPos = _charPos;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
charPos++;
|
|
||||||
_charPos = charPos;
|
_charPos = charPos;
|
||||||
throw JsonReaderException.Create(this, "Bad JSON escape sequence: {0}.".FormatWith(CultureInfo.InvariantCulture, @"\" + currentChar));
|
throw JsonReaderException.Create(this, "Bad JSON escape sequence: {0}.".FormatWith(CultureInfo.InvariantCulture, @"\" + currentChar));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user