[go: up one dir, main page]

Skip to content

Raw string literals that contain " handled incorrectly

Some C++11 raw string literals that contain " cause incorrect indentation with astyle 3.4.10 (Windows 64bit).

The following example indents the sc.SetState line too far and places the first } at line start.

Original:

void matchyMatch(StyleContext sc) {
	if (sc.Match(R"(")")) {
		sc.SetState(SCE_C_DEFAULT);
	}
}

Command:

astyle --style=attach --indent=force-tab=8 --keep-one-line-blocks --pad-header --unpad-paren --pad-comma --indent-cases --align-pointer=name --pad-method-prefix --pad-return-type --pad-param-type --align-method-colon --pad-method-colon=after AstyleExampleRaw.cxx

Result:

void matchyMatch(StyleContext sc) {
	if (sc.Match(R"(")")) {
			sc.SetState(SCE_C_DEFAULT);
}
}

This code is a simplified form of https://github.com/ScintillaOrg/lexilla/blob/c97fe3e8c41ba732a57d8d315b2ce8dee84d0fff/lexers/LexCPP.cxx#L1186 .