Skip to content

Commit c7efee7

Browse files
committed
perf(parser): Resolve regression from stackoverflow protect
1 parent a3ce25e commit c7efee7

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/toml_edit/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ unbounded = []
4141

4242
[dependencies]
4343
indexmap = { version = "2.0.0", features = ["std"] }
44-
winnow = { version = "0.6.17", optional = true }
44+
winnow = { version = "0.6.18", optional = true }
4545
serde = { version = "1.0.145", optional = true }
4646
kstring = { version = "2.0.0", features = ["max_inline"], optional = true }
4747
toml_datetime = { version = "0.6.8", path = "../toml_datetime" }

crates/toml_edit/src/parser/trivia.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ pub(crate) fn ws_comment_newline(input: &mut Input<'_>) -> PResult<()> {
9696
loop {
9797
let _ = ws.parse_next(input)?;
9898

99-
dispatch! {opt(peek(any));
100-
Some(b'#') => (comment, newline).void(),
101-
Some(b'\n') => (newline).void(),
102-
Some(b'\r') => (newline).void(),
103-
_ => empty,
99+
let next_token = opt(peek(any)).parse_next(input)?;
100+
match next_token {
101+
Some(b'#') => (comment, newline).void().parse_next(input)?,
102+
Some(b'\n') => (newline).void().parse_next(input)?,
103+
Some(b'\r') => (newline).void().parse_next(input)?,
104+
_ => break,
104105
}
105-
.parse_next(input)?;
106106

107107
let end = input.checkpoint();
108108
if start == end {

0 commit comments

Comments
 (0)