akr / abnf Goto Github PK
View Code? Open in Web Editor NEWThis is a library to convert ABNF (Augmented Backus-Naur Form) to Regexp (Regular Expression) written in Ruby.
Home Page: http://www.a-k-r.org/abnf/
This is a library to convert ABNF (Augmented Backus-Naur Form) to Regexp (Regular Expression) written in Ruby.
Home Page: http://www.a-k-r.org/abnf/
print "Regexp for A to C: "
pp ABNF.regexp_tree(<<-'End').to_s
a-to-c="abc"
End
Expected output: Regexp for A to C: "[abc]"
or maybe ... "/[abc]/"
Observed output: Regexp for A to C: "(?i-m:abc)"
If I define two times the same entity, it extends the previous entity.
For example:
a = "a"
a = "b"
Expected result: "b", "a" or (preferably) error.
Result:
%r{[ab]}xi
Maybe this is correct or documented, however it doesn't match my expectation. (I was under the impression in the RFC you have to use a special operator for extension, not =
but rather *=
or something similar.)
Thanks heaps for this library by the way, it is gold!
ABNF is usually case sensitive, right?
While the standard suggests it is illegal to use string literals "a" / "b"
and instead to escape them in to unreadable muck, many people use them anyway.
In these (common) cases, it is often correct to respect the input case.
.regex always seems to return /something/i
.
I suppose this may be a workaround for bad input, but at least an option to stop it would be cute.
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.