elimity-com / abnf Goto Github PK
View Code? Open in Web Editor NEWA Code Generator for ABNF Parsers
License: MIT License
A Code Generator for ABNF Parsers
License: MIT License
hi, I'd like to using this library.
However, github.com/elimity-com/abnf/core in README.me is not found 404.
I think correct path is github.com/elimity-com/abnf/code_generator
, right?
If you would like, please modify the README.md and add details on how to use it
There is a bug in the Optional
function.
Because of this bug the library is not able to parse IPv6 addresses correctly.
Simplified example:
rule := Concat(`[ *1( a ":" ) a ] "::"`,
Optional(`[ *1( a ":" ) a ]`,
Concat(`*1( a ":" ) a`,
Repeat(`*1( a ":" )`, 0, 1,
Concat(`a ":"`,
Rune(`a`, 'a'),
Rune(`:`, ':'),
),
),
Rune(`a`, 'a'),
),
),
String(`::`, "::", false),
)
for _, s := range []string{
"::",
"a::",
"a:a::",
} {
r := rule([]rune(s))
if r == nil {
fmt.Printf("no value found for: %s", s)
}
}
Result:
no value found for: a::
I think this is because:
::
: the optional value is empty.a::
: finds a:
but can not find the following a
, thus ignores the optional value which is incorrect.a:a::
: finds the optional value.When a rule is simply equal to another rule, the generated rule returns itself instead of the other rule.
rule-a = ALPHA / DIGIT
rule-b = rule-a
// rule-a = ALPHA / DIGIT
func RuleA() operators.Operator {
return operators.Alts(
"rule-a",
core.ALPHA(),
core.DIGIT(),
)
}
// rule-b = rule-a
func RuleB() operators.Operator {
return RuleB() // NOTE - ERROR HERE - should be RuleA
}
The option
syntax definition triggers an overflow on the goroutine stack.
https://github.com/di-wu/abnf/blob/8ee4acf92604b8a0f9e0025cda34ed52ecc13cce/abnf_definition.go#L65-L67
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.