You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[css-syntax] Define <urange> in terms of tokens. The definition is looser than it originally was, which vastly simplifies the specification and recognition of the token, without harming use.
--HG--
extra : rebase_source : edbe8a3d5531121e48c0940a45641b261d702967
Copy file name to clipboardExpand all lines: css-syntax/Overview.bs
+97Lines changed: 97 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2973,8 +2973,105 @@ The <<urange>> type</h3>
2973
2973
(using the <a href="http://www.w3.org/TR/css3-values/#value-defs">Value Definition Syntax in the Values & Units spec</a>) as:
2974
2974
2975
2975
<pre class="prod">
2976
+
<<urange>> =
2977
+
u '+' <<urange-codepoint>> |
2978
+
u '+' <<urange-codepoint>>? '?'+ |
2979
+
u '+' <<urange-codepoint>><<negative-urange-codepoint>> |
2980
+
u '+' <<urange-range>>
2976
2981
</pre>
2977
2982
2983
+
where:
2984
+
2985
+
: <dfn><<urange-codepoint>></dfn>
2986
+
:: One of the following:
2987
+
* A <<number-token>> whose type flag is set to "integer" and whose representation is composed solely of <a>digits</a> (no leading "+" or "-" characters).
2988
+
* An <<ident-token>> whose representation is solely <a>hex digits</a>.
2989
+
* A <<dimension-token>> whose type flag is set to "integer" and whose unit is composed solely of <a>hex digits</a>
2990
+
2991
+
: <dfn><<negative-urange-codepoint>></dfn>
2992
+
:: One of the following:
2993
+
* A <<number-token>> whose type flag is set to "integer", and whose value is negative.
2994
+
(If the implementation does not support <a href="https://en.wikipedia.org/wiki/Signed_zero">negative zero</a>,
2995
+
then when the value is zero,
2996
+
the implementation must additionally verify that the representation begins with U+002D HYPHEN-MINUS (-).)
2997
+
* An <<ident-token>> whose representation is U+002D HYPHEN-MINUS, followed solely <a>hex digits</a>.
2998
+
* A <<dimension-token>> whose type flag is set to "integer",
2999
+
whose value is negative,
3000
+
and whose unit is composed solely of <a>hex digits</a>.
3001
+
(Same caveat as for <<number-token>> applies here.)
3002
+
3003
+
: <dfn><<urange-range>></dfn>
3004
+
:: One of the following:
3005
+
* An <<ident-token>> whose representation consists solely of
3006
+
one or more <a>hex digits</a>,
3007
+
followed by U+002D HYPHEN-MINUS (-),
3008
+
followed by one or more <a>hex digits</a>.
3009
+
* A <<dimension-token>> whose type flag is set to "integer",
3010
+
and whose unit consists solely of
3011
+
one or more <a>hex digits</a>,
3012
+
followed by U+002D HYPHEN-MINUS (-),
3013
+
followed by one or more <a>hex digits</a>.
3014
+
3015
+
In this production,
3016
+
no whitespace can occur between any of the tokens.
3017
+
3018
+
The <<urange>> production represents a range of one or more contiguous unicode code points,
3019
+
which are non-negative integers.
3020
+
Each clause of the above grammar is interpreted as follows:
3021
+
3022
+
: <code>u '+'<<urange-codepoint>></code>
3023
+
::
3024
+
<a title="interpret a token as a hex integer">Interpret the <urange-codepoint> as a hex integer</a>.
3025
+
The <<urange>> represents a range consisting only of the resulting value.
3026
+
3027
+
: <code>u '+'<<urange-codepoint>>? '?'+</code>
3028
+
::
3029
+
If the <<urange-codepoint>> is specified,
3030
+
let <var>B</var> be the result of <a title="interpret a token as a hex integer">interpreting the <urange-codepoint> as a hex integer</a>;
3031
+
otherwise, let <var>B</var> be zero.
3032
+
Let <var>S</var> be the number of contiguous U+003F QUESTION MARK (?) codepoints.
3033
+
3034
+
The <<urange>> represents a contiguous range from
3035
+
<code style="white-space: nowrap">B✕(16<sup>S</sup>)</code> to
Let <var>starting value</var> be the result of <a title="interpret a token as a hex integer">interpreting the <urange-codepoint> as a hex integer</a>.
3042
+
Let <var>ending value</var> be the negation of the result of <a title="interpret a token as a hex integer">interpreting the <negative-urange-codepoint> as a hex integer</a>.
3043
+
3044
+
The <<urange>> represents a contiguous range from <var>starting value</var> to <var>ending value</var>, inclusive.
3045
+
3046
+
: <code>u '+'<<urange-range>></code>
3047
+
::
3048
+
Split the <<urange-range>>’s representation (or representation + unit)
3049
+
into the two halves on either side of the U+002D HYPHEN-MINUS (-) codepoint.
3050
+
Interpret each half as a hexadecimal integer.
3051
+
3052
+
The <<urange>> represents a contiguous range from the first half's value to the second half's value, inclusive.
3053
+
3054
+
To <dfn>interpret a token as a hex integer</dfn>:
3055
+
3056
+
* If the token is a <<number-token>> whose type flag is set to "integer",
3057
+
interpret its representation as a hexadecimal number
3058
+
and return the resulting value.
3059
+
3060
+
* If the token is an <<ident-token>> consisting solely of <a>hex digits</a>,
3061
+
interpret its representation as a hexadecimal number
3062
+
and return the resulting value.
3063
+
3064
+
* If the token is a <<dimension-token>> whose type flag is set to "integer"
3065
+
and whose unit consists solely of <a>hex digits</a>,
3066
+
concatenate its representation and its unit,
3067
+
then interpret that as a hexadecimal number
3068
+
and return the resulting value.
3069
+
3070
+
* Otherwise, the token can't be interpreted as a hex integer.
0 commit comments