return null;
}
if (monitor != null) {
monitor.worked(index);
}
ITypedRegion region = doc.getPartition(index);
PartitionType partitionType = PartitionType.fastValueOf(region
.getType());
if (partitionType != null) {
ITokenScanner scanner = itemParsers.get(partitionType);
if (scanner != null) {
if (newMode != this.syntaxMode
&& scanner instanceof SyntaxModeListener) {
((SyntaxModeListener) scanner)
.syntaxModeChanged(newMode);
}
scanner.setRange(doc, region.getOffset(),
region.getLength());
for (IToken token = scanner.nextToken(); !token.isEOF(); token = scanner
.nextToken()) {
if (canceled()) {
return null;
}
if (monitor != null) {
monitor.worked(index);
}
Object itemType = token.getData();
if (!token.isUndefined() && !token.isWhitespace()
&& itemType instanceof String) {
TypedRegion itemRegion = new TypedRegion(
scanner.getTokenOffset(),
scanner.getTokenLength(),
(String) itemType);
regions.add(itemRegion);
}
}
} else {
regions.add(region);
}
}
index = region.getOffset() + region.getLength() + 1;
}
} catch (BadLocationException ignored) {
} finally {
this.syntaxMode = newMode;
if (monitor != null) {