Short URL: http://html5.org/r/4301
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 4301 | 8012 | Simplify the algorithms for parsing signed and unsigned integers to use subalgorithms that have since been defined. | 2009-10-23 07:20 |
Index: source
===================================================================
--- source (revision 4300)
+++ source (revision 4301)
@@ -1628,8 +1628,6 @@
title="">input</var>, initially pointing at the start of the
string.</p></li>
- <li><p>Let <var title="">value</var> have the value 0.</li>
-
<li><p><span>Skip whitespace</span>.</p></li>
<li><p>If <var title="">position</var> is past the end of <var
@@ -1651,31 +1649,11 @@
trailing garbage which we'll ignore, but it's a number, and we
won't return an error. -->
- <li>
+ <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>
- <p><i>Loop</i>: If the character indicated by <var
- title="">position</var> is one of U+0030 DIGIT ZERO (0) to U+0039
- DIGIT NINE (9):</p>
-
- <ol>
-
- <li>Multiply <var title="">value</var> by ten.</li>
-
- <li>Add the value of the character indicated by <var
- title="">position</var> (0..9) to <var title="">value</var>.</li>
-
- <li>Advance <var title="">position</var> to the next
- character.</li>
-
- <li>If <var title="">position</var> is not past the end of <var
- title="">input</var>, return to the top of the step labeled
- <i>loop</i> in the overall algorithm (that's the step within
- which these substeps find themselves).</li>
-
- </ol>
-
- </li>
-
<li><p>Return <var title="">value</var>.</p></li>
</ol>
@@ -1717,8 +1695,6 @@
title="">input</var>, initially pointing at the start of the
string.</p></li>
- <li><p>Let <var title="">value</var> have the value 0.</p></li>
-
<li><p>Let <var title="">sign</var> have the value
"positive".</p></li>
@@ -1769,30 +1745,11 @@
trailing garbage which we'll ignore, but it's a number, and we
won't return an error. -->
- <li>
+ <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>
- <p>If the character indicated by <var title="">position</var> is
- one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9):</p>
-
- <ol>
-
- <li>Multiply <var title="">value</var> by ten.</li>
-
- <li>Add the value of the character indicated by <var
- title="">position</var> (0..9) to <var title="">value</var>.</li>
-
- <li>Advance <var title="">position</var> to the next
- character.</li>
-
- <li>If <var title="">position</var> is not past the end of <var
- title="">input</var>, return to the top of step 9 in the overall
- algorithm (that's the step within which these substeps find
- themselves).</li>
-
- </ol>
-
- </li>
-
<li><p>If <var title="">sign</var> is "positive", return <var
title="">value</var>, otherwise return the result of subtracting
<var title="">value</var> from zero.</p></li>