aas-core-works / abnf-to-regexp Goto Github PK
View Code? Open in Web Editor NEWConvert ABFN to regular expressions.
License: Other
Convert ABFN to regular expressions.
License: Other
@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!
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.