Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConsumeNextTokenFromLastNonCommentTokenMultiSegment()

ConsumeTokenResult System.Text.Json.Utf8JsonReader.ConsumeNextTokenFromLastNonCommentTokenMultiSegment ( )
inlineprivate

Definition at line 3311 of file Utf8JsonReader.cs.

3312 {
3313 if (JsonReaderHelper.IsTokenTypePrimitive(_previousTokenType))
3314 {
3315 _tokenType = (_inObject ? JsonTokenType.StartObject : JsonTokenType.StartArray);
3316 }
3317 else
3318 {
3320 }
3322 {
3323 byte b = _buffer[_consumed];
3324 if (b <= 32)
3325 {
3328 {
3329 goto IL_0393;
3330 }
3331 b = _buffer[_consumed];
3332 }
3333 if (_bitStack.CurrentDepth == 0 && _tokenType != 0)
3334 {
3335 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedEndAfterSingleJson, b);
3336 }
3338 if (b != 44)
3339 {
3340 if (b == 125)
3341 {
3342 EndObject();
3343 }
3344 else
3345 {
3346 if (b != 93)
3347 {
3348 if (_tokenType == JsonTokenType.None)
3349 {
3351 {
3352 goto IL_0391;
3353 }
3354 }
3355 else if (_tokenType == JsonTokenType.StartObject)
3356 {
3357 if (b != 34)
3358 {
3359 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyNotFound, b);
3360 }
3362 int consumed = _consumed;
3364 long lineNumber = _lineNumber;
3366 {
3367 goto IL_0391;
3368 }
3370 _tokenType = JsonTokenType.StartObject;
3372 _lineNumber = lineNumber;
3374 }
3375 else if (_tokenType == JsonTokenType.StartArray)
3376 {
3378 {
3379 goto IL_0391;
3380 }
3381 }
3382 else if (_tokenType == JsonTokenType.PropertyName)
3383 {
3385 {
3386 goto IL_0391;
3387 }
3388 }
3389 else if (_inObject)
3390 {
3391 if (b != 34)
3392 {
3393 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyNotFound, b);
3394 }
3396 {
3397 goto IL_0391;
3398 }
3399 }
3400 else if (ConsumeValueMultiSegment(b))
3401 {
3402 goto IL_0391;
3403 }
3404 goto IL_0393;
3405 }
3406 EndArray();
3407 }
3408 goto IL_0391;
3409 }
3410 if ((int)_previousTokenType <= 1 || _previousTokenType == JsonTokenType.StartArray || _trailingCommaBeforeComment)
3411 {
3412 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyOrValueAfterComment, b);
3413 }
3414 _consumed++;
3416 if (_consumed >= (uint)_buffer.Length)
3417 {
3418 if (IsLastSpan)
3419 {
3420 _consumed--;
3422 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyOrValueNotFound, 0);
3423 }
3424 if (!GetNextSpan())
3425 {
3426 if (IsLastSpan)
3427 {
3428 _consumed--;
3430 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyOrValueNotFound, 0);
3431 }
3432 goto IL_0393;
3433 }
3434 }
3435 b = _buffer[_consumed];
3436 if (b <= 32)
3437 {
3439 if (!HasMoreDataMultiSegment(ExceptionResource.ExpectedStartOfPropertyOrValueNotFound))
3440 {
3441 goto IL_0393;
3442 }
3443 b = _buffer[_consumed];
3444 }
3446 if (b == 47)
3447 {
3450 {
3451 goto IL_0391;
3452 }
3453 }
3454 else if (_inObject)
3455 {
3456 if (b != 34)
3457 {
3458 if (b == 125)
3459 {
3461 {
3462 EndObject();
3463 goto IL_0391;
3464 }
3465 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.TrailingCommaNotAllowedBeforeObjectEnd, 0);
3466 }
3467 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyNotFound, b);
3468 }
3470 {
3471 goto IL_0391;
3472 }
3473 }
3474 else
3475 {
3476 if (b == 93)
3477 {
3479 {
3480 EndArray();
3481 goto IL_0391;
3482 }
3483 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.TrailingCommaNotAllowedBeforeArrayEnd, 0);
3484 }
3486 {
3487 goto IL_0391;
3488 }
3489 }
3490 }
3491 goto IL_0393;
3492 IL_0393:
3493 return ConsumeTokenResult.NotEnoughDataRollBackState;
3494 IL_0391:
3495 return ConsumeTokenResult.Success;
3496 }
bool ReadFirstTokenMultiSegment(byte first)
bool ConsumeValueMultiSegment(byte marker)

References System.Text.Json.Utf8JsonReader._bitStack, System.Text.Json.Utf8JsonReader._buffer, System.Text.Json.Utf8JsonReader._bytePositionInLine, System.Text.Json.Utf8JsonReader._consumed, System.Text.Json.Utf8JsonReader._inObject, System.Text.Json.Utf8JsonReader._lineNumber, System.Text.Json.Utf8JsonReader._previousTokenType, System.Text.Json.Utf8JsonReader._readerOptions, System.Text.Json.Utf8JsonReader._tokenType, System.Text.Json.Utf8JsonReader._totalConsumed, System.Text.Json.Utf8JsonReader._trailingCommaBeforeComment, System.Text.Json.JsonReaderOptions.AllowTrailingCommas, System.Text.Json.Utf8JsonReader.BytesConsumed, System.Text.Json.Utf8JsonReader.ConsumePropertyNameMultiSegment(), System.Text.Json.Utf8JsonReader.ConsumeValueMultiSegment(), System.Text.Json.BitStack.CurrentDepth, System.Text.Json.Dictionary, System.Text.Json.Utf8JsonReader.EndArray(), System.Text.Json.Utf8JsonReader.EndObject(), System.Text.Json.Utf8JsonReader.GetNextSpan(), System.Text.Json.Utf8JsonReader.HasMoreDataMultiSegment(), System.Text.Json.Utf8JsonReader.IsLastSpan, System.Text.Json.JsonReaderHelper.IsTokenTypePrimitive(), System.ReadOnlySpan< T >.Length, System.Text.Json.Utf8JsonReader.ReadFirstTokenMultiSegment(), System.Text.Json.Utf8JsonReader.SkipOrConsumeCommentMultiSegmentWithRollback(), System.Text.Json.Utf8JsonReader.SkipWhiteSpaceMultiSegment(), System.Text.Json.ThrowHelper.ThrowJsonReaderException(), and System.Text.Json.Utf8JsonReader.TokenStartIndex.

Referenced by System.Text.Json.Utf8JsonReader.ConsumeNextTokenMultiSegment().