Closed puetzk closed 5 months ago
Hey, thanks for reporting! Since you're already pretty deep into the investigation, would you mind contributing a PR to fix these issues? Or if it's hard to find a fix for the second issue, a PR contributing a test case would also be great to have.
@puetzk oh hey, I'm just now noticing that you managed to come up with what looks like a fix for this issue? Are you still interested in submitting this as a PR, or are there issues with your approach?
As I recall it was working (and I then ended up fixing a couple other namespace things), but it does look like I never actually opened the PR. Oops. I'll take a look at the documents I originally had problems with to refresh my memory of whether there was anything else still wrong and get one opened.
I know that at least the commits in https://github.com/djc/rnc2rng/compare/master...puetzk:annotations were working and added tests to exercise the cases they were meant to change. I just don't recall if they were actually sufficient to make my whole grammar work as intended or if there was something else that still needed attention.
Okay, would be great if you can submit them as a PR!
e.g.
Will fail to parse, giving the error parse error in test.rnc [3:2]
This is, as far as I can tell, legal syntax: https://www.oasis-open.org/committees/relax-ng/compact-20021121.html §5.2 says
And parenthesized patterns are still patterns per the syntax in §2
I think (not completely confident that I've mapped how you're naming the productions vs what that spec uses) that the issue is just at https://github.com/djc/rnc2rng/blob/2b2c3c7c7f6a59055e68aea53769028609b469e9/rnc2rng/parser.py#L394-L401
And specifically that the fist rule should have been for primary, not annoated-primary, e.g.
Thus still allowing the next production to attach annotations in front of such a group.
That change does make the grammar where I first encountered the issue parse and agree with how trang translates this constract to rng (i.e. something like the following, though your translation is more eager about using a child
<name ns="...">
element, whereas trang prefers to use a name attribute which is transformed to this form. I don't think that causes any real difference in semantics though.rnc2rng also seems to parse, but not emit, documentation elements for references, e.g.
emits
instead of trang's
i.e. the
<a:documentation>
for the ref is missing. I haven't figured out where this is going wrong, so I don't know if it's truly related or should be a separate issue.