Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add separated_list_m_n #1722

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Jan 23, 2024

  1. feat: Add separated_list_m_n

    This is useful to naïvely represent some grammar productions
    (e.g. `IPv6address` from [RFC 3986]):
    
    ```abnf
    IPv6address /= [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
    ```
    
    turns to
    
    ```diff
     tuple((
    -    opt(tuple((many_m_n(0, 2, tuple((h16, char(':')))), h16))),
    +    separated_list_m_n(0, 3, char(':'), h16),
         tag("::"),
         many_m_n(2, 2, tuple((h16, char(':')))),
         ls32,
     ))
    ```
    
    [RFC 3986]: https://www.rfc-editor.org/rfc/rfc3986#appendix-A
    jtojnar committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    2421da1 View commit details
    Browse the repository at this point in the history