W3C home > Mailing lists > Public > www-svg@w3.org > February 2014

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

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Fri, 21 Feb 2014 21:03:34 +0100
To: bugzilla@jessica.w3.org
Cc: www-svg@w3.org
Message-ID: <sebfg9lskhorbjrie1c7qiuoe61od90j6f@hive.bjoern.hoehrmann.de>
* 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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:35 UTC