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

* 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.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Friday, 21 February 2014 20:03:53 UTC