Re: [svgwg] grammar for "closepath can substitute for final coordinate" is broken

> But if I'm reading the grammar correctly, one cannot specify d="C50 50 200 50 200 150 200 50 350 50 Z", omitting the previous final "350 150". Here there would be a triple pair, followed by a double pair.

That path is invalid because there's no intial moveto.
The curve commands should be accepted by the
''' (coordinate_pair_sequence? closepath)'''

part of
'''
curveto::=
    ("C"|"c") wsp* (curveto_coordinate_sequence | (coordinate_pair_sequence? closepath))
'''
It's five sequences of '''coordinate_pair_sequence'''. The presence of the '''closepath''' forces it to be consumed by the second of the options.

When writing the grammar, I tested with:
https://services.w3.org/yacker/uploads/svg2b?lang=perl&text=M+10%2C10+C50%2C50+200%2C50+200%2C150+200%2C50+350+50+Z&action=validate+text
And this accepts that string.
_Note: For some reason I had to change the svg_path definition of that grammar to get it accepting anything. I'm not sure why and don't have much time to look into it..._

Personally I think the grammar should be removed from the spec. It's error prone without continuous testing and the prose is much easier to understand - the rules are nowhere near as complicated as the grammar makes them seem. I wish I'd argued for removal back in the day.

-- 
GitHub Notification of comment by nikosandronikos
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/325#issuecomment-308285708 using your GitHub account

Received on Wednesday, 14 June 2017 00:29:31 UTC