in Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonTextReader.cs [151:279]
public override bool Read()
{
// Skip past whitespace to the start of the next token
// (or to the end of the buffer if the whitespace is trailing)
this.jsonTextBuffer.AdvanceWhileWhitespace();
if (this.jsonTextBuffer.IsEof)
{
// Need to check if we are still inside of an object or array
if (this.JsonObjectState.CurrentDepth != 0)
{
if (this.JsonObjectState.InObjectContext)
{
throw new JsonMissingEndObjectException();
}
else if (this.JsonObjectState.InArrayContext)
{
throw new JsonMissingEndArrayException();
}
else
{
throw new JsonNotCompleteException();
}
}
return false;
}
this.token.Start = this.jsonTextBuffer.Position;
char nextChar = this.jsonTextBuffer.PeekCharacter();
switch (nextChar)
{
case '\"':
{
this.ProcessString();
break;
}
case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this.ProcessNumber();
break;
case '[':
this.ProcessSingleByteToken(JsonTextTokenType.BeginArray);
break;
case ']':
this.ProcessSingleByteToken(JsonTextTokenType.EndArray);
break;
case '{':
this.ProcessSingleByteToken(JsonTextTokenType.BeginObject);
break;
case '}':
this.ProcessSingleByteToken(JsonTextTokenType.EndObject);
break;
case 't':
this.ProcessTrue();
break;
case 'f':
this.ProcessFalse();
break;
case 'n':
this.ProcessNull();
break;
case ',':
this.ProcessValueSeparator();
break;
case ':':
this.ProcessNameSeparator();
break;
case JsonTextReader.Int8TokenPrefix:
this.ProcessInt8();
break;
case JsonTextReader.Int16TokenPrefix:
this.ProcessInt16();
break;
case JsonTextReader.Int32TokenPrefix:
this.ProcessInt32OrInt64();
break;
case JsonTextReader.UnsignedTokenPrefix:
this.ProcessUInt32();
break;
case JsonTextReader.FloatTokenPrefix:
this.ProcessFloat32();
break;
case JsonTextReader.DoubleTokenPrefix:
this.ProcessFloat64();
break;
case JsonTextReader.GuidTokenPrefix:
this.ProcessGuid();
break;
case JsonTextReader.BinaryTokenPrefix:
this.ProcessBinary();
break;
default:
// We found a start token character which doesn't match any JSON token type
throw new JsonUnexpectedTokenException();
}
this.token.End = this.jsonTextBuffer.Position;
return true;
}