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