Short URL: http://html5.org/r/6717
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 6717 | 14234 | 2011-10-20 22:13 |
Index: source =================================================================== --- source (revision 6716) +++ source (revision 6717) @@ -3703,65 +3703,6 @@ <h4>Numbers</h4> - <h5>Non-negative integers</h5> - - <p>A string is a <dfn>valid non-negative integer</dfn> if it - consists of one or more characters in the range U+0030 DIGIT ZERO - (0) to U+0039 DIGIT NINE (9).</p> - - <p>A <span>valid non-negative integer</span> represents the number - that is represented in base ten by that string of digits.</p> - - <div class="impl"> - - <p>The <dfn>rules for parsing non-negative integers</dfn> are as - given in the following algorithm. When invoked, the steps must be - followed in the order given, aborting at the first step that returns - a value. This algorithm will return either zero, a positive integer, - or an error.</p> - - <ol> - - <li><p>Let <var title="">input</var> be the string being - parsed.</p></li> - - <li><p>Let <var title="">position</var> be a pointer into <var - title="">input</var>, initially pointing at the start of the - string.</p></li> - - <li><p><span>Skip whitespace</span>.</p></li> - - <li><p>If <var title="">position</var> is past the end of <var - title="">input</var>, return an error.</p></li> - - <li><p>If the character indicated by <var title="">position</var> - is a U+002B PLUS SIGN character (+), advance <var - title="">position</var> to the next character. (The "<code - title="">+</code>" is ignored, but it is not conforming.)</li> - - <li><p>If <var title="">position</var> is past the end of <var - title="">input</var>, return an error.</p></li> - - <li><p>If the character indicated by <var title="">position</var> - is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then - return an error.</p></li> - - <!-- Ok. At this point we know we have a number. It might have - trailing garbage which we'll ignore, but it's a number, and we - won't return an error. --> - - <li><p><span>Collect a sequence of characters</span> in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the - resulting sequence as a base-ten integer. Let <var - title="">value</var> be that integer.</p></li> - - <li><p>Return <var title="">value</var>.</p></li> - - </ol> - - </div> - - <h5>Signed integers</h5> <p>A string is a <dfn>valid integer</dfn> if it consists of one or @@ -3778,11 +3719,9 @@ <div class="impl"> - <p>The <dfn>rules for parsing integers</dfn> are similar to the - <span title="rules for parsing non-negative integers">rules for - non-negative integers</span>, and are as given in the following - algorithm. When invoked, the steps must be followed in the order - given, aborting at the first step that returns a value. This + <p>The <dfn>rules for parsing integers</dfn> are as given in the + following algorithm. When invoked, the steps must be followed in the + order given, aborting at the first step that returns a value. This algorithm will return either an integer or an error.</p> <ol> @@ -3858,6 +3797,47 @@ </div> + <h5>Non-negative integers</h5> + + <p>A string is a <dfn>valid non-negative integer</dfn> if it + consists of one or more characters in the range U+0030 DIGIT ZERO + (0) to U+0039 DIGIT NINE (9).</p> + + <p>A <span>valid non-negative integer</span> represents the number + that is represented in base ten by that string of digits.</p> + + <div class="impl"> + + <p>The <dfn>rules for parsing non-negative integers</dfn> are as + given in the following algorithm. When invoked, the steps must be + followed in the order given, aborting at the first step that returns + a value. This algorithm will return either zero, a positive integer, + or an error.</p> + + <ol> + + <li><p>Let <var title="">input</var> be the string being + parsed.</p></li> + + <li><p>Let <var title="">value</var> be the result of parsing <var + title="">input</var> using the <span>rules for parsing + integers</span>.</p></li> + + <li><p>If <var title="">value</var> is an error, return an + error.</p></li> + + <li><p>If <var title="">value</var> is less than zero, return an + error.</p></li> + + <li><p>Return <var title="">value</var>.</p></li> + + </ol> + + <!-- Implications: A leading + is ignored. A leading - is ignored if the value is zero. --> + + </div> + + <h5>Floating-point numbers</h5> <p>A string is a <dfn>valid floating point number</dfn> if it