Re: [Bug 24769] New: SVG Path BNF is ambigious

On Fri, Feb 21, 2014 at 12:03 PM, Bjoern Hoehrmann <derhoermi@gmx.net> wrote:
> * bugzilla@jessica.w3.org wrote:
>>https://www.w3.org/Bugs/Public/show_bug.cgi?id=24769
>
>>http://www.w3.org/TR/SVG2/single-page.html#paths-PathDataBNF
>>
>>There is no description in the text on how this BNF is to be used. For example,
>>are the rules for the BNF alternatives to be parsed as 'first match wins'?
>>
>>If so, then the following rules won't produce good results, as the may match
>>part of a floating point number as an integer before matching the
>>floating-point-constant rule:
>>
>>nonnegative-number:
>>    integer-constant
>>    | floating-point-constant
>>number:
>>    sign? integer-constant
>>    | sign? floating-point-constant
>
> An `integer-constant` is a `digit-sequence` while a `floating-point-
> constant` is either a `fractional-constant` followed by an optional
> exponent, or a `digit-sequence` followed by a mandatory exponent. A
> `fractional-constant` must include `.`, so either a `.` or an expo-
> nent's `e` resolve the choice, and it does not seem like either is
> a prefix to a following rule. Could you give an example string that
> has more than one parse tree?
>
> Certainly `integer-constant` is prefix of `floating-point-constant`
> but there isn't an obvious advantage to putting it last, automated
> tools that prefer some order can re-arrange them as they see fit,
> and to a human reader less to more complex ordering might actually
> be the better.

The issue is that the order isn't defined *at all* currently; the spec
doesn't even have an *internal* ordering that it defines and follows.

~TJ

Received on Friday, 21 February 2014 20:16:33 UTC