boostorg/spirit_x4

The domain of integral bounds given to `repeat_directive` is underspecified

Aberta

#62 aberto em 5 de out. de 2025

 (0 comentário) (0 reação) (0 responsável)C++ (3 forks)auto 404
documentationenhancementgood first issuehelp wanted

Métricas do repositório

Stars
 (37 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Perhaps this should be both rejected in the code and described in the new documentation.

  • The documentation should note that repeat operates on closed bounds.
  • x4::repeat(negative) should be rejected
  • x4::repat(negative, ...) and x4::repat(..., negative) should be rejected
  • x4::repeat(max, min) should be rejected
  • x4::repeat(0) should be rejected
    • This is semantically very vague.
    • As of now, I confirmed that it actually results in always succeeding parser (regardless of the underlying parser p given to repeat(0)[p]), similar to eps

Proposed solution:

  • The basic concept should be changed from std::integral to std::unsigned_integral
  • x4::repeat(max, min) should throw std::domain_error
  • x4::repeat(0) should throw std::domain_error

Guia do colaborador