Closed mristin closed 2 years ago
Here is a short code snippet for you to reproduce the issue:
import pathlib
import abnf
text = pathlib.Path("grammar.abnf.txt").read_text()
text = text.replace("\r", "")
if not text.endswith("\n"):
text = text + "\n"
text = text.replace("\n", "\r\n")
class OurRule(abnf.Rule):
"""Represent our ABNF rule list read from a file."""
pass
node = abnf.parser.ABNFGrammarRule("rulelist").parse_all(text)
visitor = abnf.parser.ABNFGrammarNodeVisitor(rule_cls=OurRule)
visitor.visit(node)
You have found a bug in CharValNodeVisitor that resulted in the node generated by parsing the quoted string '""' being read incorrectly. I will push out a fix soon.
This is fixed in https://github.com/declaresub/abnf/commit/d40d9659b067191d5d29117b24e1dc218645a087. Thanks for breaking my code.
@declaresub thanks for the fix! Do you plan to release a patch version soon?
Sure; I will do it now.
ABNF 2.0.1 is now up at pypi.
@declaresub thanks a lot!
Hi, An issue https://github.com/aas-core-works/abnf-to-regexp/issues/26 has been raised for our tool, abnf-to-regexp, which I think that might be due to the bug in this module.
Namely, the attached grammar, grammar.abnf.txt raises an
IndexError
whereas I'd expected a parsing error.Do you have any pointers about what to do with this issue?