Skip to content

Commit 913c360

Browse files
committed
[css-syntax] Yank some common states from the number-* states into a number-end state.
1 parent ceb897b commit 913c360

2 files changed

Lines changed: 101 additions & 188 deletions

File tree

css-syntax/Overview.html

Lines changed: 71 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -223,28 +223,31 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
223223
<li><a href="#sci-notation-state"><span class=secno>4.4.11. </span>
224224
Sci-notation state</a>
225225

226-
<li><a href="#dimension-state"><span class=secno>4.4.12. </span>
226+
<li><a href="#number-end-state"><span class=secno>4.4.12. </span>
227+
Number-end state</a>
228+
229+
<li><a href="#dimension-state"><span class=secno>4.4.13. </span>
227230
Dimension state</a>
228231

229-
<li><a href="#url-state"><span class=secno>4.4.13. </span> URL
232+
<li><a href="#url-state"><span class=secno>4.4.14. </span> URL
230233
state</a>
231234

232-
<li><a href="#url-double-quote-state"><span class=secno>4.4.14.
235+
<li><a href="#url-double-quote-state"><span class=secno>4.4.15.
233236
</span> URL-double-quote state</a>
234237

235-
<li><a href="#url-single-quote-state"><span class=secno>4.4.15.
238+
<li><a href="#url-single-quote-state"><span class=secno>4.4.16.
236239
</span> URL-single-quote state</a>
237240

238-
<li><a href="#url-end-state"><span class=secno>4.4.16. </span> URL-end
241+
<li><a href="#url-end-state"><span class=secno>4.4.17. </span> URL-end
239242
state</a>
240243

241-
<li><a href="#url-unquoted-state"><span class=secno>4.4.17. </span>
244+
<li><a href="#url-unquoted-state"><span class=secno>4.4.18. </span>
242245
URL-unquoted state</a>
243246

244-
<li><a href="#bad-url-state"><span class=secno>4.4.18. </span> Bad-URL
247+
<li><a href="#bad-url-state"><span class=secno>4.4.19. </span> Bad-URL
245248
state</a>
246249

247-
<li><a href="#unicode-range-state"><span class=secno>4.4.19. </span>
250+
<li><a href="#unicode-range-state"><span class=secno>4.4.20. </span>
248251
Unicode-range state</a>
249252
</ul>
250253

@@ -2086,12 +2089,6 @@ <h4 id=number-rest-state><span class=secno>4.4.10. </span> <dfn
20862089
href="#reconsume-the-current-input-character"><i>Reconsume the current
20872090
input character</i></a>.
20882091

2089-
<dt>U+0025 PERCENT SIGN (%)
2090-
2091-
<dd> Emit a percentage token with its value set to the number produced by
2092-
interpreting the number token's representation as a base-10 number.
2093-
Switch to the <a href="#data-state0"><i>data state</i></a>.
2094-
20952092
<dt>U+0045 LATIN CAPITAL LETTER E (E)
20962093

20972094
<dt>U+0065 LATIN SMALL LETTER E (e)
@@ -2107,56 +2104,15 @@ <h4 id=number-rest-state><span class=secno>4.4.10. </span> <dfn
21072104
<p> Otherwise, create a dimension token with its representation set to
21082105
the number token's representation, its value set to the number produced
21092106
by interpreting the number token's representation as a base-10 number,
2110-
and a unit initially set to the <a
2107+
and its unit initially set to the <a
21112108
href="#current-input-character"><i>current input character</i></a>.
21122109
Switch to the <a href="#dimension-state0"><i>dimension state</i></a>.
21132110

2114-
<dt>U+002D HYPHEN-MINUS (-)
2115-
2116-
<dd> If the input stream <a
2117-
href="#check-if-three-characters-would-start-an0"><i>starts with an
2118-
identifier</i></a>, create a dimension token with its representation set
2119-
to the number token's representation, its value set to the number
2120-
produced by interpreting the number token's representation as a base-10
2121-
number, and a unit initially set to the <a
2122-
href="#current-input-character"><i>current input character</i></a>.
2123-
Switch to the <a href="#dimension-state0"><i>dimension state</i></a>.
2124-
<p> Otherwise, set the number token's value to the number produced by
2125-
interpreting the number token's representation as a base-10 number and
2126-
emit it. Switch to the <a href="#data-state0"><i>data state</i></a>. <a
2127-
href="#reconsume-the-current-input-character"><i>Reconsume the current
2128-
input character</i></a>.
2129-
2130-
<dt><a href="#name-start-character"><i>name-start character</i></a>
2131-
2132-
<dd> Create a dimension token with its representation set to the number
2133-
token's representation, its value set to the number produced by
2134-
interpreting the number token's representation as a base-10 number, and a
2135-
unit initially set to the <a href="#current-input-character"><i>current
2136-
input character</i></a>. Switch to the <a
2137-
href="#dimension-state0"><i>dimension state</i></a>.
2138-
2139-
<dt>U+005C REVERSE SOLIDUS (\)
2140-
2141-
<dd> If the input stream <a
2142-
href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
2143-
escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
2144-
escaped character</i></a>. Create a dimension token with its
2145-
representation set to the number token's representation, its value set to
2146-
the number produced by interpreting the number token's representation as
2147-
a base-10 number, and a unit initially set to the returned character.
2148-
Switch to the <a href="#dimension-state0"><i>dimension state</i></a>.
2149-
<p> Otherwise, set the number token's value to the number produced by
2150-
interpreting the number token's representation as a base-10 number and
2151-
emit it. Switch to the <a href="#data-state0"><i>data state</i></a>. <a
2152-
href="#reconsume-the-current-input-character"><i>Reconsume the current
2153-
input character</i></a>.
2154-
21552111
<dt>anything else
21562112

2157-
<dd> Emit a number token with its value set to the number produced by
2158-
interpreting the string token's value as a base-10 number. Switch to the
2159-
<a href="#data-state0"><i>data state</i></a>. <a
2113+
<dd> Set the number token's value to the number produced by interpreting
2114+
the number token's representation as a base-10 number. Switch to the <a
2115+
href="#number-end-state0"><i>number-end state</i></a>. <a
21602116
href="#reconsume-the-current-input-character"><i>Reconsume the current
21612117
input character</i></a>.
21622118
</dl>
@@ -2176,41 +2132,54 @@ <h4 id=sci-notation-state><span class=secno>4.4.11. </span> <dfn
21762132
character</i></a> to the number token's representation. Remain in this
21772133
state.
21782134

2135+
<dt>anything else
2136+
2137+
<dd> Set the number token's value to the number produced by <a
2138+
href="#convert-a-sci-notation-representation-in0"><i
2139+
title=sci-not-to-value>converting the number token's representation to a
2140+
value</i></a>. Switch to the <a href="#number-end-state0"><i>number-end
2141+
state</i></a>. <a
2142+
href="#reconsume-the-current-input-character"><i>Reconsume the current
2143+
input character</i></a>.
2144+
</dl>
2145+
2146+
<h4 id=number-end-state><span class=secno>4.4.12. </span> <dfn
2147+
id=number-end-state0>Number-end state</dfn></h4>
2148+
2149+
<p class=note> This state is only ever entered with a number token having
2150+
been created by the previous state, with its value already set up
2151+
appropriately.
2152+
2153+
<p> Consume the <a href="#next-input-character"><i>next input
2154+
character</i></a>.
2155+
2156+
<dl>
21792157
<dt>U+0025 PERCENT SIGN (%)
21802158

2181-
<dd> <a href="#convert-a-sci-notation-representation-in0"><i
2182-
title=sci-not-to-value>Convert the number token's representation to a
2183-
value</i></a>. Emit a percentage token with its value set to the returned
2159+
<dd> Emit a percentage token with its value set to the number token's
21842160
value. Switch to the <a href="#data-state0"><i>data state</i></a>.
21852161

21862162
<dt>U+002D HYPHEN-MINUS (-)
21872163

21882164
<dd> If the input stream <a
21892165
href="#check-if-three-characters-would-start-an0"><i>starts with an
21902166
identifier</i></a>, create a dimension token with its representation set
2191-
to the number token's representation, its value set to the number
2192-
produced by <a href="#convert-a-sci-notation-representation-in0"><i
2193-
title=sci-not-to-value>converting the number token's representation to a
2194-
value</i></a>, and a unit initially set to the <a
2167+
to the number token's representation, its value set to the number token's
2168+
value, and a unit initially set to the <a
21952169
href="#current-input-character"><i>current input character</i></a>.
21962170
Switch to the <a href="#dimension-state0"><i>dimension state</i></a>.
2197-
<p> Otherwise, set the number token's value to the number produced by <a
2198-
href="#convert-a-sci-notation-representation-in0"><i
2199-
title=sci-not-to-value>converting the number token's representation to a
2200-
value</i></a>, and emit it. Switch to the <a href="#data-state0"><i>data
2201-
state</i></a>. <a
2171+
<p> Otherwise, emit the number token. Switch to the <a
2172+
href="#data-state0"><i>data state</i></a>. <a
22022173
href="#reconsume-the-current-input-character"><i>Reconsume the current
22032174
input character</i></a>.
22042175

22052176
<dt><a href="#name-start-character"><i>name-start character</i></a>
22062177

22072178
<dd> Create a dimension token with its representation set to the number
2208-
token's representation, its value set to the number produced by <a
2209-
href="#convert-a-sci-notation-representation-in0"><i
2210-
title=sci-not-to-value>converting the number token's representation to a
2211-
value</i></a>, and a unit initially set to the <a
2212-
href="#current-input-character"><i>current input character</i></a>.
2213-
Switch to the <a href="#dimension-state0"><i>dimension state</i></a>.
2179+
token's representation, its value set to the number token's value, and a
2180+
unit initially set to the <a href="#current-input-character"><i>current
2181+
input character</i></a>. Switch to the <a
2182+
href="#dimension-state0"><i>dimension state</i></a>.
22142183

22152184
<dt>U+005C REVERSE SOLIDUS (\)
22162185

@@ -2219,31 +2188,23 @@ <h4 id=sci-notation-state><span class=secno>4.4.11. </span> <dfn
22192188
escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
22202189
escaped character</i></a>. Create a dimension token with its
22212190
representation set to the number token's representation, its value set to
2222-
the number produced by <a
2223-
href="#convert-a-sci-notation-representation-in0"><i
2224-
title=sci-not-to-value>converting the number token's representation to a
2225-
value</i></a>, and a unit initially set to the returned character. Switch
2226-
to the <a href="#dimension-state0"><i>dimension state</i></a>.
2227-
<p> Otherwise, set the number token's value to the number produced by <a
2228-
href="#convert-a-sci-notation-representation-in0"><i
2229-
title=sci-not-to-value>converting the number token's representation to a
2230-
value</i></a>, and emit it. Switch to the <a href="#data-state0"><i>data
2231-
state</i></a>. <a
2191+
the number token's value, and a unit initially set to the returned
2192+
character. Switch to the <a href="#dimension-state0"><i>dimension
2193+
state</i></a>.
2194+
<p> Otherwise, emit the number token. Switch to the <a
2195+
href="#data-state0"><i>data state</i></a>. <a
22322196
href="#reconsume-the-current-input-character"><i>Reconsume the current
22332197
input character</i></a>.
22342198

22352199
<dt>anything else
22362200

2237-
<dd> Set the number token's value to the number produced by <a
2238-
href="#convert-a-sci-notation-representation-in0"><i
2239-
title=sci-not-to-value>converting the number token's representation to a
2240-
value</i></a>, and emit it. Switch to the <a href="#data-state0"><i>data
2201+
<dd> Emit the number token. Switch to the <a href="#data-state0"><i>data
22412202
state</i></a>. <a
22422203
href="#reconsume-the-current-input-character"><i>Reconsume the current
22432204
input character</i></a>.
22442205
</dl>
22452206

2246-
<h4 id=dimension-state><span class=secno>4.4.12. </span> <dfn
2207+
<h4 id=dimension-state><span class=secno>4.4.13. </span> <dfn
22472208
id=dimension-state0>Dimension state</dfn></h4>
22482209
<!--
22492210
This state is currently always entered with a dimension token
@@ -2283,7 +2244,7 @@ <h4 id=dimension-state><span class=secno>4.4.12. </span> <dfn
22832244
input character</i></a>.
22842245
</dl>
22852246

2286-
<h4 id=url-state><span class=secno>4.4.13. </span> <dfn id=url-state0>URL
2247+
<h4 id=url-state><span class=secno>4.4.14. </span> <dfn id=url-state0>URL
22872248
state</dfn></h4>
22882249

22892250
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2326,7 +2287,7 @@ <h4 id=url-state><span class=secno>4.4.13. </span> <dfn id=url-state0>URL
23262287
input character</i></a>.
23272288
</dl>
23282289

2329-
<h4 id=url-double-quote-state><span class=secno>4.4.14. </span> <dfn
2290+
<h4 id=url-double-quote-state><span class=secno>4.4.15. </span> <dfn
23302291
id=url-double-quote-state0>URL-double-quote state</dfn></h4>
23312292

23322293
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2369,7 +2330,7 @@ <h4 id=url-double-quote-state><span class=secno>4.4.14. </span> <dfn
23692330
character</i></a> to the url token's value. Remain in this state.
23702331
</dl>
23712332

2372-
<h4 id=url-single-quote-state><span class=secno>4.4.15. </span> <dfn
2333+
<h4 id=url-single-quote-state><span class=secno>4.4.16. </span> <dfn
23732334
id=url-single-quote-state0>URL-single-quote state</dfn></h4>
23742335

23752336
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2412,7 +2373,7 @@ <h4 id=url-single-quote-state><span class=secno>4.4.15. </span> <dfn
24122373
character</i></a> to the url token's value. Remain in this state.
24132374
</dl>
24142375

2415-
<h4 id=url-end-state><span class=secno>4.4.16. </span> <dfn
2376+
<h4 id=url-end-state><span class=secno>4.4.17. </span> <dfn
24162377
id=url-end-state0>URL-end state</dfn></h4>
24172378

24182379
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2438,7 +2399,7 @@ <h4 id=url-end-state><span class=secno>4.4.16. </span> <dfn
24382399
input character</i></a>.
24392400
</dl>
24402401

2441-
<h4 id=url-unquoted-state><span class=secno>4.4.17. </span> <dfn
2402+
<h4 id=url-unquoted-state><span class=secno>4.4.18. </span> <dfn
24422403
id=url-unquoted-state0>URL-unquoted state</dfn></h4>
24432404

24442405
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2483,7 +2444,7 @@ <h4 id=url-unquoted-state><span class=secno>4.4.17. </span> <dfn
24832444
character</i></a> to the url token's value. Remain in this state.
24842445
</dl>
24852446

2486-
<h4 id=bad-url-state><span class=secno>4.4.18. </span> <dfn
2447+
<h4 id=bad-url-state><span class=secno>4.4.19. </span> <dfn
24872448
id=bad-url-state0>Bad-URL state</dfn></h4>
24882449

24892450
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2514,7 +2475,7 @@ <h4 id=bad-url-state><span class=secno>4.4.18. </span> <dfn
25142475
<dd> Do nothing. Remain in this state.
25152476
</dl>
25162477

2517-
<h4 id=unicode-range-state><span class=secno>4.4.19. </span> <dfn
2478+
<h4 id=unicode-range-state><span class=secno>4.4.20. </span> <dfn
25182479
id=unicode-range-state0>Unicode-range state</dfn></h4>
25192480

25202481
<p> Create a new unicode-range token with an empty range.
@@ -4232,7 +4193,7 @@ <h2 class=no-num id=index> Index</h2>
42324193
title="section 7.2."><strong>7.2.</strong></a>
42334194

42344195
<li>Bad-URL state, <a href="#bad-url-state0"
4235-
title="section 4.4.18."><strong>4.4.18.</strong></a>
4196+
title="section 4.4.19."><strong>4.4.19.</strong></a>
42364197

42374198
<li>check if three characters would start an identifier, <a
42384199
href="#check-if-three-characters-would-start-an0"
@@ -4302,7 +4263,7 @@ <h2 class=no-num id=index> Index</h2>
43024263
<li>digit, <a href="#digit" title="section 4.3."><strong>4.3.</strong></a>
43034264

43044265
<li>Dimension state, <a href="#dimension-state0"
4305-
title="section 4.4.12."><strong>4.4.12.</strong></a>
4266+
title="section 4.4.13."><strong>4.4.13.</strong></a>
43064267

43074268
<li>Double-quote-string state, <a href="#double-quote-string-state0"
43084269
title="section 4.4.2."><strong>4.4.2.</strong></a>
@@ -4364,6 +4325,9 @@ <h2 class=no-num id=index> Index</h2>
43644325
<li>non-printable character, <a href="#non-printable-character"
43654326
title="section 4.3."><strong>4.3.</strong></a>
43664327

4328+
<li>Number-end state, <a href="#number-end-state0"
4329+
title="section 4.4.12."><strong>4.4.12.</strong></a>
4330+
43674331
<li>Number-rest state, <a href="#number-rest-state0"
43684332
title="section 4.4.10."><strong>4.4.10.</strong></a>
43694333

@@ -4471,25 +4435,25 @@ <h2 class=no-num id=index> Index</h2>
44714435
title="section 4.4.8."><strong>4.4.8.</strong></a>
44724436

44734437
<li>Unicode-range state, <a href="#unicode-range-state0"
4474-
title="section 4.4.19."><strong>4.4.19.</strong></a>
4438+
title="section 4.4.20."><strong>4.4.20.</strong></a>
44754439

44764440
<li>uppercase letter, <a href="#uppercase-letter"
44774441
title="section 4.3."><strong>4.3.</strong></a>
44784442

44794443
<li>URL-double-quote state, <a href="#url-double-quote-state0"
4480-
title="section 4.4.14."><strong>4.4.14.</strong></a>
4444+
title="section 4.4.15."><strong>4.4.15.</strong></a>
44814445

44824446
<li>URL-end state, <a href="#url-end-state0"
4483-
title="section 4.4.16."><strong>4.4.16.</strong></a>
4447+
title="section 4.4.17."><strong>4.4.17.</strong></a>
44844448

44854449
<li>URL-single-quote state, <a href="#url-single-quote-state0"
4486-
title="section 4.4.15."><strong>4.4.15.</strong></a>
4450+
title="section 4.4.16."><strong>4.4.16.</strong></a>
44874451

44884452
<li>URL state, <a href="#url-state0"
4489-
title="section 4.4.13."><strong>4.4.13.</strong></a>
4453+
title="section 4.4.14."><strong>4.4.14.</strong></a>
44904454

44914455
<li>URL-unquoted state, <a href="#url-unquoted-state0"
4492-
title="section 4.4.17."><strong>4.4.17.</strong></a>
4456+
title="section 4.4.18."><strong>4.4.18.</strong></a>
44934457

44944458
<li>whitespace, <a href="#whitespace"
44954459
title="section 4.3."><strong>4.3.</strong></a>

0 commit comments

Comments
 (0)