Skip to content

Commit

Permalink
Merge pull request #775 from epage/perf
Browse files Browse the repository at this point in the history
perf(parser): Resolve regression from stackoverflow protect
  • Loading branch information
epage authored Jul 31, 2024
2 parents a3ce25e + c7efee7 commit d0f242b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/toml_edit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ unbounded = []

[dependencies]
indexmap = { version = "2.0.0", features = ["std"] }
winnow = { version = "0.6.17", optional = true }
winnow = { version = "0.6.18", optional = true }
serde = { version = "1.0.145", optional = true }
kstring = { version = "2.0.0", features = ["max_inline"], optional = true }
toml_datetime = { version = "0.6.8", path = "../toml_datetime" }
Expand Down
12 changes: 6 additions & 6 deletions crates/toml_edit/src/parser/trivia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ pub(crate) fn ws_comment_newline(input: &mut Input<'_>) -> PResult<()> {
loop {
let _ = ws.parse_next(input)?;

dispatch! {opt(peek(any));
Some(b'#') => (comment, newline).void(),
Some(b'\n') => (newline).void(),
Some(b'\r') => (newline).void(),
_ => empty,
let next_token = opt(peek(any)).parse_next(input)?;
match next_token {
Some(b'#') => (comment, newline).void().parse_next(input)?,
Some(b'\n') => (newline).void().parse_next(input)?,
Some(b'\r') => (newline).void().parse_next(input)?,
_ => break,
}
.parse_next(input)?;

let end = input.checkpoint();
if start == end {
Expand Down

0 comments on commit d0f242b

Please sign in to comment.