Git Product home page Git Product logo

abnf-to-regexp's People

Contributors

mristin avatar oliverhaagh avatar s-heppner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

abnf-to-regexp's Issues

Support for named groups

@mristin, First, this is a cool and helpful project. I have been working on parsing file paths and URIs and stumbled onto this.

I think it would be useful to add the ability to name the regex capture groups. I have created a PR on my fork that does this for my immediate purposes, although it would likely need some changes to integrate properly.

Is this a feature you would consider adding? If so, I might try to put together a PR.

One issue is whether this feature would be optional, which I would presume, and if so, how the configuration option should be passed down.

Another issue is duplicate group names for repeated patterns. Fortunately, the regex package handles duplicate names well, so I was able to avoid the issue for now, but Python's re module is not able to handle duplicate group names, so this feature would have limited compatibility if this issue is not addressed. Solving the issue properly is more challenging than I initially thought because of repeated nested patterns. I have a couple of thoughts, but I'd be interested in any input or ideas you might have on this.

Thanks!

Question about IndexError

Hi, thanks for this library, it looks really cool. I have a question on an error I am encountering, apologies in advance that this is likely not an issue with your library, but perhaps you can lead me on the right track.

I was trying out abnf-to-regexp on the ABNF of the GEDCOM 7 standard:
https://github.com/FamilySearch/GEDCOM/releases/download/v7.0.10/grammar.abnf

There are two issues with this, one is quoted-string is not defined in the file (I guess that's an inconsistency there), the second is that I always get the error (thrown by abnf)

  File "~/.local/lib/python3.10/site-packages/abnf/parser.py", line 1126, in visit_concatenation
    return Concatenation(*args) if len(args) > 1 else args[0]
IndexError: list index out of range

I found through experimentation that this error goes away if I replace all occurrences of "" with something else (e.g. " ").

Using abnf_to_regexp 1.1.1 with abnf 2.0.0 on Python 3.10.6.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.