auto &fragment = it->second;
- size_t repeat_amount = fragment.get_match_amount ();
- if (!first_fragment_found)
+ if (!fragment.is_single_fragment ())
{
- first_fragment_found = true;
- expected_repetition_amount = repeat_amount;
- }
- else
- {
- if (repeat_amount != expected_repetition_amount
- && !fragment.is_single_fragment ())
+ size_t repeat_amount = fragment.get_match_amount ();
+ if (!first_fragment_found)
+ {
+ first_fragment_found = true;
+ expected_repetition_amount = repeat_amount;
+ }
+ else
{
- rust_error_at (
- frag_token->get_locus (),
- "different amount of matches used in merged "
- "repetitions: expected %lu, got %lu",
- (unsigned long) expected_repetition_amount,
- (unsigned long) repeat_amount);
- is_valid = false;
+ if (repeat_amount != expected_repetition_amount)
+ {
+ rust_error_at (
+ frag_token->get_locus (),
+ "different amount of matches used in merged "
+ "repetitions: expected %lu, got %lu",
+ (unsigned long) expected_repetition_amount,
+ (unsigned long) repeat_amount);
+ is_valid = false;
+ }
}
}
}
}
}
- return is_valid;
+ return is_valid && first_fragment_found;
}
std::vector<std::unique_ptr<AST::Token>>