Source:
<code>public CodeWriter emit(CodeBlock codeBlock) throws IOException { int a = 0; ClassName potentiallyStaticImported = null; for (String part : codeBlock.formatParts) { switch (part) { case "$L": emitLiteral(codeBlock.args.get(a++)); break; case "$N": emitAndIndent((String) codeBlock.args.get(a++)); break; case "$S": String string = (String) codeBlock.args.get(a++); emitAndIndent(string != null ? stringLiteral(string) : "null"); break; case "$T": TypeName typeName = (TypeName) codeBlock.args.get(a++); if (staticImportClassNames.contains(typeName)) { checkState(potentiallyStaticImported == null, "pending type name for static import?!"); potentiallyStaticImported = (ClassName) typeName; break; } typeName.emit(this); break; case "$$": emitAndIndent("$"); break; case "$>": indent(); break; case "$<": unindent(); break; case "$[": checkState(statementLine == -1, "statement enter $[ followed by statement enter $["); statementLine = 0; break; case "$]": checkState(statementLine != -1, "statement exit $] has no matching statement enter $["); if (statementLine > 0) { unindent(2); } statementLine = -1; break; default: if (potentiallyStaticImported == null) { emitAndIndent(part); break; } ClassName pendingClassName = potentiallyStaticImported; potentiallyStaticImported = null; if (part.startsWith(".")) { <START> int endIndex = part.indexOf('('); <END> if (endIndex < 0) endIndex = part.length(); String memberName = part.substring(1, endIndex); checkState(isIdentifier(memberName), "identifier expected, but got: %s", memberName); String candidate = pendingClassName.canonicalName + "." + memberName; String wildcard = pendingClassName.canonicalName + ".*"; if (staticImportSignatures.contains(candidate) || staticImportSignatures.contains(wildcard)) { String partTail = part.substring(memberName.length() + 1); emitAndIndent(memberName + partTail); break; } } pendingClassName.emit(this); emitAndIndent(part); break; } } return this; }</code><technical_language>non-word character, right? System.out</technical_language>

Target:
public CodeWriter emit(CodeBlock codeBlock) throws IOException { int a = 0; ClassName deferredTypeName = null; ListIterator<String> partIterator = codeBlock.formatParts.listIterator(); while (partIterator.hasNext()) { String part = partIterator.next(); switch (part) { case "$L": emitLiteral(codeBlock.args.get(a++)); break; case "$N": emitAndIndent((String) codeBlock.args.get(a++)); break; case "$S": String string = (String) codeBlock.args.get(a++); emitAndIndent(string != null ? stringLiteral(string) : "null"); break; case "$T": TypeName typeName = (TypeName) codeBlock.args.get(a++); if (typeName instanceof ClassName && partIterator.hasNext()) { if (!codeBlock.formatParts.get(partIterator.nextIndex()).startsWith("$")) { ClassName candidate = (ClassName) typeName; if (staticImportClassNames.contains(candidate.canonicalName)) { checkState(deferredTypeName == null, "pending type for static import?!"); deferredTypeName = candidate; break; } } } typeName.emit(this); break; case "$$": emitAndIndent("$"); break; case "$>": indent(); break; case "$<": unindent(); break; case "$[": checkState(statementLine == -1, "statement enter $[ followed by statement enter $["); statementLine = 0; break; case "$]": checkState(statementLine != -1, "statement exit $] has no matching statement enter $["); if (statementLine > 0) { unindent(2); } statementLine = -1; break; default: if (deferredTypeName != null) { if (part.startsWith(".")) { if (emitStaticImportMember(deferredTypeName.canonicalName, part)) { deferredTypeName = null; break; } } deferredTypeName.emit(this); deferredTypeName = null; } emitAndIndent(part); break; } } return this; }