@@ -419,7 +419,7 @@ class jsonh_reader : utf8_reader {
419419 }
420420
421421 // Closing brace
422- if (next == " }" ) {
422+ if (next. value () == " }" ) {
423423 // End of object
424424 read ();
425425 tokens.push_back (jsonh_token (json_token_type::end_object));
@@ -598,7 +598,7 @@ class jsonh_reader : utf8_reader {
598598 }
599599
600600 // Closing bracket
601- if (next == " ]" ) {
601+ if (next. value () == " ]" ) {
602602 // End of array
603603 read ();
604604 tokens.push_back (jsonh_token (json_token_type::end_array));
@@ -683,14 +683,14 @@ class jsonh_reader : utf8_reader {
683683 }
684684
685685 // End quote
686- if (next == start_quote) {
686+ if (next. value () == start_quote) {
687687 end_quote_counter++;
688688 if (end_quote_counter == start_quote_counter) {
689689 break ;
690690 }
691691 }
692692 // Escape sequence
693- else if (next == " \\ " ) {
693+ else if (next. value () == " \\ " ) {
694694 nonstd::expected<std::string, std::string> escape_sequence_result = read_hex_escape_sequence (string_builder);
695695 if (!escape_sequence_result) {
696696 return nonstd::unexpected<std::string>(escape_sequence_result.error ());
@@ -1075,11 +1075,11 @@ class jsonh_reader : utf8_reader {
10751075 }
10761076
10771077 // Number
1078- if ((next >= " 0" && next <= " 9" ) || (next == " -" || next == " +" ) || next == " ." ) {
1078+ if ((next. value () >= " 0" && next. value () <= " 9" ) || (next. value () == " -" || next. value () == " +" ) || next. value () == " ." ) {
10791079 return read_number_or_quoteless_string ();
10801080 }
10811081 // String
1082- else if (next == " \" " || next == " '" ) {
1082+ else if (next. value () == " \" " || next. value () == " '" ) {
10831083 return read_string ();
10841084 }
10851085 // Quoteless string (or named literal)
@@ -1096,9 +1096,12 @@ class jsonh_reader : utf8_reader {
10961096
10971097 // Peek rune
10981098 std::optional<std::string> next = peek ();
1099+ if (!next) {
1100+ break ;
1101+ }
10991102
11001103 // Comment
1101- if (next == " #" || next == " /" ) {
1104+ if (next. value () == " #" || next. value () == " /" ) {
11021105 tokens.push_back (read_comment ());
11031106 }
11041107 // End of comments
@@ -1145,7 +1148,7 @@ class jsonh_reader : utf8_reader {
11451148 return nonstd::unexpected<std::string>(" Expected end of block comment, got end of input" );
11461149 }
11471150 // End of block comment
1148- if (next == " *" && read_one (" /" )) {
1151+ if (next. value () == " *" && read_one (" /" )) {
11491152 return jsonh_token (json_token_type::comment, comment_builder);
11501153 }
11511154 }
0 commit comments