Re: [svgwg] Subtleties of the path data grammar (#752)

(Note: at least one thing *was* intentionally disallowed: trailing decimals in numbers, e.g., "42." is allowed in SVG 1.1 but disallowed in SVG 2)

Alright, then I'm 99% sure the first rule should be fixed from:

```
svg_path ::= wsp* moveto? (moveto drawto_command*)?
```

to:

```
svg_path ::= wsp* (moveto (wsp* drawto_command)*)? wsp*
```

There are three atomic changes here:
1. We remove the initial `moveto?`, because it's completely useless, that is, removing it from the grammar still describes the same language.
2. We change `drawto_command*` to `(wsp* drawto_command)*`, so that whitespaces are allowed between commands
3. We add a final `wsp*` so that trailing whitespaces are allowed.

(By "whitespaces", I obviously mean any of the four whitespace characters)

Also, `drawto_command` should really be renamed `command`, since it also includes `moveto` as potential command. The current name is just plain confusing, especially since in SVG 1.1 `drawto-command` was indeed referring to any command *except* `moveto`. In conclusion, we should most definitely change from:

```
svg_path::= wsp* moveto? (moveto drawto_command*)?
drawto_command::=
    moveto
    | closepath
    | lineto
    | horizontal_lineto
    | vertical_lineto
    | curveto
    | smooth_curveto
    | quadratic_bezier_curveto
    | smooth_quadratic_bezier_curveto
    | elliptical_arc
```

to:

```
svg_path::= wsp* (moveto (wsp* command)*)? wsp*
command::=
    moveto
    | closepath
    | lineto
    | horizontal_lineto
    | vertical_lineto
    | curveto
    | smooth_curveto
    | quadratic_bezier_curveto
    | smooth_quadratic_bezier_curveto
    | elliptical_arc
```


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

Received on Wednesday, 20 November 2019 11:52:26 UTC