<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>127667</bug_id>
          
          <creation_ts>2014-01-26 19:02:22 -0800</creation_ts>
          <short_desc>Decimal::fromString&apos;s EBNF documentation does not match implementation</short_desc>
          <delta_ts>2023-06-22 18:31:09 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=258418</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>annevk</cc>
    
    <cc>ap</cc>
    
    <cc>joepeck</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>972299</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-01-26 19:02:22 -0800</bug_when>
    <thetext>Current documentation for Decimal::fromString says:

    // fromString supports following syntax EBNF:
    //  number ::= sign? digit+ (&apos;.&apos; digit*) (exponent-marker sign? digit+)?
    //          | sign? &apos;.&apos; digit+ (exponent-marker sign? digit+)?
    //  sign ::= &apos;+&apos; | &apos;-&apos;
    //  exponent-marker ::= &apos;e&apos; | &apos;E&apos;
    //  digit ::= &apos;0&apos; | &apos;1&apos; | ... | &apos;9&apos;
    // Note: fromString doesn&apos;t support &quot;infinity&quot; and &quot;nan&quot;.
    static Decimal fromString(const String&amp;);

However in the implementation:

    1. It does not look possible to have &quot;sign? &apos;.&apos;&quot; at all.
    Test: &quot;-.1&quot;

    2. The documentation says &quot;sign? &apos;.&apos; digit+&quot; but it looks like &quot;sign? &apos;.&apos; digit*&quot; is possible. If so what happens? What should happen?
    Test: &quot;.e1&quot;

What should this code actually be doing? Where did that EBNF come from?

There used to be a chromium test for this. We should consider adding a test for this and testing more cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>972304</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-01-26 19:15:07 -0800</bug_when>
    <thetext>NOTE: &lt;http://www.w3.org/TR/2011/WD-html5-20110525/common-microsyntaxes.html#real-numbers&gt;

Sounds like: &quot;sign? digit+ (&apos;.&apos; digit+ )? ((&apos;e&apos;|&apos;E&apos;) sign? digit+)?&quot;

Because it always says &quot;A series of one or more characters in the range&quot;.

If that is the case, then the implicit fallthrough in the current implementation is wrong, and the documentation should not mention &quot;digit*&quot; anywhere. Also, where did the idea to support strings without a number before a &apos;.&apos; come from? Was it an older version of the spec? Should we continue to support that syntax?

So many questions!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1910827</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-11-07 11:04:59 -0800</bug_when>
    <thetext>This FIXME is still present: https://github.com/WebKit/WebKit/blob/06829a72816b3507674af7be8a740a4964ae3518/Source/WebCore/platform/Decimal.cpp#L759</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>