Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e10952b4 authored by Sasha Smundak's avatar Sasha Smundak
Browse files

Do not "escape" newline if comment ends with ESC character.

Fixes: 127521510
Test: manual
Change-Id: I88a8eb2ca94b8aa06e2682d2c14f9e74f5ada286
parent 7aa5a56b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1062,6 +1062,17 @@ include test/vts/tools/build/Android.host_config.mk
vts_config {
	name: "vtsconf",
}
`,
	},
	{
		desc: "comment with ESC",
		in: `
# Comment line 1 \
# Comment line 2
`,
		expected: `
// Comment line 1 \
// Comment line 2
`,
	},
}
+5 −3
Original line number Diff line number Diff line
@@ -485,10 +485,12 @@ loop:
		case '\\':
			p.parseEscape()
			if p.tok == '\n' {
				comment += "\n"
			} else {
				comment += "\\" + p.scanner.TokenText()
				// Special case: '\' does not "escape" newline in comment (b/127521510)
				comment += "\\"
				p.accept(p.tok)
				break loop
			}
			comment += "\\" + p.scanner.TokenText()
			p.accept(p.tok)
		case '\n':
			p.accept('\n')