- From: Boris Dalstein via GitHub <sysbot+gh@w3.org>
- Date: Mon, 18 Nov 2019 19:40:50 +0000
- To: public-svg-issues@w3.org
Slight edit to my proposal. I initially used an underscore in `coord_x` because I thought that otherwise, the `coordx` names would look too similar to the `coords` name, hiding the fact that those are fundamentally different types of syntax rules (one has recursion, the others haven't). But I found a more elegant solution, which is to rename `coords` into `coord1s`, for consistency. Then the only remaining underscore is in `arcto_arg[s]`, which we can also get rid of, so that the grammar is alllowercase: ``` path ::= wsp* moveto? (moveto command*)? command ::= closepath | moveto | lineto | hlineto | vlineto | ccurveto | scurveto | qcurveto | tcurveto | arcto closepath ::= ("Z" | "z") moveto ::= ("M" | "m") wsp* coord2s lineto ::= ("L" | "l") wsp* coord2s hlineto ::= ("H" | "h") wsp* coord1s vlineto ::= ("V" | "v") wsp* coord1s ccurveto ::= ("C" | "c") wsp* coord6s scurveto ::= ("S" | "s") wsp* coord4s qcurveto ::= ("Q" | "q") wsp* coord4s tcurveto ::= ("T" | "t") wsp* coord2s arcto ::= ("A" | "a") wsp* arctoargs coord ::= sign? unsigned coord2 ::= coord cw? coord coord4 ::= coord cw? coord cw? coord cw? coord coord6 ::= coord cw? coord cw? coord cw? coord cw? coord cw? coord arctoarg ::= unsigned cw? unsigned cw? coord cw flag cw? flag cw? coord cw? coord coord1s ::= coord | (coord cw? coord1s) coord2s ::= coord2 | (coord2 cw? coord2s) coord4s ::= coord4 | (coord4 cw? coord4s) coord6s ::= coord6 | (coord6 cw? coord6s) arctoargs ::= arctoarg | (arctoarg cw? arctoargs) unsigned ::= frac exp? frac ::= (digit* "." digit+) | digit+ exp ::= ("e" | "E") sign? digit+ cw ::= (wsp+ ","? wsp*) | ("," wsp*) sign ::= "+" | "-" flag ::= "0" | "1" wsp ::= #x9 | #xA | #xC | #xD | #x20 digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ``` (I also just reordered the closepath first, as it looks better) But looking at it now, maybe there's no need to abbreviate the `_sequence` into `s`, since we can still keep one-liners. Below is how it looks for comparison. I don't have a strong opinion either way, though I think I have a slight preference for the shorter `s`. It looks a bit less scary, and psychology matters too: if it looks simpler, we have less mental blocks. ``` path ::= wsp* moveto? (moveto command*)? command ::= closepath | moveto | lineto | hlineto | vlineto | ccurveto | scurveto | qcurveto | tcurveto | arcto closepath ::= ("Z" | "z") moveto ::= ("M" | "m") wsp* coord2_sequence lineto ::= ("L" | "l") wsp* coord2_sequence hlineto ::= ("H" | "h") wsp* coord1_sequence vlineto ::= ("V" | "v") wsp* coord1_sequence ccurveto ::= ("C" | "c") wsp* coord6_sequence scurveto ::= ("S" | "s") wsp* coord4_sequence qcurveto ::= ("Q" | "q") wsp* coord4_sequence tcurveto ::= ("T" | "t") wsp* coord2_sequence arcto ::= ("A" | "a") wsp* arctoarg_sequence coord ::= sign? unsigned coord2 ::= coord cw? coord coord4 ::= coord cw? coord cw? coord cw? coord coord6 ::= coord cw? coord cw? coord cw? coord cw? coord cw? coord arctoarg ::= unsigned cw? unsigned cw? coord cw flag cw? flag cw? coord cw? coord coord1_sequence ::= coord | (coord cw? coord1_sequence) coord2_sequence ::= coord2 | (coord2 cw? coord2_sequence) coord4_sequence ::= coord4 | (coord4 cw? coord4_sequence) coord6_sequence ::= coord6 | (coord6 cw? coord6_sequence) arctoarg_sequence ::= arctoarg | (arctoarg cw? arctoarg_sequence) unsigned ::= frac exp? frac ::= (digit* "." digit+) | digit+ exp ::= ("e" | "E") sign? digit+ cw ::= (wsp+ ","? wsp*) | ("," wsp*) sign ::= "+" | "-" flag ::= "0" | "1" wsp ::= #x9 | #xA | #xC | #xD | #x20 digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ``` -- GitHub Notification of comment by dalboris Please view or discuss this issue at https://github.com/w3c/svgwg/issues/751#issuecomment-555176481 using your GitHub account
Received on Monday, 18 November 2019 19:40:52 UTC