Open mildred opened 8 years ago
According to my reading of the spec, this is not a valid grammar. You should probably get rid of the top-level grammar { }
wrapper.
Yeah, error messages aren't that great yet.
Error messages have been improved in 6682abb3bbc93480d0e1f895bb45be171a8f0f50. Closing.
I think the top-level grammar { }
is valid: there is a rule that produces it via the pattern
nonterminal in section 2 of the spec (second to last entry).
Also "grammar"
is in the list of keywords in the spec, but not in rnc2rng's parser.py
. Other missing keywords are "external"
, "inherit"
and "token"
.
I ran into this problem when trying to convert the schemas from the Nu Html Checker, for example this one.
Hmm, okay. So I interpreted the "single element" constraint for pattern
in topLevelBody
as, it should be an element
primary, but that interpretation appears to be too narrow.
I've started to extend the grammar to allow it to eventually deal with the SVG spec (that's certainly the largest schema I've thrown at rnc2rng so far!), but it looks like it might take some further work.
@mthuurne so current rnc2rng master can parse a lot more of the SVG spec from the validator repo you pointed to (and also the original schema that started this issue). However, it's currently failing when trying to parse svg-extensibility.rnc. As far as I can tell, the use of annotation elements here is invalid per the spec. The spec says that a top-level annotation must always be surrounded by square brackets, and so an annotation element like a:documentation
cannot appear at the start of an RNC file like it does here.
Do you disagree with my interpretation of the spec?
I have the following rnc schema:
Running rnc2rng version 2.0 yields:
I believe my rnc file is correct (but I can't be so sure because I cannot find a converter that would work). If the rnc file is incorrect, I would at least expect a better error message.