Skip to content

Commit 3828e72

Browse files
committed
[css-syntax] Since I use ident validation at all the entry points, simplify the ident state and drop the ident-rest state.
1 parent fcaf9af commit 3828e72

2 files changed

Lines changed: 62 additions & 167 deletions

File tree

css-syntax/Overview.html

Lines changed: 51 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -211,46 +211,43 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
211211
<li><a href="#ident-state"><span class=secno>4.4.7. </span> Ident
212212
state</a>
213213

214-
<li><a href="#ident-rest-state"><span class=secno>4.4.8. </span>
215-
Ident-rest state</a>
216-
217214
<li><a href="#transform-function-whitespace-state"><span
218-
class=secno>4.4.9. </span> Transform-function-whitespace state</a>
215+
class=secno>4.4.8. </span> Transform-function-whitespace state</a>
219216

220-
<li><a href="#number-state"><span class=secno>4.4.10. </span> Number
217+
<li><a href="#number-state"><span class=secno>4.4.9. </span> Number
221218
state</a>
222219

223-
<li><a href="#number-rest-state"><span class=secno>4.4.11. </span>
220+
<li><a href="#number-rest-state"><span class=secno>4.4.10. </span>
224221
Number-rest state</a>
225222

226-
<li><a href="#number-fraction-state"><span class=secno>4.4.12. </span>
223+
<li><a href="#number-fraction-state"><span class=secno>4.4.11. </span>
227224
Number-fraction state</a>
228225

229-
<li><a href="#dimension-state"><span class=secno>4.4.13. </span>
226+
<li><a href="#dimension-state"><span class=secno>4.4.12. </span>
230227
Dimension state</a>
231228

232-
<li><a href="#sci-notation-state"><span class=secno>4.4.14. </span>
229+
<li><a href="#sci-notation-state"><span class=secno>4.4.13. </span>
233230
Sci-notation state</a>
234231

235-
<li><a href="#url-state"><span class=secno>4.4.15. </span> URL
232+
<li><a href="#url-state"><span class=secno>4.4.14. </span> URL
236233
state</a>
237234

238-
<li><a href="#url-double-quote-state"><span class=secno>4.4.16.
235+
<li><a href="#url-double-quote-state"><span class=secno>4.4.15.
239236
</span> URL-double-quote state</a>
240237

241-
<li><a href="#url-single-quote-state"><span class=secno>4.4.17.
238+
<li><a href="#url-single-quote-state"><span class=secno>4.4.16.
242239
</span> URL-single-quote state</a>
243240

244-
<li><a href="#url-end-state"><span class=secno>4.4.18. </span> URL-end
241+
<li><a href="#url-end-state"><span class=secno>4.4.17. </span> URL-end
245242
state</a>
246243

247-
<li><a href="#url-unquoted-state"><span class=secno>4.4.19. </span>
244+
<li><a href="#url-unquoted-state"><span class=secno>4.4.18. </span>
248245
URL-unquoted state</a>
249246

250-
<li><a href="#bad-url-state"><span class=secno>4.4.20. </span> Bad-URL
247+
<li><a href="#bad-url-state"><span class=secno>4.4.19. </span> Bad-URL
251248
state</a>
252249

253-
<li><a href="#unicode-range-state"><span class=secno>4.4.21. </span>
250+
<li><a href="#unicode-range-state"><span class=secno>4.4.20. </span>
254251
Unicode-range state</a>
255252
</ul>
256253

@@ -1940,52 +1937,8 @@ <h4 id=at-keyword-state><span class=secno>4.4.6. </span> <dfn
19401937
<h4 id=ident-state><span class=secno>4.4.7. </span> <dfn
19411938
id=ident-state0>Ident state</dfn></h4>
19421939

1943-
<p> Consume the <a href="#next-input-character"><i>next input
1944-
character</i></a>.
1945-
1946-
<dl>
1947-
<dt>U+002D HYPHEN-MINUS (-)
1948-
1949-
<dd> If the <a href="#next-input-character"><i>next input
1950-
character</i></a> is a <a href="#name-start-character"><i>name-start
1951-
character</i></a>, create an identifier token with its value initially
1952-
set to U+002D HYPHEN-MINUS. Switch to the <a
1953-
href="#ident-rest-state0"><i>ident-rest state</i></a>.
1954-
<p> Otherwise, if the <a href="#next-input-character"><i
1955-
title="next input character">next two characters</i></a> are U+005C
1956-
REVERSE SOLIDUS (\) followed by anything but a <a
1957-
href="#newline"><i>newline</i></a> or EOF, create an identifier token
1958-
with its value initially set to U+002D HYPHEN-MINUS. Switch to the <a
1959-
href="#ident-rest-state0"><i>ident-rest state</i></a>.
1960-
1961-
<p> Otherwise, emit a delim token with its value set to U+002D
1962-
HYPHEN-MINUS (-). Switch to the <a href="#data-state0"><i>data
1963-
state</i></a>.
1964-
1965-
<dt><a href="#name-start-character"><i>name-start character</i></a>
1966-
1967-
<dd> Create an ident token with its value set to the <a
1968-
href="#current-input-character"><i>current input character</i></a>.
1969-
Switch to the <a href="#ident-rest-state0"><i>ident-rest state</i></a>.
1970-
1971-
<dt>U+005C REVERSE SOLIDUS (\)
1972-
1973-
<dd> If the <a href="#next-input-character"><i>next input
1974-
character</i></a> is a <a href="#newline"><i>newline</i></a> or EOF,
1975-
switch to the <a href="#data-state0"><i>data state</i></a>. <a
1976-
href="#reconsume-the-current-input-character"><i>Reconsume the current
1977-
input character</i></a>.
1978-
<p> Otherwise, <a href="#consume-an-escaped-character0"><i>consume an
1979-
escaped character</i></a>. Create an ident token with its value set to
1980-
the returned character. Switch to the <a
1981-
href="#ident-rest-state0"><i>ident-rest state</i></a>. <!--
1982-
This state should only be entered with a valid character.
1983-
If it hits anything else, this is a spec error.
1984-
-->
1985-
</dl>
1986-
1987-
<h4 id=ident-rest-state><span class=secno>4.4.8. </span> <dfn
1988-
id=ident-rest-state0>Ident-rest state</dfn></h4>
1940+
<p> When this state is first entered, create a new ident token with its
1941+
value initially set to the empty string.
19891942

19901943
<p> Consume the <a href="#next-input-character"><i>next input
19911944
character</i></a>.
@@ -1998,22 +1951,22 @@ <h4 id=ident-rest-state><span class=secno>4.4.8. </span> <dfn
19981951

19991952
<dt>U+005C REVERSE SOLIDUS (\)
20001953

2001-
<dd> If the <a href="#next-input-character"><i>next input
2002-
character</i></a> is a <a href="#newline"><i>newline</i></a> or EOF, emit
2003-
the ident token. Switch to the <a href="#data-state0"><i>data
2004-
state</i></a>. <a
2005-
href="#reconsume-the-current-input-character"><i>Reconsume the current
2006-
input character</i></a>.
2007-
<p> Otherwise, <a href="#consume-an-escaped-character0"><i>consume an
2008-
escaped character</i></a>. Append the returned character to the ident
2009-
token's value. Remain in this state.
1954+
<dd> If the input stream <a
1955+
href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
1956+
escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
1957+
escaped character</i></a>. Append the returned character to the input
1958+
token's value. Remain in this state.
1959+
<p> Otherwise, emit the ident token. Switch to the <a
1960+
href="#data-state0"><i>data state</i></a>. <a
1961+
href="#reconsume-the-current-input-character"><i>Reconsume the current
1962+
input character</i></a>.
20101963

20111964
<dt>U+0028 LEFT PARENTHESIS (()
20121965

20131966
<dd> If the identifier token's value is an <a
20141967
href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a> match
20151968
for "url", switch to the <a href="#url-state0"><i>url state</i></a>.
2016-
<p> Otherwise, Emit a function token with its value set to the identifier
1969+
<p> Otherwise, emit a function token with its value set to the identifier
20171970
token's value. Switch to the <a href="#data-state0"><i>data
20181971
state</i></a>.
20191972

@@ -2038,7 +1991,7 @@ <h4 id=ident-rest-state><span class=secno>4.4.8. </span> <dfn
20381991
input character</i></a>.
20391992
</dl>
20401993

2041-
<h4 id=transform-function-whitespace-state><span class=secno>4.4.9. </span>
1994+
<h4 id=transform-function-whitespace-state><span class=secno>4.4.8. </span>
20421995
<dfn id=transform-function-whitespace-state0>Transform-function-whitespace
20431996
state</dfn></h4>
20441997

@@ -2062,7 +2015,7 @@ <h4 id=transform-function-whitespace-state><span class=secno>4.4.9. </span>
20622015
input character</i></a>.
20632016
</dl>
20642017

2065-
<h4 id=number-state><span class=secno>4.4.10. </span> <dfn
2018+
<h4 id=number-state><span class=secno>4.4.9. </span> <dfn
20662019
id=number-state0>Number state</dfn></h4>
20672020

20682021
<p class=note> Note: this state must only be entered <em>after</em>
@@ -2119,7 +2072,7 @@ <h4 id=number-state><span class=secno>4.4.10. </span> <dfn
21192072
or the implementation.
21202073
</dl>
21212074

2122-
<h4 id=number-rest-state><span class=secno>4.4.11. </span> <dfn
2075+
<h4 id=number-rest-state><span class=secno>4.4.10. </span> <dfn
21232076
id=number-rest-state0>Number-rest state</dfn></h4>
21242077

21252078
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2241,7 +2194,7 @@ <h4 id=number-rest-state><span class=secno>4.4.11. </span> <dfn
22412194
input character</i></a>.
22422195
</dl>
22432196

2244-
<h4 id=number-fraction-state><span class=secno>4.4.12. </span> <dfn
2197+
<h4 id=number-fraction-state><span class=secno>4.4.11. </span> <dfn
22452198
id=number-fraction-state0>Number-fraction state</dfn></h4>
22462199

22472200
<p> Set the number token's type flag to "number".
@@ -2350,7 +2303,7 @@ <h4 id=number-fraction-state><span class=secno>4.4.12. </span> <dfn
23502303
input character</i></a>.
23512304
</dl>
23522305

2353-
<h4 id=dimension-state><span class=secno>4.4.13. </span> <dfn
2306+
<h4 id=dimension-state><span class=secno>4.4.12. </span> <dfn
23542307
id=dimension-state0>Dimension state</dfn></h4>
23552308
<!--
23562309
This state is currently always entered with a dimension token
@@ -2390,7 +2343,7 @@ <h4 id=dimension-state><span class=secno>4.4.13. </span> <dfn
23902343
input character</i></a>.
23912344
</dl>
23922345

2393-
<h4 id=sci-notation-state><span class=secno>4.4.14. </span> <dfn
2346+
<h4 id=sci-notation-state><span class=secno>4.4.13. </span> <dfn
23942347
id=sci-notation-state0>Sci-notation state</dfn></h4>
23952348

23962349
<p> Set the number token's type flag to "number".
@@ -2423,7 +2376,7 @@ <h4 id=sci-notation-state><span class=secno>4.4.14. </span> <dfn
24232376
input character</i></a>.
24242377
</dl>
24252378

2426-
<h4 id=url-state><span class=secno>4.4.15. </span> <dfn id=url-state0>URL
2379+
<h4 id=url-state><span class=secno>4.4.14. </span> <dfn id=url-state0>URL
24272380
state</dfn></h4>
24282381

24292382
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2463,7 +2416,7 @@ <h4 id=url-state><span class=secno>4.4.15. </span> <dfn id=url-state0>URL
24632416
input character</i></a>.
24642417
</dl>
24652418

2466-
<h4 id=url-double-quote-state><span class=secno>4.4.16. </span> <dfn
2419+
<h4 id=url-double-quote-state><span class=secno>4.4.15. </span> <dfn
24672420
id=url-double-quote-state0>URL-double-quote state</dfn></h4>
24682421

24692422
<p> If a url token has not yet been created since entering this state,
@@ -2509,7 +2462,7 @@ <h4 id=url-double-quote-state><span class=secno>4.4.16. </span> <dfn
25092462
character</i></a> to the url token's value. Remain in this state.
25102463
</dl>
25112464

2512-
<h4 id=url-single-quote-state><span class=secno>4.4.17. </span> <dfn
2465+
<h4 id=url-single-quote-state><span class=secno>4.4.16. </span> <dfn
25132466
id=url-single-quote-state0>URL-single-quote state</dfn></h4>
25142467

25152468
<p> If a url token has not yet been created since entering this state,
@@ -2555,7 +2508,7 @@ <h4 id=url-single-quote-state><span class=secno>4.4.17. </span> <dfn
25552508
character</i></a> to the url token's value. Remain in this state.
25562509
</dl>
25572510

2558-
<h4 id=url-end-state><span class=secno>4.4.18. </span> <dfn
2511+
<h4 id=url-end-state><span class=secno>4.4.17. </span> <dfn
25592512
id=url-end-state0>URL-end state</dfn></h4>
25602513

25612514
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2581,7 +2534,7 @@ <h4 id=url-end-state><span class=secno>4.4.18. </span> <dfn
25812534
input character</i></a>.
25822535
</dl>
25832536

2584-
<h4 id=url-unquoted-state><span class=secno>4.4.19. </span> <dfn
2537+
<h4 id=url-unquoted-state><span class=secno>4.4.18. </span> <dfn
25852538
id=url-unquoted-state0>URL-unquoted state</dfn></h4>
25862539

25872540
<p> If a url token has not yet been created since entering this state,
@@ -2629,7 +2582,7 @@ <h4 id=url-unquoted-state><span class=secno>4.4.19. </span> <dfn
26292582
character</i></a> to the url token's value. Remain in this state.
26302583
</dl>
26312584

2632-
<h4 id=bad-url-state><span class=secno>4.4.20. </span> <dfn
2585+
<h4 id=bad-url-state><span class=secno>4.4.19. </span> <dfn
26332586
id=bad-url-state0>Bad-URL state</dfn></h4>
26342587

26352588
<p> Consume the <a href="#next-input-character"><i>next input
@@ -2660,7 +2613,7 @@ <h4 id=bad-url-state><span class=secno>4.4.20. </span> <dfn
26602613
<dd> Do nothing. Remain in this state.
26612614
</dl>
26622615

2663-
<h4 id=unicode-range-state><span class=secno>4.4.21. </span> <dfn
2616+
<h4 id=unicode-range-state><span class=secno>4.4.20. </span> <dfn
26642617
id=unicode-range-state0>Unicode-range state</dfn></h4>
26652618

26662619
<p> Create a new unicode-range token with an empty range.
@@ -4360,7 +4313,7 @@ <h2 class=no-num id=index> Index</h2>
43604313
title="section 7.2."><strong>7.2.</strong></a>
43614314

43624315
<li>Bad-URL state, <a href="#bad-url-state0"
4363-
title="section 4.4.20."><strong>4.4.20.</strong></a>
4316+
title="section 4.4.19."><strong>4.4.19.</strong></a>
43644317

43654318
<li>check if three characters would start an identifier, <a
43664319
href="#check-if-three-characters-would-start-an0"
@@ -4426,7 +4379,7 @@ <h2 class=no-num id=index> Index</h2>
44264379
<li>digit, <a href="#digit" title="section 4.3."><strong>4.3.</strong></a>
44274380

44284381
<li>Dimension state, <a href="#dimension-state0"
4429-
title="section 4.4.13."><strong>4.4.13.</strong></a>
4382+
title="section 4.4.12."><strong>4.4.12.</strong></a>
44304383

44314384
<li>Double-quote-string state, <a href="#double-quote-string-state0"
44324385
title="section 4.4.2."><strong>4.4.2.</strong></a>
@@ -4455,9 +4408,6 @@ <h2 class=no-num id=index> Index</h2>
44554408
<li>hex digit, <a href="#hex-digit"
44564409
title="section 4.3."><strong>4.3.</strong></a>
44574410

4458-
<li>Ident-rest state, <a href="#ident-rest-state0"
4459-
title="section 4.4.8."><strong>4.4.8.</strong></a>
4460-
44614411
<li>Ident state, <a href="#ident-state0"
44624412
title="section 4.4.7."><strong>4.4.7.</strong></a>
44634413

@@ -4492,13 +4442,13 @@ <h2 class=no-num id=index> Index</h2>
44924442
title="section 4.3."><strong>4.3.</strong></a>
44934443

44944444
<li>Number-fraction state, <a href="#number-fraction-state0"
4495-
title="section 4.4.12."><strong>4.4.12.</strong></a>
4445+
title="section 4.4.11."><strong>4.4.11.</strong></a>
44964446

44974447
<li>Number-rest state, <a href="#number-rest-state0"
4498-
title="section 4.4.11."><strong>4.4.11.</strong></a>
4448+
title="section 4.4.10."><strong>4.4.10.</strong></a>
44994449

45004450
<li>Number state, <a href="#number-state0"
4501-
title="section 4.4.10."><strong>4.4.10.</strong></a>
4451+
title="section 4.4.9."><strong>4.4.9.</strong></a>
45024452

45034453
<li>Parse a comma-separated list of component values, <a
45044454
href="#parse-a-comma-separated-list-of-componen0"
@@ -4548,7 +4498,7 @@ <h2 class=no-num id=index> Index</h2>
45484498
title="section 7.2."><strong>7.2.</strong></a>
45494499

45504500
<li>Sci-notation state, <a href="#sci-notation-state0"
4551-
title="section 4.4.14."><strong>4.4.14.</strong></a>
4501+
title="section 4.4.13."><strong>4.4.13.</strong></a>
45524502

45534503
<li>Set the unicode-range token's range, <a
45544504
href="#set-the-unicode-range-tokens-range0"
@@ -4595,28 +4545,28 @@ <h2 class=no-num id=index> Index</h2>
45954545

45964546
<li>Transform-function-whitespace state, <a
45974547
href="#transform-function-whitespace-state0"
4598-
title="section 4.4.9."><strong>4.4.9.</strong></a>
4548+
title="section 4.4.8."><strong>4.4.8.</strong></a>
45994549

46004550
<li>Unicode-range state, <a href="#unicode-range-state0"
4601-
title="section 4.4.21."><strong>4.4.21.</strong></a>
4551+
title="section 4.4.20."><strong>4.4.20.</strong></a>
46024552

46034553
<li>uppercase letter, <a href="#uppercase-letter"
46044554
title="section 4.3."><strong>4.3.</strong></a>
46054555

46064556
<li>URL-double-quote state, <a href="#url-double-quote-state0"
4607-
title="section 4.4.16."><strong>4.4.16.</strong></a>
4557+
title="section 4.4.15."><strong>4.4.15.</strong></a>
46084558

46094559
<li>URL-end state, <a href="#url-end-state0"
4610-
title="section 4.4.18."><strong>4.4.18.</strong></a>
4560+
title="section 4.4.17."><strong>4.4.17.</strong></a>
46114561

46124562
<li>URL-single-quote state, <a href="#url-single-quote-state0"
4613-
title="section 4.4.17."><strong>4.4.17.</strong></a>
4563+
title="section 4.4.16."><strong>4.4.16.</strong></a>
46144564

46154565
<li>URL state, <a href="#url-state0"
4616-
title="section 4.4.15."><strong>4.4.15.</strong></a>
4566+
title="section 4.4.14."><strong>4.4.14.</strong></a>
46174567

46184568
<li>URL-unquoted state, <a href="#url-unquoted-state0"
4619-
title="section 4.4.19."><strong>4.4.19.</strong></a>
4569+
title="section 4.4.18."><strong>4.4.18.</strong></a>
46204570

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

0 commit comments

Comments
 (0)