private void ParseUnquotedProperty()
{
int initialPosition = _charPos;
// parse unquoted property name until whitespace or colon
while (true)
{
switch (_chars[_charPos])
{
case '\0':
if (_charsUsed == _charPos)
{
if (ReadData(true) == 0)
{
throw JsonReaderException.Create(this, "Unexpected end while parsing unquoted property name.");
}
break;
}
_stringReference = new StringReference(_chars, initialPosition, _charPos - initialPosition);
return;
default:
char currentChar = _chars[_charPos];
if (ValidIdentifierChar(currentChar))
{
_charPos++;
break;
}
else if (char.IsWhiteSpace(currentChar) || currentChar == ':')
{
_stringReference = new StringReference(_chars, initialPosition, _charPos - initialPosition);
return;
}
throw JsonReaderException.Create(this, "Invalid JavaScript property identifier character: {0}.".FormatWith(CultureInfo.InvariantCulture, currentChar));
}
}
}