On 31/12/2024 04:25, Rudolf Adamkovič wrote:
Max Nikulin writes:
An extensive test suite is necessary to consider alternatives for
parsing rules.
Yes, that much is given. Without an extensive test suite, working on a
parser would be nothing but a waste of time, and the end result would
be, at least for us humans, an infinite stream of bugs.
I do not say that there is no tests, but to change the parser almost
certainly much more corner cases should be added. The format should be
suitable for non-elisp tools.
Ihor Radchenko. [PATCH] org-test: Create a collaborative test set for
Org buffer parser. Sat, 11 Dec 2021 22:39:07 +0800.
<https://list.orgmode.org/87fsqzi4tw.fsf@localhost>
Current logic may be roughly describes as the following. When Org
recognizes start of some element, it tries to find its end, mostly
neglecting opening markers. A fragment is parsed for nested elements
*after* boundaries of the parent element are determined.
Honestly? That sounds like a wrong approach to parsing. (And if that
is the case, then that could explain why I keep fighting the Org parser
on a daily basis, compared to practically never in every other language
I use.)
I expect that pandoc-like parser may reduce number of pitfalls. However,
having no experience with parsers, I will unlikely try to implement it.
I would not be surprised if it is unfeasible without some parser
generator since it should be bottom-up one. I have no idea how to
collect real life cases when current behavior is better. Otherwise it is
hard to estimate degree of disaster due to breaking change.