You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on parsing media queries, and my understanding is that the syntax specifies that a media feature must end with a ) [1].
For example, if you have the string "(width", Parser::parse_nested_block will return Ok(_). And there is no easy way to determine how if it was closed by a ) or EOF, as far as I can see.
#[test]fnblock_closed_by_delimiter(){letmut input = Parser::new("(width");assert!(input.expect_parenthesis_block().is_ok());let result = input.parse_nested_block(|input| {assert!(input.expect_ident_matching("width").is_ok());assert!(input.is_exhausted());Ok(true)});assert!(result.is_err());}
This is by design. The CSS error handling rules say that blocks close implicitly at EOF. (The newer CSS Syntax spec has the same behavior, but is less explicit about it.) This rule is implicit in all other grammar-like syntax definitions, to reduce verbosity.
By the way, you might want to copy some of Servo’s media_queries.rs. Maybe eventually the parsing parts could be move to rust-cssparser.
I admit the reason I filed this bug was because I was extending the media query support in Servo (kind of got away on me; have pretty much the full spec implemented, just testing it now)
I'm working on parsing media queries, and my understanding is that the syntax specifies that a media feature must end with a
)
[1].For example, if you have the string "(width",
Parser::parse_nested_block
will returnOk(_)
. And there is no easy way to determine how if it was closed by a)
or EOF, as far as I can see.1: http://drafts.csswg.org/mediaqueries/#typedef-media-feature
The text was updated successfully, but these errors were encountered: