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

◆ ConsumeNextTokenFromLastNonCommentToken()

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

Definition at line 1373 of file Utf8JsonReader.cs.

1374 {
1375 if (JsonReaderHelper.IsTokenTypePrimitive(_previousTokenType))
1376 {
1377 _tokenType = (_inObject ? JsonTokenType.StartObject : JsonTokenType.StartArray);
1378 }
1379 else
1380 {
1382 }
1383 if (HasMoreData())
1384 {
1385 byte b = _buffer[_consumed];
1386 if (b <= 32)
1387 {
1389 if (!HasMoreData())
1390 {
1391 goto IL_0343;
1392 }
1393 b = _buffer[_consumed];
1394 }
1395 if (_bitStack.CurrentDepth == 0 && _tokenType != 0)
1396 {
1397 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedEndAfterSingleJson, b);
1398 }
1400 if (b != 44)
1401 {
1402 if (b == 125)
1403 {
1404 EndObject();
1405 }
1406 else
1407 {
1408 if (b != 93)
1409 {
1410 if (_tokenType == JsonTokenType.None)
1411 {
1412 if (ReadFirstToken(b))
1413 {
1414 goto IL_0341;
1415 }
1416 }
1417 else if (_tokenType == JsonTokenType.StartObject)
1418 {
1419 if (b != 34)
1420 {
1421 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyNotFound, b);
1422 }
1423 int consumed = _consumed;
1425 long lineNumber = _lineNumber;
1426 if (ConsumePropertyName())
1427 {
1428 goto IL_0341;
1429 }
1431 _tokenType = JsonTokenType.StartObject;
1433 _lineNumber = lineNumber;
1434 }
1435 else if (_tokenType == JsonTokenType.StartArray)
1436 {
1437 if (ConsumeValue(b))
1438 {
1439 goto IL_0341;
1440 }
1441 }
1442 else if (_tokenType == JsonTokenType.PropertyName)
1443 {
1444 if (ConsumeValue(b))
1445 {
1446 goto IL_0341;
1447 }
1448 }
1449 else if (_inObject)
1450 {
1451 if (b != 34)
1452 {
1453 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyNotFound, b);
1454 }
1455 if (ConsumePropertyName())
1456 {
1457 goto IL_0341;
1458 }
1459 }
1460 else if (ConsumeValue(b))
1461 {
1462 goto IL_0341;
1463 }
1464 goto IL_0343;
1465 }
1466 EndArray();
1467 }
1468 goto IL_0341;
1469 }
1470 if ((int)_previousTokenType <= 1 || _previousTokenType == JsonTokenType.StartArray || _trailingCommaBeforeComment)
1471 {
1472 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyOrValueAfterComment, b);
1473 }
1474 _consumed++;
1476 if (_consumed >= (uint)_buffer.Length)
1477 {
1478 if (IsLastSpan)
1479 {
1480 _consumed--;
1482 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyOrValueNotFound, 0);
1483 }
1484 }
1485 else
1486 {
1487 b = _buffer[_consumed];
1488 if (b <= 32)
1489 {
1491 if (!HasMoreData(ExceptionResource.ExpectedStartOfPropertyOrValueNotFound))
1492 {
1493 goto IL_0343;
1494 }
1495 b = _buffer[_consumed];
1496 }
1498 if (b == 47)
1499 {
1501 if (ConsumeComment())
1502 {
1503 goto IL_0341;
1504 }
1505 }
1506 else if (_inObject)
1507 {
1508 if (b != 34)
1509 {
1510 if (b == 125)
1511 {
1513 {
1514 EndObject();
1515 goto IL_0341;
1516 }
1517 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.TrailingCommaNotAllowedBeforeObjectEnd, 0);
1518 }
1519 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyNotFound, b);
1520 }
1521 if (ConsumePropertyName())
1522 {
1523 goto IL_0341;
1524 }
1525 }
1526 else
1527 {
1528 if (b == 93)
1529 {
1531 {
1532 EndArray();
1533 goto IL_0341;
1534 }
1535 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.TrailingCommaNotAllowedBeforeArrayEnd, 0);
1536 }
1537 if (ConsumeValue(b))
1538 {
1539 goto IL_0341;
1540 }
1541 }
1542 }
1543 }
1544 goto IL_0343;
1545 IL_0343:
1546 return ConsumeTokenResult.NotEnoughDataRollBackState;
1547 IL_0341:
1548 return ConsumeTokenResult.Success;
1549 }

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._trailingCommaBeforeComment, System.Text.Json.JsonReaderOptions.AllowTrailingCommas, System.Text.Json.Utf8JsonReader.ConsumeComment(), System.Text.Json.Utf8JsonReader.ConsumePropertyName(), System.Text.Json.Utf8JsonReader.ConsumeValue(), System.Text.Json.BitStack.CurrentDepth, System.Text.Json.Dictionary, System.Text.Json.Utf8JsonReader.EndArray(), System.Text.Json.Utf8JsonReader.EndObject(), System.Text.Json.Utf8JsonReader.HasMoreData(), System.Text.Json.Utf8JsonReader.IsLastSpan, System.Text.Json.JsonReaderHelper.IsTokenTypePrimitive(), System.ReadOnlySpan< T >.Length, System.Text.Json.Utf8JsonReader.ReadFirstToken(), System.Text.Json.Utf8JsonReader.SkipWhiteSpace(), System.Text.Json.ThrowHelper.ThrowJsonReaderException(), and System.Text.Json.Utf8JsonReader.TokenStartIndex.

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