[html5] r6717 - [giowt] (0) Simplification in the microsyntax parsing rules, which makes non-neg [...]
whatwg at whatwg.org
whatwg at whatwg.org
Thu Oct 20 15:13:43 PDT 2011
Author: ianh
Date: 2011-10-20 15:13:42 -0700 (Thu, 20 Oct 2011)
New Revision: 6717
Modified:
complete.html
index
source
Log:
[giowt] (0) Simplification in the microsyntax parsing rules, which makes non-negative integers accept leading - and + characters (- only for -0 of course).
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=14234
Modified: complete.html
===================================================================
--- complete.html 2011-10-20 21:43:44 UTC (rev 6716)
+++ complete.html 2011-10-20 22:13:42 UTC (rev 6717)
@@ -324,8 +324,8 @@
<li><a href=#keywords-and-enumerated-attributes><span class=secno>2.5.3 </span>Keywords and enumerated attributes</a></li>
<li><a href=#numbers><span class=secno>2.5.4 </span>Numbers</a>
<ol>
- <li><a href=#non-negative-integers><span class=secno>2.5.4.1 </span>Non-negative integers</a></li>
- <li><a href=#signed-integers><span class=secno>2.5.4.2 </span>Signed integers</a></li>
+ <li><a href=#signed-integers><span class=secno>2.5.4.1 </span>Signed integers</a></li>
+ <li><a href=#non-negative-integers><span class=secno>2.5.4.2 </span>Non-negative integers</a></li>
<li><a href=#floating-point-numbers><span class=secno>2.5.4.3 </span>Floating-point numbers</a></li>
<li><a href=#percentages-and-dimensions><span class=secno>2.5.4.4 </span>Percentages and lengths</a></li>
<li><a href=#lists-of-integers><span class=secno>2.5.4.5 </span>Lists of integers</a></li>
@@ -4618,57 +4618,8 @@
<h4 id=numbers><span class=secno>2.5.4 </span>Numbers</h4>
- <h5 id=non-negative-integers><span class=secno>2.5.4.1 </span>Non-negative integers</h5>
+ <h5 id=signed-integers><span class=secno>2.5.4.1 </span>Signed integers</h5>
- <p>A string is a <dfn id=valid-non-negative-integer>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 <a href=#valid-non-negative-integer>valid non-negative integer</a> represents the number
- that is represented in base ten by that string of digits.</p>
-
- <div class=impl>
-
- <p>The <dfn id=rules-for-parsing-non-negative-integers>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.</li>
-
- <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><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>
-
- <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.</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.</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><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>
-
- </ol></div>
-
-
- <h5 id=signed-integers><span class=secno>2.5.4.2 </span>Signed integers</h5>
-
<p>A string is a <dfn id=valid-integer>valid integer</dfn> if it consists of one or
more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
NINE (9), optionally prefixed with a U+002D HYPHEN-MINUS character
@@ -4683,11 +4634,9 @@
<div class=impl>
- <p>The <dfn id=rules-for-parsing-integers>rules for parsing integers</dfn> are similar to the
- <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">rules for
- non-negative integers</a>, 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 id=rules-for-parsing-integers>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><li><p>Let <var title="">input</var> be the string being
@@ -4744,6 +4693,40 @@
</ol></div>
+ <h5 id=non-negative-integers><span class=secno>2.5.4.2 </span>Non-negative integers</h5>
+
+ <p>A string is a <dfn id=valid-non-negative-integer>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 <a href=#valid-non-negative-integer>valid non-negative integer</a> represents the number
+ that is represented in base ten by that string of digits.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=rules-for-parsing-non-negative-integers>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.</li>
+
+ <li><p>Let <var title="">value</var> be the result of parsing <var title="">input</var> using the <a href=#rules-for-parsing-integers>rules for parsing
+ integers</a>.</li>
+
+ <li><p>If <var title="">value</var> is an error, return an
+ error.</li>
+
+ <li><p>If <var title="">value</var> is less than zero, return an
+ error.</li>
+
+ <li><p>Return <var title="">value</var>.</li>
+
+ </ol><!-- Implications: A leading + is ignored. A leading - is ignored if the value is zero. --></div>
+
+
<h5 id=floating-point-numbers><span class=secno>2.5.4.3 </span>Floating-point numbers</h5>
<p>A string is a <dfn id=valid-floating-point-number>valid floating point number</dfn> if it
Modified: index
===================================================================
--- index 2011-10-20 21:43:44 UTC (rev 6716)
+++ index 2011-10-20 22:13:42 UTC (rev 6717)
@@ -324,8 +324,8 @@
<li><a href=#keywords-and-enumerated-attributes><span class=secno>2.5.3 </span>Keywords and enumerated attributes</a></li>
<li><a href=#numbers><span class=secno>2.5.4 </span>Numbers</a>
<ol>
- <li><a href=#non-negative-integers><span class=secno>2.5.4.1 </span>Non-negative integers</a></li>
- <li><a href=#signed-integers><span class=secno>2.5.4.2 </span>Signed integers</a></li>
+ <li><a href=#signed-integers><span class=secno>2.5.4.1 </span>Signed integers</a></li>
+ <li><a href=#non-negative-integers><span class=secno>2.5.4.2 </span>Non-negative integers</a></li>
<li><a href=#floating-point-numbers><span class=secno>2.5.4.3 </span>Floating-point numbers</a></li>
<li><a href=#percentages-and-dimensions><span class=secno>2.5.4.4 </span>Percentages and lengths</a></li>
<li><a href=#lists-of-integers><span class=secno>2.5.4.5 </span>Lists of integers</a></li>
@@ -4618,57 +4618,8 @@
<h4 id=numbers><span class=secno>2.5.4 </span>Numbers</h4>
- <h5 id=non-negative-integers><span class=secno>2.5.4.1 </span>Non-negative integers</h5>
+ <h5 id=signed-integers><span class=secno>2.5.4.1 </span>Signed integers</h5>
- <p>A string is a <dfn id=valid-non-negative-integer>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 <a href=#valid-non-negative-integer>valid non-negative integer</a> represents the number
- that is represented in base ten by that string of digits.</p>
-
- <div class=impl>
-
- <p>The <dfn id=rules-for-parsing-non-negative-integers>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.</li>
-
- <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><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>
-
- <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.</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.</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><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>
-
- </ol></div>
-
-
- <h5 id=signed-integers><span class=secno>2.5.4.2 </span>Signed integers</h5>
-
<p>A string is a <dfn id=valid-integer>valid integer</dfn> if it consists of one or
more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
NINE (9), optionally prefixed with a U+002D HYPHEN-MINUS character
@@ -4683,11 +4634,9 @@
<div class=impl>
- <p>The <dfn id=rules-for-parsing-integers>rules for parsing integers</dfn> are similar to the
- <a href=#rules-for-parsing-non-negative-integers title="rules for parsing non-negative integers">rules for
- non-negative integers</a>, 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 id=rules-for-parsing-integers>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><li><p>Let <var title="">input</var> be the string being
@@ -4744,6 +4693,40 @@
</ol></div>
+ <h5 id=non-negative-integers><span class=secno>2.5.4.2 </span>Non-negative integers</h5>
+
+ <p>A string is a <dfn id=valid-non-negative-integer>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 <a href=#valid-non-negative-integer>valid non-negative integer</a> represents the number
+ that is represented in base ten by that string of digits.</p>
+
+ <div class=impl>
+
+ <p>The <dfn id=rules-for-parsing-non-negative-integers>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.</li>
+
+ <li><p>Let <var title="">value</var> be the result of parsing <var title="">input</var> using the <a href=#rules-for-parsing-integers>rules for parsing
+ integers</a>.</li>
+
+ <li><p>If <var title="">value</var> is an error, return an
+ error.</li>
+
+ <li><p>If <var title="">value</var> is less than zero, return an
+ error.</li>
+
+ <li><p>Return <var title="">value</var>.</li>
+
+ </ol><!-- Implications: A leading + is ignored. A leading - is ignored if the value is zero. --></div>
+
+
<h5 id=floating-point-numbers><span class=secno>2.5.4.3 </span>Floating-point numbers</h5>
<p>A string is a <dfn id=valid-floating-point-number>valid floating point number</dfn> if it
Modified: source
===================================================================
--- source 2011-10-20 21:43:44 UTC (rev 6716)
+++ source 2011-10-20 22:13:42 UTC (rev 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
More information about the Commit-Watchers
mailing list