pub(super) fn parse_bare_assignment(line: &str) -> Option<(String, String)> {
let semi_pos = line.find(';')?;
let body = &line[..semi_pos];
let eq_pos = body.find(" = ")?;
let lhs = body[..eq_pos].trim();
if lhs.starts_with("let ") {
return None;
}
let rhs = body[eq_pos + 3..].trim();
Some((lhs.to_string(), rhs.to_string()))
}
pub(super) fn is_temp_identifier(s: &str) -> bool {
s.starts_with('t') && s.len() > 1 && s[1..].chars().all(|c| c.is_ascii_digit())
}
pub(super) fn leading_whitespace(s: &str) -> &str {
let trimmed = s.trim_start();
&s[..s.len() - trimmed.len()]
}
pub(super) fn parse_let_assignment(line: &str) -> Option<(String, String)> {
let rest = line.strip_prefix("let ")?;
let semi_pos = rest.find(';')?;
let rest = &rest[..semi_pos];
let eq_pos = rest.find(" = ")?;
let var = rest[..eq_pos].trim().to_string();
let rhs = rest[eq_pos + 3..].trim().to_string();
Some((var, rhs))
}