hixie: Simplify the algorithms for parsing signed and unsigned integers to use subalgorithms that have since been defined. (whatwg r4301)

hixie: Simplify the algorithms for parsing signed and unsigned integers
to use subalgorithms that have since been defined. (whatwg r4301)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3436&r2=1.3437&f=h
http://html5.org/tools/web-apps-tracker?from=4300&to=4301

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3436
retrieving revision 1.3437
diff -u -d -r1.3436 -r1.3437
--- Overview.html 23 Oct 2009 07:02:32 -0000 1.3436
+++ Overview.html 23 Oct 2009 07:07:20 -0000 1.3437
@@ -2301,8 +2301,6 @@
    <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
    string.</li>
 
-   <li><p>Let <var title="">value</var> have the value 0.</li>
-
    <li><p><a href="#skip-whitespace">Skip whitespace</a>.</li>
 
    <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error.</li>
@@ -2320,23 +2318,9 @@
    trailing garbage which we'll ignore, but it's a number, and we
    won't return an error. -->
 
-   <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><a href="#collect-a-sequence-of-characters">Collect a sequence of characters</a> 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.</li>
 
    <li><p>Return <var title="">value</var>.</li>
 
@@ -2365,8 +2349,6 @@
    <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
    string.</li>
 
-   <li><p>Let <var title="">value</var> have the value 0.</li>
-
    <li><p>Let <var title="">sign</var> have the value
    "positive".</li>
 
@@ -2405,23 +2387,9 @@
    trailing garbage which we'll ignore, but it's a number, and we
    won't return an error. -->
 
-   <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><a href="#collect-a-sequence-of-characters">Collect a sequence of characters</a> 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.</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.</li>

Received on Friday, 23 October 2009 07:08:00 UTC