@@ -988,8 +988,6 @@ template <class Derived> template <class Handler, class>
988
988
template <class RuneSet >
989
989
inline decltype (auto ) add_rune_range(RuneSet&& runes, directives mode, char32_t first, char32_t last)
990
990
{
991
- if (first > last)
992
- throw bad_character_range{};
993
991
if ((mode & directives::caseless) != directives::none)
994
992
static_cast <unicode::rune_set&>(runes).push_casefolded_range (first, last);
995
993
else
@@ -1014,10 +1012,14 @@ struct bracket_expression : terminal_encoder_expression_interface<bracket_expres
1014
1012
circumflex = true ;
1015
1013
++curr;
1016
1014
}
1015
+ if (curr == last)
1016
+ throw bad_character_range{};
1017
1017
while (curr != last) {
1018
1018
auto const [next, next_rune] = utf8::decode_rune (curr, last);
1019
- if ((next_rune == U' -' ) && (next != last) && left_rune. has_value () ) {
1019
+ if ((next_rune == U' -' ) && (next != last)) {
1020
1020
auto const [right, right_rune] = utf8::decode_rune (next, last);
1021
+ if (!left_rune.has_value ())
1022
+ throw bad_character_range{};
1021
1023
add_rune_range (std::ref (result), mode, *left_rune, right_rune);
1022
1024
left_rune = std::nullopt;
1023
1025
curr = right;
@@ -3094,8 +3096,7 @@ class basic_parser : public parser_base
3094
3096
template <class InputRng , class = detail::enable_if_char_input_range_t <InputRng>>
3095
3097
basic_parser& enqueue (InputRng&& rng) // NOLINT(cppcoreguidelines-missing-std-forward)
3096
3098
{
3097
- enqueue (rng.begin (), rng.end ());
3098
- return *this ;
3099
+ return enqueue (rng.begin (), rng.end ());
3099
3100
}
3100
3101
3101
3102
template <class InputFunc , class = std::enable_if_t <detail::input_source_has_push_source<InputSource, InputFunc&&>::value>>
0 commit comments