Lines 209-215
Link Here
|
209 |
int foundTaskIndex = this.foundTaskCount; |
209 |
int foundTaskIndex = this.foundTaskCount; |
210 |
nextChar: for (int i = commentStart; i < commentEnd && i < this.eofPosition; i++) { |
210 |
nextChar: for (int i = commentStart; i < commentEnd && i < this.eofPosition; i++) { |
211 |
|
211 |
|
212 |
int nextPos = -1; |
|
|
213 |
char[] tag = null; |
212 |
char[] tag = null; |
214 |
char[] priority = null; |
213 |
char[] priority = null; |
215 |
|
214 |
|
Lines 224-230
Link Here
|
224 |
for (int t = 0; t < tagLength; t++){ |
223 |
for (int t = 0; t < tagLength; t++){ |
225 |
if (this.source[i+t] != tag[t]) continue nextTag; |
224 |
if (this.source[i+t] != tag[t]) continue nextTag; |
226 |
} |
225 |
} |
227 |
nextPos = i + tagLength; |
|
|
228 |
|
226 |
|
229 |
if (this.foundTaskTags == null){ |
227 |
if (this.foundTaskTags == null){ |
230 |
this.foundTaskTags = new char[5][]; |
228 |
this.foundTaskTags = new char[5][]; |
Lines 239-277
Link Here
|
239 |
} |
237 |
} |
240 |
this.foundTaskTags[this.foundTaskCount] = tag; |
238 |
this.foundTaskTags[this.foundTaskCount] = tag; |
241 |
this.foundTaskPriorities[this.foundTaskCount] = priority; |
239 |
this.foundTaskPriorities[this.foundTaskCount] = priority; |
242 |
this.foundTaskPositions[this.foundTaskCount] = new int[]{ i, -1 }; |
240 |
this.foundTaskPositions[this.foundTaskCount] = new int[]{ i, i+tagLength-1 }; |
|
|
241 |
this.foundTaskMessages[this.foundTaskCount] = CharOperation.NO_CHAR; |
243 |
this.foundTaskCount++; |
242 |
this.foundTaskCount++; |
244 |
|
243 |
|
245 |
i = nextPos; |
244 |
i += tagLength-1; // will be incremented when looping |
246 |
} |
245 |
} |
247 |
} |
246 |
} |
248 |
|
247 |
|
249 |
for (int i = foundTaskIndex; i < this.foundTaskCount; i++) { |
248 |
for (int i = foundTaskIndex; i < this.foundTaskCount; i++) { |
250 |
// retrieve message start and end positions |
249 |
// retrieve message start and end positions |
251 |
int msgStart = this.foundTaskPositions[i][0] + this.foundTaskTags[i].length; |
250 |
int msgStart = this.foundTaskPositions[i][0] + this.foundTaskTags[i].length; |
252 |
int end; |
251 |
int max_value = i + 1 < this.foundTaskCount ? this.foundTaskPositions[i + 1][0] - 1 : commentEnd-1; // at most beginning of next task |
|
|
252 |
if (max_value < msgStart) max_value = msgStart; // would only occur if tag is before EOF. |
253 |
int end = -1; |
253 |
char c; |
254 |
char c; |
254 |
int max_value = i + 1 < this.foundTaskCount ? this.foundTaskPositions[i + 1][0] - 1 : Integer.MAX_VALUE; |
|
|
255 |
|
255 |
|
256 |
end = -1; |
256 |
for (int j = msgStart; j < max_value; j++){ |
257 |
for (int j = msgStart; j < commentEnd; j++){ |
|
|
258 |
if ((c = this.source[j]) == '\n' || c == '\r'){ |
257 |
if ((c = this.source[j]) == '\n' || c == '\r'){ |
259 |
end = j - 1; |
258 |
end = j-1; |
260 |
break; |
259 |
break; |
261 |
} |
260 |
} |
262 |
} |
261 |
} |
263 |
end = end < max_value ? end : max_value; |
|
|
264 |
|
262 |
|
265 |
if (end < 0){ |
263 |
if (end == -1){ |
266 |
for (int j = commentEnd-1; j >= msgStart; j--){ |
264 |
for (int j = max_value; j > msgStart; j--){ |
267 |
if ((c = this.source[j]) == '*') { |
265 |
if ((c = this.source[j]) == '*') { |
268 |
end = j-1; |
266 |
end = j-1; |
269 |
break; |
267 |
break; |
270 |
} |
268 |
} |
271 |
} |
269 |
} |
272 |
if (end < 0) end = commentEnd-1; |
270 |
if (end == -1) end = max_value; |
273 |
} |
271 |
} |
274 |
|
272 |
|
|
|
273 |
if (msgStart == end) continue; // empty |
274 |
|
275 |
// trim the message |
275 |
// trim the message |
276 |
while (CharOperation.isWhitespace(source[end]) && msgStart <= end) end--; |
276 |
while (CharOperation.isWhitespace(source[end]) && msgStart <= end) end--; |
277 |
while (CharOperation.isWhitespace(source[msgStart]) && msgStart <= end) msgStart++; |
277 |
while (CharOperation.isWhitespace(source[msgStart]) && msgStart <= end) msgStart++; |