finalResult = result;
}
finalResult = finalResult.replace('|', ' ');
PyPartitionScanner pyPartitionScanner = new PyPartitionScanner();
FastPartitioner fastPartitioner = new FastPartitioner(pyPartitionScanner, IPythonPartitions.types);
Document doc = new Document(result);
fastPartitioner.connect(doc);
TextPresentation textPresentation = new TextPresentation();
PyCodeScanner scanner = new PyCodeScanner(colorCache);
try {
ITypedRegion[] computePartitioning = fastPartitioner.computePartitioning(0, doc.getLength());
for (ITypedRegion region : computePartitioning) {
String type = region.getType();
int offset = region.getOffset();
int len = region.getLength();
if (IPythonPartitions.PY_DEFAULT.equals(type) || type == null) {
createDefaultRanges(textPresentation, scanner, doc, offset, len);
} else if (IPythonPartitions.PY_COMMENT.equals(type)) {
TextAttribute textAttribute = colorCache.getCommentTextAttribute();
textPresentation.addStyleRange(new StyleRange(offset, len, textAttribute.getForeground(), null,
textAttribute.getStyle()));
} else if (IPythonPartitions.PY_BACKQUOTES.equals(type)) {
TextAttribute textAttribute = colorCache.getBackquotesTextAttribute();
textPresentation.addStyleRange(new StyleRange(offset, len, textAttribute.getForeground(), null,
textAttribute.getStyle()));
} else if (IPythonPartitions.PY_MULTILINE_STRING1.equals(type)
|| IPythonPartitions.PY_MULTILINE_STRING2.equals(type)
|| IPythonPartitions.PY_SINGLELINE_STRING1.equals(type)
|| IPythonPartitions.PY_SINGLELINE_STRING2.equals(type)) {
TextAttribute textAttribute = colorCache.getStringTextAttribute();
textPresentation.addStyleRange(new StyleRange(offset, len, textAttribute.getForeground(), null,
textAttribute.getStyle()));
}
}
} finally {
fastPartitioner.disconnect();
}
if (showSpacesAndNewLines) {
for (int i = 0; i < result.length(); i++) {
char curr = result.charAt(i);