public void Expect(JsonTokenType type1, JsonTokenType type2) { if (this.TokenType != type1 && this.TokenType != type2) { throw LiteException.UnexpectedToken(this.Token); } }
internal BsonValue ReadValue(JsonToken token) { switch (token.TokenType) { case JsonTokenType.String: return(token.Token); case JsonTokenType.BeginDoc: return(this.ReadObject()); case JsonTokenType.BeginArray: return(this.ReadArray()); case JsonTokenType.Number: return(token.Token.Contains(".") ? new BsonValue(Convert.ToDouble(token.Token, CultureInfo.InvariantCulture.NumberFormat)) : new BsonValue(Convert.ToInt32(token.Token))); case JsonTokenType.Word: switch (token.Token) { case "null": return(BsonValue.Null); case "true": return(true); case "false": return(false); default: throw LiteException.UnexpectedToken(token.Token); } } throw LiteException.UnexpectedToken(token.Token); }