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

◆ ConsumeNextTokenMultiSegment()

ConsumeTokenResult System.Text.Json.Utf8JsonReader.ConsumeNextTokenMultiSegment ( byte marker)
inlineprivate

Definition at line 3192 of file Utf8JsonReader.cs.

3193 {
3195 {
3196 if (_readerOptions.CommentHandling != JsonCommentHandling.Allow)
3197 {
3199 }
3200 if (marker == 47)
3201 {
3203 {
3204 return ConsumeTokenResult.NotEnoughDataRollBackState;
3205 }
3206 return ConsumeTokenResult.Success;
3207 }
3208 if (_tokenType == JsonTokenType.Comment)
3209 {
3211 }
3212 }
3213 if (_bitStack.CurrentDepth == 0)
3214 {
3215 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedEndAfterSingleJson, marker);
3216 }
3217 switch (marker)
3218 {
3219 case 44:
3220 {
3221 _consumed++;
3223 if (_consumed >= (uint)_buffer.Length)
3224 {
3225 if (IsLastSpan)
3226 {
3227 _consumed--;
3229 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyOrValueNotFound, 0);
3230 }
3231 if (!GetNextSpan())
3232 {
3233 if (IsLastSpan)
3234 {
3235 _consumed--;
3237 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyOrValueNotFound, 0);
3238 }
3239 return ConsumeTokenResult.NotEnoughDataRollBackState;
3240 }
3241 }
3242 byte b = _buffer[_consumed];
3243 if (b <= 32)
3244 {
3246 if (!HasMoreDataMultiSegment(ExceptionResource.ExpectedStartOfPropertyOrValueNotFound))
3247 {
3248 return ConsumeTokenResult.NotEnoughDataRollBackState;
3249 }
3250 b = _buffer[_consumed];
3251 }
3253 if (_readerOptions.CommentHandling == JsonCommentHandling.Allow && b == 47)
3254 {
3257 {
3258 return ConsumeTokenResult.NotEnoughDataRollBackState;
3259 }
3260 return ConsumeTokenResult.Success;
3261 }
3262 if (_inObject)
3263 {
3264 if (b != 34)
3265 {
3266 if (b == 125)
3267 {
3269 {
3270 EndObject();
3271 return ConsumeTokenResult.Success;
3272 }
3273 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.TrailingCommaNotAllowedBeforeObjectEnd, 0);
3274 }
3275 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.ExpectedStartOfPropertyNotFound, b);
3276 }
3278 {
3279 return ConsumeTokenResult.NotEnoughDataRollBackState;
3280 }
3281 return ConsumeTokenResult.Success;
3282 }
3283 if (b == 93)
3284 {
3286 {
3287 EndArray();
3288 return ConsumeTokenResult.Success;
3289 }
3290 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.TrailingCommaNotAllowedBeforeArrayEnd, 0);
3291 }
3293 {
3294 return ConsumeTokenResult.NotEnoughDataRollBackState;
3295 }
3296 return ConsumeTokenResult.Success;
3297 }
3298 case 125:
3299 EndObject();
3300 break;
3301 case 93:
3302 EndArray();
3303 break;
3304 default:
3305 ThrowHelper.ThrowJsonReaderException(ref this, ExceptionResource.FoundInvalidCharacter, marker);
3306 break;
3307 }
3308 return ConsumeTokenResult.Success;
3309 }
bool ConsumeValueMultiSegment(byte marker)
ConsumeTokenResult ConsumeNextTokenUntilAfterAllCommentsAreSkippedMultiSegment(byte marker)
ConsumeTokenResult ConsumeNextTokenFromLastNonCommentTokenMultiSegment()

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._readerOptions, System.Text.Json.Utf8JsonReader._tokenType, System.Text.Json.Utf8JsonReader._trailingCommaBeforeComment, System.Text.Json.JsonReaderOptions.AllowTrailingCommas, System.Text.Json.Utf8JsonReader.BytesConsumed, System.Text.Json.JsonReaderOptions.CommentHandling, System.Text.Json.Utf8JsonReader.ConsumeNextTokenFromLastNonCommentTokenMultiSegment(), System.Text.Json.Utf8JsonReader.ConsumeNextTokenUntilAfterAllCommentsAreSkippedMultiSegment(), 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.ReadOnlySpan< T >.Length, 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.ConsumeNextTokenOrRollbackMultiSegment().