@@ -283,6 +283,8 @@ class basic_parser
283
283
val1, val2, val3
284
284
};
285
285
286
+ using no_state = std::integral_constant< state, state(CHAR_MAX) >;
287
+
286
288
struct number
287
289
{
288
290
uint64_t mant;
@@ -292,7 +294,7 @@ class basic_parser
292
294
bool neg;
293
295
};
294
296
295
- template < bool StackEmpty_ , char First_ >
297
+ template < class PrevState , char First_ >
296
298
struct parse_number_helper ;
297
299
298
300
// optimization: must come first
@@ -392,42 +394,47 @@ class basic_parser
392
394
#pragma warning pop
393
395
#endif
394
396
395
- template <bool StackEmpty_ /* , bool Terminal_*/ >
397
+ template <class PrevState /* , bool Terminal_*/ >
396
398
const char * parse_comment (const char * p,
397
- std::integral_constant< bool , StackEmpty_> stack_empty ,
399
+ PrevState st ,
398
400
/* std::integral_constant<bool, Terminal_>*/ bool terminal);
399
401
400
- template <bool StackEmpty_>
401
- const char * parse_document (const char * p,
402
- std::integral_constant<bool , StackEmpty_> stack_empty);
402
+ template <class PrevState >
403
+ const char * parse_document (const char * p, PrevState st);
403
404
404
- template <bool StackEmpty_ , bool AllowComments_/* ,
405
+ template <class PrevState , bool AllowComments_/* ,
405
406
bool AllowTrailing_, bool AllowBadUTF8_*/ >
406
- const char * parse_value (const char * p,
407
- std::integral_constant<bool , StackEmpty_> stack_empty,
407
+ const char * parse_value (
408
+ const char * p,
409
+ PrevState st,
408
410
std::integral_constant<bool , AllowComments_> allow_comments,
409
411
/* std::integral_constant<bool, AllowTrailing_>*/ bool allow_trailing,
410
412
/* std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8);
411
413
412
414
template <bool AllowComments_/* ,
413
415
bool AllowTrailing_, bool AllowBadUTF8_*/ >
414
- const char * resume_value (const char * p,
416
+ const char * resume_value (
417
+ const char * p,
418
+ state st,
415
419
std::integral_constant<bool , AllowComments_> allow_comments,
416
420
/* std::integral_constant<bool, AllowTrailing_>*/ bool allow_trailing,
417
421
/* std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8);
418
422
419
- template <bool StackEmpty_ , bool AllowComments_/* ,
423
+ template <class PrevState , bool AllowComments_/* ,
420
424
bool AllowTrailing_, bool AllowBadUTF8_*/ >
421
- const char * parse_object (const char * p,
422
- std::integral_constant<bool , StackEmpty_> stack_empty,
425
+ const char * parse_object (
426
+ const char * p,
427
+ PrevState st,
428
+ std::size_t size,
423
429
std::integral_constant<bool , AllowComments_> allow_comments,
424
430
/* std::integral_constant<bool, AllowTrailing_>*/ bool allow_trailing,
425
431
/* std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8);
426
432
427
- template <bool StackEmpty_ , bool AllowComments_/* ,
433
+ template <class PrevState , bool AllowComments_/* ,
428
434
bool AllowTrailing_, bool AllowBadUTF8_*/ >
429
435
const char * parse_array (const char * p,
430
- std::integral_constant<bool , StackEmpty_> stack_empty,
436
+ PrevState st,
437
+ std::size_t size,
431
438
std::integral_constant<bool , AllowComments_> allow_comments,
432
439
/* std::integral_constant<bool, AllowTrailing_>*/ bool allow_trailing,
433
440
/* std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8);
@@ -436,32 +443,36 @@ class basic_parser
436
443
const char * parse_literal (const char * p,
437
444
std::integral_constant<int , Literal> literal);
438
445
439
- template <bool StackEmpty_ , bool IsKey_/* ,
446
+ template <class PrevState , bool IsKey_/* ,
440
447
bool AllowBadUTF8_*/ >
441
- const char * parse_string (const char * p,
442
- std::integral_constant<bool , StackEmpty_> stack_empty,
448
+ const char * parse_string (
449
+ const char * p,
450
+ PrevState st,
451
+ std::size_t total,
443
452
std::integral_constant<bool , IsKey_> is_key,
444
453
/* std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8);
445
454
446
- template <bool StackEmpty_ , char First_, number_precision Numbers_>
455
+ template <class PrevState , char First_, number_precision Numbers_>
447
456
const char * parse_number (const char * p,
448
- std::integral_constant< bool , StackEmpty_> stack_empty ,
457
+ PrevState st ,
449
458
std::integral_constant<char , First_> first,
450
459
std::integral_constant<number_precision, Numbers_> numbers);
451
460
452
- template <bool StackEmpty_ , bool IsKey_/* ,
461
+ template <class PrevState , bool IsKey_/* ,
453
462
bool AllowBadUTF8_*/ >
454
- const char * parse_unescaped (const char * p,
455
- std::integral_constant<bool , StackEmpty_> stack_empty,
463
+ const char * parse_unescaped (
464
+ const char * p,
465
+ PrevState st,
466
+ std::size_t total,
456
467
std::integral_constant<bool , IsKey_> is_key,
457
468
/* std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8);
458
469
459
- template <bool StackEmpty_ /* , bool IsKey_,
470
+ template <class PrevState /* , bool IsKey_,
460
471
bool AllowBadUTF8_*/ >
461
472
const char * parse_escaped (
462
473
const char * p,
474
+ PrevState st,
463
475
std::size_t total,
464
- std::integral_constant<bool , StackEmpty_> stack_empty,
465
476
/* std::integral_constant<bool, IsKey_>*/ bool is_key,
466
477
/* std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8);
467
478
0 commit comments