Skip to content

Commit b95f39a

Browse files
committed
Handle bang-important naively, with an issue on it.
--HG-- extra : rebase_source : 7d22497aeb940530c5305372cf4b0ae7e4cd707f
1 parent e7fd653 commit b95f39a

2 files changed

Lines changed: 131 additions & 18 deletions

File tree

css3-syntax/Overview.html

Lines changed: 78 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -293,20 +293,23 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
293293
<li><a href="#declaration-value-mode"><span class=secno>3.5.9. </span>
294294
Declaration-value mode</a>
295295

296-
<li><a href="#next-block-error-mode"><span class=secno>3.5.10. </span>
296+
<li><a href="#declaration-end-mode"><span class=secno>3.5.10. </span>
297+
Declaration-end mode</a>
298+
299+
<li><a href="#next-block-error-mode"><span class=secno>3.5.11. </span>
297300
Next-block error mode</a>
298301

299-
<li><a href="#next-declaration-error-mode"><span class=secno>3.5.11.
302+
<li><a href="#next-declaration-error-mode"><span class=secno>3.5.12.
300303
</span> Next-declaration error mode</a>
301304

302305
<li><a href="#next-block-or-statement-error-mode"><span
303-
class=secno>3.5.12. </span> Next-block-or-statement error mode</a>
306+
class=secno>3.5.13. </span> Next-block-or-statement error mode</a>
304307

305-
<li><a href="#consume-a-block"><span class=secno>3.5.13. </span>
308+
<li><a href="#consume-a-block"><span class=secno>3.5.14. </span>
306309
Consume a block</a>
307310

308311
<li><a href="#switch-to-the-current-rules-content-mode"><span
309-
class=secno>3.5.14. </span> Switch to the current rule's content
312+
class=secno>3.5.15. </span> Switch to the current rule's content
310313
mode</a>
311314
</ul>
312315
</ul>
@@ -2381,6 +2384,17 @@ <h4 id=declaration-value-mode><span class=secno>3.5.9. </span> <dfn
23812384
href="#next-declaration-error-mode0"><i>next-declaration error
23822385
mode</i></a>.
23832386

2387+
<dt>delim token with a value of "!"
2388+
2389+
<dd> If the <a href="#next-input-token"><i>next input token</i></a> is an
2390+
identifier token with the value "important", consume it and set the
2391+
important flag of the <a href="#current-declaration"><i>current
2392+
declaration</i></a> to true. Switch to the <a
2393+
href="#declaration-end-mode0"><i>declaration-end mode</i></a>.
2394+
<p class=issue> This currently always parses !important at the end of a
2395+
declaration as meaning that the declaration has its important flag set.
2396+
It's not entirely clear yet that that's the behavior we want.
2397+
23842398
<dt>semicolon token
23852399

23862400
<dd> Append the <a href="#current-declaration"><i>current
@@ -2408,7 +2422,50 @@ <h4 id=declaration-value-mode><span class=secno>3.5.9. </span> <dfn
24082422
this mode.
24092423
</dl>
24102424

2411-
<h4 id=next-block-error-mode><span class=secno>3.5.10. </span> <dfn
2425+
<h4 id=declaration-end-mode><span class=secno>3.5.10. </span> <dfn
2426+
id=declaration-end-mode0>Declaration-end mode</dfn></h4>
2427+
<!--
2428+
This is intended only for times
2429+
when you've just consumed something that must come at the end of a declaration.
2430+
Currently, that's just !important.
2431+
-->
2432+
2433+
<p> Consume the <a href="#next-input-token"><i>next input token</i></a>.
2434+
2435+
<dl>
2436+
<dt>whitespace token
2437+
2438+
<dd> Do nothing. Remain in this mode.
2439+
2440+
<dt>semicolon token
2441+
2442+
<dd> Append the <a href="#current-declaration"><i>current
2443+
declaration</i></a> to the list of declarations for the <a
2444+
href="#current-rule"><i>current rule</i></a>. <a
2445+
href="#switch-to-the-current-rules-content-mode0"><i>Switch to the
2446+
current rule's content mode</i></a>.
2447+
2448+
<dt><span class=temp>}</span> token
2449+
2450+
<dd> Append the <a href="#current-declaration"><i>current
2451+
declaration</i></a> to the list of declarations for the <a
2452+
href="#current-rule"><i>current rule</i></a>. Pop the <a
2453+
href="#current-rule"><i>current rule</i></a> from the <a
2454+
href="#stack-of-open-rules"><i>stack of open rules</i></a>, and append it
2455+
to the list of rules for the new <a href="#current-rule"><i>current
2456+
rule</i></a>. <a
2457+
href="#switch-to-the-current-rules-content-mode0"><i>Switch to the
2458+
current rule's content mode</i></a>.
2459+
2460+
<dt>anything else
2461+
2462+
<dd> This is a <i>parse error</i>. Discard the <a
2463+
href="#current-declaration"><i>current declaration</i></a> and switch to
2464+
the <a href="#next-declaration-error-mode0"><i>next-declaration error
2465+
mode</i></a>.
2466+
</dl>
2467+
2468+
<h4 id=next-block-error-mode><span class=secno>3.5.11. </span> <dfn
24122469
id=next-block-error-mode0>Next-block error mode</dfn></h4>
24132470

24142471
<p> Consume the <a href="#next-input-token"><i>next input token</i></a>.
@@ -2439,7 +2496,7 @@ <h4 id=next-block-error-mode><span class=secno>3.5.10. </span> <dfn
24392496
<dd> Do nothing. Remain in this mode.
24402497
</dl>
24412498

2442-
<h4 id=next-declaration-error-mode><span class=secno>3.5.11. </span> <dfn
2499+
<h4 id=next-declaration-error-mode><span class=secno>3.5.12. </span> <dfn
24432500
id=next-declaration-error-mode0>Next-declaration error mode</dfn></h4>
24442501

24452502
<p> Consume the <a href="#next-input-token"><i>next input token</i></a>.
@@ -2475,7 +2532,7 @@ <h4 id=next-declaration-error-mode><span class=secno>3.5.11. </span> <dfn
24752532
<dd> Do nothing. Remain in this mode.
24762533
</dl>
24772534

2478-
<h4 id=next-block-or-statement-error-mode><span class=secno>3.5.12. </span>
2535+
<h4 id=next-block-or-statement-error-mode><span class=secno>3.5.13. </span>
24792536
<dfn id=next-block-or-statement-error-mode0>Next-block-or-statement error
24802537
mode</dfn></h4>
24812538

@@ -2513,7 +2570,7 @@ <h4 id=next-block-or-statement-error-mode><span class=secno>3.5.12. </span>
25132570
<dd> Do nothing. Remain in this mode.
25142571
</dl>
25152572

2516-
<h4 id=consume-a-block><span class=secno>3.5.13. </span> <dfn
2573+
<h4 id=consume-a-block><span class=secno>3.5.14. </span> <dfn
25172574
id=consume-a-block0>Consume a block</dfn></h4>
25182575

25192576
<p> This section describes how to <a href="#consume-a-block0"><i>consume a
@@ -2588,7 +2645,7 @@ <h4 id=consume-a-block><span class=secno>3.5.13. </span> <dfn
25882645
href="#current-block"><i>current block</i></a>.
25892646
</dl>
25902647

2591-
<h4 id=switch-to-the-current-rules-content-mode><span class=secno>3.5.14.
2648+
<h4 id=switch-to-the-current-rules-content-mode><span class=secno>3.5.15.
25922649
</span> <dfn id=switch-to-the-current-rules-content-mode0>Switch to the
25932650
current rule's content mode</dfn></h4>
25942651

@@ -2888,13 +2945,13 @@ <h2 class=no-num id=index> Index</h2>
28882945
title="Comment state"><strong>3.4.8.</strong></a>
28892946

28902947
<li>Consume a block, <a href="#consume-a-block0"
2891-
title="Consume a block"><strong>3.5.13.</strong></a>
2948+
title="Consume a block"><strong>3.5.14.</strong></a>
28922949

28932950
<li>Consume an escaped character, <a href="#consume-an-escaped-character0"
28942951
title="Consume an escaped character"><strong>3.4.26.</strong></a>
28952952

28962953
<li>current block, <a href="#current-block"
2897-
title="current block"><strong>3.5.13.</strong></a>
2954+
title="current block"><strong>3.5.14.</strong></a>
28982955

28992956
<li>current declaration, <a href="#current-declaration"
29002957
title="current declaration"><strong>3.5.2.</strong></a>
@@ -2908,6 +2965,9 @@ <h2 class=no-num id=index> Index</h2>
29082965
<li>Data state, <a href="#data-state0"
29092966
title="Data state"><strong>3.4.3.</strong></a>
29102967

2968+
<li>Declaration-end mode, <a href="#declaration-end-mode0"
2969+
title="Declaration-end mode"><strong>3.5.10.</strong></a>
2970+
29112971
<li>Declaration mode, <a href="#declaration-mode0"
29122972
title="Declaration mode"><strong>3.5.7.</strong></a>
29132973

@@ -2923,13 +2983,13 @@ <h2 class=no-num id=index> Index</h2>
29232983
title="Double-quote-string state"><strong>3.4.4.</strong></a>
29242984

29252985
<li>ending token, <a href="#ending-token"
2926-
title="ending token"><strong>3.5.13.</strong></a>
2986+
title="ending token"><strong>3.5.14.</strong></a>
29272987

29282988
<li>end of the range, <a href="#end-of-the-range"
29292989
title="end of the range"><strong>3.4.27.</strong></a>
29302990

29312991
<li>error flag, <a href="#error-flag"
2932-
title="error flag"><strong>3.5.13.</strong></a>
2992+
title="error flag"><strong>3.5.14.</strong></a>
29332993

29342994
<li>Hash-rest state, <a href="#hash-rest-state0"
29352995
title="Hash-rest state"><strong>3.4.7.</strong></a>
@@ -2963,14 +3023,14 @@ <h2 class=no-num id=index> Index</h2>
29633023
<li>newline, <a href="#newline" title=newline><strong>3.4.2.</strong></a>
29643024

29653025
<li>Next-block error mode, <a href="#next-block-error-mode0"
2966-
title="Next-block error mode"><strong>3.5.10.</strong></a>
3026+
title="Next-block error mode"><strong>3.5.11.</strong></a>
29673027

29683028
<li>Next-block-or-statement error mode, <a
29693029
href="#next-block-or-statement-error-mode0"
2970-
title="Next-block-or-statement error mode"><strong>3.5.12.</strong></a>
3030+
title="Next-block-or-statement error mode"><strong>3.5.13.</strong></a>
29713031

29723032
<li>Next-declaration error mode, <a href="#next-declaration-error-mode0"
2973-
title="Next-declaration error mode"><strong>3.5.11.</strong></a>
3033+
title="Next-declaration error mode"><strong>3.5.12.</strong></a>
29743034

29753035
<li>next input character, <a href="#next-input-character"
29763036
title="next input character"><strong>3.2.2.</strong></a>
@@ -3028,7 +3088,7 @@ <h2 class=no-num id=index> Index</h2>
30283088

30293089
<li>Switch to the current rule's content mode, <a
30303090
href="#switch-to-the-current-rules-content-mode0"
3031-
title="Switch to the current rule's content mode"><strong>3.5.14.</strong></a>
3091+
title="Switch to the current rule's content mode"><strong>3.5.15.</strong></a>
30323092

30333093

30343094
<li>Top-level mode, <a href="#top-level-mode"

css3-syntax/Overview.src.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,6 +2348,19 @@ <h4>
23482348
Otherwise, discard the <i>current declaration</i>
23492349
and switch to the <i>next-declaration error mode</i>.
23502350

2351+
<dt>delim token with a value of "!"
2352+
<dd>
2353+
If the <i>next input token</i>
2354+
is an identifier token with the value "important",
2355+
consume it
2356+
and set the important flag of the <i>current declaration</i> to true.
2357+
Switch to the <i>declaration-end mode</i>.
2358+
2359+
<p class='issue'>
2360+
This currently always parses !important at the end of a declaration
2361+
as meaning that the declaration has its important flag set.
2362+
It's not entirely clear yet that that's the behavior we want.
2363+
23512364
<dt>semicolon token
23522365
<dd>
23532366
Append the <i>current declaration</i>
@@ -2370,6 +2383,46 @@ <h4>
23702383
</dl>
23712384

23722385

2386+
<h4>
2387+
<dfn>Declaration-end mode</dfn></h4>
2388+
2389+
<!--
2390+
This is intended only for times
2391+
when you've just consumed something that must come at the end of a declaration.
2392+
Currently, that's just !important.
2393+
-->
2394+
2395+
<p>
2396+
Consume the <i>next input token</i>.
2397+
2398+
<dl>
2399+
<dt>whitespace token</dt>
2400+
<dd>
2401+
Do nothing.
2402+
Remain in this mode.
2403+
2404+
<dt>semicolon token
2405+
<dd>
2406+
Append the <i>current declaration</i>
2407+
to the list of declarations for the <i>current rule</i>.
2408+
<i>Switch to the current rule's content mode</i>.
2409+
2410+
<dt><span class='temp'>}</span> token
2411+
<dd>
2412+
Append the <i>current declaration</i>
2413+
to the list of declarations for the <i>current rule</i>.
2414+
Pop the <i>current rule</i> from the <i>stack of open rules</i>,
2415+
and append it to the list of rules for the new <i>current rule</i>.
2416+
<i>Switch to the current rule's content mode</i>.
2417+
2418+
<dt>anything else
2419+
<dd>
2420+
This is a <i>parse error</i>.
2421+
Discard the <i>current declaration</i>
2422+
and switch to the <i>next-declaration error mode</i>.
2423+
</dl>
2424+
2425+
23732426
<h4>
23742427
<dfn>Next-block error mode</dfn></h4>
23752428

0 commit comments

Comments
 (0)