@@ -34,13 +34,6 @@ pub enum AtRuleType<P, R> {
3434 ///
3535 /// The value is the representation of the "prelude" part of the rule.
3636 WithBlock ( P ) ,
37-
38- /// The at-rule may either have a block or end with a semicolon.
39- ///
40- /// This is mostly for testing. As of this writing no real CSS at-rule behaves like this.
41- ///
42- /// The value is the representation of the "prelude" part of the rule.
43- OptionalBlock ( P ) ,
4437}
4538
4639/// A trait to provide various parsing of declaration values.
@@ -124,24 +117,14 @@ pub trait AtRuleParser<'i> {
124117 /// as returned by `RuleListParser::next` or `DeclarationListParser::next`,
125118 /// or `Err(())` to ignore the entire at-rule as invalid.
126119 ///
127- /// This is only called when `parse_prelude` returned `WithBlock` or `OptionalBlock`,
128- /// and a block was indeed found following the prelude.
120+ /// This is only called when `parse_prelude` returned `WithBlock`, and a block
121+ /// was indeed found following the prelude.
129122 fn parse_block < ' t > ( & mut self , prelude : Self :: Prelude , input : & mut Parser < ' i , ' t > )
130123 -> Result < Self :: AtRule , ParseError < ' i , Self :: Error > > {
131124 let _ = prelude;
132125 let _ = input;
133126 Err ( ParseError :: Basic ( BasicParseError :: AtRuleBodyInvalid ) )
134127 }
135-
136- /// An `OptionalBlock` prelude was followed by `;`.
137- ///
138- /// Convert the prelude into the finished representation of the at-rule
139- /// as returned by `RuleListParser::next` or `DeclarationListParser::next`.
140- fn rule_without_block ( & mut self , prelude : Self :: Prelude ) -> Self :: AtRule {
141- let _ = prelude;
142- panic ! ( "The `AtRuleParser::rule_without_block` method must be overriden \
143- if `AtRuleParser::parse_prelude` ever returns `AtRuleType::OptionalBlock`.")
144- }
145128}
146129
147130/// A trait to provide various parsing of qualified rules.
@@ -495,21 +478,6 @@ fn parse_at_rule<'i: 't, 't, P, E>(start: &ParserState, name: CowRcStr<'i>,
495478 Ok ( _) => unreachable ! ( )
496479 }
497480 }
498- Ok ( AtRuleType :: OptionalBlock ( prelude) ) => {
499- match input. next ( ) {
500- Ok ( & Token :: Semicolon ) | Err ( _) => Ok ( parser. rule_without_block ( prelude) ) ,
501- Ok ( & Token :: CurlyBracketBlock ) => {
502- // FIXME: https://github.com/rust-lang/rust/issues/42508
503- parse_nested_block :: < ' i , ' t , _ , _ , _ > ( input, move |input| parser. parse_block ( prelude, input) )
504- . map_err ( |e| PreciseParseError {
505- error : e,
506- slice : input. slice_from ( start. position ( ) ) ,
507- location : start. source_location ( ) ,
508- } )
509- }
510- _ => unreachable ! ( )
511- }
512- }
513481 Err ( error) => {
514482 let end_position = input. position ( ) ;
515483 match input. next ( ) {
0 commit comments