afs-ld Public
Comparing changes
Choose two branches to see what's changed or to start a new pull request.
Cannot automatically merge.
These branches have conflicts that must be resolved.
1 commit
1 file changed
1 contributor
Commits on ci-submodule-refs-20260416
src/macho/tbd_yaml.rsmodified@@ -198,15 +198,16 @@ fn strip_eol_comment(s: &mut String) { | ||
| 198 | 198 | i += 2; |
| 199 | 199 | continue; |
| 200 | 200 | } |
| 201 | - b'#' if !in_single && !in_double => { | |
| 202 | - // A comment must be preceded by whitespace or be at BOL. | |
| 203 | - if i == 0 || bytes[i - 1] == b' ' || bytes[i - 1] == b'\t' { | |
| 204 | - s.truncate(i); | |
| 205 | - // Trim trailing whitespace left by the strip. | |
| 206 | - let trimmed_len = s.trim_end().len(); | |
| 207 | - s.truncate(trimmed_len); | |
| 208 | - return; | |
| 209 | - } | |
| 201 | + b'#' | |
| 202 | + if !in_single | |
| 203 | + && !in_double | |
| 204 | + && (i == 0 || bytes[i - 1] == b' ' || bytes[i - 1] == b'\t') => | |
| 205 | + { | |
| 206 | + s.truncate(i); | |
| 207 | + // Trim trailing whitespace left by the strip. | |
| 208 | + let trimmed_len = s.trim_end().len(); | |
| 209 | + s.truncate(trimmed_len); | |
| 210 | + return; | |
| 210 | 211 | } |
| 211 | 212 | _ => {} |
| 212 | 213 | } |
@@ -426,11 +427,15 @@ fn find_top_level_mapping_colon(s: &str) -> Option<usize> { | ||
| 426 | 427 | } |
| 427 | 428 | b'[' | b'{' if !in_single && !in_double => depth += 1, |
| 428 | 429 | b']' | b'}' if !in_single && !in_double => depth -= 1, |
| 429 | - b':' if !in_single && !in_double && depth == 0 => { | |
| 430 | - // Must be followed by whitespace or end of line per YAML rules. | |
| 431 | - if i + 1 == bytes.len() || bytes[i + 1] == b' ' || bytes[i + 1] == b'\t' { | |
| 432 | - return Some(i); | |
| 433 | - } | |
| 430 | + b':' | |
| 431 | + if !in_single | |
| 432 | + && !in_double | |
| 433 | + && depth == 0 | |
| 434 | + && (i + 1 == bytes.len() | |
| 435 | + || bytes[i + 1] == b' ' | |
| 436 | + || bytes[i + 1] == b'\t') => | |
| 437 | + { | |
| 438 | + return Some(i); | |
| 434 | 439 | } |
| 435 | 440 | _ => {} |
| 436 | 441 | } |