Skip to content

Commit f7a2f77

Browse files
committed
add comments
1 parent 1dba56e commit f7a2f77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ast/value.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,20 @@ impl fmt::Display for EscapeQuotedString<'_> {
462462
match ch {
463463
char if char == quote => {
464464
if previous_char == '\\' {
465+
// the quote is already escaped with a backslash, skip
465466
peekable_chars.next();
466467
continue;
467468
}
468469
peekable_chars.next();
469470
match peekable_chars.peek() {
470471
Some((_, c)) if *c == quote => {
472+
// the quote is already escaped with another quote, skip
471473
peekable_chars.next();
472474
}
473475
_ => {
474-
// not calling .next(), so the quote at idx will be printed twice
476+
// The quote is not escaped.
477+
// Not calling .next(), so the quote at idx will be printed twice:
478+
// in this call to write_str() and in the next one.
475479
f.write_str(&self.string[start_idx..=idx])?;
476480
start_idx = idx;
477481
}

0 commit comments

Comments
 (0)