Skip to content

Commit b02c259

Browse files
committed
Merge branch 'nesting-bug'
2 parents 94ac819 + 2cfe870 commit b02c259

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/parser.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ impl<'i, 't> Parser<'i, 't> {
378378
stop_before: closing_delimiter,
379379
};
380380
result = nested_parser.parse_entirely(parse);
381+
if let Some(block_type) = nested_parser.at_start_of {
382+
consume_until_end_of_block(block_type, &mut *nested_parser.tokenizer);
383+
}
381384
}
382385
consume_until_end_of_block(block_type, &mut *self.tokenizer);
383386
result

src/tests.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,17 @@ fn expect_no_error_token() {
271271
}
272272

273273

274+
/// https://github.com/servo/rust-cssparser/issues/71
275+
#[test]
276+
fn outer_block_end_consumed() {
277+
let mut input = Parser::new("(calc(true))");
278+
assert!(input.expect_parenthesis_block().is_ok());
279+
assert!(input.parse_nested_block(|input| input.expect_function_matching("calc")).is_ok());
280+
println!("{:?}", input.position());
281+
assert_eq!(input.next(), Err(()));
282+
}
283+
284+
274285
fn run_color_tests<F: Fn(Result<Color, ()>) -> Json>(json_data: &str, to_json: F) {
275286
run_json_tests(json_data, |input| {
276287
to_json(input.parse_entirely(Color::parse))

0 commit comments

Comments
 (0)