Skip to content

Commit 022dc36

Browse files
committed
[css-syntax] Consolidate the definition of what the <urange> represents, so I can do error-checking in one spot.
1 parent 01c55ee commit 022dc36

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

css-syntax/Overview.bs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,7 +2943,7 @@ The <<urange>> type</h3>
29432943
: <code>u '+' <<urange-codepoint>></code>
29442944
::
29452945
<a title="interpret a token as a hex integer">Interpret the &lt;urange-codepoint> as a hex integer</a>.
2946-
The <<urange>> represents a range consisting only of the resulting value.
2946+
Let <var>start value</var> and <var>end value</var> both be the returned value.
29472947

29482948
: <code>u '+' <<urange-codepoint>>? '?'+</code>
29492949
::
@@ -2952,25 +2952,33 @@ The <<urange>> type</h3>
29522952
otherwise, let <var>B</var> be zero.
29532953
Let <var>S</var> be the number of contiguous U+003F QUESTION MARK (?) codepoints.
29542954

2955-
The <<urange>> represents a contiguous range from
2956-
<code style="white-space: nowrap">B✕(16<sup>S</sup>)</code> to
2957-
<code style="white-space: nowrap">B✕(16<sup>S</sup>) + 16<sup>S+1</sup> − 1</code>,
2958-
inclusive.
2955+
Let <var>start value</var> be <code style="white-space: nowrap">B✕(16<sup>S</sup>)</code>.
2956+
Let <var>end value</var> be <code style="white-space: nowrap">B✕(16<sup>S</sup>) + 16<sup>S+1</sup> − 1</code>.
29592957

29602958
: <code>u '+' <<urange-codepoint>> <<negative-urange-codepoint>></code>
29612959
::
2962-
Let <var>starting value</var> be the result of <a title="interpret a token as a hex integer">interpreting the &lt;urange-codepoint> as a hex integer</a>.
2963-
Let <var>ending value</var> be the negation of the result of <a title="interpret a token as a hex integer">interpreting the &lt;negative-urange-codepoint> as a hex integer</a>.
2960+
Let <var>start value</var> be the result of <a title="interpret a token as a hex integer">interpreting the &lt;urange-codepoint> as a hex integer</a>.
2961+
Let <var>end value</var> be the negation of the result of <a title="interpret a token as a hex integer">interpreting the &lt;negative-urange-codepoint> as a hex integer</a>.
29642962

2965-
The <<urange>> represents a contiguous range from <var>starting value</var> to <var>ending value</var>, inclusive.
29662963

29672964
: <code>u '+' <<urange-range>></code>
29682965
::
29692966
Split the <<urange-range>>’s representation (or representation + unit)
29702967
into the two halves on either side of the U+002D HYPHEN-MINUS (-) codepoint.
29712968
Interpret each half as a hexadecimal integer.
29722969

2973-
The <<urange>> represents a contiguous range from the first half's value to the second half's value, inclusive.
2970+
Let <var>start value</var> be the first half's value.
2971+
Let <var>end value</var> be the second half's value.
2972+
2973+
To determine what codepoints the <<urange>> represents:
2974+
2975+
1. If <var>end value</var> is greater than the <a>maximum allowed code point</a>,
2976+
set it to the <a>maximum allowed code point</a>.
2977+
2978+
2. If <var>start value</var> is greater than <var>end value</var>,
2979+
the <<urange>> represents an empty range of codepoints.
2980+
2981+
3. Otherwise, the <<urange>> represents a contiguous range of codepoints from <var>start value</var> to <var>end value</var>, inclusive.
29742982

29752983
To <dfn>interpret a token as a hex integer</dfn>:
29762984

css-syntax/Overview.html

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4405,7 +4405,7 @@ <h3 class="heading settled" data-level=7.1 id=urange-syntax><span class=secno>7.
44054405
<dl><dt data-md=""><p><code>u '+' <a class="production css" data-link-type=type href=#typedef-urange-codepoint title="<urange-codepoint>">&lt;urange-codepoint&gt;</a></code></p>
44064406
<dd data-md="">
44074407
<p><a data-link-type=dfn href=#interpret-a-token-as-a-hex-integer title="interpret a token as a hex integer">Interpret the &lt;urange-codepoint&gt; as a hex integer</a>.
4408-
The <a class="production css" data-link-type=type href=#typedef-urange title="<urange>">&lt;urange&gt;</a> represents a range consisting only of the resulting value.</p>
4408+
Let <var>start value</var> and <var>end value</var> both be the returned value.</p>
44094409

44104410
<dt data-md=""><p><code>u '+' <a class="production css" data-link-type=type href=#typedef-urange-codepoint title="<urange-codepoint>">&lt;urange-codepoint&gt;</a>? '?'+</code></p>
44114411
<dd data-md="">
@@ -4414,26 +4414,34 @@ <h3 class="heading settled" data-level=7.1 id=urange-syntax><span class=secno>7.
44144414
otherwise, let <var>B</var> be zero.
44154415
Let <var>S</var> be the number of contiguous U+003F QUESTION MARK (?) codepoints.</p>
44164416

4417-
<p>The <a class="production css" data-link-type=type href=#typedef-urange title="<urange>">&lt;urange&gt;</a> represents a contiguous range from
4418-
<code style="white-space: nowrap">B✕(16<sup>S</sup>)</code> to
4419-
<code style="white-space: nowrap">B✕(16<sup>S</sup>) + 16<sup>S+1</sup> − 1</code>,
4420-
inclusive.</p>
4417+
<p>Let <var>start value</var> be <code style="white-space: nowrap">B✕(16<sup>S</sup>)</code>.
4418+
Let <var>end value</var> be <code style="white-space: nowrap">B✕(16<sup>S</sup>) + 16<sup>S+1</sup> − 1</code>.</p>
44214419

44224420
<dt data-md=""><p><code>u '+' <a class="production css" data-link-type=type href=#typedef-urange-codepoint title="<urange-codepoint>">&lt;urange-codepoint&gt;</a> <a class="production css" data-link-type=type href=#typedef-negative-urange-codepoint title="<negative-urange-codepoint>">&lt;negative-urange-codepoint&gt;</a></code></p>
44234421
<dd data-md="">
4424-
<p>Let <var>starting value</var> be the result of <a data-link-type=dfn href=#interpret-a-token-as-a-hex-integer title="interpret a token as a hex integer">interpreting the &lt;urange-codepoint&gt; as a hex integer</a>.
4425-
Let <var>ending value</var> be the negation of the result of <a data-link-type=dfn href=#interpret-a-token-as-a-hex-integer title="interpret a token as a hex integer">interpreting the &lt;negative-urange-codepoint&gt; as a hex integer</a>.</p>
4422+
<p>Let <var>start value</var> be the result of <a data-link-type=dfn href=#interpret-a-token-as-a-hex-integer title="interpret a token as a hex integer">interpreting the &lt;urange-codepoint&gt; as a hex integer</a>.
4423+
Let <var>end value</var> be the negation of the result of <a data-link-type=dfn href=#interpret-a-token-as-a-hex-integer title="interpret a token as a hex integer">interpreting the &lt;negative-urange-codepoint&gt; as a hex integer</a>.</p>
44264424

4427-
<p>The <a class="production css" data-link-type=type href=#typedef-urange title="<urange>">&lt;urange&gt;</a> represents a contiguous range from <var>starting value</var> to <var>ending value</var>, inclusive.</p>
44284425

44294426
<dt data-md=""><p><code>u '+' <a class="production css" data-link-type=type href=#typedef-urange-range title="<urange-range>">&lt;urange-range&gt;</a></code></p>
44304427
<dd data-md="">
44314428
<p>Split the <a class="production css" data-link-type=type href=#typedef-urange-range title="<urange-range>">&lt;urange-range&gt;</a>’s representation (or representation + unit)
44324429
into the two halves on either side of the U+002D HYPHEN-MINUS (-) codepoint.
44334430
Interpret each half as a hexadecimal integer.</p>
44344431

4435-
<p>The <a class="production css" data-link-type=type href=#typedef-urange title="<urange>">&lt;urange&gt;</a> represents a contiguous range from the first half’s value to the second half’s value, inclusive.</p>
4432+
<p>Let <var>start value</var> be the first half’s value.
4433+
Let <var>end value</var> be the second half’s value.</p>
44364434
</dl>
4435+
<p>To determine what codepoints the <a class="production css" data-link-type=type href=#typedef-urange title="<urange>">&lt;urange&gt;</a> represents:</p>
4436+
4437+
<ol><li data-md=""><p>If <var>end value</var> is greater than the <a data-link-type=dfn href=#maximum-allowed-code-point title="maximum allowed code point">maximum allowed code point</a>,
4438+
set it to the <a data-link-type=dfn href=#maximum-allowed-code-point title="maximum allowed code point">maximum allowed code point</a>.</p>
4439+
4440+
<li data-md=""><p>If <var>start value</var> is greater than <var>end value</var>,
4441+
the <a class="production css" data-link-type=type href=#typedef-urange title="<urange>">&lt;urange&gt;</a> represents an empty range of codepoints.</p>
4442+
4443+
<li data-md=""><p>Otherwise, the <a class="production css" data-link-type=type href=#typedef-urange title="<urange>">&lt;urange&gt;</a> represents a contiguous range of codepoints from <var>start value</var> to <var>end value</var>, inclusive.</p>
4444+
</ol>
44374445
<p>To <dfn data-dfn-type=dfn data-noexport="" id=interpret-a-token-as-a-hex-integer>interpret a token as a hex integer<a class=self-link href=#interpret-a-token-as-a-hex-integer></a></dfn>:</p>
44384446

44394447
<ul><li data-md=""><p>If the token is a <a class="production css" data-link-type=type href=#typedef-number-token title="<number-token>">&lt;number-token&gt;</a> whose type flag is set to "integer",

0 commit comments

Comments
 (0)