@@ -315,7 +315,10 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
315315 class =secno > 3.6.15. </ span > Switch to the current rule's content
316316 mode</ a >
317317
318- < li > < a href ="#finish-parsing "> < span class =secno > 3.6.16. </ span > Finish
318+ < li > < a href ="#pop-the-current-rule "> < span class =secno > 3.6.16. </ span >
319+ Pop the current rule</ a >
320+
321+ < li > < a href ="#finish-parsing "> < span class =secno > 3.6.17. </ span > Finish
319322 parsing</ a >
320323 </ ul >
321324
@@ -2218,10 +2221,8 @@ <h4 id=at-rule-mode><span class=secno>3.6.3. </span> <dfn
22182221 < dl >
22192222 < dt > semicolon token
22202223
2221- < dd > Pop the < a href ="#current-rule "> < i > current rule</ i > </ a > from the < a
2222- href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > and append it
2223- to the value of the new < a href ="#current-rule "> < i > current rule</ i > </ a > .
2224- < a href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
2224+ < dd > < a href ="#pop-the-current-rule0 "> < i > Pop the current rule</ i > </ a > . < a
2225+ href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
22252226 current rule's content mode.</ i > </ a >
22262227
22272228 < dt > { token
@@ -2257,10 +2258,8 @@ <h4 id=rule-mode><span class=secno>3.6.4. </span> <dfn id=rule-mode0>Rule
22572258 < dl >
22582259 < dt > } token
22592260
2260- < dd > Pop the < a href ="#current-rule "> < i > current rule</ i > </ a > from the < a
2261- href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > , and append it
2262- to the value of the new < a href ="#current-rule "> < i > current rule</ i > </ a > .
2263- < a href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
2261+ < dd > < a href ="#pop-the-current-rule0 "> < i > Pop the current rule</ i > </ a > . < a
2262+ href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
22642263 current rule's content mode</ i > </ a > .
22652264
22662265 < dt > at-keyword token
@@ -2295,9 +2294,8 @@ <h4 id=selector-mode><span class=secno>3.6.5. </span> <dfn
22952294
22962295 < dt > EOF token
22972296
2298- < dd > Pop the top rule from the < a href ="#stack-of-open-rules "> < i > stack of
2299- open rules</ i > </ a > and discard it. < a href ="#finish-parsing0 "> < i > Finish
2300- parsing</ i > </ a > .
2297+ < dd > Discard the < a href ="#current-rule "> < i > current rule</ i > </ a > . < a
2298+ href ="#finish-parsing0 "> < i > Finish parsing</ i > </ a > .
23012299
23022300 < dt > anything else
23032301
@@ -2320,10 +2318,7 @@ <h4 id=declaration-mode><span class=secno>3.6.6. </span> <dfn
23202318
23212319 < dt > } token
23222320
2323- < dd > Pop the < a href ="#current-rule "> < i > current rule</ i > </ a > from the < a
2324- href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > , and append it
2325- to the list of rules for the new < a href ="#current-rule "> < i > current
2326- rule</ i > </ a > . < a
2321+ < dd > < a href ="#pop-the-current-rule0 "> < i > Pop the current rule</ i > </ a > . < a
23272322 href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
23282323 current rule's content mode</ i > </ a > .
23292324
@@ -2409,21 +2404,19 @@ <h4 id=declaration-value-mode><span class=secno>3.6.8. </span> <dfn
24092404
24102405 < dt > semicolon token
24112406
2412- < dd > Append the < a href ="#current-declaration "> < i > current
2413- declaration </ i > </ a > to the value of the < a
2407+ < dd > If the < a href ="#current-declaration "> < i > current declaration </ i > </ a >
2408+ is grammatically valid, append it to the value of the < a
24142409 href ="#current-rule "> < i > current rule</ i > </ a > . < a
24152410 href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
24162411 current rule's content mode</ i > </ a > .
24172412
24182413 < dt > } token
24192414
2420- < dd > Append the < a href ="#current-declaration "> < i > current
2421- declaration</ i > </ a > to the value of the < a
2422- href ="#current-rule "> < i > current rule</ i > </ a > . Pop the < a
2423- href ="#current-rule "> < i > current rule</ i > </ a > from the < a
2424- href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > , and append it
2425- to the value of the new < a href ="#current-rule "> < i > current rule</ i > </ a > .
2426- < a href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
2415+ < dd > If the < a href ="#current-declaration "> < i > current declaration</ i > </ a >
2416+ is grammatically valid, append it to the value of the < a
2417+ href ="#current-rule "> < i > current rule</ i > </ a > . < a
2418+ href ="#pop-the-current-rule0 "> < i > Pop the current rule</ i > </ a > . < a
2419+ href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
24272420 current rule's content mode</ i > </ a > .
24282421
24292422 < dt > EOF token
@@ -2455,21 +2448,19 @@ <h4 id=declaration-end-mode><span class=secno>3.6.9. </span> <dfn
24552448
24562449 < dt > semicolon token
24572450
2458- < dd > Append the < a href ="#current-declaration "> < i > current
2459- declaration </ i > </ a > to the value of the < a
2451+ < dd > If the < a href ="#current-declaration "> < i > current declaration </ i > </ a >
2452+ is grammatically valid, append it to the value of the < a
24602453 href ="#current-rule "> < i > current rule</ i > </ a > . < a
24612454 href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
24622455 current rule's content mode</ i > </ a > .
24632456
24642457 < dt > } token
24652458
2466- < dd > Append the < a href ="#current-declaration "> < i > current
2467- declaration</ i > </ a > to the value of the < a
2468- href ="#current-rule "> < i > current rule</ i > </ a > . Pop the < a
2469- href ="#current-rule "> < i > current rule</ i > </ a > from the < a
2470- href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > , and append it
2471- to the value of the new < a href ="#current-rule "> < i > current rule</ i > </ a > .
2472- < a href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
2459+ < dd > If the < a href ="#current-declaration "> < i > current declaration</ i > </ a >
2460+ is grammatically valid, append it to the value of the < a
2461+ href ="#current-rule "> < i > current rule</ i > </ a > . < a
2462+ href ="#pop-the-current-rule0 "> < i > Pop the current rule.</ i > </ a > < a
2463+ href ="#switch-to-the-current-rules-content-mode0 "> < i > Switch to the
24732464 current rule's content mode</ i > </ a > .
24742465
24752466 < dt > EOF token
@@ -2635,21 +2626,35 @@ <h4 id=switch-to-the-current-rules-content-mode><span class=secno>3.6.15.
26352626 < p > If the < a href ="#current-rule "> < i > current rule</ i > </ a > is a stylesheet,
26362627 switch to the < a href ="#top-level-mode "> < i > top-level mode</ i > </ a > .
26372628
2638- < h4 id =finish-parsing > < span class =secno > 3.6.16. </ span > < dfn
2629+ < h4 id =pop-the-current-rule > < span class =secno > 3.6.16. </ span > < dfn
2630+ id =pop-the-current-rule0 > Pop the current rule</ dfn > </ h4 >
2631+
2632+ < p > This section describes how to < a href ="#pop-the-current-rule0 "> < i > pop
2633+ the current rule</ i > </ a > . It is invoked whenever a rule is "finished"
2634+ parsing and can be made part of its parent rule.
2635+
2636+ < p > First, validate the < a href ="#current-rule "> < i > current rule</ i > </ a >
2637+ according to the appropriate grammar rules. If the rule does not match its
2638+ required grammar, discard it.
2639+
2640+ < p > Otherwise, pop the < a href ="#current-rule "> < i > current rule</ i > </ a > from
2641+ the < a href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > and
2642+ append it to the value of the new < a href ="#current-rule "> < i > current
2643+ rule</ i > </ a > .
2644+
2645+ < h4 id =finish-parsing > < span class =secno > 3.6.17. </ span > < dfn
26392646 id =finish-parsing0 > Finish parsing</ dfn > </ h4 >
26402647
26412648 < p > This section describes how to < a href ="#finish-parsing0 "> < i > finish
26422649 parsing</ i > </ a > . It is invoked whenever an EOF token is encountered.
26432650
26442651 < p > If there is a < a href ="#current-declaration "> < i > current
2645- declaration</ i > </ a > , append it to the value of the < a
2646- href ="#current-rule "> < i > current rule</ i > </ a > .
2652+ declaration</ i > </ a > , and it is grammatically valid, append it to the value
2653+ of the < a href ="#current-rule "> < i > current rule</ i > </ a > .
26472654
26482655 < p > While there's more than one rule on the < a
2649- href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > , pop the < a
2650- href ="#current-rule "> < i > current rule</ i > </ a > from the < a
2651- href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > , and append it
2652- to the value of the new < a href ="#current-rule "> < i > current rule</ i > </ a > .
2656+ href ="#stack-of-open-rules "> < i > stack of open rules</ i > </ a > , < a
2657+ href ="#pop-the-current-rule0 "> < i > pop the current rule</ i > </ a > .
26532658
26542659 < p > Finally, return the < a href ="#current-rule "> < i > current rule</ i > </ a > as
26552660 the result of parsing.
@@ -3007,7 +3012,7 @@ <h2 class=no-num id=index> Index</h2>
30073012 title ="end of the range "> < strong > 3.4.27.</ strong > </ a >
30083013
30093014 < li > Finish parsing, < a href ="#finish-parsing0 "
3010- title ="Finish parsing "> < strong > 3.6.16 .</ strong > </ a >
3015+ title ="Finish parsing "> < strong > 3.6.17 .</ strong > </ a >
30113016
30123017 < li > Hash-rest state, < a href ="#hash-rest-state0 "
30133018 title ="Hash-rest state "> < strong > 3.4.7.</ strong > </ a >
@@ -3067,6 +3072,9 @@ <h2 class=no-num id=index> Index</h2>
30673072 < li > Number state, < a href ="#number-state0 "
30683073 title ="Number state "> < strong > 3.4.14.</ strong > </ a >
30693074
3075+ < li > Pop the current rule, < a href ="#pop-the-current-rule0 "
3076+ title ="Pop the current rule "> < strong > 3.6.16.</ strong > </ a >
3077+
30703078 < li > renderer, < a href ="#renderer " title =renderer > < strong > 4.2.</ strong > </ a >
30713079
30723080
0 commit comments