Skip to content

Commit 1c55e16

Browse files
committedMar 4, 2025·
parser: remove the node instead here.
1 parent 8964f32 commit 1c55e16

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed
 

‎src/parser/mod.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -3073,16 +3073,19 @@ where
30733073
text.drain(..end);
30743074

30753075
let adjust = spx.consume(end) + 1;
3076-
// Do we need to account separately for the parent? I _think_ it always
3077-
// has the same start col to begin with as `sourcepos` itself.
30783076
assert_eq!(
30793077
sourcepos.start.column,
30803078
parent.data.borrow().sourcepos.start.column
30813079
);
30823080

3083-
// HACK: See tests::fuzz::echaw9. The paragraph doesn't exist in the source!
3084-
sourcepos.start.column = usize::min(sourcepos.end.column, adjust);
3085-
parent.data.borrow_mut().sourcepos.start.column = sourcepos.start.column;
3081+
// See tests::fuzz::echaw9. The paragraph doesn't exist in the source,
3082+
// so we remove it.
3083+
if sourcepos.end.column < adjust {
3084+
parent.detach();
3085+
} else {
3086+
sourcepos.start.column = adjust;
3087+
parent.data.borrow_mut().sourcepos.start.column = adjust;
3088+
}
30863089

30873090
grandparent.data.borrow_mut().value =
30883091
NodeValue::TaskItem(if symbol == ' ' { None } else { Some(symbol) });

‎src/tests/fuzz.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,7 @@ fn echaw9() {
350350
"-\t[ ]&NewLine;",
351351
(document (1:1-1:14) [
352352
(list (1:1-1:14) [
353-
(taskitem (1:1-1:14) [
354-
(paragraph (1:14-1:14)) // Unsatisfying. See parser::process_tasklist.
355-
])
353+
(taskitem (1:1-1:14))
356354
])
357355
]),
358356
);

0 commit comments

Comments
 (0)
Please sign in to comment.