This commit is contained in:
2026-03-24 13:40:42 +00:00
parent 78ed7a8253
commit 6950f2bef0
22 changed files with 428 additions and 289 deletions
@@ -216,12 +216,12 @@ fn strip_comments_and_strings(src: &str) -> String {
let mut out = String::with_capacity(src.len());
let b = src.as_bytes();
let mut i = 0;
let mut line = 1usize; // keep newlines for accurate positions
let _line = 1usize; // keep newlines for accurate positions (unused)
while i < b.len() {
let c = b[i] as char;
// Preserve newlines to maintain line numbers
if c == '\n' { out.push('\n'); i += 1; line += 1; continue; }
if c == '\n' { out.push('\n'); i += 1; continue; }
// Try to match line comment
if c == '/' && i + 1 < b.len() && b[i + 1] as char == '/' {
@@ -239,7 +239,7 @@ fn strip_comments_and_strings(src: &str) -> String {
i += 2;
while i + 1 < b.len() {
let ch = b[i] as char;
if ch == '\n' { out.push('\n'); line += 1; }
if ch == '\n' { out.push('\n'); }
if ch == '*' && b[i + 1] as char == '/' { i += 2; break; }
i += 1;
}
@@ -259,7 +259,7 @@ fn strip_comments_and_strings(src: &str) -> String {
let mut end_found = false;
while j < b.len() {
let ch = b[j] as char;
if ch == '\n' { out.push('\n'); line += 1; j += 1; continue; }
if ch == '\n' { out.push('\n'); j += 1; continue; }
if ch == '"' {
// check for closing hashes
let mut k = j + 1;
@@ -288,7 +288,7 @@ fn strip_comments_and_strings(src: &str) -> String {
i += 1; // skip starting quote
while i < b.len() {
let ch = b[i] as char;
if ch == '\n' { out.push('\n'); line += 1; }
if ch == '\n' { out.push('\n'); }
if ch == '\\' {
i += 2; // skip escaped char
continue;
@@ -314,8 +314,8 @@ mod pathdiff {
pub fn diff_paths(path: &Path, base: &Path) -> Option<PathBuf> {
let path = path.absolutize();
let base = base.absolutize();
let mut ita = base.components();
let mut itb = path.components();
let ita = base.components();
let itb = path.components();
// pop common prefix
let mut comps_a: Vec<Component> = Vec::new();